OpenJDK / jdk / hs
changeset 23931:7b24912f728f
Merge
author | mullan |
---|---|
date | Wed, 16 Apr 2014 09:49:45 -0400 |
parents | 0e5983df5018 e70b7aee5962 |
children | 0c547f072113 |
files | hotspot/src/share/vm/gc_implementation/g1/heapRegionSets.cpp hotspot/src/share/vm/gc_implementation/g1/heapRegionSets.hpp jaxws/src/share/jaxws_classes/com/sun/codemodel/internal/util/MS1252Encoder.java jaxws/src/share/jaxws_classes/com/sun/codemodel/internal/util/SingleByteEncoder.java jaxws/src/share/jaxws_classes/com/sun/codemodel/internal/util/Surrogate.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/impl/CommentImpl.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/impl/TextImpl.java jdk/src/macosx/lib/content-types.properties jdk/src/share/demo/nio/zipfs/Demo.java jdk/src/share/demo/nio/zipfs/README.txt jdk/src/share/demo/nio/zipfs/src/META-INF/services/java.nio.file.spi.FileSystemProvider jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/JarFileSystemProvider.java jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipCoder.java jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipConstants.java jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipDirectoryStream.java jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileAttributeView.java jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileAttributes.java jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileStore.java jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipInfo.java jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipPath.java jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipUtils.java jdk/src/solaris/lib/content-types.properties jdk/src/windows/lib/content-types.properties jdk/test/demo/zipfs/Basic.java jdk/test/demo/zipfs/PathOps.java jdk/test/demo/zipfs/ZFSTests.java jdk/test/demo/zipfs/ZipFSTester.java jdk/test/demo/zipfs/basic.sh |
diffstat | 932 files changed, 42390 insertions(+), 21492 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags Wed Apr 16 09:46:49 2014 -0400 +++ b/.hgtags Wed Apr 16 09:49:45 2014 -0400 @@ -249,3 +249,4 @@ 099891b1d86f3719e116ac717ffdafc90d037fb7 jdk9-b04 dd311791ad6895a3989020dd6c6c46db87972ab8 jdk9-b05 85dbdc227c5e11429b4fc4a8ba763f50107edd6e jdk9-b06 +c826d05f1fb0773f6a28caa763307dd30d90d36e jdk9-b07
--- a/.hgtags-top-repo Wed Apr 16 09:46:49 2014 -0400 +++ b/.hgtags-top-repo Wed Apr 16 09:49:45 2014 -0400 @@ -249,3 +249,4 @@ cb4c3440bc2748101923e2488506e61009ab1bf5 jdk9-b04 8c63f0b6ada282f27e3a80125e53c3be603f9af7 jdk9-b05 d0b525cd31b87abeb6d5b7e3516953eeb13b323c jdk9-b06 +0ea015c298b201c07fa33990f2445b6d0ef3566d jdk9-b07
--- a/common/autoconf/basics.m4 Wed Apr 16 09:46:49 2014 -0400 +++ b/common/autoconf/basics.m4 Wed Apr 16 09:49:45 2014 -0400 @@ -46,10 +46,24 @@ # Appends a string to a path variable, only adding the : when needed. AC_DEFUN([BASIC_APPEND_TO_PATH], [ - if test "x[$]$1" = x; then - $1="$2" - else - $1="[$]$1:$2" + if test "x$2" != x; then + if test "x[$]$1" = x; then + $1="$2" + else + $1="[$]$1:$2" + fi + fi +]) + +# Prepends a string to a path variable, only adding the : when needed. +AC_DEFUN([BASIC_PREPEND_TO_PATH], +[ + if test "x$2" != x; then + if test "x[$]$1" = x; then + $1="$2" + else + $1="$2:[$]$1" + fi fi ]) @@ -442,43 +456,95 @@ # Locate the directory of this script. AUTOCONF_DIR=$TOPDIR/common/autoconf +]) + +AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT], +[ + AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit], + [use this devkit for compilers, tools and resources])], + [ + BASIC_FIXUP_PATH([with_devkit]) + DEVKIT_ROOT="$with_devkit" + # Check for a meta data info file in the root of the devkit + if test -f "$DEVKIT_ROOT/devkit.info"; then + # This potentially sets the following: + # DEVKIT_NAME: A descriptive name of the devkit + # DEVKIT_TOOLCHAIN_PATH: Corresponds to --with-toolchain-path + # DEVKIT_EXTRA_PATH: Corresponds to --with-extra-path + # DEVKIT_SYSROOT: Corresponds to --with-sysroot + . $DEVKIT_ROOT/devkit.info + fi + + AC_MSG_CHECKING([for devkit]) + if test "x$DEVKIT_NAME" != x; then + AC_MSG_RESULT([$DEVKIT_NAME in $DEVKIT_ROOT]) + else + AC_MSG_RESULT([$DEVKIT_ROOT]) + fi + + if test "x$DEVKIT_EXTRA_PATH" != x; then + BASIC_PREPEND_TO_PATH([EXTRA_PATH],$DEVKIT_EXTRA_PATH) + fi + + # Fallback default of just /bin if DEVKIT_PATH is not defined + if test "x$DEVKIT_TOOLCHAIN_PATH" = x; then + DEVKIT_TOOLCHAIN_PATH="$DEVKIT_ROOT/bin" + fi + BASIC_PREPEND_TO_PATH([TOOLCHAIN_PATH],$DEVKIT_TOOLCHAIN_PATH) + + # If DEVKIT_SYSROOT is set, use that, otherwise try a couple of known + # places for backwards compatiblity. + if test "x$DEVKIT_SYSROOT" != x; then + SYSROOT="$DEVKIT_SYSROOT" + elif test -d "$DEVKIT_ROOT/$host_alias/libc"; then + SYSROOT="$DEVKIT_ROOT/$host_alias/libc" + elif test -d "$DEVKIT_ROOT/$host/sys-root"; then + SYSROOT="$DEVKIT_ROOT/$host/sys-root" + fi + ] + ) + + # You can force the sysroot if the sysroot encoded into the compiler tools + # is not correct. + AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root], + [alias for --with-sysroot for backwards compatability])], + [SYSROOT=$with_sys_root] + ) + + AC_ARG_WITH(sysroot, [AS_HELP_STRING([--with-sysroot], + [use this directory as sysroot)])], + [SYSROOT=$with_sysroot] + ) + + AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir], + [alias for --with-toolchain-path for backwards compatibility])], + [BASIC_PREPEND_TO_PATH([TOOLCHAIN_PATH],$with_tools_dir)] + ) + + AC_ARG_WITH([toolchain-path], [AS_HELP_STRING([--with-toolchain-path], + [prepend these directories when searching for toolchain binaries (compilers etc)])], + [BASIC_PREPEND_TO_PATH([TOOLCHAIN_PATH],$with_toolchain_path)] + ) + + AC_ARG_WITH([extra-path], [AS_HELP_STRING([--with-extra-path], + [prepend these directories to the default path])], + [BASIC_PREPEND_TO_PATH([EXTRA_PATH],$with_extra_path)] + ) + + # Prepend the extra path to the global path + BASIC_PREPEND_TO_PATH([PATH],$EXTRA_PATH) if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then # Add extra search paths on solaris for utilities like ar and as etc... PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin" fi - # You can force the sys-root if the sys-root encoded into the cross compiler tools - # is not correct. - AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root], - [pass this sys-root to the compilers and tools (for cross-compiling)])]) - - if test "x$with_sys_root" != x; then - SYS_ROOT=$with_sys_root - else - SYS_ROOT=/ - fi - AC_SUBST(SYS_ROOT) - - AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir], - [search this directory for compilers and tools (for cross-compiling)])], - [TOOLS_DIR=$with_tools_dir] - ) - - AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit], - [use this directory as base for tools-dir and sys-root (for cross-compiling)])], - [ - if test "x$with_sys_root" != x; then - AC_MSG_ERROR([Cannot specify both --with-devkit and --with-sys-root at the same time]) - fi - BASIC_FIXUP_PATH([with_devkit]) - BASIC_APPEND_TO_PATH([TOOLS_DIR],$with_devkit/bin) - if test -d "$with_devkit/$host_alias/libc"; then - SYS_ROOT=$with_devkit/$host_alias/libc - elif test -d "$with_devkit/$host/sys-root"; then - SYS_ROOT=$with_devkit/$host/sys-root - fi - ]) + AC_MSG_CHECKING([for sysroot]) + AC_MSG_RESULT([$SYSROOT]) + AC_MSG_CHECKING([for toolchain path]) + AC_MSG_RESULT([$TOOLCHAIN_PATH]) + AC_MSG_CHECKING([for extra path]) + AC_MSG_RESULT([$EXTRA_PATH]) ]) AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR], @@ -648,10 +714,10 @@ fi if test "x$FOUND_MAKE" = x; then - if test "x$TOOLS_DIR" != x; then - # We have a tools-dir, check that as well before giving up. + if test "x$TOOLCHAIN_PATH" != x; then + # We have a toolchain path, check that as well before giving up. OLD_PATH=$PATH - PATH=$TOOLS_DIR:$PATH + PATH=$TOOLCHAIN_PATH:$PATH AC_PATH_PROGS(CHECK_TOOLSDIR_GMAKE, gmake) BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_GMAKE", [gmake in tools-dir]) if test "x$FOUND_MAKE" = x; then
--- a/common/autoconf/build-aux/config.guess Wed Apr 16 09:46:49 2014 -0400 +++ b/common/autoconf/build-aux/config.guess Wed Apr 16 09:49:45 2014 -0400 @@ -76,4 +76,14 @@ OUT=powerpc$KERNEL_BITMODE`echo $OUT | sed -e 's/[^-]*//'` fi +# Test and fix little endian PowerPC64. +# TODO: should be handled by autoconf-config.guess. +if [ "x$OUT" = x ]; then + if [ `uname -m` = ppc64le ]; then + if [ `uname -s` = Linux ]; then + OUT=powerpc64le-unknown-linux-gnu + fi + fi +fi + echo $OUT
--- a/common/autoconf/build-performance.m4 Wed Apr 16 09:46:49 2014 -0400 +++ b/common/autoconf/build-performance.m4 Wed Apr 16 09:49:45 2014 -0400 @@ -169,8 +169,8 @@ if test "x$enable_ccache" = xyes; then AC_MSG_RESULT([yes]) OLD_PATH="$PATH" - if test "x$TOOLS_DIR" != x; then - PATH=$TOOLS_DIR:$PATH + if test "x$TOOLCHAIN_PATH" != x; then + PATH=$TOOLCHAIN_PATH:$PATH fi BASIC_REQUIRE_PROGS(CCACHE, ccache) CCACHE_STATUS="enabled"
--- a/common/autoconf/configure.ac Wed Apr 16 09:46:49 2014 -0400 +++ b/common/autoconf/configure.ac Wed Apr 16 09:49:45 2014 -0400 @@ -100,6 +100,9 @@ # With basic setup done, call the custom early hook. CUSTOM_EARLY_HOOK +# Check if we have devkits, extra paths or sysroot set. +BASIC_SETUP_DEVKIT + # To properly create a configuration name, we need to have the OpenJDK target # and options (variants and debug level) parsed. BASIC_SETUP_OUTPUT_DIR
--- a/common/autoconf/flags.m4 Wed Apr 16 09:46:49 2014 -0400 +++ b/common/autoconf/flags.m4 Wed Apr 16 09:49:45 2014 -0400 @@ -119,6 +119,32 @@ # FIXME: likely bug, should be CCXXFLAGS_JDK? or one for C or CXX. CCXXFLAGS="$CCXXFLAGS -nologo" fi + + if test "x$SYSROOT" != "x"; then + if test "x$TOOLCHAIN_TYPE" = xsolstudio; then + if test "x$OPENJDK_TARGET_OS" = xsolaris; then + # Solaris Studio does not have a concept of sysroot. Instead we must + # make sure the default include and lib dirs are appended to each + # compile and link command line. + SYSROOT_CFLAGS="-I$SYSROOT/usr/include" + SYSROOT_LDFLAGS="-L$SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \ + -L$SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \ + -L$SYSROOT/usr/ccs/lib$OPENJDK_TARGET_CPU_ISADIR" + fi + elif test "x$TOOLCHAIN_TYPE" = xgcc; then + SYSROOT_CFLAGS="--sysroot=\"$SYSROOT\"" + SYSROOT_LDFLAGS="--sysroot=\"$SYSROOT\"" + elif test "x$TOOLCHAIN_TYPE" = xclang; then + SYSROOT_CFLAGS="-isysroot \"$SYSROOT\"" + SYSROOT_LDFLAGS="-isysroot \"$SYSROOT\"" + fi + # Propagate the sysroot args to hotspot + LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $SYSROOT_CFLAGS" + LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $SYSROOT_CFLAGS" + LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $SYSROOT_LDFLAGS" + fi + AC_SUBST(SYSROOT_CFLAGS) + AC_SUBST(SYSROOT_LDFLAGS) ]) AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS], @@ -421,9 +447,9 @@ LDFLAGS_JDK="${LDFLAGS_JDK} $with_extra_ldflags" # Hotspot needs these set in their legacy form - LEGACY_EXTRA_CFLAGS=$with_extra_cflags - LEGACY_EXTRA_CXXFLAGS=$with_extra_cxxflags - LEGACY_EXTRA_LDFLAGS=$with_extra_ldflags + LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $with_extra_cflags" + LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $with_extra_cxxflags" + LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $with_extra_ldflags" AC_SUBST(LEGACY_EXTRA_CFLAGS) AC_SUBST(LEGACY_EXTRA_CXXFLAGS) @@ -521,7 +547,13 @@ CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN" fi else - CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN" + # Same goes for _BIG_ENDIAN. Do we really need to set *ENDIAN on Solaris if they + # are defined in the system? + if test "x$OPENJDK_TARGET_OS" = xsolaris; then + CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN=" + else + CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN" + fi fi # Setup target OS define. Use OS target name but in upper case. @@ -735,4 +767,20 @@ [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true], [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false]) AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG) + + case "${TOOLCHAIN_TYPE}" in + microsoft) + CFLAGS_WARNINGS_ARE_ERRORS="/WX" + ;; + solstudio) + CFLAGS_WARNINGS_ARE_ERRORS="-errtags -errwarn=%all" + ;; + gcc) + CFLAGS_WARNINGS_ARE_ERRORS="-Werror" + ;; + clang) + CFLAGS_WARNINGS_ARE_ERRORS="-Werror" + ;; + esac + AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS) ])
--- a/common/autoconf/generated-configure.sh Wed Apr 16 09:46:49 2014 -0400 +++ b/common/autoconf/generated-configure.sh Wed Apr 16 09:49:45 2014 -0400 @@ -664,7 +664,6 @@ FREETYPE_LIBS FREETYPE_CFLAGS CUPS_CFLAGS -OPENWIN_HOME X_EXTRA_LIBS X_LIBS X_PRE_LIBS @@ -673,6 +672,7 @@ FIXPATH ZIP_DEBUGINFO_FILES ENABLE_DEBUG_SYMBOLS +CFLAGS_WARNINGS_ARE_ERRORS COMPILER_SUPPORTS_TARGET_BITS_FLAG ZERO_ARCHFLAG LDFLAGS_CXX_JDK @@ -707,6 +707,8 @@ SHARED_LIBRARY_FLAGS CXX_FLAG_REORDER C_FLAG_REORDER +SYSROOT_LDFLAGS +SYSROOT_CFLAGS RC_FLAGS AR_OUT_OPTION LD_OUT_OPTION @@ -759,7 +761,7 @@ CXX ac_ct_PROPER_COMPILER_CXX PROPER_COMPILER_CXX -TOOLS_DIR_CXX +TOOLCHAIN_PATH_CXX POTENTIAL_CXX OBJEXT EXEEXT @@ -770,11 +772,11 @@ CC ac_ct_PROPER_COMPILER_CC PROPER_COMPILER_CC -TOOLS_DIR_CC +TOOLCHAIN_PATH_CC POTENTIAL_CC -VS_PATH VS_LIB VS_INCLUDE +VS_PATH CYGWIN_LINK EXE_SUFFIX OBJ_SUFFIX @@ -886,7 +888,6 @@ BUILD_LOG_WRAPPER BUILD_LOG_PREVIOUS BUILD_LOG -SYS_ROOT TOPDIR PATH_SEP ZERO_ARCHDEF @@ -1019,9 +1020,6 @@ ac_user_opts=' enable_option_checking with_target_bits -with_sys_root -with_tools_dir -with_devkit enable_openjdk_only with_custom_make_dir with_jdk_variant @@ -1029,6 +1027,12 @@ with_jvm_variants enable_debug with_debug_level +with_devkit +with_sys_root +with_sysroot +with_tools_dir +with_toolchain_path +with_extra_path with_conf_name with_builddeps_conf with_builddeps_server @@ -1847,12 +1851,6 @@ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-target-bits build 32-bit or 64-bit binaries (for platforms that support it), e.g. --with-target-bits=32 [guessed] - --with-sys-root pass this sys-root to the compilers and tools (for - cross-compiling) - --with-tools-dir search this directory for compilers and tools (for - cross-compiling) - --with-devkit use this directory as base for tools-dir and - sys-root (for cross-compiling) --with-custom-make-dir Deprecated. Option is kept for backwards compatibility and is ignored --with-jdk-variant JDK variant to build (normal) [normal] @@ -1860,8 +1858,16 @@ --with-jvm-variants JVM variants (separated by commas) to build (server, client, minimal1, kernel, zero, zeroshark, core) [server] - --with-debug-level set the debug level (release, fastdebug, slowdebug) - [release] + --with-debug-level set the debug level (release, fastdebug, slowdebug, + optimized (HotSpot build only)) [release] + --with-devkit use this devkit for compilers, tools and resources + --with-sys-root alias for --with-sysroot for backwards compatability + --with-sysroot use this directory as sysroot) + --with-tools-dir alias for --with-toolchain-path for backwards + compatibility + --with-toolchain-path prepend these directories when searching for + toolchain binaries (compilers etc) + --with-extra-path prepend these directories to the default path --with-conf-name use this as the name of the configuration [generated from important configuration options] --with-builddeps-conf use this configuration file for the builddeps @@ -3324,6 +3330,9 @@ # Appends a string to a path variable, only adding the : when needed. +# Prepends a string to a path variable, only adding the : when needed. + + # This will make sure the given variable points to a full and proper # path. This means: # 1) There will be no spaces in the path. On posix platforms, @@ -3406,6 +3415,8 @@ + + #%%% Simple tools %%% # Check if we have found a usable version of make @@ -4232,7 +4243,7 @@ #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1394794899 +DATE_WHEN_GENERATED=1396624161 ############################################################################### # @@ -13507,6 +13518,12 @@ VAR_CPU_BITS=64 VAR_CPU_ENDIAN=big ;; + powerpc64le) + VAR_CPU=ppc64 + VAR_CPU_ARCH=ppc + VAR_CPU_BITS=64 + VAR_CPU_ENDIAN=little + ;; s390) VAR_CPU=s390 VAR_CPU_ARCH=s390 @@ -13632,6 +13649,12 @@ VAR_CPU_BITS=64 VAR_CPU_ENDIAN=big ;; + powerpc64le) + VAR_CPU=ppc64 + VAR_CPU_ARCH=ppc + VAR_CPU_BITS=64 + VAR_CPU_ENDIAN=little + ;; s390) VAR_CPU=s390 VAR_CPU_ARCH=s390 @@ -14239,180 +14262,6 @@ # Locate the directory of this script. AUTOCONF_DIR=$TOPDIR/common/autoconf - if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then - # Add extra search paths on solaris for utilities like ar and as etc... - PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin" - fi - - # You can force the sys-root if the sys-root encoded into the cross compiler tools - # is not correct. - -# Check whether --with-sys-root was given. -if test "${with_sys_root+set}" = set; then : - withval=$with_sys_root; -fi - - - if test "x$with_sys_root" != x; then - SYS_ROOT=$with_sys_root - else - SYS_ROOT=/ - fi - - - -# Check whether --with-tools-dir was given. -if test "${with_tools_dir+set}" = set; then : - withval=$with_tools_dir; TOOLS_DIR=$with_tools_dir - -fi - - - -# Check whether --with-devkit was given. -if test "${with_devkit+set}" = set; then : - withval=$with_devkit; - if test "x$with_sys_root" != x; then - as_fn_error $? "Cannot specify both --with-devkit and --with-sys-root at the same time" "$LINENO" 5 - fi - - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then - - # Input might be given as Windows format, start by converting to - # unix format. - path="$with_devkit" - 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 with_devkit, which resolves as \"$path\", is invalid." >&5 -$as_echo "$as_me: The path of with_devkit, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Cannot locate the the path of with_devkit" "$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-stile (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 - with_devkit="$new_path" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting with_devkit to \"$new_path\"" >&5 -$as_echo "$as_me: Rewriting with_devkit to \"$new_path\"" >&6;} - fi - - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then - - path="$with_devkit" - 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 - with_devkit="$new_path" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting with_devkit to \"$new_path\"" >&5 -$as_echo "$as_me: Rewriting with_devkit 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 posix platform. Hooray! :) - path="$with_devkit" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of with_devkit, which resolves as \"$path\", is invalid." >&5 -$as_echo "$as_me: The path of with_devkit, 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 with_devkit, which resolves as \"$path\", is not found." "$LINENO" 5 - fi - - with_devkit="`cd "$path"; $THEPWDCMD -L`" - fi - - - if test "x$TOOLS_DIR" = x; then - TOOLS_DIR="$with_devkit/bin" - else - TOOLS_DIR="$TOOLS_DIR:$with_devkit/bin" - fi - - if test -d "$with_devkit/$host_alias/libc"; then - SYS_ROOT=$with_devkit/$host_alias/libc - elif test -d "$with_devkit/$host/sys-root"; then - SYS_ROOT=$with_devkit/$host/sys-root - fi - -fi - - # Setup default logging of stdout and stderr to build.log in the output root. BUILD_LOG='$(OUTPUT_ROOT)/build.log' @@ -14647,6 +14496,7 @@ # # Set the debug level # release: no debug information, all optimizations, no asserts. + # optimized: no debug information, all optimizations, no asserts, HotSpot target is 'optimized'. # fastdebug: debug information (-g), all optimizations, all asserts # slowdebug: debug information (-g), no optimizations, all asserts # @@ -14679,6 +14529,7 @@ $as_echo "$DEBUG_LEVEL" >&6; } if test "x$DEBUG_LEVEL" != xrelease && \ + test "x$DEBUG_LEVEL" != xoptimized && \ test "x$DEBUG_LEVEL" != xfastdebug && \ test "x$DEBUG_LEVEL" != xslowdebug; then as_fn_error $? "Allowed debug levels are: release, fastdebug and slowdebug" "$LINENO" 5 @@ -14715,8 +14566,30 @@ HOTSPOT_DEBUG_LEVEL="jvmg" HOTSPOT_EXPORT="debug" ;; + optimized ) + VARIANT="OPT" + FASTDEBUG="false" + DEBUG_CLASSFILES="false" + BUILD_VARIANT_RELEASE="-optimized" + HOTSPOT_DEBUG_LEVEL="optimized" + HOTSPOT_EXPORT="optimized" + ;; esac + # The debug level 'optimized' is a little special because it is currently only + # applicable to the HotSpot build where it means to build a completely + # optimized version of the VM without any debugging code (like for the + # 'release' debug level which is called 'product' in the HotSpot build) but + # with the exception that it can contain additional code which is otherwise + # protected by '#ifndef PRODUCT' macros. These 'optimized' builds are used to + # test new and/or experimental features which are not intended for customer + # shipment. Because these new features need to be tested and benchmarked in + # real world scenarios, we want to build the containing JDK at the 'release' + # debug level. + if test "x$DEBUG_LEVEL" = xoptimized; then + DEBUG_LEVEL="release" + fi + ##### # Generate the legacy makefile targets for hotspot. # The hotspot api for selecting the build artifacts, really, needs to be improved. @@ -14775,6 +14648,291 @@ # With basic setup done, call the custom early hook. +# Check if we have devkits, extra paths or sysroot set. + + +# Check whether --with-devkit was given. +if test "${with_devkit+set}" = set; then : + withval=$with_devkit; + + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + + # Input might be given as Windows format, start by converting to + # unix format. + path="$with_devkit" + 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 with_devkit, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of with_devkit, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Cannot locate the the path of with_devkit" "$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-stile (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 + with_devkit="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting with_devkit to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting with_devkit to \"$new_path\"" >&6;} + fi + + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + + path="$with_devkit" + 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 + with_devkit="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting with_devkit to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting with_devkit 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 posix platform. Hooray! :) + path="$with_devkit" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of with_devkit, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of with_devkit, 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 with_devkit, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + with_devkit="`cd "$path"; $THEPWDCMD -L`" + fi + + DEVKIT_ROOT="$with_devkit" + # Check for a meta data info file in the root of the devkit + if test -f "$DEVKIT_ROOT/devkit.info"; then + # This potentially sets the following: + # DEVKIT_NAME: A descriptive name of the devkit + # DEVKIT_TOOLCHAIN_PATH: Corresponds to --with-toolchain-path + # DEVKIT_EXTRA_PATH: Corresponds to --with-extra-path + # DEVKIT_SYSROOT: Corresponds to --with-sysroot + . $DEVKIT_ROOT/devkit.info + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for devkit" >&5 +$as_echo_n "checking for devkit... " >&6; } + if test "x$DEVKIT_NAME" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEVKIT_NAME in $DEVKIT_ROOT" >&5 +$as_echo "$DEVKIT_NAME in $DEVKIT_ROOT" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEVKIT_ROOT" >&5 +$as_echo "$DEVKIT_ROOT" >&6; } + fi + + if test "x$DEVKIT_EXTRA_PATH" != x; then + + if test "x$DEVKIT_EXTRA_PATH" != x; then + if test "x$EXTRA_PATH" = x; then + EXTRA_PATH="$DEVKIT_EXTRA_PATH" + else + EXTRA_PATH="$DEVKIT_EXTRA_PATH:$EXTRA_PATH" + fi + fi + + fi + + # Fallback default of just /bin if DEVKIT_PATH is not defined + if test "x$DEVKIT_TOOLCHAIN_PATH" = x; then + DEVKIT_TOOLCHAIN_PATH="$DEVKIT_ROOT/bin" + fi + + if test "x$DEVKIT_TOOLCHAIN_PATH" != x; then + if test "x$TOOLCHAIN_PATH" = x; then + TOOLCHAIN_PATH="$DEVKIT_TOOLCHAIN_PATH" + else + TOOLCHAIN_PATH="$DEVKIT_TOOLCHAIN_PATH:$TOOLCHAIN_PATH" + fi + fi + + + # If DEVKIT_SYSROOT is set, use that, otherwise try a couple of known + # places for backwards compatiblity. + if test "x$DEVKIT_SYSROOT" != x; then + SYSROOT="$DEVKIT_SYSROOT" + elif test -d "$DEVKIT_ROOT/$host_alias/libc"; then + SYSROOT="$DEVKIT_ROOT/$host_alias/libc" + elif test -d "$DEVKIT_ROOT/$host/sys-root"; then + SYSROOT="$DEVKIT_ROOT/$host/sys-root" + fi + + +fi + + + # You can force the sysroot if the sysroot encoded into the compiler tools + # is not correct. + +# Check whether --with-sys-root was given. +if test "${with_sys_root+set}" = set; then : + withval=$with_sys_root; SYSROOT=$with_sys_root + +fi + + + +# Check whether --with-sysroot was given. +if test "${with_sysroot+set}" = set; then : + withval=$with_sysroot; SYSROOT=$with_sysroot + +fi + + + +# Check whether --with-tools-dir was given. +if test "${with_tools_dir+set}" = set; then : + withval=$with_tools_dir; + if test "x$with_tools_dir" != x; then + if test "x$TOOLCHAIN_PATH" = x; then + TOOLCHAIN_PATH="$with_tools_dir" + else + TOOLCHAIN_PATH="$with_tools_dir:$TOOLCHAIN_PATH" + fi + fi + + +fi + + + +# Check whether --with-toolchain-path was given. +if test "${with_toolchain_path+set}" = set; then : + withval=$with_toolchain_path; + if test "x$with_toolchain_path" != x; then + if test "x$TOOLCHAIN_PATH" = x; then + TOOLCHAIN_PATH="$with_toolchain_path" + else + TOOLCHAIN_PATH="$with_toolchain_path:$TOOLCHAIN_PATH" + fi + fi + + +fi + + + +# Check whether --with-extra-path was given. +if test "${with_extra_path+set}" = set; then : + withval=$with_extra_path; + if test "x$with_extra_path" != x; then + if test "x$EXTRA_PATH" = x; then + EXTRA_PATH="$with_extra_path" + else + EXTRA_PATH="$with_extra_path:$EXTRA_PATH" + fi + fi + + +fi + + + # Prepend the extra path to the global path + + if test "x$EXTRA_PATH" != x; then + if test "x$PATH" = x; then + PATH="$EXTRA_PATH" + else + PATH="$EXTRA_PATH:$PATH" + fi + fi + + + if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then + # Add extra search paths on solaris for utilities like ar and as etc... + PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin" + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +$as_echo_n "checking for sysroot... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SYSROOT" >&5 +$as_echo "$SYSROOT" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for toolchain path" >&5 +$as_echo_n "checking for toolchain path... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TOOLCHAIN_PATH" >&5 +$as_echo "$TOOLCHAIN_PATH" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for extra path" >&5 +$as_echo_n "checking for extra path... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $EXTRA_PATH" >&5 +$as_echo "$EXTRA_PATH" >&6; } + + # To properly create a configuration name, we need to have the OpenJDK target # and options (variants and debug level) parsed. @@ -16082,10 +16240,10 @@ fi if test "x$FOUND_MAKE" = x; then - if test "x$TOOLS_DIR" != x; then - # We have a tools-dir, check that as well before giving up. + if test "x$TOOLCHAIN_PATH" != x; then + # We have a toolchain path, check that as well before giving up. OLD_PATH=$PATH - PATH=$TOOLS_DIR:$PATH + PATH=$TOOLCHAIN_PATH:$PATH for ac_prog in gmake do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -27207,47 +27365,62 @@ # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat { $as_echo "$as_me:${as_lineno-$LINENO}: Trying to extract Visual Studio environment variables" >&5 $as_echo "$as_me: Trying to extract Visual Studio environment variables" >&6;} - cd $OUTPUT_ROOT - # FIXME: The code betweeen ---- was inlined from a separate script and is not properly adapted - # to autoconf standards. - - #---- - - # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment) - # but calculate the difference in Cygwin environment before/after running it and then - # apply the diff. - - if test "x$OPENJDK_BUILD_OS_ENV" = xwindows.cygwin; then - _vs10varsall=`cygpath -a -m -s "$VS_ENV_CMD"` - _dosvs10varsall=`cygpath -a -w -s $_vs10varsall` - _dosbash=`cygpath -a -w -s \`which bash\`.*` - else - _dosvs10varsall=`cmd //c echo $VS_ENV_CMD` - _dosbash=`cmd //c echo \`which bash\`` - fi - - # generate the set of exported vars before/after the vs10 setup - $ECHO "@echo off" > localdevenvtmp.bat - $ECHO "$_dosbash -c \"export -p\" > localdevenvtmp.export0" >> localdevenvtmp.bat - $ECHO "call $_dosvs10varsall $VS_ENV_ARGS" >> localdevenvtmp.bat - $ECHO "$_dosbash -c \"export -p\" > localdevenvtmp.export1" >> localdevenvtmp.bat + + # We need to create a couple of temporary files. + VS_ENV_TMP_DIR="$OUTPUT_ROOT/vs-env" + $MKDIR -p $VS_ENV_TMP_DIR + + # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment). + # Instead create a shell script which will set the relevant variables when run. + WINPATH_VS_ENV_CMD="$VS_ENV_CMD" + + unix_path="$WINPATH_VS_ENV_CMD" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + windows_path=`$CYGPATH -m "$unix_path"` + WINPATH_VS_ENV_CMD="$windows_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + windows_path=`cmd //c echo $unix_path` + WINPATH_VS_ENV_CMD="$windows_path" + fi + + WINPATH_BASH="$BASH" + + unix_path="$WINPATH_BASH" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + windows_path=`$CYGPATH -m "$unix_path"` + WINPATH_BASH="$windows_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + windows_path=`cmd //c echo $unix_path` + WINPATH_BASH="$windows_path" + fi + + + # Generate a DOS batch file which runs $VS_ENV_CMD, and then creates a shell + # script (executable by bash) that will setup the important variables. + EXTRACT_VC_ENV_BAT_FILE="$VS_ENV_TMP_DIR/extract-vs-env.bat" + $ECHO "@echo off" > $EXTRACT_VC_ENV_BAT_FILE + # This will end up something like: + # call C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat + $ECHO "call $WINPATH_VS_ENV_CMD $VS_ENV_ARGS" >> $EXTRACT_VC_ENV_BAT_FILE + # These will end up something like: + # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh + # The trailing space for everyone except PATH is no typo, but is needed due + # to trailing \ in the Windows paths. These will be stripped later. + $ECHO "$WINPATH_BASH -c 'echo VS_PATH="'\"$PATH\" > set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE + $ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE + $ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE + $ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE + $ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE + $ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE # Now execute the newly created bat file. - # The | cat is to stop SetEnv.Cmd to mess with system colors on msys - cmd /c localdevenvtmp.bat | cat - - # apply the diff (less some non-vs10 vars named by "!") - $SORT localdevenvtmp.export0 | $GREP -v "!" > localdevenvtmp.export0.sort - $SORT localdevenvtmp.export1 | $GREP -v "!" > localdevenvtmp.export1.sort - $COMM -1 -3 localdevenvtmp.export0.sort localdevenvtmp.export1.sort > localdevenv.sh - - # cleanup - $RM localdevenvtmp* - #---- + # The | cat is to stop SetEnv.Cmd to mess with system colors on msys. + # Change directory so we don't need to mess with Windows paths in redirects. + cd $VS_ENV_TMP_DIR + cmd /c extract-vs-env.bat | $CAT cd $CURDIR - if test ! -s $OUTPUT_ROOT/localdevenv.sh; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + + if test ! -s $VS_ENV_TMP_DIR/set-vs-env.sh; then { $as_echo "$as_me:${as_lineno-$LINENO}: Could not succesfully extract the envionment variables needed for the VS setup." >&5 $as_echo "$as_me: Could not succesfully extract the envionment variables needed for the VS setup." >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: Try setting --with-tools-dir to the VC/bin directory within the VS installation" >&5 @@ -27261,31 +27434,37 @@ # the configure script to find and run the compiler in the proper way. { $as_echo "$as_me:${as_lineno-$LINENO}: Setting extracted environment variables" >&5 $as_echo "$as_me: Setting extracted environment variables" >&6;} - . $OUTPUT_ROOT/localdevenv.sh + . $VS_ENV_TMP_DIR/set-vs-env.sh + # Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we + # also define VCINSTALLDIR, WindowsSdkDir and WINDOWSSDKDIR. else # We did not find a vsvars bat file, let's hope we are run from a VS command prompt. { $as_echo "$as_me:${as_lineno-$LINENO}: Cannot locate a valid Visual Studio installation, checking current environment" >&5 $as_echo "$as_me: Cannot locate a valid Visual Studio installation, checking current environment" >&6;} fi - # At this point, we should have corrent variables in the environment, or we can't continue. + # At this point, we should have correct variables in the environment, or we can't continue. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Visual Studio variables" >&5 $as_echo_n "checking for Visual Studio variables... " >&6; } if test "x$VCINSTALLDIR" != x || test "x$WindowsSDKDir" != x || test "x$WINDOWSSDKDIR" != x; then - if test "x$INCLUDE" = x || test "x$LIB" = x; then + if test "x$VS_INCLUDE" = x || test "x$VS_LIB" = x; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: present but broken" >&5 $as_echo "present but broken" >&6; } as_fn_error $? "Your VC command prompt seems broken, INCLUDE and/or LIB is missing." "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } - # Remove any trailing \ from INCLUDE and LIB to avoid trouble in spec.gmk. - VS_INCLUDE=`$ECHO "$INCLUDE" | $SED 's/\\\\$//'` - VS_LIB=`$ECHO "$LIB" | $SED 's/\\\\$//'` - # Remove any paths containing # (typically F#) as that messes up make - PATH=`$ECHO "$PATH" | $SED 's/[^:#]*#[^:]*://g'` - VS_PATH="$PATH" + # Remove any trailing "\" and " " from the variables. + VS_INCLUDE=`$ECHO "$VS_INCLUDE" | $SED 's/\\\\* *$//'` + VS_LIB=`$ECHO "$VS_LIB" | $SED 's/\\\\* *$//'` + VCINSTALLDIR=`$ECHO "$VCINSTALLDIR" | $SED 's/\\\\* *$//'` + WindowsSDKDir=`$ECHO "$WindowsSDKDir" | $SED 's/\\\\* *$//'` + WINDOWSSDKDIR=`$ECHO "$WINDOWSSDKDIR" | $SED 's/\\\\* *$//'` + # Remove any paths containing # (typically F#) as that messes up make. This + # is needed if visual studio was installed with F# support. + VS_PATH=`$ECHO "$VS_PATH" | $SED 's/[^:#]*#[^:]*://g'` + @@ -27310,6 +27489,12 @@ as_fn_error $? "Cannot continue" "$LINENO" 5 fi + # Reset path to VS_PATH. It will include everything that was on PATH at the time we + # ran TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV. + PATH="$VS_PATH" + # The microsoft toolchain also requires INCLUDE and LIB to be set. + export INCLUDE="$VS_INCLUDE" + export LIB="$VS_LIB" fi # autoconf magic only relies on PATH, so update it if tools dir is specified @@ -27323,169 +27508,11 @@ PATH="/usr/ccs/bin:$PATH" fi - # Finally add TOOLS_DIR at the beginning, to allow --with-tools-dir to + # Finally add TOOLCHAIN_PATH at the beginning, to allow --with-tools-dir to # override all other locations. - if test "x$TOOLS_DIR" != x; then - PATH=$TOOLS_DIR:$PATH - fi - - # If a devkit is found on the builddeps server, then prepend its path to the - # PATH variable. If there are cross compilers available in the devkit, these - # will be found by AC_PROG_CC et al. - DEVKIT= - - - if test "x$with_builddeps_server" != x || test "x$with_builddeps_conf" != x; then - # Source the builddeps file again, to make sure it uses the latest variables! - . $builddepsfile - # Look for a target and build machine specific resource! - eval resource=\${builddep_devkit_BUILD_${rewritten_build_var}_TARGET_${rewritten_target_var}} - if test "x$resource" = x; then - # Ok, lets instead look for a target specific resource - eval resource=\${builddep_devkit_TARGET_${rewritten_target_var}} - fi - if test "x$resource" = x; then - # Ok, lets instead look for a build specific resource - eval resource=\${builddep_devkit_BUILD_${rewritten_build_var}} - fi - if test "x$resource" = x; then - # Ok, lets instead look for a generic resource - # (The devkit comes from M4 and not the shell, thus no need for eval here.) - resource=${builddep_devkit} - fi - if test "x$resource" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Using builddeps $resource for devkit" >&5 -$as_echo "$as_me: Using builddeps $resource for devkit" >&6;} - # If the resource in the builddeps.conf file is an existing directory, - # for example /java/linux/cups - if test -d ${resource}; then - depdir=${resource} - else - - # devkit is for example mymodule - # $resource is for example libs/general/libmymod_1_2_3.zip - # $with_builddeps_server is for example ftp://mybuilddeps.myserver.com/builddeps - # $with_builddeps_dir is for example /localhome/builddeps - # depdir is the name of the variable into which we store the depdir, eg MYMOD - # Will download ftp://mybuilddeps.myserver.com/builddeps/libs/general/libmymod_1_2_3.zip and - # unzip into the directory: /localhome/builddeps/libmymod_1_2_3 - filename=`basename $resource` - filebase=`echo $filename | sed 's/\.[^\.]*$//'` - filebase=${filename%%.*} - extension=${filename#*.} - installdir=$with_builddeps_dir/$filebase - if test ! -f $installdir/$filename.unpacked; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Downloading build dependency devkit from $with_builddeps_server/$resource and installing into $installdir" >&5 -$as_echo "$as_me: Downloading build dependency devkit from $with_builddeps_server/$resource and installing into $installdir" >&6;} - if test ! -d $installdir; then - mkdir -p $installdir - fi - if test ! -d $installdir; then - as_fn_error $? "Could not create directory $installdir" "$LINENO" 5 - fi - tmpfile=`mktemp $installdir/devkit.XXXXXXXXX` - touch $tmpfile - if test ! -f $tmpfile; then - as_fn_error $? "Could not create files in directory $installdir" "$LINENO" 5 - fi - - # $with_builddeps_server/$resource is the ftp://abuilddeps.server.com/libs/cups.zip - # $tmpfile is the local file name for the downloaded file. - VALID_TOOL=no - if test "x$BDEPS_FTP" = xwget; then - VALID_TOOL=yes - wget -O $tmpfile $with_builddeps_server/$resource - fi - if test "x$BDEPS_FTP" = xlftp; then - VALID_TOOL=yes - lftp -c "get $with_builddeps_server/$resource -o $tmpfile" - fi - if test "x$BDEPS_FTP" = xftp; then - VALID_TOOL=yes - FTPSERVER=`echo $with_builddeps_server/$resource | cut -f 3 -d '/'` - FTPPATH=`echo $with_builddeps_server/$resource | cut -f 4- -d '/'` - FTPUSERPWD=${FTPSERVER%%@*} - if test "x$FTPSERVER" != "x$FTPUSERPWD"; then - FTPUSER=${userpwd%%:*} - FTPPWD=${userpwd#*@} - FTPSERVER=${FTPSERVER#*@} - else - FTPUSER=ftp - FTPPWD=ftp - fi - # the "pass" command does not work on some - # ftp clients (read ftp.exe) but if it works, - # passive mode is better! - ( \ - echo "user $FTPUSER $FTPPWD" ; \ - echo "pass" ; \ - echo "bin" ; \ - echo "get $FTPPATH $tmpfile" ; \ - ) | ftp -in $FTPSERVER - fi - if test "x$VALID_TOOL" != xyes; then - as_fn_error $? "I do not know how to use the tool: $BDEPS_FTP" "$LINENO" 5 - fi - - mv $tmpfile $installdir/$filename - if test ! -s $installdir/$filename; then - as_fn_error $? "Could not download $with_builddeps_server/$resource" "$LINENO" 5 - fi - case "$extension" in - zip) echo "Unzipping $installdir/$filename..." - (cd $installdir ; rm -f $installdir/$filename.unpacked ; $BDEPS_UNZIP $installdir/$filename > /dev/null && touch $installdir/$filename.unpacked) - ;; - tar.gz) echo "Untaring $installdir/$filename..." - (cd $installdir ; rm -f $installdir/$filename.unpacked ; tar xzf $installdir/$filename && touch $installdir/$filename.unpacked) - ;; - tgz) echo "Untaring $installdir/$filename..." - (cd $installdir ; rm -f $installdir/$filename.unpacked ; tar xzf $installdir/$filename && touch $installdir/$filename.unpacked) - ;; - *) as_fn_error $? "Cannot handle build depency archive with extension $extension" "$LINENO" 5 - ;; - esac - fi - if test -f $installdir/$filename.unpacked; then - depdir=$installdir - fi - - fi - # Source the builddeps file again, because in the previous command, the depdir - # was updated to point at the current build dependency install directory. - . $builddepsfile - # Now extract variables from the builddeps.conf files. - theroot=${builddep_devkit_ROOT} - thecflags=${builddep_devkit_CFLAGS} - thelibs=${builddep_devkit_LIBS} - if test "x$depdir" = x; then - as_fn_error $? "Could not download build dependency devkit" "$LINENO" 5 - fi - DEVKIT=$depdir - if test "x$theroot" != x; then - DEVKIT="$theroot" - fi - if test "x$thecflags" != x; then - DEVKIT_CFLAGS="$thecflags" - fi - if test "x$thelibs" != x; then - DEVKIT_LIBS="$thelibs" - fi - - # Found devkit - PATH="$DEVKIT/bin:$PATH" - SYS_ROOT="$DEVKIT/${rewritten_target}/sys-root" - if test "x$x_includes" = "xNONE"; then - x_includes="$SYS_ROOT/usr/include/X11" - fi - if test "x$x_libraries" = "xNONE"; then - x_libraries="$SYS_ROOT/usr/lib" - fi - - - fi - - fi - + if test "x$TOOLCHAIN_PATH" != x; then + PATH=$TOOLCHAIN_PATH:$PATH + fi # @@ -27569,59 +27596,59 @@ # used. CC= - # If TOOLS_DIR is set, check for all compiler names in there first + # If TOOLCHAIN_PATH is set, check for all compiler names in there first # before checking the rest of the PATH. # FIXME: Now that we prefix the TOOLS_DIR to the PATH in the PRE_DETECTION # step, this should not be necessary. - if test -n "$TOOLS_DIR"; then + if test -n "$TOOLCHAIN_PATH"; then PATH_save="$PATH" - PATH="$TOOLS_DIR" + PATH="$TOOLCHAIN_PATH" for ac_prog in $SEARCH_LIST 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_TOOLS_DIR_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $TOOLS_DIR_CC in - [\\/]* | ?:[\\/]*) - ac_cv_path_TOOLS_DIR_CC="$TOOLS_DIR_CC" # 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_TOOLS_DIR_CC="$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 -TOOLS_DIR_CC=$ac_cv_path_TOOLS_DIR_CC -if test -n "$TOOLS_DIR_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TOOLS_DIR_CC" >&5 -$as_echo "$TOOLS_DIR_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$TOOLS_DIR_CC" && break -done - - CC=$TOOLS_DIR_CC +if ${ac_cv_path_TOOLCHAIN_PATH_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $TOOLCHAIN_PATH_CC in + [\\/]* | ?:[\\/]*) + ac_cv_path_TOOLCHAIN_PATH_CC="$TOOLCHAIN_PATH_CC" # 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_TOOLCHAIN_PATH_CC="$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 +TOOLCHAIN_PATH_CC=$ac_cv_path_TOOLCHAIN_PATH_CC +if test -n "$TOOLCHAIN_PATH_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TOOLCHAIN_PATH_CC" >&5 +$as_echo "$TOOLCHAIN_PATH_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$TOOLCHAIN_PATH_CC" && break +done + + CC=$TOOLCHAIN_PATH_CC PATH="$PATH_save" fi @@ -29275,59 +29302,59 @@ # used. CXX= - # If TOOLS_DIR is set, check for all compiler names in there first + # If TOOLCHAIN_PATH is set, check for all compiler names in there first # before checking the rest of the PATH. # FIXME: Now that we prefix the TOOLS_DIR to the PATH in the PRE_DETECTION # step, this should not be necessary. - if test -n "$TOOLS_DIR"; then + if test -n "$TOOLCHAIN_PATH"; then PATH_save="$PATH" - PATH="$TOOLS_DIR" + PATH="$TOOLCHAIN_PATH" for ac_prog in $SEARCH_LIST 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_TOOLS_DIR_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $TOOLS_DIR_CXX in - [\\/]* | ?:[\\/]*) - ac_cv_path_TOOLS_DIR_CXX="$TOOLS_DIR_CXX" # 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_TOOLS_DIR_CXX="$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 -TOOLS_DIR_CXX=$ac_cv_path_TOOLS_DIR_CXX -if test -n "$TOOLS_DIR_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TOOLS_DIR_CXX" >&5 -$as_echo "$TOOLS_DIR_CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$TOOLS_DIR_CXX" && break -done - - CXX=$TOOLS_DIR_CXX +if ${ac_cv_path_TOOLCHAIN_PATH_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $TOOLCHAIN_PATH_CXX in + [\\/]* | ?:[\\/]*) + ac_cv_path_TOOLCHAIN_PATH_CXX="$TOOLCHAIN_PATH_CXX" # 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_TOOLCHAIN_PATH_CXX="$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 +TOOLCHAIN_PATH_CXX=$ac_cv_path_TOOLCHAIN_PATH_CXX +if test -n "$TOOLCHAIN_PATH_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TOOLCHAIN_PATH_CXX" >&5 +$as_echo "$TOOLCHAIN_PATH_CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$TOOLCHAIN_PATH_CXX" && break +done + + CXX=$TOOLCHAIN_PATH_CXX PATH="$PATH_save" fi @@ -40735,6 +40762,32 @@ CCXXFLAGS="$CCXXFLAGS -nologo" fi + if test "x$SYSROOT" != "x"; then + if test "x$TOOLCHAIN_TYPE" = xsolstudio; then + if test "x$OPENJDK_TARGET_OS" = xsolaris; then + # Solaris Studio does not have a concept of sysroot. Instead we must + # make sure the default include and lib dirs are appended to each + # compile and link command line. + SYSROOT_CFLAGS="-I$SYSROOT/usr/include" + SYSROOT_LDFLAGS="-L$SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \ + -L$SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \ + -L$SYSROOT/usr/ccs/lib$OPENJDK_TARGET_CPU_ISADIR" + fi + elif test "x$TOOLCHAIN_TYPE" = xgcc; then + SYSROOT_CFLAGS="--sysroot=\"$SYSROOT\"" + SYSROOT_LDFLAGS="--sysroot=\"$SYSROOT\"" + elif test "x$TOOLCHAIN_TYPE" = xclang; then + SYSROOT_CFLAGS="-isysroot \"$SYSROOT\"" + SYSROOT_LDFLAGS="-isysroot \"$SYSROOT\"" + fi + # Propagate the sysroot args to hotspot + LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $SYSROOT_CFLAGS" + LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $SYSROOT_CFLAGS" + LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $SYSROOT_LDFLAGS" + fi + + + # FIXME: Currently we must test this after toolchain but before flags. Fix! @@ -41583,9 +41636,9 @@ LDFLAGS_JDK="${LDFLAGS_JDK} $with_extra_ldflags" # Hotspot needs these set in their legacy form - LEGACY_EXTRA_CFLAGS=$with_extra_cflags - LEGACY_EXTRA_CXXFLAGS=$with_extra_cxxflags - LEGACY_EXTRA_LDFLAGS=$with_extra_ldflags + LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $with_extra_cflags" + LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $with_extra_cxxflags" + LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $with_extra_ldflags" @@ -41683,7 +41736,13 @@ CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN" fi else - CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN" + # Same goes for _BIG_ENDIAN. Do we really need to set *ENDIAN on Solaris if they + # are defined in the system? + if test "x$OPENJDK_TARGET_OS" = xsolaris; then + CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN=" + else + CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN" + fi fi # Setup target OS define. Use OS target name but in upper case. @@ -41989,6 +42048,22 @@ + case "${TOOLCHAIN_TYPE}" in + microsoft) + CFLAGS_WARNINGS_ARE_ERRORS="/WX" + ;; + solstudio) + CFLAGS_WARNINGS_ARE_ERRORS="-errtags -errwarn=%all" + ;; + gcc) + CFLAGS_WARNINGS_ARE_ERRORS="-Werror" + ;; + clang) + CFLAGS_WARNINGS_ARE_ERRORS="-Werror" + ;; + esac + + # Setup debug symbols (need objcopy from the toolchain for that) @@ -42230,21 +42305,23 @@ # Check if the user has specified sysroot, but not --x-includes or --x-libraries. # Make a simple check for the libraries at the sysroot, and setup --x-includes and # --x-libraries for the sysroot, if that seems to be correct. - if test "x$SYS_ROOT" != "x/"; then - if test "x$x_includes" = xNONE; then - if test -f "$SYS_ROOT/usr/X11R6/include/X11/Xlib.h"; then - x_includes="$SYS_ROOT/usr/X11R6/include" - elif test -f "$SYS_ROOT/usr/include/X11/Xlib.h"; then - x_includes="$SYS_ROOT/usr/include" - fi - fi - if test "x$x_libraries" = xNONE; then - if test -f "$SYS_ROOT/usr/X11R6/lib/libX11.so"; then - x_libraries="$SYS_ROOT/usr/X11R6/lib" - elif test "$SYS_ROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then - x_libraries="$SYS_ROOT/usr/lib64" - elif test -f "$SYS_ROOT/usr/lib/libX11.so"; then - x_libraries="$SYS_ROOT/usr/lib" + if test "x$OPENJDK_TARGET_OS" = "xlinux"; then + if test "x$SYSROOT" != "x"; then + if test "x$x_includes" = xNONE; then + if test -f "$SYSROOT/usr/X11R6/include/X11/Xlib.h"; then + x_includes="$SYSROOT/usr/X11R6/include" + elif test -f "$SYSROOT/usr/include/X11/Xlib.h"; then + x_includes="$SYSROOT/usr/include" + fi + fi + if test "x$x_libraries" = xNONE; then + if test -f "$SYSROOT/usr/X11R6/lib/libX11.so"; then + x_libraries="$SYSROOT/usr/X11R6/lib" + elif test "$SYSROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then + x_libraries="$SYSROOT/usr/lib64" + elif test -f "$SYSROOT/usr/lib/libX11.so"; then + x_libraries="$SYSROOT/usr/lib" + fi fi fi fi @@ -42976,9 +43053,12 @@ if test "x$OPENJDK_TARGET_OS" = xsolaris; then OPENWIN_HOME="/usr/openwin" - fi - - + X_CFLAGS="-I$SYSROOT$OPENWIN_HOME/include -I$SYSROOT$OPENWIN_HOME/include/X11/extensions" + X_LIBS="-L$SYSROOT$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \ + -L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \ + -R$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \ + -R$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR" + fi # # Weird Sol10 something check...TODO change to try compile @@ -43278,14 +43358,14 @@ # package installation locations. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cups headers" >&5 $as_echo_n "checking for cups headers... " >&6; } - if test -s /opt/sfw/cups/include/cups/cups.h; then + if test -s $SYSROOT/opt/sfw/cups/include/cups/cups.h; then # An SFW package seems to be installed! CUPS_FOUND=yes - CUPS_CFLAGS="-I/opt/sfw/cups/include" - elif test -s /opt/csw/include/cups/cups.h; then + CUPS_CFLAGS="-I$SYSROOT/opt/sfw/cups/include" + elif test -s $SYSROOT/opt/csw/include/cups/cups.h; then # A CSW package seems to be installed! CUPS_FOUND=yes - CUPS_CFLAGS="-I/opt/csw/include" + CUPS_CFLAGS="-I$SYSROOT/opt/csw/include" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CUPS_FOUND" >&5 $as_echo "$CUPS_FOUND" >&6; } @@ -43878,9 +43958,11 @@ fi fi - if test "x$FOUND_FREETYPE" != xyes; then - # Check modules using pkg-config, but only if we have it (ugly output results otherwise) - if test "x$PKG_CONFIG" != x; then + # If we have a sysroot, assume that's where we are supposed to look and skip pkg-config. + if test "x$SYSROOT" = x; then + if test "x$FOUND_FREETYPE" != xyes; then + # Check modules using pkg-config, but only if we have it (ugly output results otherwise) + if test "x$PKG_CONFIG" != x; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FREETYPE" >&5 @@ -43948,23 +44030,24 @@ $as_echo "yes" >&6; } FOUND_FREETYPE=yes fi - if test "x$FOUND_FREETYPE" = xyes; then - # On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us. - FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's/-lz//g'` - # 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64 - if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64; then - FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's?/lib?/lib/amd64?g'` - fi - # BDEPS_CHECK_MODULE will set FREETYPE_CFLAGS and _LIBS, but we don't get a lib path for bundling. - if test "x$BUNDLE_FREETYPE" = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype using pkg-config, but ignoring since we can not bundle that" >&5 + if test "x$FOUND_FREETYPE" = xyes; then + # On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us. + FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's/-lz//g'` + # 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64 + if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64; then + FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's?/lib?/lib/amd64?g'` + fi + # BDEPS_CHECK_MODULE will set FREETYPE_CFLAGS and _LIBS, but we don't get a lib path for bundling. + if test "x$BUNDLE_FREETYPE" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype using pkg-config, but ignoring since we can not bundle that" >&5 $as_echo "$as_me: Found freetype using pkg-config, but ignoring since we can not bundle that" >&6;} - FOUND_FREETYPE=no - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype" >&5 + FOUND_FREETYPE=no + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype" >&5 $as_echo_n "checking for freetype... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (using pkg-config)" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (using pkg-config)" >&5 $as_echo "yes (using pkg-config)" >&6; } + fi fi fi fi @@ -44578,12 +44661,7 @@ fi else - if test "x$SYS_ROOT" = "x/"; then - FREETYPE_ROOT= - else - FREETYPE_ROOT="$SYS_ROOT" - fi - FREETYPE_BASE_DIR="$FREETYPE_ROOT/usr" + FREETYPE_BASE_DIR="$SYSROOT/usr" POTENTIAL_FREETYPE_INCLUDE_PATH="$FREETYPE_BASE_DIR/include" POTENTIAL_FREETYPE_LIB_PATH="$FREETYPE_BASE_DIR/lib" @@ -44876,7 +44954,7 @@ if test "x$FOUND_FREETYPE" != xyes; then - FREETYPE_BASE_DIR="$FREETYPE_ROOT/usr/X11" + FREETYPE_BASE_DIR="$SYSROOT/usr/X11" POTENTIAL_FREETYPE_INCLUDE_PATH="$FREETYPE_BASE_DIR/include" POTENTIAL_FREETYPE_LIB_PATH="$FREETYPE_BASE_DIR/lib" @@ -45170,7 +45248,301 @@ fi if test "x$FOUND_FREETYPE" != xyes; then - FREETYPE_BASE_DIR="$FREETYPE_ROOT/usr" + FREETYPE_BASE_DIR="$SYSROOT/usr/sfw" + + POTENTIAL_FREETYPE_INCLUDE_PATH="$FREETYPE_BASE_DIR/include" + POTENTIAL_FREETYPE_LIB_PATH="$FREETYPE_BASE_DIR/lib" + METHOD="well-known location" + + # First check if the files exists. + if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then + # We found an arbitrary include file. That's a good sign. + { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&5 +$as_echo "$as_me: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&6;} + FOUND_FREETYPE=yes + + FREETYPE_LIB_NAME="${LIBRARY_PREFIX}freetype${SHARED_LIBRARY_SUFFIX}" + if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5 +$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&6;} + FOUND_FREETYPE=no + else + if test "x$OPENJDK_TARGET_OS" = xwindows; then + # On Windows, we will need both .lib and .dll file. + if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/freetype.lib"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&5 +$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;} + FOUND_FREETYPE=no + fi + elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then + # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess! + POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64" + fi + fi + fi + + if test "x$FOUND_FREETYPE" = xyes; 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="$POTENTIAL_FREETYPE_INCLUDE_PATH" + 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 POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_INCLUDE_PATH" "$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-stile (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 + POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;} + fi + + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + + path="$POTENTIAL_FREETYPE_INCLUDE_PATH" + 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 + POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH 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 posix platform. Hooray! :) + path="$POTENTIAL_FREETYPE_INCLUDE_PATH" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, 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 POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`" + fi + + + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + + # Input might be given as Windows format, start by converting to + # unix format. + path="$POTENTIAL_FREETYPE_LIB_PATH" + 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 POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_LIB_PATH" "$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-stile (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 + POTENTIAL_FREETYPE_LIB_PATH="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} + fi + + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + + path="$POTENTIAL_FREETYPE_LIB_PATH" + 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 + POTENTIAL_FREETYPE_LIB_PATH="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH 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 posix platform. Hooray! :) + path="$POTENTIAL_FREETYPE_LIB_PATH" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, 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 POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`" + fi + + + FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype includes" >&5 +$as_echo_n "checking for freetype includes... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_INCLUDE_PATH" >&5 +$as_echo "$FREETYPE_INCLUDE_PATH" >&6; } + FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype libraries" >&5 +$as_echo_n "checking for freetype libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_LIB_PATH" >&5 +$as_echo "$FREETYPE_LIB_PATH" >&6; } + fi + + fi + + if test "x$FOUND_FREETYPE" != xyes; then + FREETYPE_BASE_DIR="$SYSROOT/usr" if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then POTENTIAL_FREETYPE_INCLUDE_PATH="$FREETYPE_BASE_DIR/include" @@ -46646,7 +47018,9 @@ fi fi - if test "x$ALSA_FOUND" = xno; then + # Do not try pkg-config if we have a sysroot set. + if test "x$SYSROOT" = x; then + if test "x$ALSA_FOUND" = xno; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ALSA" >&5 @@ -46714,6 +47088,7 @@ $as_echo "yes" >&6; } ALSA_FOUND=yes fi + fi fi if test "x$ALSA_FOUND" = xno; then for ac_header in alsa/asoundlib.h @@ -47593,7 +47968,7 @@ # libCrun is the c++ runtime-library with SunStudio (roughly the equivalent of gcc's libstdc++.so) if test "x$TOOLCHAIN_TYPE" = xsolstudio && test "x$LIBCXX" = x; then - LIBCXX="/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1" + LIBCXX="${SYSROOT}/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1" fi # TODO better (platform agnostic) test @@ -48518,8 +48893,8 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } OLD_PATH="$PATH" - if test "x$TOOLS_DIR" != x; then - PATH=$TOOLS_DIR:$PATH + if test "x$TOOLCHAIN_PATH" != x; then + PATH=$TOOLCHAIN_PATH:$PATH fi @@ -50203,6 +50578,7 @@ printf "\n" printf "Configuration summary:\n" printf "* Debug level: $DEBUG_LEVEL\n" + printf "* HS debug level: $HOTSPOT_DEBUG_LEVEL\n" printf "* JDK variant: $JDK_VARIANT\n" printf "* JVM variants: $with_jvm_variants\n" printf "* OpenJDK target: OS: $OPENJDK_TARGET_OS, CPU architecture: $OPENJDK_TARGET_CPU_ARCH, address length: $OPENJDK_TARGET_CPU_BITS\n"
--- a/common/autoconf/help.m4 Wed Apr 16 09:46:49 2014 -0400 +++ b/common/autoconf/help.m4 Wed Apr 16 09:49:45 2014 -0400 @@ -200,6 +200,7 @@ printf "\n" printf "Configuration summary:\n" printf "* Debug level: $DEBUG_LEVEL\n" + printf "* HS debug level: $HOTSPOT_DEBUG_LEVEL\n" printf "* JDK variant: $JDK_VARIANT\n" printf "* JVM variants: $with_jvm_variants\n" printf "* OpenJDK target: OS: $OPENJDK_TARGET_OS, CPU architecture: $OPENJDK_TARGET_CPU_ARCH, address length: $OPENJDK_TARGET_CPU_BITS\n"
--- a/common/autoconf/jdk-options.m4 Wed Apr 16 09:46:49 2014 -0400 +++ b/common/autoconf/jdk-options.m4 Wed Apr 16 09:49:45 2014 -0400 @@ -176,6 +176,7 @@ # # Set the debug level # release: no debug information, all optimizations, no asserts. + # optimized: no debug information, all optimizations, no asserts, HotSpot target is 'optimized'. # fastdebug: debug information (-g), all optimizations, all asserts # slowdebug: debug information (-g), no optimizations, all asserts # @@ -189,7 +190,7 @@ ], [ENABLE_DEBUG="no"]) AC_ARG_WITH([debug-level], [AS_HELP_STRING([--with-debug-level], - [set the debug level (release, fastdebug, slowdebug) @<:@release@:>@])], + [set the debug level (release, fastdebug, slowdebug, optimized (HotSpot build only)) @<:@release@:>@])], [ DEBUG_LEVEL="${withval}" if test "x$ENABLE_DEBUG" = xyes; then @@ -199,6 +200,7 @@ AC_MSG_RESULT([$DEBUG_LEVEL]) if test "x$DEBUG_LEVEL" != xrelease && \ + test "x$DEBUG_LEVEL" != xoptimized && \ test "x$DEBUG_LEVEL" != xfastdebug && \ test "x$DEBUG_LEVEL" != xslowdebug; then AC_MSG_ERROR([Allowed debug levels are: release, fastdebug and slowdebug]) @@ -235,8 +237,30 @@ HOTSPOT_DEBUG_LEVEL="jvmg" HOTSPOT_EXPORT="debug" ;; + optimized ) + VARIANT="OPT" + FASTDEBUG="false" + DEBUG_CLASSFILES="false" + BUILD_VARIANT_RELEASE="-optimized" + HOTSPOT_DEBUG_LEVEL="optimized" + HOTSPOT_EXPORT="optimized" + ;; esac + # The debug level 'optimized' is a little special because it is currently only + # applicable to the HotSpot build where it means to build a completely + # optimized version of the VM without any debugging code (like for the + # 'release' debug level which is called 'product' in the HotSpot build) but + # with the exception that it can contain additional code which is otherwise + # protected by '#ifndef PRODUCT' macros. These 'optimized' builds are used to + # test new and/or experimental features which are not intended for customer + # shipment. Because these new features need to be tested and benchmarked in + # real world scenarios, we want to build the containing JDK at the 'release' + # debug level. + if test "x$DEBUG_LEVEL" = xoptimized; then + DEBUG_LEVEL="release" + fi + ##### # Generate the legacy makefile targets for hotspot. # The hotspot api for selecting the build artifacts, really, needs to be improved.
--- a/common/autoconf/libraries.m4 Wed Apr 16 09:46:49 2014 -0400 +++ b/common/autoconf/libraries.m4 Wed Apr 16 09:49:45 2014 -0400 @@ -110,21 +110,23 @@ # Check if the user has specified sysroot, but not --x-includes or --x-libraries. # Make a simple check for the libraries at the sysroot, and setup --x-includes and # --x-libraries for the sysroot, if that seems to be correct. - if test "x$SYS_ROOT" != "x/"; then - if test "x$x_includes" = xNONE; then - if test -f "$SYS_ROOT/usr/X11R6/include/X11/Xlib.h"; then - x_includes="$SYS_ROOT/usr/X11R6/include" - elif test -f "$SYS_ROOT/usr/include/X11/Xlib.h"; then - x_includes="$SYS_ROOT/usr/include" + if test "x$OPENJDK_TARGET_OS" = "xlinux"; then + if test "x$SYSROOT" != "x"; then + if test "x$x_includes" = xNONE; then + if test -f "$SYSROOT/usr/X11R6/include/X11/Xlib.h"; then + x_includes="$SYSROOT/usr/X11R6/include" + elif test -f "$SYSROOT/usr/include/X11/Xlib.h"; then + x_includes="$SYSROOT/usr/include" + fi fi - fi - if test "x$x_libraries" = xNONE; then - if test -f "$SYS_ROOT/usr/X11R6/lib/libX11.so"; then - x_libraries="$SYS_ROOT/usr/X11R6/lib" - elif test "$SYS_ROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then - x_libraries="$SYS_ROOT/usr/lib64" - elif test -f "$SYS_ROOT/usr/lib/libX11.so"; then - x_libraries="$SYS_ROOT/usr/lib" + if test "x$x_libraries" = xNONE; then + if test -f "$SYSROOT/usr/X11R6/lib/libX11.so"; then + x_libraries="$SYSROOT/usr/X11R6/lib" + elif test "$SYSROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then + x_libraries="$SYSROOT/usr/lib64" + elif test -f "$SYSROOT/usr/lib/libX11.so"; then + x_libraries="$SYSROOT/usr/lib" + fi fi fi fi @@ -146,9 +148,12 @@ if test "x$OPENJDK_TARGET_OS" = xsolaris; then OPENWIN_HOME="/usr/openwin" + X_CFLAGS="-I$SYSROOT$OPENWIN_HOME/include -I$SYSROOT$OPENWIN_HOME/include/X11/extensions" + X_LIBS="-L$SYSROOT$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \ + -L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \ + -R$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \ + -R$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR" fi - AC_SUBST(OPENWIN_HOME) - # # Weird Sol10 something check...TODO change to try compile @@ -237,14 +242,14 @@ # Getting nervous now? Lets poke around for standard Solaris third-party # package installation locations. AC_MSG_CHECKING([for cups headers]) - if test -s /opt/sfw/cups/include/cups/cups.h; then + if test -s $SYSROOT/opt/sfw/cups/include/cups/cups.h; then # An SFW package seems to be installed! CUPS_FOUND=yes - CUPS_CFLAGS="-I/opt/sfw/cups/include" - elif test -s /opt/csw/include/cups/cups.h; then + CUPS_CFLAGS="-I$SYSROOT/opt/sfw/cups/include" + elif test -s $SYSROOT/opt/csw/include/cups/cups.h; then # A CSW package seems to be installed! CUPS_FOUND=yes - CUPS_CFLAGS="-I/opt/csw/include" + CUPS_CFLAGS="-I$SYSROOT/opt/csw/include" fi AC_MSG_RESULT([$CUPS_FOUND]) fi @@ -398,24 +403,27 @@ fi fi - if test "x$FOUND_FREETYPE" != xyes; then - # Check modules using pkg-config, but only if we have it (ugly output results otherwise) - if test "x$PKG_CONFIG" != x; then - PKG_CHECK_MODULES(FREETYPE, freetype2, [FOUND_FREETYPE=yes], [FOUND_FREETYPE=no]) - if test "x$FOUND_FREETYPE" = xyes; then - # On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us. - FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's/-lz//g'` - # 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64 - if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64; then - FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's?/lib?/lib/amd64?g'` - fi - # BDEPS_CHECK_MODULE will set FREETYPE_CFLAGS and _LIBS, but we don't get a lib path for bundling. - if test "x$BUNDLE_FREETYPE" = xyes; then - AC_MSG_NOTICE([Found freetype using pkg-config, but ignoring since we can not bundle that]) - FOUND_FREETYPE=no - else - AC_MSG_CHECKING([for freetype]) - AC_MSG_RESULT([yes (using pkg-config)]) + # If we have a sysroot, assume that's where we are supposed to look and skip pkg-config. + if test "x$SYSROOT" = x; then + if test "x$FOUND_FREETYPE" != xyes; then + # Check modules using pkg-config, but only if we have it (ugly output results otherwise) + if test "x$PKG_CONFIG" != x; then + PKG_CHECK_MODULES(FREETYPE, freetype2, [FOUND_FREETYPE=yes], [FOUND_FREETYPE=no]) + if test "x$FOUND_FREETYPE" = xyes; then + # On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us. + FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's/-lz//g'` + # 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64 + if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64; then + FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's?/lib?/lib/amd64?g'` + fi + # BDEPS_CHECK_MODULE will set FREETYPE_CFLAGS and _LIBS, but we don't get a lib path for bundling. + if test "x$BUNDLE_FREETYPE" = xyes; then + AC_MSG_NOTICE([Found freetype using pkg-config, but ignoring since we can not bundle that]) + FOUND_FREETYPE=no + else + AC_MSG_CHECKING([for freetype]) + AC_MSG_RESULT([yes (using pkg-config)]) + fi fi fi fi @@ -433,21 +441,21 @@ LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location]) fi else - if test "x$SYS_ROOT" = "x/"; then - FREETYPE_ROOT= - else - FREETYPE_ROOT="$SYS_ROOT" - fi - FREETYPE_BASE_DIR="$FREETYPE_ROOT/usr" + FREETYPE_BASE_DIR="$SYSROOT/usr" LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location]) if test "x$FOUND_FREETYPE" != xyes; then - FREETYPE_BASE_DIR="$FREETYPE_ROOT/usr/X11" + FREETYPE_BASE_DIR="$SYSROOT/usr/X11" LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location]) fi if test "x$FOUND_FREETYPE" != xyes; then - FREETYPE_BASE_DIR="$FREETYPE_ROOT/usr" + FREETYPE_BASE_DIR="$SYSROOT/usr/sfw" + LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location]) + fi + + if test "x$FOUND_FREETYPE" != xyes; then + FREETYPE_BASE_DIR="$SYSROOT/usr" if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib/x86_64-linux-gnu], [well-known location]) else @@ -577,8 +585,11 @@ if test "x$ALSA_FOUND" = xno; then BDEPS_CHECK_MODULE(ALSA, alsa, xxx, [ALSA_FOUND=yes], [ALSA_FOUND=no]) fi - if test "x$ALSA_FOUND" = xno; then - PKG_CHECK_MODULES(ALSA, alsa, [ALSA_FOUND=yes], [ALSA_FOUND=no]) + # Do not try pkg-config if we have a sysroot set. + if test "x$SYSROOT" = x; then + if test "x$ALSA_FOUND" = xno; then + PKG_CHECK_MODULES(ALSA, alsa, [ALSA_FOUND=yes], [ALSA_FOUND=no]) + fi fi if test "x$ALSA_FOUND" = xno; then AC_CHECK_HEADERS([alsa/asoundlib.h], @@ -917,7 +928,7 @@ # libCrun is the c++ runtime-library with SunStudio (roughly the equivalent of gcc's libstdc++.so) if test "x$TOOLCHAIN_TYPE" = xsolstudio && test "x$LIBCXX" = x; then - LIBCXX="/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1" + LIBCXX="${SYSROOT}/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1" fi # TODO better (platform agnostic) test
--- a/common/autoconf/platform.m4 Wed Apr 16 09:46:49 2014 -0400 +++ b/common/autoconf/platform.m4 Wed Apr 16 09:49:45 2014 -0400 @@ -60,6 +60,12 @@ VAR_CPU_BITS=64 VAR_CPU_ENDIAN=big ;; + powerpc64le) + VAR_CPU=ppc64 + VAR_CPU_ARCH=ppc + VAR_CPU_BITS=64 + VAR_CPU_ENDIAN=little + ;; s390) VAR_CPU=s390 VAR_CPU_ARCH=s390
--- a/common/autoconf/spec.gmk.in Wed Apr 16 09:46:49 2014 -0400 +++ b/common/autoconf/spec.gmk.in Wed Apr 16 09:49:45 2014 -0400 @@ -130,10 +130,8 @@ export LIB:=@VS_LIB@ endif -# The sys root where standard headers and libraries are found. -# Usually not needed since the configure script should have -# taken it into account already when setting CFLAGS et al. -SYS_ROOT:=@SYS_ROOT@ +SYSROOT_CFLAGS := @SYSROOT_CFLAGS@ +SYSROOT_LDFLAGS := @SYSROOT_LDFLAGS@ # Paths to the source code ADD_SRC_ROOT:=@ADD_SRC_ROOT@ @@ -294,7 +292,6 @@ # Necessary additional compiler flags to compile X11 X_CFLAGS:=@X_CFLAGS@ X_LIBS:=@X_LIBS@ -OPENWIN_HOME:=@OPENWIN_HOME@ # The lowest required version of macosx to enforce compatiblity for MACOSX_VERSION_MIN=@MACOSX_VERSION_MIN@ @@ -324,6 +321,8 @@ C_FLAG_DEPS:=@C_FLAG_DEPS@ CXX_FLAG_DEPS:=@CXX_FLAG_DEPS@ +CFLAGS_WARNINGS_ARE_ERRORS:=@CFLAGS_WARNINGS_ARE_ERRORS@ + # Tools that potentially need to be cross compilation aware. CC:=@FIXPATH@ @CCACHE@ @CC@
--- a/common/autoconf/toolchain.m4 Wed Apr 16 09:46:49 2014 -0400 +++ b/common/autoconf/toolchain.m4 Wed Apr 16 09:49:45 2014 -0400 @@ -189,6 +189,12 @@ # it for DLL resolution in runtime. if test "x$OPENJDK_BUILD_OS" = "xwindows" && test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV + # Reset path to VS_PATH. It will include everything that was on PATH at the time we + # ran TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV. + PATH="$VS_PATH" + # The microsoft toolchain also requires INCLUDE and LIB to be set. + export INCLUDE="$VS_INCLUDE" + export LIB="$VS_LIB" fi # autoconf magic only relies on PATH, so update it if tools dir is specified @@ -202,29 +208,11 @@ PATH="/usr/ccs/bin:$PATH" fi - # Finally add TOOLS_DIR at the beginning, to allow --with-tools-dir to + # Finally add TOOLCHAIN_PATH at the beginning, to allow --with-tools-dir to # override all other locations. - if test "x$TOOLS_DIR" != x; then - PATH=$TOOLS_DIR:$PATH + if test "x$TOOLCHAIN_PATH" != x; then + PATH=$TOOLCHAIN_PATH:$PATH fi - - # If a devkit is found on the builddeps server, then prepend its path to the - # PATH variable. If there are cross compilers available in the devkit, these - # will be found by AC_PROG_CC et al. - DEVKIT= - BDEPS_CHECK_MODULE(DEVKIT, devkit, xxx, - [ - # Found devkit - PATH="$DEVKIT/bin:$PATH" - SYS_ROOT="$DEVKIT/${rewritten_target}/sys-root" - if test "x$x_includes" = "xNONE"; then - x_includes="$SYS_ROOT/usr/include/X11" - fi - if test "x$x_libraries" = "xNONE"; then - x_libraries="$SYS_ROOT/usr/lib" - fi - ], - []) ]) # Restore path, etc @@ -396,15 +384,15 @@ # used. $1= - # If TOOLS_DIR is set, check for all compiler names in there first + # If TOOLCHAIN_PATH is set, check for all compiler names in there first # before checking the rest of the PATH. # FIXME: Now that we prefix the TOOLS_DIR to the PATH in the PRE_DETECTION # step, this should not be necessary. - if test -n "$TOOLS_DIR"; then + if test -n "$TOOLCHAIN_PATH"; then PATH_save="$PATH" - PATH="$TOOLS_DIR" - AC_PATH_PROGS(TOOLS_DIR_$1, $SEARCH_LIST) - $1=$TOOLS_DIR_$1 + PATH="$TOOLCHAIN_PATH" + AC_PATH_PROGS(TOOLCHAIN_PATH_$1, $SEARCH_LIST) + $1=$TOOLCHAIN_PATH_$1 PATH="$PATH_save" fi
--- a/common/autoconf/toolchain_windows.m4 Wed Apr 16 09:46:49 2014 -0400 +++ b/common/autoconf/toolchain_windows.m4 Wed Apr 16 09:49:45 2014 -0400 @@ -141,46 +141,44 @@ # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat AC_MSG_NOTICE([Trying to extract Visual Studio environment variables]) - cd $OUTPUT_ROOT - # FIXME: The code betweeen ---- was inlined from a separate script and is not properly adapted - # to autoconf standards. + + # We need to create a couple of temporary files. + VS_ENV_TMP_DIR="$OUTPUT_ROOT/vs-env" + $MKDIR -p $VS_ENV_TMP_DIR - #---- - - # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment) - # but calculate the difference in Cygwin environment before/after running it and then - # apply the diff. + # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment). + # Instead create a shell script which will set the relevant variables when run. + WINPATH_VS_ENV_CMD="$VS_ENV_CMD" + BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_VS_ENV_CMD]) + WINPATH_BASH="$BASH" + BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_BASH]) - if test "x$OPENJDK_BUILD_OS_ENV" = xwindows.cygwin; then - _vs10varsall=`cygpath -a -m -s "$VS_ENV_CMD"` - _dosvs10varsall=`cygpath -a -w -s $_vs10varsall` - _dosbash=`cygpath -a -w -s \`which bash\`.*` - else - _dosvs10varsall=`cmd //c echo $VS_ENV_CMD` - _dosbash=`cmd //c echo \`which bash\`` - fi - - # generate the set of exported vars before/after the vs10 setup - $ECHO "@echo off" > localdevenvtmp.bat - $ECHO "$_dosbash -c \"export -p\" > localdevenvtmp.export0" >> localdevenvtmp.bat - $ECHO "call $_dosvs10varsall $VS_ENV_ARGS" >> localdevenvtmp.bat - $ECHO "$_dosbash -c \"export -p\" > localdevenvtmp.export1" >> localdevenvtmp.bat + # Generate a DOS batch file which runs $VS_ENV_CMD, and then creates a shell + # script (executable by bash) that will setup the important variables. + EXTRACT_VC_ENV_BAT_FILE="$VS_ENV_TMP_DIR/extract-vs-env.bat" + $ECHO "@echo off" > $EXTRACT_VC_ENV_BAT_FILE + # This will end up something like: + # call C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat + $ECHO "call $WINPATH_VS_ENV_CMD $VS_ENV_ARGS" >> $EXTRACT_VC_ENV_BAT_FILE + # These will end up something like: + # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh + # The trailing space for everyone except PATH is no typo, but is needed due + # to trailing \ in the Windows paths. These will be stripped later. + $ECHO "$WINPATH_BASH -c 'echo VS_PATH="'\"$PATH\" > set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE + $ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE + $ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE + $ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE + $ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE + $ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE # Now execute the newly created bat file. - # The | cat is to stop SetEnv.Cmd to mess with system colors on msys - cmd /c localdevenvtmp.bat | cat + # The | cat is to stop SetEnv.Cmd to mess with system colors on msys. + # Change directory so we don't need to mess with Windows paths in redirects. + cd $VS_ENV_TMP_DIR + cmd /c extract-vs-env.bat | $CAT + cd $CURDIR - # apply the diff (less some non-vs10 vars named by "!") - $SORT localdevenvtmp.export0 | $GREP -v "!" > localdevenvtmp.export0.sort - $SORT localdevenvtmp.export1 | $GREP -v "!" > localdevenvtmp.export1.sort - $COMM -1 -3 localdevenvtmp.export0.sort localdevenvtmp.export1.sort > localdevenv.sh - - # cleanup - $RM localdevenvtmp* - #---- - cd $CURDIR - if test ! -s $OUTPUT_ROOT/localdevenv.sh; then - AC_MSG_RESULT([no]) + if test ! -s $VS_ENV_TMP_DIR/set-vs-env.sh; then AC_MSG_NOTICE([Could not succesfully extract the envionment variables needed for the VS setup.]) AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation]) AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.]) @@ -190,30 +188,36 @@ # Now set all paths and other env variables. This will allow the rest of # the configure script to find and run the compiler in the proper way. AC_MSG_NOTICE([Setting extracted environment variables]) - . $OUTPUT_ROOT/localdevenv.sh + . $VS_ENV_TMP_DIR/set-vs-env.sh + # Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we + # also define VCINSTALLDIR, WindowsSdkDir and WINDOWSSDKDIR. else # We did not find a vsvars bat file, let's hope we are run from a VS command prompt. AC_MSG_NOTICE([Cannot locate a valid Visual Studio installation, checking current environment]) fi - # At this point, we should have corrent variables in the environment, or we can't continue. + # At this point, we should have correct variables in the environment, or we can't continue. AC_MSG_CHECKING([for Visual Studio variables]) if test "x$VCINSTALLDIR" != x || test "x$WindowsSDKDir" != x || test "x$WINDOWSSDKDIR" != x; then - if test "x$INCLUDE" = x || test "x$LIB" = x; then + if test "x$VS_INCLUDE" = x || test "x$VS_LIB" = x; then AC_MSG_RESULT([present but broken]) AC_MSG_ERROR([Your VC command prompt seems broken, INCLUDE and/or LIB is missing.]) else AC_MSG_RESULT([ok]) - # Remove any trailing \ from INCLUDE and LIB to avoid trouble in spec.gmk. - VS_INCLUDE=`$ECHO "$INCLUDE" | $SED 's/\\\\$//'` - VS_LIB=`$ECHO "$LIB" | $SED 's/\\\\$//'` - # Remove any paths containing # (typically F#) as that messes up make - PATH=`$ECHO "$PATH" | $SED 's/[[^:#]]*#[^:]*://g'` - VS_PATH="$PATH" + # Remove any trailing "\" and " " from the variables. + VS_INCLUDE=`$ECHO "$VS_INCLUDE" | $SED 's/\\\\* *$//'` + VS_LIB=`$ECHO "$VS_LIB" | $SED 's/\\\\* *$//'` + VCINSTALLDIR=`$ECHO "$VCINSTALLDIR" | $SED 's/\\\\* *$//'` + WindowsSDKDir=`$ECHO "$WindowsSDKDir" | $SED 's/\\\\* *$//'` + WINDOWSSDKDIR=`$ECHO "$WINDOWSSDKDIR" | $SED 's/\\\\* *$//'` + # Remove any paths containing # (typically F#) as that messes up make. This + # is needed if visual studio was installed with F# support. + VS_PATH=`$ECHO "$VS_PATH" | $SED 's/[[^:#]]*#[^:]*://g'` + + AC_SUBST(VS_PATH) AC_SUBST(VS_INCLUDE) AC_SUBST(VS_LIB) - AC_SUBST(VS_PATH) fi else AC_MSG_RESULT([not found])
--- a/common/bin/compare.sh Wed Apr 16 09:46:49 2014 -0400 +++ b/common/bin/compare.sh Wed Apr 16 09:49:45 2014 -0400 @@ -114,7 +114,7 @@ fi if test "x$SUFFIX" = "xproperties"; then # Run through nawk to add possibly missing newline at end of file. - $CAT $OTHER_FILE | $NAWK '{ print }' > $OTHER_FILE.cleaned + $CAT $OTHER_FILE | $NAWK '{ print }' | LC_ALL=C $SORT > $OTHER_FILE.cleaned # Disable this exception since we aren't changing the properties cleaning method yet. # $CAT $OTHER_FILE | $SED -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \ # | $SED -f "$SRC_ROOT/common/makefiles/support/unicode2x.sed" \
--- a/common/bin/hgforest.sh Wed Apr 16 09:46:49 2014 -0400 +++ b/common/bin/hgforest.sh Wed Apr 16 09:49:45 2014 -0400 @@ -24,12 +24,58 @@ # # Shell script for a fast parallel forest command -command="$1" -pull_extra_base="$2" + +global_opts="" +status_output="/dev/stdout" +qflag="false" +vflag="false" +sflag="false" +while [ $# -gt 0 ] +do + case $1 in + -q | --quiet ) + qflag="true" + global_opts="${global_opts} -q" + status_output="/dev/null" + ;; + + -v | --verbose ) + vflag="true" + global_opts="${global_opts} -v" + ;; + + -s | --sequential ) + sflag="true" + ;; -if [ "" = "$command" ] ; then - echo No command to hg supplied! - exit 1 + '--' ) # no more options + shift; break + ;; + + -*) # bad option + usage + ;; + + * ) # non option + break + ;; + esac + shift +done + + +command="$1"; shift +command_args="$@" + +usage() { + echo "usage: $0 [-q|--quiet] [-v|--verbose] [-s|--sequential] [--] <command> [commands...]" > ${status_output} + exit 1 +} + + +if [ "x" = "x$command" ] ; then + echo "ERROR: No command to hg supplied!" + usage fi # Clean out the temporary directory that stores the pid files. @@ -40,17 +86,17 @@ safe_interrupt () { if [ -d ${tmp} ]; then if [ "`ls ${tmp}/*.pid`" != "" ]; then - echo "Waiting for processes ( `cat ${tmp}/*.pid | tr '\n' ' '`) to terminate nicely!" + echo "Waiting for processes ( `cat ${tmp}/*.pid | tr '\n' ' '`) to terminate nicely!" > ${status_output} sleep 1 # Pipe stderr to dev/null to silence kill, that complains when trying to kill # a subprocess that has already exited. kill -TERM `cat ${tmp}/*.pid | tr '\n' ' '` 2> /dev/null wait - echo Interrupt complete! + echo "Interrupt complete!" > ${status_output} fi + rm -f -r ${tmp} fi - rm -f -r ${tmp} - exit 1 + exit 130 } nice_exit () { @@ -58,39 +104,44 @@ if [ "`ls ${tmp}`" != "" ]; then wait fi + rm -f -r ${tmp} fi - rm -f -r ${tmp} } trap 'safe_interrupt' INT QUIT trap 'nice_exit' EXIT +subrepos="corba jaxp jaxws langtools jdk hotspot nashorn" +subrepos_extra="closed jdk/src/closed jdk/make/closed jdk/test/closed hotspot/make/closed hotspot/src/closed hotspot/test/closed deploy install sponsors pubs" + # Only look in specific locations for possible forests (avoids long searches) pull_default="" repos="" repos_extra="" -if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then - subrepos="corba jaxp jaxws langtools jdk hotspot nashorn" - if [ -f .hg/hgrc ] ; then - pull_default=`hg paths default` - if [ "${pull_default}" = "" ] ; then - echo "ERROR: Need initial clone with 'hg paths default' defined" - exit 1 - fi - fi - if [ "${pull_default}" = "" ] ; then - echo "ERROR: Need initial repository to use this script" +if [ "${command}" = "clone" -o "${command}" = "fclone" -o "${command}" = "tclone" ] ; then + if [ ! -f .hg/hgrc ] ; then + echo "ERROR: Need initial repository to use this script" > ${status_output} exit 1 fi + + pull_default=`hg paths default` + if [ "${pull_default}" = "" ] ; then + echo "ERROR: Need initial clone with 'hg paths default' defined" > ${status_output} + exit 1 + fi + for i in ${subrepos} ; do if [ ! -f ${i}/.hg/hgrc ] ; then repos="${repos} ${i}" fi done - if [ "${pull_extra_base}" != "" ] ; then - subrepos_extra="closed jdk/src/closed jdk/make/closed jdk/test/closed hotspot/make/closed hotspot/src/closed hotspot/test/closed deploy install sponsors pubs" + if [ "${command_args}" != "" ] ; then pull_default_tail=`echo ${pull_default} | sed -e 's@^.*://[^/]*/\(.*\)@\1@'` - pull_extra="${pull_extra_base}/${pull_default_tail}" + if [ "x${pull_default}" = "x${pull_default_tail}" ] ; then + echo "ERROR: Need initial clone from non-local source" > ${status_output} + exit 1 + fi + pull_extra="${command_args}/${pull_default_tail}" for i in ${subrepos_extra} ; do if [ ! -f ${i}/.hg/hgrc ] ; then repos_extra="${repos_extra} ${i}" @@ -100,78 +151,115 @@ at_a_time=2 # Any repos to deal with? if [ "${repos}" = "" -a "${repos_extra}" = "" ] ; then + echo "No repositories to process." > ${status_output} exit fi else - hgdirs=`ls -d ./.hg ./*/.hg ./*/*/.hg ./*/*/*/.hg ./*/*/*/*/.hg 2>/dev/null` - # Derive repository names from the .hg directory locations - for i in ${hgdirs} ; do - repos="${repos} `echo ${i} | sed -e 's@/.hg$@@'`" + for i in . ${subrepos} ${subrepos_extra} ; do + if [ -d ${i}/.hg ] ; then + repos="${repos} ${i}" + fi done + + # Any repos to deal with? + if [ "${repos}" = "" ] ; then + echo "No repositories to process." > ${status_output} + exit + fi + + # any of the repos locked? for i in ${repos} ; do if [ -h ${i}/.hg/store/lock -o -f ${i}/.hg/store/lock ] ; then locked="${i} ${locked}" fi done + if [ "${locked}" != "" ] ; then + echo "ERROR: These repositories are locked: ${locked}" > ${status_output} + exit 1 + fi at_a_time=8 - # Any repos to deal with? - if [ "${repos}" = "" ] ; then - echo "No repositories to process." - exit - fi - if [ "${locked}" != "" ] ; then - echo "These repositories are locked: ${locked}" - exit - fi fi # Echo out what repositories we do a command on. -echo "# Repositories: ${repos} ${repos_extra}" -echo +echo "# Repositories: ${repos} ${repos_extra}" > ${status_output} + +if [ "${command}" = "serve" ] ; then + # "serve" is run for all the repos. + ( + ( + ( + echo "[web]" + echo "description = $(basename $(pwd))" + echo "allow_push = *" + echo "push_ssl = False" -# Run the supplied command on all repos in parallel. -n=0 -for i in ${repos} ${repos_extra} ; do - n=`expr ${n} '+' 1` - repopidfile=`echo ${i} | sed -e 's@./@@' -e 's@/@_@g'` - reponame=`echo ${i} | sed -e :a -e 's/^.\{1,20\}$/ &/;ta'` - pull_base="${pull_default}" - for j in $repos_extra ; do + echo "[paths]" + for i in ${repos} ${repos_extra} ; do + if [ "${i}" != "." ] ; then + echo "/$(basename $(pwd))/${i} = ${i}" + else + echo "/$(basename $(pwd)) = $(pwd)" + fi + done + ) > ${tmp}/serve.web-conf + + echo "serving root repo $(basename $(pwd))" + + (PYTHONUNBUFFERED=true hg${global_opts} serve -A ${status_output} -E ${status_output} --pid-file ${tmp}/serve.pid --web-conf ${tmp}/serve.web-conf; echo "$?" > ${tmp}/serve.pid.rc ) 2>&1 & + ) 2>&1 | sed -e "s@^@serve: @" > ${status_output} + ) & +else + # Run the supplied command on all repos in parallel. + n=0 + for i in ${repos} ${repos_extra} ; do + n=`expr ${n} '+' 1` + repopidfile=`echo ${i} | sed -e 's@./@@' -e 's@/@_@g'` + reponame=`echo ${i} | sed -e :a -e 's/^.\{1,20\}$/ &/;ta'` + pull_base="${pull_default}" + for j in $repos_extra ; do if [ "$i" = "$j" ] ; then pull_base="${pull_extra}" fi - done - ( + done ( - if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then - pull_newrepo="`echo ${pull_base}/${i} | sed -e 's@\([^:]/\)//*@\1@g'`" - echo hg clone ${pull_newrepo} ${i} - path="`dirname ${i}`" - if [ "${path}" != "." ] ; then - times=0 - while [ ! -d "${path}" ] ## nested repo, ensure containing dir exists - do - times=`expr ${times} '+' 1` - if [ `expr ${times} '%' 10` -eq 0 ] ; then - echo ${path} still not created, waiting... - fi - sleep 5 - done + ( + if [ "${command}" = "clone" -o "${command}" = "fclone" -o "${command}" = "tclone" ] ; then + pull_newrepo="`echo ${pull_base}/${i} | sed -e 's@\([^:]/\)//*@\1@g'`" + path="`dirname ${i}`" + if [ "${path}" != "." ] ; then + times=0 + while [ ! -d "${path}" ] ## nested repo, ensure containing dir exists + do + times=`expr ${times} '+' 1` + if [ `expr ${times} '%' 10` -eq 0 ] ; then + echo "${path} still not created, waiting..." > ${status_output} + fi + sleep 5 + done + fi + echo "hg clone ${pull_newrepo} ${i}" > ${status_output} + (PYTHONUNBUFFERED=true hg${global_opts} clone ${pull_newrepo} ${i}; echo "$?" > ${tmp}/${repopidfile}.pid.rc ) 2>&1 & + else + echo "cd ${i} && hg${global_opts} ${command} ${command_args}" > ${status_output} + cd ${i} && (PYTHONUNBUFFERED=true hg${global_opts} ${command} ${command_args}; echo "$?" > ${tmp}/${repopidfile}.pid.rc ) 2>&1 & fi - (PYTHONUNBUFFERED=true hg clone ${pull_newrepo} ${i}; echo "$?" > ${tmp}/${repopidfile}.pid.rc )& - else - echo "cd ${i} && hg $*" - cd ${i} && (PYTHONUNBUFFERED=true hg "$@"; echo "$?" > ${tmp}/${repopidfile}.pid.rc )& - fi - echo $! > ${tmp}/${repopidfile}.pid - ) 2>&1 | sed -e "s@^@${reponame}: @") & + + echo $! > ${tmp}/${repopidfile}.pid + ) 2>&1 | sed -e "s@^@${reponame}: @" > ${status_output} + ) & - if [ `expr ${n} '%' ${at_a_time}` -eq 0 ] ; then - sleep 2 - echo Waiting 5 secs before spawning next background command. - sleep 3 - fi -done + if [ `expr ${n} '%' ${at_a_time}` -eq 0 -a "${sflag}" = "false" ] ; then + sleep 2 + echo "Waiting 5 secs before spawning next background command." > ${status_output} + sleep 3 + fi + + if [ "${sflag}" = "true" ] ; then + wait + fi + done +fi + # Wait for all hg commands to complete wait @@ -181,7 +269,8 @@ for rc in ${tmp}/*.pid.rc ; do exit_code=`cat ${rc} | tr -d ' \n\r'` if [ "${exit_code}" != "0" ] ; then - echo "WARNING: ${rc} exited abnormally." + repo="`echo ${rc} | sed -e s@^${tmp}@@ -e 's@/*\([^/]*\)\.pid\.rc$@\1@' -e 's@_@/@g'`" + echo "WARNING: ${repo} exited abnormally." > ${status_output} ec=1 fi done
--- a/common/src/fixpath.c Wed Apr 16 09:46:49 2014 -0400 +++ b/common/src/fixpath.c Wed Apr 16 09:49:45 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -29,7 +29,7 @@ #include <string.h> #include <malloc.h> -void report_error() +void report_error(char const * msg) { LPVOID lpMsgBuf; DWORD dw = GetLastError(); @@ -46,8 +46,8 @@ NULL); fprintf(stderr, - "Could not start process! Failed with error %d: %s\n", - dw, lpMsgBuf); + "%s Failed with error %d: %s\n", + msg, dw, lpMsgBuf); LocalFree(lpMsgBuf); } @@ -56,7 +56,7 @@ * Test if pos points to /cygdrive/_/ where _ can * be any character. */ -int is_cygdrive_here(int pos, char *in, int len) +int is_cygdrive_here(int pos, char const *in, int len) { // Length of /cygdrive/c/ is 12 if (pos+12 > len) return 0; @@ -81,16 +81,17 @@ * Works in place since drive letter is always * shorter than /cygdrive/ */ -char *replace_cygdrive_cygwin(char *in) +char *replace_cygdrive_cygwin(char const *in) { - int len = strlen(in); - char *out = malloc(len+1); + size_t len = strlen(in); + char *out = (char*) malloc(len+1); int i,j; if (len < 12) { - strcpy(out, in); + memmove(out, in, len + 1); return out; } + for (i = 0, j = 0; i<len;) { if (is_cygdrive_here(i, in, len)) { out[j++] = in[i+10]; @@ -102,7 +103,7 @@ j++; } } - out[j] = 0; + out[j] = '\0'; return out; } @@ -110,7 +111,7 @@ { while ( (addlen+*u+1) > *bl) { *bl *= 2; - *b = realloc(*b, *bl); + *b = (char*) realloc(*b, *bl); } memcpy(*b+*u, add, addlen); *u += addlen; @@ -125,7 +126,7 @@ int in_len = strlen(in); int sub_len = strlen(sub); int rep_len = strlen(rep); - char *out = malloc(in_len - sub_len + rep_len + 1); + char *out = (char *) malloc(in_len - sub_len + rep_len + 1); char *p; if (!(p = strstr(in, sub))) { @@ -145,7 +146,7 @@ char* msys_path_list; // @-separated list of paths prefix to look for char* msys_path_list_end; // Points to last \0 in msys_path_list. -void setup_msys_path_list(char* argument) +void setup_msys_path_list(char const * argument) { char* p; char* drive_letter_pos; @@ -173,7 +174,7 @@ } while (p != NULL); } -char *replace_cygdrive_msys(char *in) +char *replace_cygdrive_msys(char const *in) { char* str; char* prefix; @@ -195,12 +196,12 @@ return str; } -char*(*replace_cygdrive)(char *in) = NULL; +char*(*replace_cygdrive)(char const *in) = NULL; char *files_to_delete[1024]; int num_files_to_delete = 0; -char *fix_at_file(char *in) +char *fix_at_file(char const *in) { char *tmpdir; char name[2048]; @@ -222,9 +223,13 @@ exit(-1); } - tmpdir = getenv("TMP"); + tmpdir = getenv("TEMP"); if (tmpdir == NULL) { +#if _WIN64 + tmpdir = "c:/cygwin64/tmp"; +#else tmpdir = "c:/cygwin/tmp"; +#endif } _snprintf(name, sizeof(name), "%s\\atfile_XXXXXX", tmpdir); @@ -240,7 +245,7 @@ exit(-1); } - buffer = malloc(buflen); + buffer = (char*) malloc(buflen); while((blocklen = fread(block,1,sizeof(block),atin)) > 0) { append(&buffer, &buflen, &used, block, blocklen); } @@ -257,84 +262,229 @@ fclose(atout); free(fixed); free(buffer); - files_to_delete[num_files_to_delete] = malloc(strlen(name)+1); + files_to_delete[num_files_to_delete] = (char*) malloc(strlen(name)+1); strcpy(files_to_delete[num_files_to_delete], name); num_files_to_delete++; - atname = malloc(strlen(name)+2); + atname = (char*) malloc(strlen(name)+2); atname[0] = '@'; strcpy(atname+1, name); return atname; } -int main(int argc, char **argv) +// given an argument, convert it to the windows command line safe quoted version +// using rules from: +// http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/everyone-quotes-arguments-the-wrong-way.aspx +// caller is responsible for freeing both input and output. +char * quote_arg(char const * in_arg) { + char *quoted = NULL; + char *current = quoted; + int pass; + + if(strpbrk(in_arg, " \t\n\v\r\\\"") == NULL) { + return _strdup(in_arg); + } + + // process the arg twice. Once to calculate the size and then to copy it. + for(pass=1; pass<=2; pass++) { + char const *arg = in_arg; + + // initial " + if(pass == 2) { + *current = '\"'; + } + current++; + + // process string to be quoted until NUL + do { + int escapes = 0; + + while (*arg == '\\') { + // count escapes. + escapes++; + arg++; + } + + if (*arg == '\0') { + // escape the escapes before final " + escapes *= 2; + } else if (*arg == '"') { + // escape the escapes and the " + escapes = escapes * 2 + 1; + } else { + // escapes aren't special, just echo them. + } + + // emit some escapes + while (escapes > 0) { + if (pass == 2) { + *current = '\\'; + } + current++; + escapes--; + } + + // and the current char + if (pass == 2) { + *current = *arg; + } + current++; + } while( *arg++ != '\0'); + + // allocate the buffer + if (pass == 1) { + size_t alloc = (size_t) (current - quoted + (ptrdiff_t) 2); + current = quoted = (char*) calloc(alloc, sizeof(char)); + } + } + + // final " and \0 + *(current - 1) = '"'; + *current = '\0'; + + return quoted; +} + +int main(int argc, char const ** argv) { STARTUPINFO si; PROCESS_INFORMATION pi; unsigned short rc; - char *new_at_file; - char *old_at_file; char *line; - int i; + char *current; + int i, cmd; DWORD exitCode; - if (argc<3 || argv[1][0] != '-' || (argv[1][1] != 'c' && argv[1][1] != 'm')) { - fprintf(stderr, "Usage: fixpath -c|m<path@path@...> /cygdrive/c/WINDOWS/notepad.exe /cygdrive/c/x/test.txt\n"); + if (argc<2 || argv[1][0] != '-' || (argv[1][1] != 'c' && argv[1][1] != 'm')) { + fprintf(stderr, "Usage: fixpath -c|m<path@path@...> /cygdrive/c/WINDOWS/notepad.exe [/cygdrive/c/x/test.txt|@/cygdrive/c/x/atfile]\n"); exit(0); } if (getenv("DEBUG_FIXPATH") != NULL) { - fprintf(stderr, "fixpath input line >%s<\n", strstr(GetCommandLine(), argv[1])); + char const * cmdline = GetCommandLine(); + fprintf(stderr, "fixpath input line >%s<\n", strstr( cmdline , argv[1])); } if (argv[1][1] == 'c' && argv[1][2] == '\0') { if (getenv("DEBUG_FIXPATH") != NULL) { - fprintf(stderr, "using cygwin mode\n"); + fprintf(stderr, "fixpath using cygwin mode\n"); } replace_cygdrive = replace_cygdrive_cygwin; } else if (argv[1][1] == 'm') { if (getenv("DEBUG_FIXPATH") != NULL) { - fprintf(stderr, "using msys mode, with path list: %s\n", &argv[1][2]); + fprintf(stderr, "fixpath using msys mode, with path list: %s\n", &argv[1][2]); } setup_msys_path_list(argv[1]); replace_cygdrive = replace_cygdrive_msys; } else { - fprintf(stderr, "Unknown mode: %s\n", argv[1]); + fprintf(stderr, "fixpath Unknown mode: %s\n", argv[1]); exit(-1); } - line = replace_cygdrive(strstr(GetCommandLine(), argv[2])); + + i = 2; + + // handle assignments + while (i < argc) { + char const * assignment = strchr(argv[i], '='); + if (assignment != NULL && assignment != argv[i]) { + size_t var_len = (size_t) (assignment - argv[i] + (ptrdiff_t) 1); + char *var = (char *) calloc(var_len, sizeof(char)); + char *val = replace_cygdrive(assignment + 1); + memmove(var, argv[i], var_len); + var[var_len - 1] = '\0'; + strupr(var); + + if (getenv("DEBUG_FIXPATH") != NULL) { + fprintf(stderr, "fixpath setting var >%s< to >%s<\n", var, val); + } + + rc = SetEnvironmentVariable(var, val); + if(!rc) { + // Could not set var for some reason. Try to report why. + const int msg_len = 80 + var_len + strlen(val); + char * msg = (char *) alloca(msg_len); + _snprintf_s(msg, msg_len, _TRUNCATE, "Could not set environment variable [%s=%s]", var, val); + report_error(msg); + exit(1); + } + free(var); + free(val); + } else { + // no more assignments; + break; + } + i++; + } - for (i=1; i<argc; ++i) { - if (argv[i][0] == '@') { - // Found at-file! Fix it! - old_at_file = replace_cygdrive(argv[i]); - new_at_file = fix_at_file(old_at_file); - line = replace_substring(line, old_at_file, new_at_file); - } + // remember index of the command + cmd = i; + + // handle command and it's args. + while (i < argc) { + char const *replaced = replace_cygdrive(argv[i]); + if(replaced[0] == '@') { + // Found at-file! Fix it! + replaced = fix_at_file(replaced); + } + argv[i] = quote_arg(replaced); + i++; } + // determine the length of the line + line = NULL; + // args + for(i = cmd; i < argc; i++) { + line += (ptrdiff_t) strlen(argv[i]); + } + // spaces and null + line += (ptrdiff_t) (argc - cmd + 1); + // allocate + line = (char*) calloc(line - (char*) NULL, sizeof(char)); + + // copy in args. + current = line; + for(i = cmd; i < argc; i++) { + ptrdiff_t len = strlen(argv[i]); + if (i != cmd) { + *current++ = ' '; + } + memmove(current, argv[i], len); + current += len; + } + *current = '\0'; + if (getenv("DEBUG_FIXPATH") != NULL) { fprintf(stderr, "fixpath converted line >%s<\n", line); } + if(cmd == argc) { + if (getenv("DEBUG_FIXPATH") != NULL) { + fprintf(stderr, "fixpath no command provided!\n"); + } + exit(0); + } + ZeroMemory(&si,sizeof(si)); si.cb=sizeof(si); ZeroMemory(&pi,sizeof(pi)); + fflush(stderr); + fflush(stdout); + rc = CreateProcess(NULL, line, 0, 0, TRUE, 0, - 0, - 0, + NULL, + NULL, &si, &pi); if(!rc) { // Could not start process for some reason. Try to report why: - report_error(); - exit(rc); + report_error("Could not start process!"); + exit(126); } WaitForSingleObject(pi.hProcess,INFINITE); @@ -342,15 +492,21 @@ if (getenv("DEBUG_FIXPATH") != NULL) { for (i=0; i<num_files_to_delete; ++i) { - fprintf(stderr, "Not deleting temporary fixpath file %s\n", + fprintf(stderr, "fixpath Not deleting temporary file %s\n", files_to_delete[i]); } - } - else { + } else { for (i=0; i<num_files_to_delete; ++i) { remove(files_to_delete[i]); } } + if (exitCode != 0) { + if (getenv("DEBUG_FIXPATH") != NULL) { + fprintf(stderr, "fixpath exit code %d\n", + exitCode); + } + } + exit(exitCode); }
--- a/corba/.hgtags Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/.hgtags Wed Apr 16 09:49:45 2014 -0400 @@ -249,3 +249,4 @@ 1ed19de263e1e0772da0269118cdd9deeb9fff04 jdk9-b04 167c39eb44731a5d66770d0f00e231164653a2ff jdk9-b05 a4bf701ac316946c2e5e83138ad8e687da6a4b30 jdk9-b06 +6c8563600a71394c949405189ddd66267a88d8cd jdk9-b07
--- a/corba/src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelAcceptorImpl.java Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelAcceptorImpl.java Wed Apr 16 09:49:45 2014 -0400 @@ -253,6 +253,13 @@ // registered with the selector. Otherwise if the bytes // are read on the connection it will attempt a time stamp // but the cache will be null, resulting in NPE. + + // A connection needs to be timestamped before putting to the cache. + // Otherwise the newly created connection (with 0 timestamp) could be + // incorrectly reclaimed by concurrent reclaim() call OR if there + // will be no events on this connection then it could be reclaimed + // by upcoming reclaim() call. + getConnectionCache().stampTime(connection); getConnectionCache().put(this, connection); if (connection.shouldRegisterServerReadEvent()) {
--- a/corba/src/share/classes/com/sun/corba/se/spi/orb/ORB.java Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/com/sun/corba/se/spi/orb/ORB.java Wed Apr 16 09:49:45 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -25,6 +25,8 @@ package com.sun.corba.se.spi.orb; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.Map ; import java.util.HashMap ; import java.util.Properties ; @@ -97,8 +99,7 @@ import com.sun.corba.se.impl.presentation.rmi.PresentationManagerImpl ; -import sun.awt.AppContext; -import sun.corba.SharedSecrets; +import sun.misc.JavaAWTAccess; public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB implements Broker, TypeCodeFactory @@ -170,6 +171,13 @@ // representing LogDomain and ExceptionGroup. private Map wrapperMap ; + static class Holder { + static final PresentationManager defaultPresentationManager = + setupPresentationManager(); + } + + private static final Map<Object, PresentationManager> pmContexts = new HashMap<>(); + private static Map staticWrapperMap = new ConcurrentHashMap(); protected MonitoringManager monitoringManager; @@ -201,8 +209,9 @@ try { // First try the configured class name, if any - Class<?> cls = SharedSecrets.getJavaCorbaAccess().loadClass( className ) ; - sff = (PresentationManager.StubFactoryFactory)cls.newInstance() ; + Class<?> cls = + sun.corba.SharedSecrets.getJavaCorbaAccess().loadClass(className); + sff = (PresentationManager.StubFactoryFactory)cls.newInstance(); } catch (Exception exc) { // Use the default. Log the error as a warning. staticWrapper.errorInSettingDynamicStubFactoryFactory( @@ -235,13 +244,34 @@ */ public static PresentationManager getPresentationManager() { - AppContext ac = AppContext.getAppContext(); - PresentationManager pm = (PresentationManager) ac.get(PresentationManager.class); - if (pm == null) { - pm = setupPresentationManager(); - ac.put(PresentationManager.class, pm); + SecurityManager sm = System.getSecurityManager(); + JavaAWTAccess javaAwtAccess = sun.misc.SharedSecrets.getJavaAWTAccess(); + if (sm != null && javaAwtAccess != null) { + Object appletContext; + try { + Class<?> clazz = JavaAWTAccess.class; + Method method = clazz.getMethod("getAppletContext"); + appletContext = method.invoke(javaAwtAccess); + } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { + InternalError err = new InternalError(); + err.initCause(e); + throw err; + } + + if (appletContext != null) { + synchronized (pmContexts) { + PresentationManager pm = pmContexts.get(appletContext); + if (pm == null) { + pm = setupPresentationManager(); + pmContexts.put(appletContext, pm); + } + return pm; + } + } } - return pm; + + // No security manager or AppletAppContext + return Holder.defaultPresentationManager; } /** Get the appropriate StubFactoryFactory. This
--- a/corba/src/share/classes/org/omg/CORBA/AnySeqHelper.java Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/org/omg/CORBA/AnySeqHelper.java Wed Apr 16 09:49:45 2014 -0400 @@ -38,11 +38,11 @@ * OMG specifications : * <ul> * <li> ORB core as defined by CORBA 2.3.1 -* (<a href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) +* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) * </li> * * <li> IDL/Java Language Mapping as defined in -* <a href="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> +* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> * </li> * </ul> */
--- a/corba/src/share/classes/org/omg/CORBA/BooleanSeqHelper.java Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/org/omg/CORBA/BooleanSeqHelper.java Wed Apr 16 09:49:45 2014 -0400 @@ -38,11 +38,11 @@ * OMG specifications : * <ul> * <li> ORB core as defined by CORBA 2.3.1 -* (<a href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) +* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) * </li> * * <li> IDL/Java Language Mapping as defined in -* <a href="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> +* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> * </li> * </ul> */
--- a/corba/src/share/classes/org/omg/CORBA/CharSeqHelper.java Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/org/omg/CORBA/CharSeqHelper.java Wed Apr 16 09:49:45 2014 -0400 @@ -38,11 +38,11 @@ * OMG specifications : * <ul> * <li> ORB core as defined by CORBA 2.3.1 -* (<a href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) +* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) * </li> * * <li> IDL/Java Language Mapping as defined in -* <a href="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> +* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> * </li> * </ul> */
--- a/corba/src/share/classes/org/omg/CORBA/DoubleSeqHelper.java Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/org/omg/CORBA/DoubleSeqHelper.java Wed Apr 16 09:49:45 2014 -0400 @@ -38,11 +38,11 @@ * OMG specifications : * <ul> * <li> ORB core as defined by CORBA 2.3.1 -* (<a href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) +* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) * </li> * * <li> IDL/Java Language Mapping as defined in -* <a href="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> +* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> * </li> * </ul> */
--- a/corba/src/share/classes/org/omg/CORBA/LongLongSeqHelper.java Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/org/omg/CORBA/LongLongSeqHelper.java Wed Apr 16 09:49:45 2014 -0400 @@ -38,11 +38,11 @@ * OMG specifications : * <ul> * <li> ORB core as defined by CORBA 2.3.1 -* (<a href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) +* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) * </li> * * <li> IDL/Java Language Mapping as defined in -* <a href="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> +* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> * </li> * </ul> */
--- a/corba/src/share/classes/org/omg/CORBA/LongSeqHelper.java Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/org/omg/CORBA/LongSeqHelper.java Wed Apr 16 09:49:45 2014 -0400 @@ -38,11 +38,11 @@ * OMG specifications : * <ul> * <li> ORB core as defined by CORBA 2.3.1 -* (<a href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) +* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) * </li> * * <li> IDL/Java Language Mapping as defined in -* <a href="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> +* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> * </li> * </ul> */
--- a/corba/src/share/classes/org/omg/CORBA/OctetSeqHelper.java Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/org/omg/CORBA/OctetSeqHelper.java Wed Apr 16 09:49:45 2014 -0400 @@ -38,11 +38,11 @@ * OMG specifications : * <ul> * <li> ORB core as defined by CORBA 2.3.1 -* (<a href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) +* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) * </li> * * <li> IDL/Java Language Mapping as defined in -* <a href="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> +* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> * </li> * </ul> */
--- a/corba/src/share/classes/org/omg/CORBA/ShortSeqHelper.java Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/org/omg/CORBA/ShortSeqHelper.java Wed Apr 16 09:49:45 2014 -0400 @@ -38,11 +38,11 @@ * OMG specifications : * <ul> * <li> ORB core as defined by CORBA 2.3.1 -* (<a href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) +* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) * </li> * * <li> IDL/Java Language Mapping as defined in -* <a href="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> +* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> * </li> * </ul> */
--- a/corba/src/share/classes/org/omg/CORBA/StringValueHelper.java Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/org/omg/CORBA/StringValueHelper.java Wed Apr 16 09:49:45 2014 -0400 @@ -44,11 +44,11 @@ * OMG specifications : * <ul> * <li> ORB core as defined by CORBA 2.3.1 -* (<a href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) +* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) * </li> * * <li> IDL/Java Language Mapping as defined in -* <a href="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> +* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> * </li> * </ul> */
--- a/corba/src/share/classes/org/omg/CORBA/ULongLongSeqHelper.java Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/org/omg/CORBA/ULongLongSeqHelper.java Wed Apr 16 09:49:45 2014 -0400 @@ -38,11 +38,11 @@ * OMG specifications : * <ul> * <li> ORB core as defined by CORBA 2.3.1 -* (<a href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) +* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) * </li> * * <li> IDL/Java Language Mapping as defined in -* <a href="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> +* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> * </li> * </ul> */
--- a/corba/src/share/classes/org/omg/CORBA/ULongSeqHelper.java Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/org/omg/CORBA/ULongSeqHelper.java Wed Apr 16 09:49:45 2014 -0400 @@ -38,11 +38,11 @@ * OMG specifications : * <ul> * <li> ORB core as defined by CORBA 2.3.1 -* (<a href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) +* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) * </li> * * <li> IDL/Java Language Mapping as defined in -* <a href="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> +* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> * </li> * </ul> */
--- a/corba/src/share/classes/org/omg/CORBA/UShortSeqHelper.java Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/org/omg/CORBA/UShortSeqHelper.java Wed Apr 16 09:49:45 2014 -0400 @@ -38,11 +38,11 @@ * OMG specifications : * <ul> * <li> ORB core as defined by CORBA 2.3.1 -* (<a href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) +* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) * </li> * * <li> IDL/Java Language Mapping as defined in -* <a href="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> +* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> * </li> * </ul> */
--- a/corba/src/share/classes/org/omg/CORBA/WCharSeqHelper.java Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/org/omg/CORBA/WCharSeqHelper.java Wed Apr 16 09:49:45 2014 -0400 @@ -38,11 +38,11 @@ * OMG specifications : * <ul> * <li> ORB core as defined by CORBA 2.3.1 -* (<a href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) +* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) * </li> * * <li> IDL/Java Language Mapping as defined in -* <a href="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> +* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> * </li> * </ul> */
--- a/corba/src/share/classes/org/omg/CORBA/WStringValueHelper.java Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/org/omg/CORBA/WStringValueHelper.java Wed Apr 16 09:49:45 2014 -0400 @@ -48,11 +48,11 @@ * OMG specifications : * <ul> * <li> ORB core as defined by CORBA 2.3.1 -* (<a href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) +* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) * </li> * * <li> IDL/Java Language Mapping as defined in -* <a href="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> +* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> * </li> * </ul> */
--- a/corba/src/share/classes/org/omg/CORBA/doc-files/compliance.html Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/org/omg/CORBA/doc-files/compliance.html Wed Apr 16 09:49:45 2014 -0400 @@ -18,26 +18,26 @@ <ul> <li> CORBA 2.3.1 (<a -href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)</li> +href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)</li> <li> IDL to Java language mapping (<a -href="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>)</li> +href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>)</li> <li>Revised IDL to Java language mapping (<a -href="http://cgi.omg.org/cgi-bin/doc?ptc/00-11-03">ptc/00-11-03</a>)</li> +href="http://www.omg.org/cgi-bin/doc?ptc/00-11-03">ptc/00-11-03</a>)</li> <li> Java to IDL language mapping (<a -href="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-06">ptc/00-01-06</a>)</li> +href="http://www.omg.org/cgi-bin/doc?ptc/00-01-06">ptc/00-01-06</a>)</li> <li> Interoperable Naming Service (<a -href="http://cgi.omg.org/cgi-bin/doc?ptc/00-08-07">ptc/00-08-07</a>)</li> +href="http://www.omg.org/cgi-bin/doc?ptc/00-08-07">ptc/00-08-07</a>)</li> <li> Portable Interceptors (<a -href="http://cgi.omg.org/cgi-bin/doc?ptc/2001-03-04">ptc/2001-03-04</a>)</li> +href="http://www.omg.org/cgi-bin/doc?ptc/2001-03-04">ptc/2001-03-04</a>)</li> </ul> These are the only specifications referenced by this document.
--- a/corba/src/share/classes/org/omg/CORBA/doc-files/generatedfiles.html Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/org/omg/CORBA/doc-files/generatedfiles.html Wed Apr 16 09:49:45 2014 -0400 @@ -8,7 +8,7 @@ <H1>IDL-to-Java Generated Files</H1> -<P>The files that are generated by the IDL-to-Java compiler, in accordance with the <em><a href="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">IDL-to-Java Language Mapping Specification</a></em>, which is implemented in Java<sup><font size="-2">TM</font></sup> SE 6 according the <a href="compliance.html">compliance</a> document. +<P>The files that are generated by the IDL-to-Java compiler, in accordance with the <em><a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">IDL-to-Java Language Mapping Specification</a></em>, which is implemented in Java<sup><font size="-2">TM</font></sup> SE 6 according the <a href="compliance.html">compliance</a> document. <P>In general IDL names and identifiers are mapped to Java names and identifiers with no change. Because of the nature of the Java language, a single IDL construct may be mapped to several (differently named) Java constructs. The additional names are constructed by appending a descriptive suffix. For example, the IDL interface <tt>foo</tt> is mapped to the Java interfaces <tt>foo</tt> and <tt>fooOperations</tt>, and additional Java classes <tt>fooHelper</tt>, <tt>fooHolder</tt>, <tt>fooPOA</tt>, and optionally <tt>fooPOATie</tt>.
--- a/corba/src/share/classes/org/omg/CORBA/package.html Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/org/omg/CORBA/package.html Wed Apr 16 09:49:45 2014 -0400 @@ -344,7 +344,7 @@ </PRE> <P>For more information on Holder classes, see Chapter 1.4, <em>Mapping for -Basic Types</em> in the <a href="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08"> +Basic Types</em> in the <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08"> <em>OMG IDL to Java Language Mapping</em></a>. The Holder classes defined in the package <TT>org.omg.CORBA</TT> are: <PRE>
--- a/corba/src/share/classes/org/omg/CosNaming/package.html Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/org/omg/CosNaming/package.html Wed Apr 16 09:49:45 2014 -0400 @@ -331,7 +331,7 @@ <ul> <li>Interoperable Naming Service (<a -href="http://cgi.omg.org/cgi-bin/doc?ptc/00-08-07">ptc/00-08-07</a>) +href="http://www.omg.org/cgi-bin/doc?ptc/00-08-07">ptc/00-08-07</a>) </ul> <h2>Related Documentation</h2>
--- a/corba/src/share/classes/org/omg/Dynamic/package.html Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/org/omg/Dynamic/package.html Wed Apr 16 09:49:45 2014 -0400 @@ -33,8 +33,8 @@ <body bgcolor="white"> <P>This package contains the <tt>Dynamic</tt> module specified in the OMG Portable Interceptor specification, -<a href="http://cgi.omg.org/cgi-bin/doc?ptc/2000-08-06"> -http://cgi.omg.org/cgi-bin/doc?ptc/2000-08-06</a>, section 21.9. Please +<a href="http://www.omg.org/cgi-bin/doc?ptc/2000-08-06"> +ptc/2000-08-06</a>, section 21.9. Please refer to that OMG specification for further details.
--- a/corba/src/share/classes/org/omg/DynamicAny/DynAnyFactoryPackage/package.html Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/org/omg/DynamicAny/DynAnyFactoryPackage/package.html Wed Apr 16 09:49:45 2014 -0400 @@ -38,8 +38,8 @@ <tt>DynamicAny</tt> module specified in the OMG <em>The Common Object Request Broker: Architecture and Specification</em>, -<a href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07"> -http://cgi.omg.org/cgi-bin/doc?formal/99-10-07</a>, section 9.2.2. Please +<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07"> +formal/99-10-07</a>, section 9.2.2. Please refer to that OMG specification for further details. <H3>Package Specification</H3>
--- a/corba/src/share/classes/org/omg/DynamicAny/DynAnyPackage/package.html Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/org/omg/DynamicAny/DynAnyPackage/package.html Wed Apr 16 09:49:45 2014 -0400 @@ -34,8 +34,8 @@ interface of the <tt>DynamicAny</tt> module specified in the OMG <em>The Common Object Request Broker: Architecture and Specification</em>, -<a href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07"> -http://cgi.omg.org/cgi-bin/doc?formal/99-10-07</a>, section 9.2. Please +<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07"> +formal/99-10-07</a>, section 9.2. Please refer to that OMG specification for further details.
--- a/corba/src/share/classes/org/omg/IOP/package.html Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/org/omg/IOP/package.html Wed Apr 16 09:49:45 2014 -0400 @@ -33,8 +33,8 @@ <P>This package contains the <TT>IOP</tt> module specified in the OMG document <em>The Common Object Request Broker: Architecture and Specification</em>, -<a href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07"> -http://cgi.omg.org/cgi-bin/doc?formal/99-10-07</a>, section 13.6. Please +<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07"> +formal/99-10-07</a>, section 13.6. Please refer to that OMG specification for further details. <P>Please note that we do not provide all parts of the <tt>IOP</tt> module from
--- a/corba/src/share/classes/org/omg/Messaging/package.html Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/org/omg/Messaging/package.html Wed Apr 16 09:49:45 2014 -0400 @@ -32,8 +32,8 @@ <body bgcolor="white"> <P>This package contains the <tt>Messaging</tt> module specified in the OMG CORBA Messaging specification, -<a href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07"> -http://cgi.omg.org/cgi-bin/doc?formal/99-10-07</a>. Please refer to that OMG +<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07"> +formal/99-10-07</a>. Please refer to that OMG specification for further details. <P>Please note that we do not provide all parts of the <tt>Messaging</tt> module from
--- a/corba/src/share/classes/org/omg/PortableInterceptor/ORBInitInfoPackage/package.html Wed Apr 16 09:46:49 2014 -0400 +++ b/corba/src/share/classes/org/omg/PortableInterceptor/ORBInitInfoPackage/package.html Wed Apr 16 09:49:45 2014 -0400 @@ -33,8 +33,8 @@ <P>This package contains the exceptions and typedefs from the <tt>ORBInitInfo</tt> local interface of the <tt>PortableInterceptor</tt> module specified in the OMG Portable Interceptor specification, -<a href="http://cgi.omg.org/cgi-bin/doc?ptc/2000-08-06"> -http://cgi.omg.org/cgi-bin/doc?ptc/2000-08-06</a>, section 21.7.2. Please +<a href="http://www.omg.org/cgi-bin/doc?ptc/2000-08-06"> +ptc/2000-08-06</a>, section 21.7.2. Please refer to that OMG specification for further details.
--- a/hotspot/.hgtags Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/.hgtags Wed Apr 16 09:49:45 2014 -0400 @@ -409,3 +409,4 @@ 3812c088b9456ee22c933e88aee1ece71f4e783a jdk9-b04 bdc5311e1db7598589b77015119b821bf8c828bd jdk9-b05 52377a30a3f87b62d6135706997b8c7a47366e37 jdk9-b06 +52f7edf2589d9f9d35db3008bc5377f279de9c18 jdk9-b07
--- a/hotspot/agent/src/os/bsd/MacosxDebuggerLocal.m Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/agent/src/os/bsd/MacosxDebuggerLocal.m Wed Apr 16 09:49:45 2014 -0400 @@ -95,7 +95,9 @@ #define CHECK_EXCEPTION_CLEAR_(value) if ((*env)->ExceptionOccurred(env)) { (*env)->ExceptionClear(env); return value; } static void throw_new_debugger_exception(JNIEnv* env, const char* errMsg) { - (*env)->ThrowNew(env, (*env)->FindClass(env, "sun/jvm/hotspot/debugger/DebuggerException"), errMsg); + jclass exceptionClass = (*env)->FindClass(env, "sun/jvm/hotspot/debugger/DebuggerException"); + CHECK_EXCEPTION; + (*env)->ThrowNew(env, exceptionClass, errMsg); } static struct ps_prochandle* get_proc_handle(JNIEnv* env, jobject this_obj) { @@ -129,6 +131,7 @@ JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_init0(JNIEnv *env, jclass cls) { symbolicatorID = (*env)->GetFieldID(env, cls, "symbolicator", "J"); + CHECK_EXCEPTION; taskID = (*env)->GetFieldID(env, cls, "task", "J"); CHECK_EXCEPTION; @@ -236,13 +239,16 @@ (JNIEnv *env, jobject this_obj, jlong addr) { uintptr_t offset; const char* sym = NULL; + jstring sym_string; struct ps_prochandle* ph = get_proc_handle(env, this_obj); if (ph != NULL && ph->core != NULL) { sym = symbol_for_pc(ph, (uintptr_t) addr, &offset); if (sym == NULL) return 0; + sym_string = (*env)->NewStringUTF(env, sym); + CHECK_EXCEPTION_(0); return (*env)->CallObjectMethod(env, this_obj, createClosestSymbol_ID, - (*env)->NewStringUTF(env, sym), (jlong)offset); + sym_string, (jlong)offset); } return 0; } @@ -749,11 +755,14 @@ const char* name; jobject loadObject; jobject loadObjectList; + jstring nameString; base = get_lib_base(ph, i); name = get_lib_name(ph, i); + nameString = (*env)->NewStringUTF(env, name); + CHECK_EXCEPTION; loadObject = (*env)->CallObjectMethod(env, this_obj, createLoadObject_ID, - (*env)->NewStringUTF(env, name), (jlong)0, (jlong)base); + nameString, (jlong)0, (jlong)base); CHECK_EXCEPTION; loadObjectList = (*env)->GetObjectField(env, this_obj, loadObjectList_ID); CHECK_EXCEPTION;
--- a/hotspot/agent/src/os/linux/symtab.c Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/agent/src/os/linux/symtab.c Wed Apr 16 09:49:45 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -162,28 +162,27 @@ static struct elf_section *find_section_by_name(char *name, int fd, ELF_EHDR *ehdr, - ELF_SHDR *shbuf, struct elf_section *scn_cache) { - ELF_SHDR* cursct = NULL; char *strtab; int cnt; + int strtab_size; + // Section cache have to already contain data for e_shstrndx section. + // If it's not true - elf file is broken, so just bail out if (scn_cache[ehdr->e_shstrndx].c_data == NULL) { - if ((scn_cache[ehdr->e_shstrndx].c_data - = read_section_data(fd, ehdr, cursct)) == NULL) { - return NULL; - } + return NULL; } strtab = scn_cache[ehdr->e_shstrndx].c_data; + strtab_size = scn_cache[ehdr->e_shstrndx].c_shdr->sh_size; - for (cursct = shbuf, cnt = 0; - cnt < ehdr->e_shnum; - cnt++, cursct++) { - if (strcmp(cursct->sh_name + strtab, name) == 0) { - scn_cache[cnt].c_data = read_section_data(fd, ehdr, cursct); - return &scn_cache[cnt]; + for (cnt = 0; cnt < ehdr->e_shnum; ++cnt) { + if (scn_cache[cnt].c_shdr->sh_name < strtab_size) { + if (strcmp(scn_cache[cnt].c_shdr->sh_name + strtab, name) == 0) { + scn_cache[cnt].c_data = read_section_data(fd, ehdr, scn_cache[cnt].c_shdr); + return &scn_cache[cnt]; + } } } @@ -195,12 +194,11 @@ static int open_file_from_debug_link(const char *name, int fd, ELF_EHDR *ehdr, - ELF_SHDR *shbuf, struct elf_section *scn_cache) { int debug_fd; struct elf_section *debug_link = find_section_by_name(".gnu_debuglink", fd, ehdr, - shbuf, scn_cache); + scn_cache); if (debug_link == NULL) return -1; char *debug_filename = debug_link->c_data; @@ -221,7 +219,6 @@ /* Look in the same directory as the object. */ strcpy(last_slash+1, debug_filename); - debug_fd = open_debug_file(debug_pathname, crc); if (debug_fd >= 0) { free(debug_pathname); @@ -261,10 +258,9 @@ static struct symtab *build_symtab_from_debug_link(const char *name, int fd, ELF_EHDR *ehdr, - ELF_SHDR *shbuf, struct elf_section *scn_cache) { - fd = open_file_from_debug_link(name, fd, ehdr, shbuf, scn_cache); + fd = open_file_from_debug_link(name, fd, ehdr, scn_cache); if (fd >= 0) { struct symtab *symtab = build_symtab_internal(fd, NULL, /* try_debuginfo */ false); @@ -463,7 +459,7 @@ // Then, if that doesn't work, the debug link if (symtab == NULL) { - symtab = build_symtab_from_debug_link(filename, fd, &ehdr, shbuf, + symtab = build_symtab_from_debug_link(filename, fd, &ehdr, scn_cache); }
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/G1CollectedHeap.java Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/G1CollectedHeap.java Wed Apr 16 09:49:45 2014 -0400 @@ -51,9 +51,9 @@ static private CIntegerField summaryBytesUsedField; // G1MonitoringSupport* _g1mm; static private AddressField g1mmField; - // MasterOldRegionSet _old_set; + // HeapRegionSet _old_set; static private long oldSetFieldOffset; - // MasterHumongousRegionSet _humongous_set; + // HeapRegionSet _humongous_set; static private long humongousSetFieldOffset; static {
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegionSetBase.java Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegionSetBase.java Wed Apr 16 09:49:45 2014 -0400 @@ -40,12 +40,8 @@ // Mirror class for HeapRegionSetBase. Represents a group of regions. public class HeapRegionSetBase extends VMObject { - // uint _length; - static private CIntegerField lengthField; - // uint _region_num; - static private CIntegerField regionNumField; - // size_t _total_used_bytes; - static private CIntegerField totalUsedBytesField; + + static private long countField; static { VM.registerVMInitializedObserver(new Observer() { @@ -58,21 +54,13 @@ static private synchronized void initialize(TypeDataBase db) { Type type = db.lookupType("HeapRegionSetBase"); - lengthField = type.getCIntegerField("_length"); - regionNumField = type.getCIntegerField("_region_num"); - totalUsedBytesField = type.getCIntegerField("_total_used_bytes"); + countField = type.getField("_count").getOffset(); } - public long length() { - return lengthField.getValue(addr); - } - public long regionNum() { - return regionNumField.getValue(addr); - } - - public long totalUsedBytes() { - return totalUsedBytesField.getValue(addr); + public HeapRegionSetCount count() { + Address countFieldAddr = addr.addOffsetTo(countField); + return (HeapRegionSetCount) VMObjectFactory.newObject(HeapRegionSetCount.class, countFieldAddr); } public HeapRegionSetBase(Address addr) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegionSetCount.java Wed Apr 16 09:49:45 2014 -0400 @@ -0,0 +1,73 @@ +/* + * 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. + * + */ + +package sun.jvm.hotspot.gc_implementation.g1; + +import java.util.Iterator; +import java.util.Observable; +import java.util.Observer; + +import sun.jvm.hotspot.debugger.Address; +import sun.jvm.hotspot.runtime.VM; +import sun.jvm.hotspot.runtime.VMObject; +import sun.jvm.hotspot.runtime.VMObjectFactory; +import sun.jvm.hotspot.types.AddressField; +import sun.jvm.hotspot.types.CIntegerField; +import sun.jvm.hotspot.types.Type; +import sun.jvm.hotspot.types.TypeDataBase; + +// Mirror class for HeapRegionSetCount. Represents a group of regions. + +public class HeapRegionSetCount extends VMObject { + + static private CIntegerField lengthField; + static private CIntegerField capacityField; + + static { + VM.registerVMInitializedObserver(new Observer() { + public void update(Observable o, Object data) { + initialize(VM.getVM().getTypeDataBase()); + } + }); + } + + static private synchronized void initialize(TypeDataBase db) { + Type type = db.lookupType("HeapRegionSetCount"); + + lengthField = type.getCIntegerField("_length"); + capacityField = type.getCIntegerField("_capacity"); + } + + public long length() { + return lengthField.getValue(addr); + } + + public long capacity() { + return capacityField.getValue(addr); + } + + public HeapRegionSetCount(Address addr) { + super(addr); + } +}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java Wed Apr 16 09:49:45 2014 -0400 @@ -114,7 +114,8 @@ long survivorRegionNum = g1mm.survivorRegionNum(); HeapRegionSetBase oldSet = g1h.oldSet(); HeapRegionSetBase humongousSet = g1h.humongousSet(); - long oldRegionNum = oldSet.regionNum() + humongousSet.regionNum(); + long oldRegionNum = oldSet.count().length() + + humongousSet.count().capacity() / HeapRegion.grainBytes(); printG1Space("G1 Heap:", g1h.n_regions(), g1h.used(), g1h.capacity()); System.out.println("G1 Young Generation:");
--- a/hotspot/make/Makefile Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/make/Makefile Wed Apr 16 09:49:45 2014 -0400 @@ -287,8 +287,43 @@ @$(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) +generic_export: $(EXPORT_LIST) remove_old_debuginfo export_product: $(MAKE) BUILD_FLAVOR=$(@:export_%=%) generic_export @@ -841,4 +876,4 @@ 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 + $(HS_ALT_MAKE)/Makefile.make remove_old_debuginfo
--- a/hotspot/make/aix/makefiles/vm.make Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/make/aix/makefiles/vm.make Wed Apr 16 09:49:45 2014 -0400 @@ -101,7 +101,7 @@ # 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. -vm_version.o: CXXFLAGS += ${JRE_VERSION} +CXXFLAGS/vm_version.o += ${JRE_VERSION} CXXFLAGS/BYFILE = $(CXXFLAGS/$@)
--- a/hotspot/make/excludeSrc.make Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/make/excludeSrc.make Wed Apr 16 09:49:45 2014 -0400 @@ -1,5 +1,5 @@ # -# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +# 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 @@ -87,9 +87,10 @@ g1BlockOffsetTable.cpp g1CardCounts.cpp g1CollectedHeap.cpp g1CollectorPolicy.cpp \ g1ErgoVerbose.cpp g1GCPhaseTimes.cpp g1HRPrinter.cpp g1HotCardCache.cpp g1Log.cpp \ g1MMUTracker.cpp g1MarkSweep.cpp g1MemoryPool.cpp g1MonitoringSupport.cpp g1OopClosures.cpp \ - g1RemSet.cpp g1RemSetSummary.cpp g1SATBCardTableModRefBS.cpp g1_globals.cpp heapRegion.cpp \ + g1RemSet.cpp g1RemSetSummary.cpp g1SATBCardTableModRefBS.cpp g1StringDedup.cpp g1StringDedupStat.cpp \ + g1StringDedupTable.cpp g1StringDedupThread.cpp g1StringDedupQueue.cpp g1_globals.cpp heapRegion.cpp \ g1BiasedArray.cpp heapRegionRemSet.cpp heapRegionSeq.cpp heapRegionSet.cpp heapRegionSets.cpp \ - ptrQueue.cpp satbQueue.cpp sparsePRT.cpp survRateGroup.cpp vm_operations_g1.cpp \ + ptrQueue.cpp satbQueue.cpp sparsePRT.cpp survRateGroup.cpp vm_operations_g1.cpp g1CodeCacheRemSet.cpp \ adjoiningGenerations.cpp adjoiningVirtualSpaces.cpp asPSOldGen.cpp asPSYoungGen.cpp \ cardTableExtension.cpp gcTaskManager.cpp gcTaskThread.cpp objectStartArray.cpp \ parallelScavengeHeap.cpp parMarkBitMap.cpp pcTasks.cpp psAdaptiveSizePolicy.cpp \
--- a/hotspot/make/jprt.properties Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/make/jprt.properties Wed Apr 16 09:49:45 2014 -0400 @@ -33,7 +33,7 @@ # This tells jprt what default release we want to build -jprt.hotspot.default.release=jdk8 +jprt.hotspot.default.release=jdk9 jprt.tools.default.release=${jprt.submit.option.release?${jprt.submit.option.release}:${jprt.hotspot.default.release}} @@ -47,72 +47,50 @@ # sparc etc. # Define the Solaris platforms we want for the various releases -jprt.my.solaris.sparcv9.jdk8=solaris_sparcv9_5.10 -jprt.my.solaris.sparcv9.jdk7=solaris_sparcv9_5.10 -jprt.my.solaris.sparcv9.jdk7u8=${jprt.my.solaris.sparcv9.jdk7} +jprt.my.solaris.sparcv9.jdk9=solaris_sparcv9_5.10 jprt.my.solaris.sparcv9=${jprt.my.solaris.sparcv9.${jprt.tools.default.release}} -jprt.my.solaris.x64.jdk8=solaris_x64_5.10 -jprt.my.solaris.x64.jdk7=solaris_x64_5.10 -jprt.my.solaris.x64.jdk7u8=${jprt.my.solaris.x64.jdk7} +jprt.my.solaris.x64.jdk9=solaris_x64_5.10 jprt.my.solaris.x64=${jprt.my.solaris.x64.${jprt.tools.default.release}} -jprt.my.linux.i586.jdk8=linux_i586_2.6 -jprt.my.linux.i586.jdk7=linux_i586_2.6 -jprt.my.linux.i586.jdk7u8=${jprt.my.linux.i586.jdk7} +jprt.my.linux.i586.jdk9=linux_i586_2.6 jprt.my.linux.i586=${jprt.my.linux.i586.${jprt.tools.default.release}} -jprt.my.linux.x64.jdk8=linux_x64_2.6 -jprt.my.linux.x64.jdk7=linux_x64_2.6 -jprt.my.linux.x64.jdk7u8=${jprt.my.linux.x64.jdk7} +jprt.my.linux.x64.jdk9=linux_x64_2.6 jprt.my.linux.x64=${jprt.my.linux.x64.${jprt.tools.default.release}} -jprt.my.linux.ppc.jdk8=linux_ppc_2.6 -jprt.my.linux.ppc.jdk7=linux_ppc_2.6 -jprt.my.linux.ppc.jdk7u8=${jprt.my.linux.ppc.jdk7} +jprt.my.linux.ppc.jdk9=linux_ppc_2.6 jprt.my.linux.ppc=${jprt.my.linux.ppc.${jprt.tools.default.release}} -jprt.my.linux.ppcv2.jdk8=linux_ppcv2_2.6 -jprt.my.linux.ppcv2.jdk7=linux_ppcv2_2.6 -jprt.my.linux.ppcv2.jdk7u8=${jprt.my.linux.ppcv2.jdk7} +jprt.my.linux.ppcv2.jdk9=linux_ppcv2_2.6 jprt.my.linux.ppcv2=${jprt.my.linux.ppcv2.${jprt.tools.default.release}} -jprt.my.linux.ppcsflt.jdk8=linux_ppcsflt_2.6 -jprt.my.linux.ppcsflt.jdk7=linux_ppcsflt_2.6 -jprt.my.linux.ppcsflt.jdk7u8=${jprt.my.linux.ppcsflt.jdk7} +jprt.my.linux.ppcsflt.jdk9=linux_ppcsflt_2.6 jprt.my.linux.ppcsflt=${jprt.my.linux.ppcsflt.${jprt.tools.default.release}} -jprt.my.linux.armvfpsflt.jdk8=linux_armvfpsflt_2.6 +jprt.my.linux.armvfpsflt.jdk9=linux_armvfpsflt_2.6 jprt.my.linux.armvfpsflt=${jprt.my.linux.armvfpsflt.${jprt.tools.default.release}} -jprt.my.linux.armvfphflt.jdk8=linux_armvfphflt_2.6 +jprt.my.linux.armvfphflt.jdk9=linux_armvfphflt_2.6 jprt.my.linux.armvfphflt=${jprt.my.linux.armvfphflt.${jprt.tools.default.release}} # The ARM GP vfp-sflt build is not currently supported -#jprt.my.linux.armvs.jdk8=linux_armvs_2.6 +#jprt.my.linux.armvs.jdk9=linux_armvs_2.6 #jprt.my.linux.armvs=${jprt.my.linux.armvs.${jprt.tools.default.release}} -jprt.my.linux.armvh.jdk8=linux_armvh_2.6 +jprt.my.linux.armvh.jdk9=linux_armvh_2.6 jprt.my.linux.armvh=${jprt.my.linux.armvh.${jprt.tools.default.release}} -jprt.my.linux.armsflt.jdk8=linux_armsflt_2.6 -jprt.my.linux.armsflt.jdk7=linux_armsflt_2.6 -jprt.my.linux.armsflt.jdk7u8=${jprt.my.linux.armsflt.jdk7} +jprt.my.linux.armsflt.jdk9=linux_armsflt_2.6 jprt.my.linux.armsflt=${jprt.my.linux.armsflt.${jprt.tools.default.release}} -jprt.my.macosx.x64.jdk8=macosx_x64_10.7 -jprt.my.macosx.x64.jdk7=macosx_x64_10.7 -jprt.my.macosx.x64.jdk7u8=${jprt.my.macosx.x64.jdk7} +jprt.my.macosx.x64.jdk9=macosx_x64_10.7 jprt.my.macosx.x64=${jprt.my.macosx.x64.${jprt.tools.default.release}} -jprt.my.windows.i586.jdk8=windows_i586_6.1 -jprt.my.windows.i586.jdk7=windows_i586_6.1 -jprt.my.windows.i586.jdk7u8=${jprt.my.windows.i586.jdk7} +jprt.my.windows.i586.jdk9=windows_i586_6.1 jprt.my.windows.i586=${jprt.my.windows.i586.${jprt.tools.default.release}} -jprt.my.windows.x64.jdk8=windows_x64_6.1 -jprt.my.windows.x64.jdk7=windows_x64_6.1 -jprt.my.windows.x64.jdk7u8=${jprt.my.windows.x64.jdk7} +jprt.my.windows.x64.jdk9=windows_x64_6.1 jprt.my.windows.x64=${jprt.my.windows.x64.${jprt.tools.default.release}} # Standard list of jprt build targets for this source tree @@ -143,9 +121,7 @@ jprt.build.targets.all=${jprt.build.targets.standard}, \ ${jprt.build.targets.embedded}, ${jprt.build.targets.open} -jprt.build.targets.jdk8=${jprt.build.targets.all} -jprt.build.targets.jdk7=${jprt.build.targets.all} -jprt.build.targets.jdk7u8=${jprt.build.targets.all} +jprt.build.targets.jdk9=${jprt.build.targets.all} jprt.build.targets=${jprt.build.targets.${jprt.tools.default.release}} # Subset lists of test targets for this source tree @@ -349,9 +325,7 @@ ${jprt.my.windows.i586.test.targets}, \ ${jprt.my.windows.x64.test.targets} -jprt.test.targets.jdk8=${jprt.test.targets.standard} -jprt.test.targets.jdk7=${jprt.test.targets.standard} -jprt.test.targets.jdk7u8=${jprt.test.targets.jdk7} +jprt.test.targets.jdk9=${jprt.test.targets.standard} jprt.test.targets=${jprt.test.targets.${jprt.tools.default.release}} # The default test/Makefile targets that should be run @@ -399,9 +373,7 @@ jprt.make.rule.test.targets.embedded = \ ${jprt.make.rule.test.targets.standard.client} -jprt.make.rule.test.targets.jdk8=${jprt.make.rule.test.targets.standard} -jprt.make.rule.test.targets.jdk7=${jprt.make.rule.test.targets.standard} -jprt.make.rule.test.targets.jdk7u8=${jprt.make.rule.test.targets.jdk7} +jprt.make.rule.test.targets.jdk9=${jprt.make.rule.test.targets.standard} jprt.make.rule.test.targets=${jprt.make.rule.test.targets.${jprt.tools.default.release}} # 7155453: Work-around to prevent popups on OSX from blocking test completion
--- a/hotspot/make/linux/Makefile Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/make/linux/Makefile Wed Apr 16 09:49:45 2014 -0400 @@ -66,8 +66,8 @@ FORCE_TIERED=1 endif endif -# C1 is not ported on ppc64(le), so we cannot build a tiered VM: -ifneq (,$(filter $(ARCH),ppc64 pp64le)) +# C1 is not ported on ppc64, so we cannot build a tiered VM: +ifeq ($(ARCH),ppc64) FORCE_TIERED=0 endif
--- a/hotspot/make/linux/makefiles/defs.make Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/make/linux/makefiles/defs.make Wed Apr 16 09:49:45 2014 -0400 @@ -33,6 +33,11 @@ # 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 ?= :
--- a/hotspot/make/linux/makefiles/gcc.make Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/make/linux/makefiles/gcc.make Wed Apr 16 09:49:45 2014 -0400 @@ -337,56 +337,20 @@ 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/ppc64 = -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 + DEBUG_CFLAGS += -g 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/ppc64 = -g - FASTDEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH)) + 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 + FASTDEBUG_CFLAGS += -g endif - - OPT_CFLAGS/ia64 = -g - OPT_CFLAGS/amd64 = -g - OPT_CFLAGS/arm = -g - OPT_CFLAGS/ppc = -g - OPT_CFLAGS/ppc64 = -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 + OPT_CFLAGS += -g endif endif endif
--- a/hotspot/make/linux/makefiles/ppc64.make Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/make/linux/makefiles/ppc64.make Wed Apr 16 09:49:45 2014 -0400 @@ -26,14 +26,26 @@ # make c code know it is on a 64 bit platform. CFLAGS += -D_LP64=1 -# fixes `relocation truncated to fit' error for gcc 4.1. -CFLAGS += -mminimal-toc +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 -# finds use ppc64 instructions, but schedule for power5 -CFLAGS += -mcpu=powerpc64 -mtune=power5 -minsert-sched-nops=regroup_exact -mno-multiple -mno-string +ifeq ($(filter $(OPENJDK_TARGET_CPU_ENDIAN),big little),) + $(error OPENJDK_TARGET_CPU_ENDIAN value should be 'big' or 'little') +endif -# let linker find external 64 bit libs. -LFLAGS_VM += -L/lib64 +ifeq ($(OPENJDK_TARGET_CPU_ENDIAN),big) + # fixes `relocation truncated to fit' error for gcc 4.1. + CFLAGS += -mminimal-toc -# specify lib format. -LFLAGS_VM += -Wl,-melf64ppc + # 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
--- a/hotspot/make/windows/makefiles/defs.make Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/make/windows/makefiles/defs.make Wed Apr 16 09:49:45 2014 -0400 @@ -260,7 +260,6 @@ EXPORT_LIST += $(EXPORT_SERVER_DIR)/jvm.map endif endif - EXPORT_LIST += $(EXPORT_LIB_DIR)/jvm.lib endif ifeq ($(JVM_VARIANT_CLIENT),true) EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt @@ -275,6 +274,8 @@ endif endif +EXPORT_LIST += $(EXPORT_LIB_DIR)/jvm.lib + ifeq ($(BUILD_WIN_SA), 1) EXPORT_LIST += $(EXPORT_JRE_BIN_DIR)/sawindbg.$(LIBRARY_SUFFIX) ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
--- a/hotspot/src/cpu/ppc/vm/assembler_ppc.cpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/ppc/vm/assembler_ppc.cpp Wed Apr 16 09:49:45 2014 -0400 @@ -1,6 +1,6 @@ /* * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. - * Copyright 2012, 2013 SAP AG. All rights reserved. + * Copyright 2012, 2014 SAP AG. All rights reserved. * 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,6 @@ */ #include "precompiled.hpp" -#include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "gc_interface/collectedHeap.inline.hpp" #include "interpreter/interpreter.hpp" @@ -37,6 +36,7 @@ #include "runtime/os.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/stubRoutines.hpp" +#include "utilities/macros.hpp" #if INCLUDE_ALL_GCS #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" @@ -384,10 +384,10 @@ bool load_xa = (xa != 0) || (xb < 0); bool return_xd = false; - if (load_xa) lis(tmp, xa); - if (xc) lis(d, xc); + if (load_xa) { lis(tmp, xa); } + if (xc) { lis(d, xc); } if (load_xa) { - if (xb) ori(tmp, tmp, xb); // No addi, we support tmp == R0. + if (xb) { ori(tmp, tmp, (unsigned short)xb); } // No addi, we support tmp == R0. } else { li(tmp, xb); // non-negative } @@ -409,18 +409,18 @@ // opt 4: avoid adding 0 if (xa) { // Highest 16-bit needed? lis(d, xa); - if (xb) addi(d, d, xb); + if (xb) { addi(d, d, xb); } } else { li(d, xb); } sldi(d, d, 32); - if (xc) addis(d, d, xc); + if (xc) { addis(d, d, xc); } } // opt 5: Return offset to be inserted into following instruction. if (return_simm16_rest) return xd; - if (xd) addi(d, d, xd); + if (xd) { addi(d, d, xd); } return 0; } @@ -696,4 +696,5 @@ tty->print_cr("\ntest_asm disassembly (0x%lx 0x%lx):", code()->insts_begin(), code()->insts_end()); code()->decode(); } + #endif // !PRODUCT
--- a/hotspot/src/cpu/ppc/vm/assembler_ppc.hpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/ppc/vm/assembler_ppc.hpp Wed Apr 16 09:49:45 2014 -0400 @@ -1025,15 +1025,14 @@ } static void set_imm(int* instr, short s) { - short* p = ((short *)instr) + 1; - *p = s; + // imm is always in the lower 16 bits of the instruction, + // so this is endian-neutral. Same for the get_imm below. + uint32_t w = *(uint32_t *)instr; + *instr = (int)((w & ~0x0000FFFF) | (s & 0x0000FFFF)); } static int get_imm(address a, int instruction_number) { - short imm; - short *p =((short *)a)+2*instruction_number+1; - imm = *p; - return (int)imm; + return (short)((int *)a)[instruction_number]; } static inline int hi16_signed( int x) { return (int)(int16_t)(x >> 16); }
--- a/hotspot/src/cpu/ppc/vm/assembler_ppc.inline.hpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/ppc/vm/assembler_ppc.inline.hpp Wed Apr 16 09:49:45 2014 -0400 @@ -1,6 +1,6 @@ /* * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. - * Copyright 2012, 2013 SAP AG. All rights reserved. + * Copyright 2012, 2014 SAP AG. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -139,7 +139,8 @@ inline void Assembler::cmplw( ConditionRegister crx, Register a, Register b) { Assembler::cmpl( crx, 0, a, b); } inline void Assembler::cmpld( ConditionRegister crx, Register a, Register b) { Assembler::cmpl( crx, 1, a, b); } -inline void Assembler::isel(Register d, Register a, Register b, int c) { emit_int32(ISEL_OPCODE | rt(d) | ra(a) | rb(b) | bc(c)); } +inline void Assembler::isel(Register d, Register a, Register b, int c) { guarantee(VM_Version::has_isel(), "opcode not supported on this hardware"); + emit_int32(ISEL_OPCODE | rt(d) | ra(a) | rb(b) | bc(c)); } // PPC 1, section 3.3.11, Fixed-Point Logical Instructions inline void Assembler::andi_( Register a, Register s, int ui16) { emit_int32(ANDI_OPCODE | rta(a) | rs(s) | uimm(ui16, 16)); } @@ -531,9 +532,12 @@ //inline void Assembler::mffgpr( FloatRegister d, Register b) { emit_int32( MFFGPR_OPCODE | frt(d) | rb(b) | rc(0)); } //inline void Assembler::mftgpr( Register d, FloatRegister b) { emit_int32( MFTGPR_OPCODE | rt(d) | frb(b) | rc(0)); } // add cmpb and popcntb to detect ppc power version. -inline void Assembler::cmpb( Register a, Register s, Register b) { emit_int32( CMPB_OPCODE | rta(a) | rs(s) | rb(b) | rc(0)); } -inline void Assembler::popcntb(Register a, Register s) { emit_int32( POPCNTB_OPCODE | rta(a) | rs(s)); }; -inline void Assembler::popcntw(Register a, Register s) { emit_int32( POPCNTW_OPCODE | rta(a) | rs(s)); }; +inline void Assembler::cmpb( Register a, Register s, Register b) { guarantee(VM_Version::has_cmpb(), "opcode not supported on this hardware"); + emit_int32( CMPB_OPCODE | rta(a) | rs(s) | rb(b) | rc(0)); } +inline void Assembler::popcntb(Register a, Register s) { guarantee(VM_Version::has_popcntb(), "opcode not supported on this hardware"); + emit_int32( POPCNTB_OPCODE | rta(a) | rs(s)); }; +inline void Assembler::popcntw(Register a, Register s) { guarantee(VM_Version::has_popcntw(), "opcode not supported on this hardware"); + emit_int32( POPCNTW_OPCODE | rta(a) | rs(s)); }; inline void Assembler::popcntd(Register a, Register s) { emit_int32( POPCNTD_OPCODE | rta(a) | rs(s)); }; inline void Assembler::fneg( FloatRegister d, FloatRegister b) { emit_int32( FNEG_OPCODE | frt(d) | frb(b) | rc(0)); } @@ -568,14 +572,17 @@ inline void Assembler::fctiw( FloatRegister d, FloatRegister b) { emit_int32( FCTIW_OPCODE | frt(d) | frb(b) | rc(0)); } inline void Assembler::fctiwz(FloatRegister d, FloatRegister b) { emit_int32( FCTIWZ_OPCODE | frt(d) | frb(b) | rc(0)); } inline void Assembler::fcfid( FloatRegister d, FloatRegister b) { emit_int32( FCFID_OPCODE | frt(d) | frb(b) | rc(0)); } -inline void Assembler::fcfids(FloatRegister d, FloatRegister b) { emit_int32( FCFIDS_OPCODE | frt(d) | frb(b) | rc(0)); } +inline void Assembler::fcfids(FloatRegister d, FloatRegister b) { guarantee(VM_Version::has_fcfids(), "opcode not supported on this hardware"); + emit_int32( FCFIDS_OPCODE | frt(d) | frb(b) | rc(0)); } // PPC 1, section 4.6.7 Floating-Point Compare Instructions inline void Assembler::fcmpu( ConditionRegister crx, FloatRegister a, FloatRegister b) { emit_int32( FCMPU_OPCODE | bf(crx) | fra(a) | frb(b)); } // PPC 1, section 5.2.1 Floating-Point Arithmetic Instructions -inline void Assembler::fsqrt( FloatRegister d, FloatRegister b) { emit_int32( FSQRT_OPCODE | frt(d) | frb(b) | rc(0)); } -inline void Assembler::fsqrts(FloatRegister d, FloatRegister b) { emit_int32( FSQRTS_OPCODE | frt(d) | frb(b) | rc(0)); } +inline void Assembler::fsqrt( FloatRegister d, FloatRegister b) { guarantee(VM_Version::has_fsqrt(), "opcode not supported on this hardware"); + emit_int32( FSQRT_OPCODE | frt(d) | frb(b) | rc(0)); } +inline void Assembler::fsqrts(FloatRegister d, FloatRegister b) { guarantee(VM_Version::has_fsqrts(), "opcode not supported on this hardware"); + emit_int32( FSQRTS_OPCODE | frt(d) | frb(b) | rc(0)); } // Vector instructions for >= Power6. inline void Assembler::lvebx( VectorRegister d, Register s1, Register s2) { emit_int32( LVEBX_OPCODE | vrt(d) | ra0mem(s1) | rb(s2)); } @@ -703,7 +710,8 @@ inline void Assembler::vcmpgtub_(VectorRegister d,VectorRegister a, VectorRegister b) { emit_int32( VCMPGTUB_OPCODE | vrt(d) | vra(a) | vrb(b) | vcmp_rc(1)); } inline void Assembler::vcmpgtuh_(VectorRegister d,VectorRegister a, VectorRegister b) { emit_int32( VCMPGTUH_OPCODE | vrt(d) | vra(a) | vrb(b) | vcmp_rc(1)); } inline void Assembler::vcmpgtuw_(VectorRegister d,VectorRegister a, VectorRegister b) { emit_int32( VCMPGTUW_OPCODE | vrt(d) | vra(a) | vrb(b) | vcmp_rc(1)); } -inline void Assembler::vand( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VAND_OPCODE | vrt(d) | vra(a) | vrb(b)); } +inline void Assembler::vand( VectorRegister d, VectorRegister a, VectorRegister b) { guarantee(VM_Version::has_vand(), "opcode not supported on this hardware"); + emit_int32( VAND_OPCODE | vrt(d) | vra(a) | vrb(b)); } inline void Assembler::vandc( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VANDC_OPCODE | vrt(d) | vra(a) | vrb(b)); } inline void Assembler::vnor( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VNOR_OPCODE | vrt(d) | vra(a) | vrb(b)); } inline void Assembler::vor( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VOR_OPCODE | vrt(d) | vra(a) | vrb(b)); }
--- a/hotspot/src/cpu/ppc/vm/bytes_ppc.hpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/ppc/vm/bytes_ppc.hpp Wed Apr 16 09:49:45 2014 -0400 @@ -35,6 +35,126 @@ // Can I count on address always being a pointer to an unsigned char? Yes. +#if defined(VM_LITTLE_ENDIAN) + + // Returns true, if the byte ordering used by Java is different from the native byte ordering + // of the underlying machine. For example, true for Intel x86, False, for Solaris on Sparc. + static inline bool is_Java_byte_ordering_different() { return true; } + + // Forward declarations of the compiler-dependent implementation + static inline u2 swap_u2(u2 x); + static inline u4 swap_u4(u4 x); + static inline u8 swap_u8(u8 x); + + static inline u2 get_native_u2(address p) { + return (intptr_t(p) & 1) == 0 + ? *(u2*)p + : ( u2(p[1]) << 8 ) + | ( u2(p[0]) ); + } + + static inline u4 get_native_u4(address p) { + switch (intptr_t(p) & 3) { + case 0: return *(u4*)p; + + case 2: return ( u4( ((u2*)p)[1] ) << 16 ) + | ( u4( ((u2*)p)[0] ) ); + + default: return ( u4(p[3]) << 24 ) + | ( u4(p[2]) << 16 ) + | ( u4(p[1]) << 8 ) + | u4(p[0]); + } + } + + static inline u8 get_native_u8(address p) { + switch (intptr_t(p) & 7) { + case 0: return *(u8*)p; + + case 4: return ( u8( ((u4*)p)[1] ) << 32 ) + | ( u8( ((u4*)p)[0] ) ); + + case 2: return ( u8( ((u2*)p)[3] ) << 48 ) + | ( u8( ((u2*)p)[2] ) << 32 ) + | ( u8( ((u2*)p)[1] ) << 16 ) + | ( u8( ((u2*)p)[0] ) ); + + default: return ( u8(p[7]) << 56 ) + | ( u8(p[6]) << 48 ) + | ( u8(p[5]) << 40 ) + | ( u8(p[4]) << 32 ) + | ( u8(p[3]) << 24 ) + | ( u8(p[2]) << 16 ) + | ( u8(p[1]) << 8 ) + | u8(p[0]); + } + } + + + + static inline void put_native_u2(address p, u2 x) { + if ( (intptr_t(p) & 1) == 0 ) *(u2*)p = x; + else { + p[1] = x >> 8; + p[0] = x; + } + } + + static inline void put_native_u4(address p, u4 x) { + switch ( intptr_t(p) & 3 ) { + case 0: *(u4*)p = x; + break; + + case 2: ((u2*)p)[1] = x >> 16; + ((u2*)p)[0] = x; + break; + + default: ((u1*)p)[3] = x >> 24; + ((u1*)p)[2] = x >> 16; + ((u1*)p)[1] = x >> 8; + ((u1*)p)[0] = x; + break; + } + } + + static inline void put_native_u8(address p, u8 x) { + switch ( intptr_t(p) & 7 ) { + case 0: *(u8*)p = x; + break; + + case 4: ((u4*)p)[1] = x >> 32; + ((u4*)p)[0] = x; + break; + + case 2: ((u2*)p)[3] = x >> 48; + ((u2*)p)[2] = x >> 32; + ((u2*)p)[1] = x >> 16; + ((u2*)p)[0] = x; + break; + + default: ((u1*)p)[7] = x >> 56; + ((u1*)p)[6] = x >> 48; + ((u1*)p)[5] = x >> 40; + ((u1*)p)[4] = x >> 32; + ((u1*)p)[3] = x >> 24; + ((u1*)p)[2] = x >> 16; + ((u1*)p)[1] = x >> 8; + ((u1*)p)[0] = x; + } + } + + // Efficient reading and writing of unaligned unsigned data in Java byte ordering (i.e. big-endian ordering) + // (no byte-order reversal is needed since Power CPUs are big-endian oriented). + static inline u2 get_Java_u2(address p) { return swap_u2(get_native_u2(p)); } + static inline u4 get_Java_u4(address p) { return swap_u4(get_native_u4(p)); } + static inline u8 get_Java_u8(address p) { return swap_u8(get_native_u8(p)); } + + static inline void put_Java_u2(address p, u2 x) { put_native_u2(p, swap_u2(x)); } + static inline void put_Java_u4(address p, u4 x) { put_native_u4(p, swap_u4(x)); } + static inline void put_Java_u8(address p, u8 x) { put_native_u8(p, swap_u8(x)); } + +#else // !defined(VM_LITTLE_ENDIAN) + // Returns true, if the byte ordering used by Java is different from the nativ byte ordering // of the underlying machine. For example, true for Intel x86, False, for Solaris on Sparc. static inline bool is_Java_byte_ordering_different() { return false; } @@ -150,6 +270,12 @@ static inline void put_Java_u2(address p, u2 x) { put_native_u2(p, x); } static inline void put_Java_u4(address p, u4 x) { put_native_u4(p, x); } static inline void put_Java_u8(address p, u8 x) { put_native_u8(p, x); } + +#endif // VM_LITTLE_ENDIAN }; +#if defined(TARGET_OS_ARCH_linux_ppc) +#include "bytes_linux_ppc.inline.hpp" +#endif + #endif // CPU_PPC_VM_BYTES_PPC_HPP
--- a/hotspot/src/cpu/ppc/vm/c2_globals_ppc.hpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/ppc/vm/c2_globals_ppc.hpp Wed Apr 16 09:49:45 2014 -0400 @@ -1,6 +1,6 @@ /* * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. - * Copyright 2012, 2013 SAP AG. All rights reserved. + * Copyright 2012, 2014 SAP AG. All rights reserved. * 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,7 +87,7 @@ define_pd_global(uintx, CodeCacheMinBlockLength, 4); define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K); -define_pd_global(bool, TrapBasedRangeChecks, false); +define_pd_global(bool, TrapBasedRangeChecks, true); // Heap related flags define_pd_global(uintx,MetaspaceSize, ScaleForWordSize(16*M));
--- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp Wed Apr 16 09:49:45 2014 -0400 @@ -1,6 +1,6 @@ /* * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. - * Copyright 2012, 2013 SAP AG. All rights reserved. + * Copyright 2012, 2014 SAP AG. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,6 @@ */ #include "precompiled.hpp" -#include "asm/assembler.hpp" -#include "asm/assembler.inline.hpp" #include "asm/macroAssembler.inline.hpp" #include "compiler/disassembler.hpp" #include "gc_interface/collectedHeap.inline.hpp" @@ -1120,7 +1118,7 @@ } return _last_calls_return_pc; } -#endif +#endif // ABI_ELFv2 void MacroAssembler::call_VM_base(Register oop_result, Register last_java_sp, @@ -1794,7 +1792,7 @@ cmpwi(cr_reg, temp_reg, markOopDesc::biased_lock_pattern); bne(cr_reg, cas_label); - load_klass_with_trap_null_check(temp_reg, obj_reg); + load_klass(temp_reg, obj_reg); load_const_optimized(temp2_reg, ~((int) markOopDesc::age_mask_in_place)); ld(temp_reg, in_bytes(Klass::prototype_header_offset()), temp_reg); @@ -1891,7 +1889,7 @@ // the bias from one thread to another directly in this situation. andi(temp_reg, mark_reg, markOopDesc::age_mask_in_place); orr(temp_reg, R16_thread, temp_reg); - load_klass_with_trap_null_check(temp2_reg, obj_reg); + load_klass(temp2_reg, obj_reg); ld(temp2_reg, in_bytes(Klass::prototype_header_offset()), temp2_reg); orr(temp_reg, temp_reg, temp2_reg); @@ -1927,7 +1925,7 @@ // that another thread raced us for the privilege of revoking the // bias of this particular object, so it's okay to continue in the // normal locking code. - load_klass_with_trap_null_check(temp_reg, obj_reg); + load_klass(temp_reg, obj_reg); ld(temp_reg, in_bytes(Klass::prototype_header_offset()), temp_reg); andi(temp2_reg, mark_reg, markOopDesc::age_mask_in_place); orr(temp_reg, temp_reg, temp2_reg); @@ -2213,8 +2211,7 @@ stbx(R0, Rtmp, Robj); } -#ifndef SERIALGC - +#if INCLUDE_ALL_GCS // General G1 pre-barrier generator. // Goal: record the previous value if it is not null. void MacroAssembler::g1_write_barrier_pre(Register Robj, RegisterOrConstant offset, Register Rpre_val, @@ -2328,14 +2325,17 @@ // Get the address of the card. lbzx(/*card value*/ Rtmp3, Rbase, Rcard_addr); - - assert(CardTableModRefBS::dirty_card_val() == 0, "otherwise check this code"); - cmpwi(CCR0, Rtmp3 /* card value */, 0); + cmpwi(CCR0, Rtmp3, (int)G1SATBCardTableModRefBS::g1_young_card_val()); + beq(CCR0, filtered); + + membar(Assembler::StoreLoad); + lbzx(/*card value*/ Rtmp3, Rbase, Rcard_addr); // Reload after membar. + cmpwi(CCR0, Rtmp3 /* card value */, CardTableModRefBS::dirty_card_val()); beq(CCR0, filtered); // Storing a region crossing, non-NULL oop, card is clean. // Dirty card and log. - li(Rtmp3, 0); // dirty + li(Rtmp3, CardTableModRefBS::dirty_card_val()); //release(); // G1: oops are allowed to get visible after dirty marking. stbx(Rtmp3, Rbase, Rcard_addr); @@ -2362,7 +2362,7 @@ bind(filtered_int); } -#endif // SERIALGC +#endif // INCLUDE_ALL_GCS // Values for last_Java_pc, and last_Java_sp must comply to the rules // in frame_ppc64.hpp. @@ -2453,7 +2453,8 @@ void MacroAssembler::encode_klass_not_null(Register dst, Register src) { Register current = (src != noreg) ? src : dst; // Klass is in dst if no src provided. if (Universe::narrow_klass_base() != 0) { - load_const(R0, Universe::narrow_klass_base(), (dst != current) ? dst : noreg); // Use dst as temp if it is free. + // Use dst as temp if it is free. + load_const(R0, Universe::narrow_klass_base(), (dst != current && dst != R0) ? dst : noreg); sub(dst, current, R0); current = dst; }
--- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp Wed Apr 16 09:49:45 2014 -0400 @@ -514,14 +514,14 @@ void card_write_barrier_post(Register Rstore_addr, Register Rnew_val, Register Rtmp); void card_table_write(jbyte* byte_map_base, Register Rtmp, Register Robj); -#ifndef SERIALGC +#if INCLUDE_ALL_GCS // General G1 pre-barrier generator. void g1_write_barrier_pre(Register Robj, RegisterOrConstant offset, Register Rpre_val, Register Rtmp1, Register Rtmp2, bool needs_frame = false); // General G1 post-barrier generator void g1_write_barrier_post(Register Rstore_addr, Register Rnew_val, Register Rtmp1, Register Rtmp2, Register Rtmp3, Label *filtered_ext = NULL); -#endif // SERIALGC +#endif // Support for managing the JavaThread pointer (i.e.; the reference to // thread-local information).
--- a/hotspot/src/cpu/ppc/vm/methodHandles_ppc.cpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/ppc/vm/methodHandles_ppc.cpp Wed Apr 16 09:49:45 2014 -0400 @@ -1,6 +1,6 @@ /* * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. - * Copyright 2012, 2013 SAP AG. All rights reserved. + * Copyright 2012, 2014 SAP AG. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -119,6 +119,7 @@ void MethodHandles::jump_from_method_handle(MacroAssembler* _masm, Register method, Register target, Register temp, bool for_compiler_entry) { + Label L_no_such_method; assert(method == R19_method, "interpreter calling convention"); assert_different_registers(method, target, temp); @@ -131,17 +132,31 @@ __ lwz(temp, in_bytes(JavaThread::interp_only_mode_offset()), R16_thread); __ cmplwi(CCR0, temp, 0); __ beq(CCR0, run_compiled_code); + // Null method test is replicated below in compiled case, + // it might be able to address across the verify_thread() + __ cmplwi(CCR0, R19_method, 0); + __ beq(CCR0, L_no_such_method); __ ld(target, in_bytes(Method::interpreter_entry_offset()), R19_method); __ mtctr(target); __ bctr(); __ BIND(run_compiled_code); } + // Compiled case, either static or fall-through from runtime conditional + __ cmplwi(CCR0, R19_method, 0); + __ beq(CCR0, L_no_such_method); + const ByteSize entry_offset = for_compiler_entry ? Method::from_compiled_offset() : Method::from_interpreted_offset(); __ ld(target, in_bytes(entry_offset), R19_method); __ mtctr(target); __ bctr(); + + __ bind(L_no_such_method); + assert(StubRoutines::throw_AbstractMethodError_entry() != NULL, "not yet generated!"); + __ load_const_optimized(target, StubRoutines::throw_AbstractMethodError_entry()); + __ mtctr(target); + __ bctr(); }
--- a/hotspot/src/cpu/ppc/vm/ppc.ad Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/ppc/vm/ppc.ad Wed Apr 16 09:49:45 2014 -0400 @@ -891,6 +891,13 @@ // This is a block of C++ code which provides values, functions, and // definitions necessary in the rest of the architecture description. source_hpp %{ + // Header information of the source block. + // Method declarations/definitions which are used outside + // the ad-scope can conveniently be defined here. + // + // To keep related declarations/definitions/uses close together, + // we switch between source %{ }% and source_hpp %{ }% freely as needed. + // Returns true if Node n is followed by a MemBar node that // will do an acquire. If so, this node must not do the acquire // operation. @@ -1114,6 +1121,40 @@ //============================================================================= +%} // interrupt source + +source_hpp %{ // Header information of the source block. + +//-------------------------------------------------------------- +//---< Used for optimization in Compile::Shorten_branches >--- +//-------------------------------------------------------------- + +const uint trampoline_stub_size = 6 * BytesPerInstWord; + +class CallStubImpl { + + public: + + static void emit_trampoline_stub(MacroAssembler &_masm, int destination_toc_offset, int insts_call_instruction_offset); + + // Size of call trampoline stub. + // This doesn't need to be accurate to the byte, but it + // must be larger than or equal to the real size of the stub. + static uint size_call_trampoline() { + return trampoline_stub_size; + } + + // number of relocations needed by a call trampoline stub + static uint reloc_call_trampoline() { + return 5; + } + +}; + +%} // end source_hpp + +source %{ + // Emit a trampoline stub for a call to a target which is too far away. // // code sequences: @@ -1125,9 +1166,7 @@ // load the call target from the constant pool // branch via CTR (LR/link still points to the call-site above) -const uint trampoline_stub_size = 6 * BytesPerInstWord; - -void emit_trampoline_stub(MacroAssembler &_masm, int destination_toc_offset, int insts_call_instruction_offset) { +void CallStubImpl::emit_trampoline_stub(MacroAssembler &_masm, int destination_toc_offset, int insts_call_instruction_offset) { // Start the stub. address stub = __ start_a_stub(Compile::MAX_stubs_size/2); if (stub == NULL) { @@ -1170,19 +1209,6 @@ __ end_a_stub(); } -// Size of trampoline stub, this doesn't need to be accurate but it must -// be larger or equal to the real size of the stub. -// Used for optimization in Compile::Shorten_branches. -uint size_call_trampoline() { - return trampoline_stub_size; -} - -// Number of relocation entries needed by trampoline stub. -// Used for optimization in Compile::Shorten_branches. -uint reloc_call_trampoline() { - return 5; -} - //============================================================================= // Emit an inline branch-and-link call and a related trampoline stub. @@ -1221,7 +1247,7 @@ const int entry_point_toc_offset = __ offset_to_method_toc(entry_point_toc_addr); // Emit the trampoline stub which will be related to the branch-and-link below. - emit_trampoline_stub(_masm, entry_point_toc_offset, offsets.insts_call_instruction_offset); + CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, offsets.insts_call_instruction_offset); __ relocate(rtype); } @@ -2023,17 +2049,34 @@ //============================================================================= -uint size_exception_handler() { - // The exception_handler is a b64_patchable. - return MacroAssembler::b64_patchable_size; -} - -uint size_deopt_handler() { - // The deopt_handler is a bl64_patchable. - return MacroAssembler::bl64_patchable_size; -} - -int emit_exception_handler(CodeBuffer &cbuf) { +%} // interrupt source + +source_hpp %{ // Header information of the source block. + +class HandlerImpl { + + public: + + static int emit_exception_handler(CodeBuffer &cbuf); + static int emit_deopt_handler(CodeBuffer& cbuf); + + static uint size_exception_handler() { + // The exception_handler is a b64_patchable. + return MacroAssembler::b64_patchable_size; + } + + static uint size_deopt_handler() { + // The deopt_handler is a bl64_patchable. + return MacroAssembler::bl64_patchable_size; + } + +}; + +%} // end source_hpp + +source %{ + +int HandlerImpl::emit_exception_handler(CodeBuffer &cbuf) { MacroAssembler _masm(&cbuf); address base = __ start_a_stub(size_exception_handler()); @@ -2050,7 +2093,7 @@ // The deopt_handler is like the exception handler, but it calls to // the deoptimization blob instead of jumping to the exception blob. -int emit_deopt_handler(CodeBuffer& cbuf) { +int HandlerImpl::emit_deopt_handler(CodeBuffer& cbuf) { MacroAssembler _masm(&cbuf); address base = __ start_a_stub(size_deopt_handler()); @@ -3438,7 +3481,7 @@ const int entry_point_toc_offset = __ offset_to_method_toc(entry_point_toc_addr); // Emit the trampoline stub which will be related to the branch-and-link below. - emit_trampoline_stub(_masm, entry_point_toc_offset, start_offset); + CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, start_offset); __ relocate(_optimized_virtual ? relocInfo::opt_virtual_call_type : relocInfo::static_call_type); } @@ -3481,7 +3524,7 @@ const int entry_point_toc_offset = __ offset_to_method_toc(entry_point_toc_addr); // Emit the trampoline stub which will be related to the branch-and-link below. - emit_trampoline_stub(_masm, entry_point_toc_offset, start_offset); + CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, start_offset); assert(_optimized_virtual, "methodHandle call should be a virtual call"); __ relocate(relocInfo::opt_virtual_call_type); } @@ -3531,7 +3574,7 @@ const address entry_point = !($meth$$method) ? 0 : (address)$meth$$method; const address entry_point_const = __ address_constant(entry_point, RelocationHolder::none); const int entry_point_const_toc_offset = __ offset_to_method_toc(entry_point_const); - emit_trampoline_stub(_masm, entry_point_const_toc_offset, __ offset()); + CallStubImpl::emit_trampoline_stub(_masm, entry_point_const_toc_offset, __ offset()); if (ra_->C->env()->failing()) return; @@ -8755,6 +8798,7 @@ // Single-precision sqrt. instruct sqrtF_reg(regF dst, regF src) %{ match(Set dst (ConvD2F (SqrtD (ConvF2D src)))); + predicate(VM_Version::has_fsqrts()); ins_cost(DEFAULT_COST); format %{ "FSQRTS $dst, $src" %} @@ -11550,8 +11594,7 @@ // effect no longer needs to be mentioned, since r0 is not contained // in a reg_class. - format %{ "LD R12, addr of polling page\n\t" - "LD R0, #0, R12 \t// Safepoint poll for GC" %} + format %{ "LD R0, #0, R12 \t// Safepoint poll for GC" %} ins_encode( enc_poll(0x0, poll) ); ins_pipe(pipe_class_default); %}
--- a/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp Wed Apr 16 09:49:45 2014 -0400 @@ -34,6 +34,7 @@ #include "runtime/sharedRuntime.hpp" #include "runtime/vframeArray.hpp" #include "vmreg_ppc.inline.hpp" +#include "adfiles/ad_ppc_64.hpp" #ifdef COMPILER1 #include "c1/c1_Runtime1.hpp" #endif @@ -52,10 +53,6 @@ #define BIND(label) bind(label); BLOCK_COMMENT(#label ":") -// Used by generate_deopt_blob. Defined in .ad file. -extern uint size_deopt_handler(); - - class RegisterSaver { // Used for saving volatile registers. public: @@ -2782,7 +2779,7 @@ // We can't grab a free register here, because all registers may // contain live values, so let the RegisterSaver do the adjustment // of the return pc. - const int return_pc_adjustment_no_exception = -size_deopt_handler(); + const int return_pc_adjustment_no_exception = -HandlerImpl::size_deopt_handler(); // Push the "unpack frame" // Save everything in sight.
--- a/hotspot/src/cpu/ppc/vm/stubRoutines_ppc_64.cpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/ppc/vm/stubRoutines_ppc_64.cpp Wed Apr 16 09:49:45 2014 -0400 @@ -1,6 +1,6 @@ /* * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. - * Copyright 2012, 2013 SAP AG. All rights reserved. + * Copyright 2012, 2014 SAP AG. All rights reserved. * 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,6 @@ * */ -#include "precompiled.hpp" -#include "runtime/deoptimization.hpp" -#include "runtime/frame.inline.hpp" -#include "runtime/stubRoutines.hpp" -#ifdef TARGET_OS_FAMILY_aix -# include "thread_aix.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_linux -# include "thread_linux.inline.hpp" -#endif - // Implementation of the platform-specific part of StubRoutines - for // a description of how to extend it, see the stubRoutines.hpp file.
--- a/hotspot/src/cpu/ppc/vm/templateInterpreter_ppc.cpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/ppc/vm/templateInterpreter_ppc.cpp Wed Apr 16 09:49:45 2014 -0400 @@ -1672,7 +1672,7 @@ //__ flush_bundle(); address entry = __ pc(); - char *bname = NULL; + const char *bname = NULL; uint tsize = 0; switch(state) { case ftos:
--- a/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp Wed Apr 16 09:49:45 2014 -0400 @@ -1,6 +1,6 @@ /* * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. - * Copyright 2012, 2013 SAP AG. All rights reserved. + * Copyright 2012, 2014 SAP AG. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -402,6 +402,9 @@ CodeBuffer cb("detect_cpu_features", code_size, 0); MacroAssembler* a = new MacroAssembler(&cb); + // Must be set to true so we can generate the test code. + _features = VM_Version::all_features_m; + // Emit code. void (*test)(address addr, uint64_t offset)=(void(*)(address addr, uint64_t offset))(void *)a->function_entry(); uint32_t *code = (uint32_t *)a->pc(); @@ -409,14 +412,15 @@ // Keep R3_ARG1 unmodified, it contains &field (see below). // Keep R4_ARG2 unmodified, it contains offset = 0 (see below). a->fsqrt(F3, F4); // code[0] -> fsqrt_m - a->isel(R7, R5, R6, 0); // code[1] -> isel_m - a->ldarx_unchecked(R7, R3_ARG1, R4_ARG2, 1); // code[2] -> lxarx_m - a->cmpb(R7, R5, R6); // code[3] -> bcmp - //a->mftgpr(R7, F3); // code[4] -> mftgpr - a->popcntb(R7, R5); // code[5] -> popcntb - a->popcntw(R7, R5); // code[6] -> popcntw - a->fcfids(F3, F4); // code[7] -> fcfids - a->vand(VR0, VR0, VR0); // code[8] -> vand + a->fsqrts(F3, F4); // code[1] -> fsqrts_m + a->isel(R7, R5, R6, 0); // code[2] -> isel_m + a->ldarx_unchecked(R7, R3_ARG1, R4_ARG2, 1); // code[3] -> lxarx_m + a->cmpb(R7, R5, R6); // code[4] -> bcmp + //a->mftgpr(R7, F3); // code[5] -> mftgpr + a->popcntb(R7, R5); // code[6] -> popcntb + a->popcntw(R7, R5); // code[7] -> popcntw + a->fcfids(F3, F4); // code[8] -> fcfids + a->vand(VR0, VR0, VR0); // code[9] -> vand a->blr(); // Emit function to set one cache line to zero. Emit function descriptor and get pointer to it. @@ -426,6 +430,7 @@ uint32_t *code_end = (uint32_t *)a->pc(); a->flush(); + _features = VM_Version::unknown_m; // Print the detection code. if (PrintAssembly) { @@ -450,6 +455,7 @@ // determine which instructions are legal. int feature_cntr = 0; if (code[feature_cntr++]) features |= fsqrt_m; + if (code[feature_cntr++]) features |= fsqrts_m; if (code[feature_cntr++]) features |= isel_m; if (code[feature_cntr++]) features |= lxarxeh_m; if (code[feature_cntr++]) features |= cmpb_m;
--- a/hotspot/src/cpu/ppc/vm/vm_version_ppc.hpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/ppc/vm/vm_version_ppc.hpp Wed Apr 16 09:49:45 2014 -0400 @@ -1,6 +1,6 @@ /* * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. - * Copyright 2012, 2013 SAP AG. All rights reserved. + * Copyright 2012, 2014 SAP AG. All rights reserved. * 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,7 @@ protected: enum Feature_Flag { fsqrt, + fsqrts, isel, lxarxeh, cmpb, @@ -46,6 +47,7 @@ enum Feature_Flag_Set { unknown_m = 0, fsqrt_m = (1 << fsqrt ), + fsqrts_m = (1 << fsqrts ), isel_m = (1 << isel ), lxarxeh_m = (1 << lxarxeh), cmpb_m = (1 << cmpb ), @@ -72,6 +74,7 @@ static bool is_determine_features_test_running() { return _is_determine_features_test_running; } // CPU instruction support static bool has_fsqrt() { return (_features & fsqrt_m) != 0; } + static bool has_fsqrts() { return (_features & fsqrts_m) != 0; } static bool has_isel() { return (_features & isel_m) != 0; } static bool has_lxarxeh() { return (_features & lxarxeh_m) !=0; } static bool has_cmpb() { return (_features & cmpb_m) != 0; }
--- a/hotspot/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp Wed Apr 16 09:49:45 2014 -0400 @@ -1,6 +1,6 @@ /* * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. - * Copyright 2012, 2013 SAP AG. All rights reserved. + * Copyright 2012, 2014 SAP AG. All rights reserved. * 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 @@ address npe_addr = __ pc(); // npe = null pointer exception __ load_klass_with_trap_null_check(rcvr_klass, R3); - // Set methodOop (in case of interpreted method), and destination address. + // Set method (in case of interpreted method), and destination address. int entry_offset = InstanceKlass::vtable_start_offset() + vtable_index*vtableEntry::size(); #ifndef PRODUCT @@ -161,8 +161,6 @@ address npe_addr = __ pc(); // npe = null pointer exception __ load_klass_with_trap_null_check(rcvr_klass, R3_ARG1); - //__ ld(rcvr_klass, oopDesc::klass_offset_in_bytes(), R3_ARG1); - BLOCK_COMMENT("Load start of itable entries into itable_entry."); __ lwz(vtable_len, InstanceKlass::vtable_length_offset() * wordSize, rcvr_klass); __ slwi(vtable_len, vtable_len, exact_log2(vtableEntry::size() * wordSize)); @@ -199,7 +197,7 @@ itable_offset_search_inc; __ lwz(vtable_offset, vtable_offset_offset, itable_entry_addr); - // Compute itableMethodEntry and get methodOop and entry point for compiler. + // Compute itableMethodEntry and get method and entry point for compiler. const int method_offset = (itableMethodEntry::size() * wordSize * vtable_index) + itableMethodEntry::method_offset_in_bytes(); @@ -211,7 +209,7 @@ Label ok; __ cmpd(CCR0, R19_method, 0); __ bne(CCR0, ok); - __ stop("methodOop is null", 103); + __ stop("method is null", 103); __ bind(ok); } #endif
--- a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Wed Apr 16 09:49:45 2014 -0400 @@ -3320,7 +3320,7 @@ // if tmp is invalid, then the function being called doesn't destroy the thread if (tmp->is_valid()) { - __ save_thread(tmp->as_register()); + __ save_thread(tmp->as_pointer_register()); } __ call(dest, relocInfo::runtime_call_type); __ delayed()->nop(); @@ -3328,7 +3328,7 @@ add_call_info_here(info); } if (tmp->is_valid()) { - __ restore_thread(tmp->as_register()); + __ restore_thread(tmp->as_pointer_register()); } #ifdef ASSERT
--- a/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp Wed Apr 16 09:49:45 2014 -0400 @@ -69,7 +69,7 @@ LIR_Opr LIRGenerator::exceptionOopOpr() { return FrameMap::Oexception_opr; } LIR_Opr LIRGenerator::exceptionPcOpr() { return FrameMap::Oissuing_pc_opr; } LIR_Opr LIRGenerator::syncTempOpr() { return new_register(T_OBJECT); } -LIR_Opr LIRGenerator::getThreadTemp() { return rlock_callee_saved(T_INT); } +LIR_Opr LIRGenerator::getThreadTemp() { return rlock_callee_saved(NOT_LP64(T_INT) LP64_ONLY(T_LONG)); } LIR_Opr LIRGenerator::result_register_for(ValueType* type, bool callee) { LIR_Opr opr;
--- a/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp Wed Apr 16 09:49:45 2014 -0400 @@ -66,6 +66,4 @@ define_pd_global(bool, CSEArrayLength, true ); define_pd_global(bool, TwoOperandLIRForm, false); -define_pd_global(intx, SafepointPollOffset, 0 ); - #endif // CPU_SPARC_VM_C1_GLOBALS_SPARC_HPP
--- a/hotspot/src/cpu/sparc/vm/sparc.ad Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/sparc/vm/sparc.ad Wed Apr 16 09:49:45 2014 -0400 @@ -457,6 +457,13 @@ // This is a block of C++ code which provides values, functions, and // definitions necessary in the rest of the architecture description source_hpp %{ +// Header information of the source block. +// Method declarations/definitions which are used outside +// the ad-scope can conveniently be defined here. +// +// To keep related declarations/definitions/uses close together, +// we switch between source %{ }% and source_hpp %{ }% freely as needed. + // Must be visible to the DFA in dfa_sparc.cpp extern bool can_branch_register( Node *bol, Node *cmp ); @@ -468,6 +475,46 @@ #define LONG_HI_REG(x) (x) #define LONG_LO_REG(x) (x) +class CallStubImpl { + + //-------------------------------------------------------------- + //---< Used for optimization in Compile::Shorten_branches >--- + //-------------------------------------------------------------- + + public: + // Size of call trampoline stub. + static uint size_call_trampoline() { + return 0; // no call trampolines on this platform + } + + // number of relocations needed by a call trampoline stub + static uint reloc_call_trampoline() { + return 0; // no call trampolines on this platform + } +}; + +class HandlerImpl { + + public: + + static int emit_exception_handler(CodeBuffer &cbuf); + static int emit_deopt_handler(CodeBuffer& cbuf); + + static uint size_exception_handler() { + if (TraceJumps) { + return (400); // just a guess + } + return ( NativeJump::instruction_size ); // sethi;jmp;nop + } + + static uint size_deopt_handler() { + if (TraceJumps) { + return (400); // just a guess + } + return ( 4+ NativeJump::instruction_size ); // save;sethi;jmp;restore + } +}; + %} source %{ @@ -1710,22 +1757,9 @@ //============================================================================= -uint size_exception_handler() { - if (TraceJumps) { - return (400); // just a guess - } - return ( NativeJump::instruction_size ); // sethi;jmp;nop -} - -uint size_deopt_handler() { - if (TraceJumps) { - return (400); // just a guess - } - return ( 4+ NativeJump::instruction_size ); // save;sethi;jmp;restore -} // Emit exception handler code. -int emit_exception_handler(CodeBuffer& cbuf) { +int HandlerImpl::emit_exception_handler(CodeBuffer& cbuf) { Register temp_reg = G3; AddressLiteral exception_blob(OptoRuntime::exception_blob()->entry_point()); MacroAssembler _masm(&cbuf); @@ -1746,7 +1780,7 @@ return offset; } -int emit_deopt_handler(CodeBuffer& cbuf) { +int HandlerImpl::emit_deopt_handler(CodeBuffer& cbuf) { // Can't use any of the current frame's registers as we may have deopted // at a poll and everything (including G3) can be live. Register temp_reg = L0;
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp Wed Apr 16 09:49:45 2014 -0400 @@ -1112,7 +1112,6 @@ } void Assembler::bsrl(Register dst, Register src) { - assert(!VM_Version::supports_lzcnt(), "encoding is treated as LZCNT"); int encode = prefix_and_encode(dst->encoding(), src->encoding()); emit_int8(0x0F); emit_int8((unsigned char)0xBD); @@ -2343,6 +2342,11 @@ emit_int8(imm8); } +void Assembler::pause() { + emit_int8((unsigned char)0xF3); + emit_int8((unsigned char)0x90); +} + void Assembler::pcmpestri(XMMRegister dst, Address src, int imm8) { assert(VM_Version::supports_sse4_2(), ""); InstructionMark im(this); @@ -2667,6 +2671,11 @@ } } +void Assembler::rdtsc() { + emit_int8((unsigned char)0x0F); + emit_int8((unsigned char)0x31); +} + // copies data from [esi] to [edi] using rcx pointer sized words // generic void Assembler::rep_mov() { @@ -2976,6 +2985,11 @@ emit_simd_arith_nonds(0x2E, dst, src, VEX_SIMD_NONE); } +void Assembler::xabort(int8_t imm8) { + emit_int8((unsigned char)0xC6); + emit_int8((unsigned char)0xF8); + emit_int8((unsigned char)(imm8 & 0xFF)); +} void Assembler::xaddl(Address dst, Register src) { InstructionMark im(this); @@ -2985,6 +2999,24 @@ emit_operand(src, dst); } +void Assembler::xbegin(Label& abort, relocInfo::relocType rtype) { + InstructionMark im(this); + relocate(rtype); + if (abort.is_bound()) { + address entry = target(abort); + assert(entry != NULL, "abort entry NULL"); + intptr_t offset = entry - pc(); + emit_int8((unsigned char)0xC7); + emit_int8((unsigned char)0xF8); + emit_int32(offset - 6); // 2 opcode + 4 address + } else { + abort.add_patch_at(code(), locator()); + emit_int8((unsigned char)0xC7); + emit_int8((unsigned char)0xF8); + emit_int32(0); + } +} + void Assembler::xchgl(Register dst, Address src) { // xchg InstructionMark im(this); prefix(src, dst); @@ -2998,6 +3030,12 @@ emit_int8((unsigned char)(0xC0 | encode)); } +void Assembler::xend() { + emit_int8((unsigned char)0x0F); + emit_int8((unsigned char)0x01); + emit_int8((unsigned char)0xD5); +} + void Assembler::xgetbv() { emit_int8(0x0F); emit_int8(0x01); @@ -4938,7 +4976,6 @@ } void Assembler::bsrq(Register dst, Register src) { - assert(!VM_Version::supports_lzcnt(), "encoding is treated as LZCNT"); int encode = prefixq_and_encode(dst->encoding(), src->encoding()); emit_int8(0x0F); emit_int8((unsigned char)0xBD);
--- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp Wed Apr 16 09:49:45 2014 -0400 @@ -1451,6 +1451,8 @@ // Pemutation of 64bit words void vpermq(XMMRegister dst, XMMRegister src, int imm8, bool vector256); + void pause(); + // SSE4.2 string instructions void pcmpestri(XMMRegister xmm1, XMMRegister xmm2, int imm8); void pcmpestri(XMMRegister xmm1, Address src, int imm8); @@ -1535,6 +1537,8 @@ void rclq(Register dst, int imm8); + void rdtsc(); + void ret(int imm16); void sahf(); @@ -1632,16 +1636,22 @@ void ucomiss(XMMRegister dst, Address src); void ucomiss(XMMRegister dst, XMMRegister src); + void xabort(int8_t imm8); + void xaddl(Address dst, Register src); void xaddq(Address dst, Register src); + void xbegin(Label& abort, relocInfo::relocType rtype = relocInfo::none); + void xchgl(Register reg, Address adr); void xchgl(Register dst, Register src); void xchgq(Register reg, Address adr); void xchgq(Register dst, Register src); + void xend(); + // Get Value of Extended Control Register void xgetbv();
--- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Wed Apr 16 09:49:45 2014 -0400 @@ -604,8 +604,7 @@ // Note: we do not need to round double result; float result has the right precision // the poll sets the condition code, but no data registers - AddressLiteral polling_page(os::get_polling_page() + (SafepointPollOffset % os::vm_page_size()), - relocInfo::poll_return_type); + AddressLiteral polling_page(os::get_polling_page(), relocInfo::poll_return_type); if (Assembler::is_polling_page_far()) { __ lea(rscratch1, polling_page); @@ -619,8 +618,7 @@ int LIR_Assembler::safepoint_poll(LIR_Opr tmp, CodeEmitInfo* info) { - AddressLiteral polling_page(os::get_polling_page() + (SafepointPollOffset % os::vm_page_size()), - relocInfo::poll_type); + AddressLiteral polling_page(os::get_polling_page(), relocInfo::poll_type); guarantee(info != NULL, "Shouldn't be NULL"); int offset = __ offset(); if (Assembler::is_polling_page_far()) { @@ -801,7 +799,13 @@ if (UseCompressedOops && !wide) { __ movl(as_Address(addr), (int32_t)NULL_WORD); } else { +#ifdef _LP64 + __ xorptr(rscratch1, rscratch1); + null_check_here = code_offset(); + __ movptr(as_Address(addr), rscratch1); +#else __ movptr(as_Address(addr), NULL_WORD); +#endif } } else { if (is_literal_address(addr)) {
--- a/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp Wed Apr 16 09:49:45 2014 -0400 @@ -65,6 +65,4 @@ define_pd_global(bool, CSEArrayLength, false); define_pd_global(bool, TwoOperandLIRForm, true ); -define_pd_global(intx, SafepointPollOffset, 256 ); - #endif // CPU_X86_VM_C1_GLOBALS_X86_HPP
--- a/hotspot/src/cpu/x86/vm/globals_x86.hpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/x86/vm/globals_x86.hpp Wed Apr 16 09:49:45 2014 -0400 @@ -129,6 +129,42 @@ product(bool, UseFastStosb, false, \ "Use fast-string operation for zeroing: rep stosb") \ \ + /* Use Restricted Transactional Memory for lock eliding */ \ + product(bool, UseRTMLocking, false, \ + "Enable RTM lock eliding for inflated locks in compiled code") \ + \ + experimental(bool, UseRTMForStackLocks, false, \ + "Enable RTM lock eliding for stack locks in compiled code") \ + \ + product(bool, UseRTMDeopt, false, \ + "Perform deopt and recompilation based on RTM abort ratio") \ + \ + product(uintx, RTMRetryCount, 5, \ + "Number of RTM retries on lock abort or busy") \ + \ + experimental(intx, RTMSpinLoopCount, 100, \ + "Spin count for lock to become free before RTM retry") \ + \ + experimental(intx, RTMAbortThreshold, 1000, \ + "Calculate abort ratio after this number of aborts") \ + \ + experimental(intx, RTMLockingThreshold, 10000, \ + "Lock count at which to do RTM lock eliding without " \ + "abort ratio calculation") \ + \ + experimental(intx, RTMAbortRatio, 50, \ + "Lock abort ratio at which to stop use RTM lock eliding") \ + \ + experimental(intx, RTMTotalCountIncrRate, 64, \ + "Increment total RTM attempted lock count once every n times") \ + \ + experimental(intx, RTMLockingCalculationDelay, 0, \ + "Number of milliseconds to wait before start calculating aborts " \ + "for RTM locking") \ + \ + experimental(bool, UseRTMXendForLockBusy, false, \ + "Use RTM Xend instead of Xabort when lock busy") \ + \ /* assembler */ \ product(bool, Use486InstrsOnly, false, \ "Use 80486 Compliant instruction subset") \
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Wed Apr 16 09:49:45 2014 -0400 @@ -301,7 +301,9 @@ mov_literal32(dst, (int32_t)obj, metadata_Relocation::spec_for_immediate()); } -void MacroAssembler::movptr(Register dst, AddressLiteral src) { +void MacroAssembler::movptr(Register dst, AddressLiteral src, Register scratch) { + // scratch register is not used, + // it is defined to match parameters of 64-bit version of this method. if (src.is_lval()) { mov_literal32(dst, (intptr_t)src.target(), src.rspec()); } else { @@ -613,6 +615,15 @@ /* else */ { subq(dst, value) ; return; } } +void MacroAssembler::incrementq(AddressLiteral dst) { + if (reachable(dst)) { + incrementq(as_Address(dst)); + } else { + lea(rscratch1, dst); + incrementq(Address(rscratch1, 0)); + } +} + void MacroAssembler::incrementq(Register reg, int value) { if (value == min_jint) { addq(reg, value); return; } if (value < 0) { decrementq(reg, -value); return; } @@ -681,15 +692,15 @@ movq(dst, rscratch1); } -void MacroAssembler::movptr(Register dst, AddressLiteral src) { +void MacroAssembler::movptr(Register dst, AddressLiteral src, Register scratch) { if (src.is_lval()) { mov_literal64(dst, (intptr_t)src.target(), src.rspec()); } else { if (reachable(src)) { movq(dst, as_Address(src)); } else { - lea(rscratch1, src); - movq(dst, Address(rscratch1,0)); + lea(scratch, src); + movq(dst, Address(scratch, 0)); } } } @@ -988,20 +999,37 @@ LP64_ONLY(andq(dst, imm32)) NOT_LP64(andl(dst, imm32)); } -void MacroAssembler::atomic_incl(AddressLiteral counter_addr) { - pushf(); +void MacroAssembler::atomic_incl(Address counter_addr) { + if (os::is_MP()) + lock(); + incrementl(counter_addr); +} + +void MacroAssembler::atomic_incl(AddressLiteral counter_addr, Register scr) { if (reachable(counter_addr)) { - if (os::is_MP()) - lock(); - incrementl(as_Address(counter_addr)); + atomic_incl(as_Address(counter_addr)); } else { - lea(rscratch1, counter_addr); - if (os::is_MP()) - lock(); - incrementl(Address(rscratch1, 0)); - } - popf(); -} + lea(scr, counter_addr); + atomic_incl(Address(scr, 0)); + } +} + +#ifdef _LP64 +void MacroAssembler::atomic_incq(Address counter_addr) { + if (os::is_MP()) + lock(); + incrementq(counter_addr); +} + +void MacroAssembler::atomic_incq(AddressLiteral counter_addr, Register scr) { + if (reachable(counter_addr)) { + atomic_incq(as_Address(counter_addr)); + } else { + lea(scr, counter_addr); + atomic_incq(Address(scr, 0)); + } +} +#endif // Writes to stack successive pages until offset reached to check for // stack overflow + shadow pages. This clobbers tmp. @@ -1274,6 +1302,325 @@ } #ifdef COMPILER2 + +#if INCLUDE_RTM_OPT + +// Update rtm_counters based on abort status +// input: abort_status +// rtm_counters (RTMLockingCounters*) +// flags are killed +void MacroAssembler::rtm_counters_update(Register abort_status, Register rtm_counters) { + + atomic_incptr(Address(rtm_counters, RTMLockingCounters::abort_count_offset())); + if (PrintPreciseRTMLockingStatistics) { + for (int i = 0; i < RTMLockingCounters::ABORT_STATUS_LIMIT; i++) { + Label check_abort; + testl(abort_status, (1<<i)); + jccb(Assembler::equal, check_abort); + atomic_incptr(Address(rtm_counters, RTMLockingCounters::abortX_count_offset() + (i * sizeof(uintx)))); + bind(check_abort); + } + } +} + +// Branch if (random & (count-1) != 0), count is 2^n +// tmp, scr and flags are killed +void MacroAssembler::branch_on_random_using_rdtsc(Register tmp, Register scr, int count, Label& brLabel) { + assert(tmp == rax, ""); + assert(scr == rdx, ""); + rdtsc(); // modifies EDX:EAX + andptr(tmp, count-1); + jccb(Assembler::notZero, brLabel); +} + +// Perform abort ratio calculation, set no_rtm bit if high ratio +// input: rtm_counters_Reg (RTMLockingCounters* address) +// tmpReg, rtm_counters_Reg and flags are killed +void MacroAssembler::rtm_abort_ratio_calculation(Register tmpReg, + Register rtm_counters_Reg, + RTMLockingCounters* rtm_counters, + Metadata* method_data) { + Label L_done, L_check_always_rtm1, L_check_always_rtm2; + + if (RTMLockingCalculationDelay > 0) { + // Delay calculation + movptr(tmpReg, ExternalAddress((address) RTMLockingCounters::rtm_calculation_flag_addr()), tmpReg); + testptr(tmpReg, tmpReg); + jccb(Assembler::equal, L_done); + } + // Abort ratio calculation only if abort_count > RTMAbortThreshold + // Aborted transactions = abort_count * 100 + // All transactions = total_count * RTMTotalCountIncrRate + // Set no_rtm bit if (Aborted transactions >= All transactions * RTMAbortRatio) + + movptr(tmpReg, Address(rtm_counters_Reg, RTMLockingCounters::abort_count_offset())); + cmpptr(tmpReg, RTMAbortThreshold); + jccb(Assembler::below, L_check_always_rtm2); + imulptr(tmpReg, tmpReg, 100); + + Register scrReg = rtm_counters_Reg; + movptr(scrReg, Address(rtm_counters_Reg, RTMLockingCounters::total_count_offset())); + imulptr(scrReg, scrReg, RTMTotalCountIncrRate); + imulptr(scrReg, scrReg, RTMAbortRatio); + cmpptr(tmpReg, scrReg); + jccb(Assembler::below, L_check_always_rtm1); + if (method_data != NULL) { + // set rtm_state to "no rtm" in MDO + mov_metadata(tmpReg, method_data); + if (os::is_MP()) { + lock(); + } + orl(Address(tmpReg, MethodData::rtm_state_offset_in_bytes()), NoRTM); + } + jmpb(L_done); + bind(L_check_always_rtm1); + // Reload RTMLockingCounters* address + lea(rtm_counters_Reg, ExternalAddress((address)rtm_counters)); + bind(L_check_always_rtm2); + movptr(tmpReg, Address(rtm_counters_Reg, RTMLockingCounters::total_count_offset())); + cmpptr(tmpReg, RTMLockingThreshold / RTMTotalCountIncrRate); + jccb(Assembler::below, L_done); + if (method_data != NULL) { + // set rtm_state to "always rtm" in MDO + mov_metadata(tmpReg, method_data); + if (os::is_MP()) { + lock(); + } + orl(Address(tmpReg, MethodData::rtm_state_offset_in_bytes()), UseRTM); + } + bind(L_done); +} + +// Update counters and perform abort ratio calculation +// input: abort_status_Reg +// rtm_counters_Reg, flags are killed +void MacroAssembler::rtm_profiling(Register abort_status_Reg, + Register rtm_counters_Reg, + RTMLockingCounters* rtm_counters, + Metadata* method_data, + bool profile_rtm) { + + assert(rtm_counters != NULL, "should not be NULL when profiling RTM"); + // update rtm counters based on rax value at abort + // reads abort_status_Reg, updates flags + lea(rtm_counters_Reg, ExternalAddress((address)rtm_counters)); + rtm_counters_update(abort_status_Reg, rtm_counters_Reg); + if (profile_rtm) { + // Save abort status because abort_status_Reg is used by following code. + if (RTMRetryCount > 0) { + push(abort_status_Reg); + } + assert(rtm_counters != NULL, "should not be NULL when profiling RTM"); + rtm_abort_ratio_calculation(abort_status_Reg, rtm_counters_Reg, rtm_counters, method_data); + // restore abort status + if (RTMRetryCount > 0) { + pop(abort_status_Reg); + } + } +} + +// Retry on abort if abort's status is 0x6: can retry (0x2) | memory conflict (0x4) +// inputs: retry_count_Reg +// : abort_status_Reg +// output: retry_count_Reg decremented by 1 +// flags are killed +void MacroAssembler::rtm_retry_lock_on_abort(Register retry_count_Reg, Register abort_status_Reg, Label& retryLabel) { + Label doneRetry; + assert(abort_status_Reg == rax, ""); + // The abort reason bits are in eax (see all states in rtmLocking.hpp) + // 0x6 = conflict on which we can retry (0x2) | memory conflict (0x4) + // if reason is in 0x6 and retry count != 0 then retry + andptr(abort_status_Reg, 0x6); + jccb(Assembler::zero, doneRetry); + testl(retry_count_Reg, retry_count_Reg); + jccb(Assembler::zero, doneRetry); + pause(); + decrementl(retry_count_Reg); + jmp(retryLabel); + bind(doneRetry); +} + +// Spin and retry if lock is busy, +// inputs: box_Reg (monitor address) +// : retry_count_Reg +// output: retry_count_Reg decremented by 1 +// : clear z flag if retry count exceeded +// tmp_Reg, scr_Reg, flags are killed +void MacroAssembler::rtm_retry_lock_on_busy(Register retry_count_Reg, Register box_Reg, + Register tmp_Reg, Register scr_Reg, Label& retryLabel) { + Label SpinLoop, SpinExit, doneRetry; + // Clean monitor_value bit to get valid pointer + int owner_offset = ObjectMonitor::owner_offset_in_bytes() - markOopDesc::monitor_value; + + testl(retry_count_Reg, retry_count_Reg); + jccb(Assembler::zero, doneRetry); + decrementl(retry_count_Reg); + movptr(scr_Reg, RTMSpinLoopCount); + + bind(SpinLoop); + pause(); + decrementl(scr_Reg); + jccb(Assembler::lessEqual, SpinExit); + movptr(tmp_Reg, Address(box_Reg, owner_offset)); + testptr(tmp_Reg, tmp_Reg); + jccb(Assembler::notZero, SpinLoop); + + bind(SpinExit); + jmp(retryLabel); + bind(doneRetry); + incrementl(retry_count_Reg); // clear z flag +} + +// Use RTM for normal stack locks +// Input: objReg (object to lock) +void MacroAssembler::rtm_stack_locking(Register objReg, Register tmpReg, Register scrReg, + Register retry_on_abort_count_Reg, + RTMLockingCounters* stack_rtm_counters, + Metadata* method_data, bool profile_rtm, + Label& DONE_LABEL, Label& IsInflated) { + assert(UseRTMForStackLocks, "why call this otherwise?"); + assert(!UseBiasedLocking, "Biased locking is not supported with RTM locking"); + assert(tmpReg == rax, ""); + assert(scrReg == rdx, ""); + Label L_rtm_retry, L_decrement_retry, L_on_abort; + + if (RTMRetryCount > 0) { + movl(retry_on_abort_count_Reg, RTMRetryCount); // Retry on abort + bind(L_rtm_retry); + } + if (!UseRTMXendForLockBusy) { + movptr(tmpReg, Address(objReg, 0)); + testptr(tmpReg, markOopDesc::monitor_value); // inflated vs stack-locked|neutral|biased + jcc(Assembler::notZero, IsInflated); + } + if (PrintPreciseRTMLockingStatistics || profile_rtm) { + Label L_noincrement; + if (RTMTotalCountIncrRate > 1) { + // tmpReg, scrReg and flags are killed + branch_on_random_using_rdtsc(tmpReg, scrReg, (int)RTMTotalCountIncrRate, L_noincrement); + } + assert(stack_rtm_counters != NULL, "should not be NULL when profiling RTM"); + atomic_incptr(ExternalAddress((address)stack_rtm_counters->total_count_addr()), scrReg); + bind(L_noincrement); + } + xbegin(L_on_abort); + movptr(tmpReg, Address(objReg, 0)); // fetch markword + andptr(tmpReg, markOopDesc::biased_lock_mask_in_place); // look at 3 lock bits + cmpptr(tmpReg, markOopDesc::unlocked_value); // bits = 001 unlocked + jcc(Assembler::equal, DONE_LABEL); // all done if unlocked + + Register abort_status_Reg = tmpReg; // status of abort is stored in RAX + if (UseRTMXendForLockBusy) { + xend(); + movptr(tmpReg, Address(objReg, 0)); + testptr(tmpReg, markOopDesc::monitor_value); // inflated vs stack-locked|neutral|biased + jcc(Assembler::notZero, IsInflated); + movptr(abort_status_Reg, 0x1); // Set the abort status to 1 (as xabort does) + jmp(L_decrement_retry); + } + else { + xabort(0); + } + bind(L_on_abort); + if (PrintPreciseRTMLockingStatistics || profile_rtm) { + rtm_profiling(abort_status_Reg, scrReg, stack_rtm_counters, method_data, profile_rtm); + } + bind(L_decrement_retry); + if (RTMRetryCount > 0) { + // retry on lock abort if abort status is 'can retry' (0x2) or 'memory conflict' (0x4) + rtm_retry_lock_on_abort(retry_on_abort_count_Reg, abort_status_Reg, L_rtm_retry); + } +} + +// Use RTM for inflating locks +// inputs: objReg (object to lock) +// boxReg (on-stack box address (displaced header location) - KILLED) +// tmpReg (ObjectMonitor address + 2(monitor_value)) +void MacroAssembler::rtm_inflated_locking(Register objReg, Register boxReg, Register tmpReg, + Register scrReg, Register retry_on_busy_count_Reg, + Register retry_on_abort_count_Reg, + RTMLockingCounters* rtm_counters, + Metadata* method_data, bool profile_rtm, + Label& DONE_LABEL) { + assert(UseRTMLocking, "why call this otherwise?"); + assert(tmpReg == rax, ""); + assert(scrReg == rdx, ""); + Label L_rtm_retry, L_decrement_retry, L_on_abort; + // Clean monitor_value bit to get valid pointer + int owner_offset = ObjectMonitor::owner_offset_in_bytes() - markOopDesc::monitor_value; + + // Without cast to int32_t a movptr will destroy r10 which is typically obj + movptr(Address(boxReg, 0), (int32_t)intptr_t(markOopDesc::unused_mark())); + movptr(boxReg, tmpReg); // Save ObjectMonitor address + + if (RTMRetryCount > 0) { + movl(retry_on_busy_count_Reg, RTMRetryCount); // Retry on lock busy + movl(retry_on_abort_count_Reg, RTMRetryCount); // Retry on abort + bind(L_rtm_retry); + } + if (PrintPreciseRTMLockingStatistics || profile_rtm) { + Label L_noincrement; + if (RTMTotalCountIncrRate > 1) { + // tmpReg, scrReg and flags are killed + branch_on_random_using_rdtsc(tmpReg, scrReg, (int)RTMTotalCountIncrRate, L_noincrement); + } + assert(rtm_counters != NULL, "should not be NULL when profiling RTM"); + atomic_incptr(ExternalAddress((address)rtm_counters->total_count_addr()), scrReg); + bind(L_noincrement); + } + xbegin(L_on_abort); + movptr(tmpReg, Address(objReg, 0)); + movptr(tmpReg, Address(tmpReg, owner_offset)); + testptr(tmpReg, tmpReg); + jcc(Assembler::zero, DONE_LABEL); + if (UseRTMXendForLockBusy) { + xend(); + jmp(L_decrement_retry); + } + else { + xabort(0); + } + bind(L_on_abort); + Register abort_status_Reg = tmpReg; // status of abort is stored in RAX + if (PrintPreciseRTMLockingStatistics || profile_rtm) { + rtm_profiling(abort_status_Reg, scrReg, rtm_counters, method_data, profile_rtm); + } + if (RTMRetryCount > 0) { + // retry on lock abort if abort status is 'can retry' (0x2) or 'memory conflict' (0x4) + rtm_retry_lock_on_abort(retry_on_abort_count_Reg, abort_status_Reg, L_rtm_retry); + } + + movptr(tmpReg, Address(boxReg, owner_offset)) ; + testptr(tmpReg, tmpReg) ; + jccb(Assembler::notZero, L_decrement_retry) ; + + // Appears unlocked - try to swing _owner from null to non-null. + // Invariant: tmpReg == 0. tmpReg is EAX which is the implicit cmpxchg comparand. +#ifdef _LP64 + Register threadReg = r15_thread; +#else + get_thread(scrReg); + Register threadReg = scrReg; +#endif + if (os::is_MP()) { + lock(); + } + cmpxchgptr(threadReg, Address(boxReg, owner_offset)); // Updates tmpReg + + if (RTMRetryCount > 0) { + // success done else retry + jccb(Assembler::equal, DONE_LABEL) ; + bind(L_decrement_retry); + // Spin and retry if lock is busy. + rtm_retry_lock_on_busy(retry_on_busy_count_Reg, boxReg, tmpReg, scrReg, L_rtm_retry); + } + else { + bind(L_decrement_retry); + } +} + +#endif // INCLUDE_RTM_OPT + // Fast_Lock and Fast_Unlock used by C2 // Because the transitions from emitted code to the runtime @@ -1350,17 +1697,26 @@ // box: on-stack box address (displaced header location) - KILLED // rax,: tmp -- KILLED // scr: tmp -- KILLED -void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg, Register scrReg, BiasedLockingCounters* counters) { +void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg, + Register scrReg, Register cx1Reg, Register cx2Reg, + BiasedLockingCounters* counters, + RTMLockingCounters* rtm_counters, + RTMLockingCounters* stack_rtm_counters, + Metadata* method_data, + bool use_rtm, bool profile_rtm) { // Ensure the register assignents are disjoint - guarantee (objReg != boxReg, ""); - guarantee (objReg != tmpReg, ""); - guarantee (objReg != scrReg, ""); - guarantee (boxReg != tmpReg, ""); - guarantee (boxReg != scrReg, ""); - guarantee (tmpReg == rax, ""); + assert(tmpReg == rax, ""); + + if (use_rtm) { + assert_different_registers(objReg, boxReg, tmpReg, scrReg, cx1Reg, cx2Reg); + } else { + assert(cx1Reg == noreg, ""); + assert(cx2Reg == noreg, ""); + assert_different_registers(objReg, boxReg, tmpReg, scrReg); + } if (counters != NULL) { - atomic_incl(ExternalAddress((address)counters->total_entry_count_addr())); + atomic_incl(ExternalAddress((address)counters->total_entry_count_addr()), scrReg); } if (EmitSync & 1) { // set box->dhw = unused_mark (3) @@ -1419,12 +1775,20 @@ biased_locking_enter(boxReg, objReg, tmpReg, scrReg, true, DONE_LABEL, NULL, counters); } +#if INCLUDE_RTM_OPT + if (UseRTMForStackLocks && use_rtm) { + rtm_stack_locking(objReg, tmpReg, scrReg, cx2Reg, + stack_rtm_counters, method_data, profile_rtm, + DONE_LABEL, IsInflated); + } +#endif // INCLUDE_RTM_OPT + movptr(tmpReg, Address(objReg, 0)); // [FETCH] - testl (tmpReg, markOopDesc::monitor_value); // inflated vs stack-locked|neutral|biased - jccb (Assembler::notZero, IsInflated); + testptr(tmpReg, markOopDesc::monitor_value); // inflated vs stack-locked|neutral|biased + jccb(Assembler::notZero, IsInflated); // Attempt stack-locking ... - orptr (tmpReg, 0x1); + orptr (tmpReg, markOopDesc::unlocked_value); movptr(Address(boxReg, 0), tmpReg); // Anticipate successful CAS if (os::is_MP()) { lock(); @@ -1434,19 +1798,32 @@ cond_inc32(Assembler::equal, ExternalAddress((address)counters->fast_path_entry_count_addr())); } - jccb(Assembler::equal, DONE_LABEL); - - // Recursive locking + jcc(Assembler::equal, DONE_LABEL); // Success + + // Recursive locking. + // The object is stack-locked: markword contains stack pointer to BasicLock. + // Locked by current thread if difference with current SP is less than one page. subptr(tmpReg, rsp); + // Next instruction set ZFlag == 1 (Success) if difference is less then one page. andptr(tmpReg, (int32_t) (NOT_LP64(0xFFFFF003) LP64_ONLY(7 - os::vm_page_size())) ); movptr(Address(boxReg, 0), tmpReg); if (counters != NULL) { cond_inc32(Assembler::equal, ExternalAddress((address)counters->fast_path_entry_count_addr())); } - jmpb(DONE_LABEL); + jmp(DONE_LABEL); bind(IsInflated); + // The object is inflated. tmpReg contains pointer to ObjectMonitor* + 2(monitor_value) + +#if INCLUDE_RTM_OPT + // Use the same RTM locking code in 32- and 64-bit VM. + if (use_rtm) { + rtm_inflated_locking(objReg, boxReg, tmpReg, scrReg, cx1Reg, cx2Reg, + rtm_counters, method_data, profile_rtm, DONE_LABEL); + } else { +#endif // INCLUDE_RTM_OPT + #ifndef _LP64 // The object is inflated. // @@ -1576,7 +1953,7 @@ // Without cast to int32_t a movptr will destroy r10 which is typically obj movptr(Address(boxReg, 0), (int32_t)intptr_t(markOopDesc::unused_mark())); - mov (boxReg, tmpReg); + movptr (boxReg, tmpReg); movptr (tmpReg, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2)); testptr(tmpReg, tmpReg); jccb (Assembler::notZero, DONE_LABEL); @@ -1587,9 +1964,11 @@ } cmpxchgptr(r15_thread, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2)); // Intentional fall-through into DONE_LABEL ... - +#endif // _LP64 + +#if INCLUDE_RTM_OPT + } // use_rtm() #endif - // DONE_LABEL is a hot target - we'd really like to place it at the // start of cache line by padding with NOPs. // See the AMD and Intel software optimization manuals for the @@ -1631,11 +2010,9 @@ // should not be unlocked by "normal" java-level locking and vice-versa. The specification // doesn't specify what will occur if a program engages in such mixed-mode locking, however. -void MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register tmpReg) { - guarantee (objReg != boxReg, ""); - guarantee (objReg != tmpReg, ""); - guarantee (boxReg != tmpReg, ""); - guarantee (boxReg == rax, ""); +void MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register tmpReg, bool use_rtm) { + assert(boxReg == rax, ""); + assert_different_registers(objReg, boxReg, tmpReg); if (EmitSync & 4) { // Disable - inhibit all inlining. Force control through the slow-path @@ -1667,14 +2044,41 @@ biased_locking_exit(objReg, tmpReg, DONE_LABEL); } +#if INCLUDE_RTM_OPT + if (UseRTMForStackLocks && use_rtm) { + assert(!UseBiasedLocking, "Biased locking is not supported with RTM locking"); + Label L_regular_unlock; + movptr(tmpReg, Address(objReg, 0)); // fetch markword + andptr(tmpReg, markOopDesc::biased_lock_mask_in_place); // look at 3 lock bits + cmpptr(tmpReg, markOopDesc::unlocked_value); // bits = 001 unlocked + jccb(Assembler::notEqual, L_regular_unlock); // if !HLE RegularLock + xend(); // otherwise end... + jmp(DONE_LABEL); // ... and we're done + bind(L_regular_unlock); + } +#endif + cmpptr(Address(boxReg, 0), (int32_t)NULL_WORD); // Examine the displaced header + jcc (Assembler::zero, DONE_LABEL); // 0 indicates recursive stack-lock movptr(tmpReg, Address(objReg, 0)); // Examine the object's markword - jccb (Assembler::zero, DONE_LABEL); // 0 indicates recursive stack-lock - - testptr(tmpReg, 0x02); // Inflated? + testptr(tmpReg, markOopDesc::monitor_value); // Inflated? jccb (Assembler::zero, Stacked); // It's inflated. +#if INCLUDE_RTM_OPT + if (use_rtm) { + Label L_regular_inflated_unlock; + // Clean monitor_value bit to get valid pointer + int owner_offset = ObjectMonitor::owner_offset_in_bytes() - markOopDesc::monitor_value; + movptr(boxReg, Address(tmpReg, owner_offset)); + testptr(boxReg, boxReg); + jccb(Assembler::notZero, L_regular_inflated_unlock); + xend(); + jmpb(DONE_LABEL); + bind(L_regular_inflated_unlock); + } +#endif + // Despite our balanced locking property we still check that m->_owner == Self // as java routines or native JNI code called by this thread might // have released the lock. @@ -2448,7 +2852,9 @@ Condition negated_cond = negate_condition(cond); Label L; jcc(negated_cond, L); + pushf(); // Preserve flags atomic_incl(counter_addr); + popf(); bind(L); }
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp Wed Apr 16 09:49:45 2014 -0400 @@ -27,6 +27,7 @@ #include "asm/assembler.hpp" #include "utilities/macros.hpp" +#include "runtime/rtmLocking.hpp" // MacroAssembler extends Assembler by frequently used macros. @@ -111,7 +112,8 @@ op == 0xE9 /* jmp */ || op == 0xEB /* short jmp */ || (op & 0xF0) == 0x70 /* short jcc */ || - op == 0x0F && (branch[1] & 0xF0) == 0x80 /* jcc */, + op == 0x0F && (branch[1] & 0xF0) == 0x80 /* jcc */ || + op == 0xC7 && branch[1] == 0xF8 /* xbegin */, "Invalid opcode at patch point"); if (op == 0xEB || (op & 0xF0) == 0x70) { @@ -121,7 +123,7 @@ guarantee(this->is8bit(imm8), "Short forward jump exceeds 8-bit offset"); *disp = imm8; } else { - int* disp = (int*) &branch[(op == 0x0F)? 2: 1]; + int* disp = (int*) &branch[(op == 0x0F || op == 0xC7)? 2: 1]; int imm32 = target - (address) &disp[1]; *disp = imm32; } @@ -161,7 +163,6 @@ void incrementq(Register reg, int value = 1); void incrementq(Address dst, int value = 1); - // Support optimal SSE move instructions. void movflt(XMMRegister dst, XMMRegister src) { if (UseXmmRegToRegMoveAll) { movaps(dst, src); return; } @@ -187,6 +188,8 @@ void incrementl(AddressLiteral dst); void incrementl(ArrayAddress dst); + void incrementq(AddressLiteral dst); + // Alignment void align(int modulus); @@ -654,8 +657,36 @@ #ifdef COMPILER2 // Code used by cmpFastLock and cmpFastUnlock mach instructions in .ad file. // See full desription in macroAssembler_x86.cpp. - void fast_lock(Register obj, Register box, Register tmp, Register scr, BiasedLockingCounters* counters); - void fast_unlock(Register obj, Register box, Register tmp); + void fast_lock(Register obj, Register box, Register tmp, + Register scr, Register cx1, Register cx2, + BiasedLockingCounters* counters, + RTMLockingCounters* rtm_counters, + RTMLockingCounters* stack_rtm_counters, + Metadata* method_data, + bool use_rtm, bool profile_rtm); + void fast_unlock(Register obj, Register box, Register tmp, bool use_rtm); +#if INCLUDE_RTM_OPT + void rtm_counters_update(Register abort_status, Register rtm_counters); + void branch_on_random_using_rdtsc(Register tmp, Register scr, int count, Label& brLabel); + void rtm_abort_ratio_calculation(Register tmp, Register rtm_counters_reg, + RTMLockingCounters* rtm_counters, + Metadata* method_data); + void rtm_profiling(Register abort_status_Reg, Register rtm_counters_Reg, + RTMLockingCounters* rtm_counters, Metadata* method_data, bool profile_rtm); + void rtm_retry_lock_on_abort(Register retry_count, Register abort_status, Label& retryLabel); + void rtm_retry_lock_on_busy(Register retry_count, Register box, Register tmp, Register scr, Label& retryLabel); + void rtm_stack_locking(Register obj, Register tmp, Register scr, + Register retry_on_abort_count, + RTMLockingCounters* stack_rtm_counters, + Metadata* method_data, bool profile_rtm, + Label& DONE_LABEL, Label& IsInflated); + void rtm_inflated_locking(Register obj, Register box, Register tmp, + Register scr, Register retry_on_busy_count, + Register retry_on_abort_count, + RTMLockingCounters* rtm_counters, + Metadata* method_data, bool profile_rtm, + Label& DONE_LABEL); +#endif #endif Condition negate_condition(Condition cond); @@ -721,6 +752,7 @@ void imulptr(Register dst, Register src) { LP64_ONLY(imulq(dst, src)) NOT_LP64(imull(dst, src)); } + void imulptr(Register dst, Register src, int imm32) { LP64_ONLY(imulq(dst, src, imm32)) NOT_LP64(imull(dst, src, imm32)); } void negptr(Register dst) { LP64_ONLY(negq(dst)) NOT_LP64(negl(dst)); } @@ -762,7 +794,14 @@ // Conditionally (atomically, on MPs) increments passed counter address, preserving condition codes. void cond_inc32(Condition cond, AddressLiteral counter_addr); // Unconditional atomic increment. - void atomic_incl(AddressLiteral counter_addr); + void atomic_incl(Address counter_addr); + void atomic_incl(AddressLiteral counter_addr, Register scr = rscratch1); +#ifdef _LP64 + void atomic_incq(Address counter_addr); + void atomic_incq(AddressLiteral counter_addr, Register scr = rscratch1); +#endif + void atomic_incptr(AddressLiteral counter_addr, Register scr = rscratch1) { LP64_ONLY(atomic_incq(counter_addr, scr)) NOT_LP64(atomic_incl(counter_addr, scr)) ; } + void atomic_incptr(Address counter_addr) { LP64_ONLY(atomic_incq(counter_addr)) NOT_LP64(atomic_incl(counter_addr)) ; } void lea(Register dst, AddressLiteral adr); void lea(Address dst, AddressLiteral adr); @@ -1074,7 +1113,11 @@ void movptr(Register dst, Address src); - void movptr(Register dst, AddressLiteral src); +#ifdef _LP64 + void movptr(Register dst, AddressLiteral src, Register scratch=rscratch1); +#else + void movptr(Register dst, AddressLiteral src, Register scratch=noreg); // Scratch reg is ignored in 32-bit +#endif void movptr(Register dst, intptr_t src); void movptr(Register dst, Register src);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/cpu/x86/vm/rtmLocking.cpp Wed Apr 16 09:49:45 2014 -0400 @@ -0,0 +1,60 @@ +/* + * 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. + * + */ + +#include "precompiled.hpp" +#include "memory/allocation.inline.hpp" +#include "runtime/task.hpp" +#include "runtime/rtmLocking.hpp" + +// One-shot PeriodicTask subclass for enabling RTM locking +uintx RTMLockingCounters::_calculation_flag = 0; + +class RTMLockingCalculationTask : public PeriodicTask { + public: + RTMLockingCalculationTask(size_t interval_time) : PeriodicTask(interval_time){ } + + virtual void task() { + RTMLockingCounters::_calculation_flag = 1; + // Reclaim our storage and disenroll ourself + delete this; + } +}; + +void RTMLockingCounters::init() { + if (UseRTMLocking && RTMLockingCalculationDelay > 0) { + RTMLockingCalculationTask* task = new RTMLockingCalculationTask(RTMLockingCalculationDelay); + task->enroll(); + } else { + _calculation_flag = 1; + } +} + +//------------------------------print_on------------------------------- +void RTMLockingCounters::print_on(outputStream* st) { + tty->print_cr("# rtm locks total (estimated): " UINTX_FORMAT, _total_count * RTMTotalCountIncrRate); + tty->print_cr("# rtm lock aborts : " UINTX_FORMAT, _abort_count); + for (int i = 0; i < ABORT_STATUS_LIMIT; i++) { + tty->print_cr("# rtm lock aborts %d: " UINTX_FORMAT, i, _abortX_count[i]); + } +}
--- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp Wed Apr 16 09:49:45 2014 -0400 @@ -1817,6 +1817,13 @@ // Frame is now completed as far as size and linkage. int frame_complete = ((intptr_t)__ pc()) - start; + if (UseRTMLocking) { + // Abort RTM transaction before calling JNI + // because critical section will be large and will be + // aborted anyway. Also nmethod could be deoptimized. + __ xabort(0); + } + // Calculate the difference between rsp and rbp,. We need to know it // after the native call because on windows Java Natives will pop // the arguments and it is painful to do rsp relative addressing @@ -3170,6 +3177,12 @@ }; address start = __ pc(); + + if (UseRTMLocking) { + // Abort RTM transaction before possible nmethod deoptimization. + __ xabort(0); + } + // Push self-frame. __ subptr(rsp, return_off*wordSize); // Epilog! @@ -3355,6 +3368,14 @@ address call_pc = NULL; bool cause_return = (poll_type == POLL_AT_RETURN); bool save_vectors = (poll_type == POLL_AT_VECTOR_LOOP); + + if (UseRTMLocking) { + // Abort RTM transaction before calling runtime + // because critical section will be large and will be + // aborted anyway. Also nmethod could be deoptimized. + __ xabort(0); + } + // If cause_return is true we are at a poll_return and there is // the return address on the stack to the caller on the nmethod // that is safepoint. We can leave this return on the stack and
--- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Wed Apr 16 09:49:45 2014 -0400 @@ -2012,6 +2012,13 @@ // Frame is now completed as far as size and linkage. int frame_complete = ((intptr_t)__ pc()) - start; + if (UseRTMLocking) { + // Abort RTM transaction before calling JNI + // because critical section will be large and will be + // aborted anyway. Also nmethod could be deoptimized. + __ xabort(0); + } + #ifdef ASSERT { Label L; @@ -3612,6 +3619,11 @@ address start = __ pc(); + if (UseRTMLocking) { + // Abort RTM transaction before possible nmethod deoptimization. + __ xabort(0); + } + // Push self-frame. We get here with a return address on the // stack, so rsp is 8-byte aligned until we allocate our frame. __ subptr(rsp, SimpleRuntimeFrame::return_off << LogBytesPerInt); // Epilog! @@ -3792,6 +3804,13 @@ bool cause_return = (poll_type == POLL_AT_RETURN); bool save_vectors = (poll_type == POLL_AT_VECTOR_LOOP); + if (UseRTMLocking) { + // Abort RTM transaction before calling runtime + // because critical section will be large and will be + // aborted anyway. Also nmethod could be deoptimized. + __ xabort(0); + } + // Make room for return address (or push it again) if (!cause_return) { __ push(rbx);
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp Wed Apr 16 09:46:49 2014 -0400 +++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp Wed Apr 16 09:49:45 2014 -0400 @@ -50,13 +50,18 @@ const char* VM_Version::_features_str = ""; VM_Version::CpuidInfo VM_Version::_cpuid_info = { 0, }; +// Address of instruction which causes SEGV +address VM_Version::_cpuinfo_segv_addr = 0; +// Address of instruction after the one which causes SEGV +address VM_Version::_cpuinfo_cont_addr = 0; + static BufferBlob* stub_blob; -static const int stub_size = 550; +static const int stub_size = 600; extern "C" { - typedef void (*getPsrInfo_stub_t)(void*); + typedef void (*get_cpu_info_stub_t)(void*); } -static getPsrInfo_stub_t getPsrInfo_stub = NULL; +static get_cpu_info_stub_t get_cpu_info_s