changeset 2778:d51f7271f795

Merge
author jwilhelm
date Tue, 08 Aug 2017 21:15:58 +0200
parents b803e6cff41e d2b64cb3dc6e
children caf2fd524fd5
files common/autoconf/generated-configure.sh common/autoconf/lib-elf.m4 make/Docs.gmk
diffstat 26 files changed, 1259 insertions(+), 596 deletions(-) [+]
line wrap: on
line diff
--- a/common/autoconf/configure.ac	Fri Aug 04 23:29:03 2017 +0000
+++ b/common/autoconf/configure.ac	Tue Aug 08 21:15:58 2017 +0200
@@ -187,6 +187,9 @@
 # Setup the JTReg Regression Test Harness.
 TOOLCHAIN_SETUP_JTREG
 
+# Setup Jib dependency tool
+TOOLCHAIN_SETUP_JIB
+
 FLAGS_SETUP_INIT_FLAGS
 
 # Now we can test some aspects on the target using configure macros.
--- a/common/autoconf/flags.m4	Fri Aug 04 23:29:03 2017 +0000
+++ b/common/autoconf/flags.m4	Tue Aug 08 21:15:58 2017 +0200
@@ -760,6 +760,19 @@
 [
 
   FLAGS_SETUP_ABI_PROFILE
+
+  # Optional POSIX functionality needed by the JVM
+  #
+  # Check if clock_gettime is available and in which library. This indicates
+  # availability of CLOCK_MONOTONIC for hotspot. But we don't need to link, so
+  # don't let it update LIBS.
+  save_LIBS="$LIBS"
+  AC_SEARCH_LIBS(clock_gettime, rt, [HAS_CLOCK_GETTIME=true], [])
+  if test "x$LIBS" = "x-lrt "; then
+    CLOCK_GETTIME_IN_LIBRT=true
+  fi
+  LIBS="$save_LIBS"
+
   FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER([TARGET])
   FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER([BUILD], [OPENJDK_BUILD_])
 
@@ -897,7 +910,7 @@
     $2CFLAGS_JDK="[$]$2CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal"
     $2CXXFLAGS_JDK="[$]$2CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX -norunpath -xnolib"
   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
-    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_REENTRANT -D__STDC_FORMAT_MACROS"
+    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_REENTRANT"
     $2CFLAGS_JDK="[$]$2CFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
     $2CXXFLAGS_JDK="[$]$2CXXFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
@@ -962,6 +975,11 @@
     fi
   fi
 
+  # Always enable optional macros for VM.
+  $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D__STDC_FORMAT_MACROS"
+  $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D__STDC_LIMIT_MACROS"
+  $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D__STDC_CONSTANT_MACROS"
+
   # Setup target OS define. Use OS target name but in upper case.
   OPENJDK_$1_OS_UPPERCASE=`$ECHO $OPENJDK_$1_OS | $TR 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
   $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D$OPENJDK_$1_OS_UPPERCASE"
@@ -981,6 +999,16 @@
     $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -DDEBUG"
   fi
 
+  # Optional POSIX functionality needed by the VM
+
+  if test "x$HAS_CLOCK_GETTIME" = "xtrue"; then
+    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -DSUPPORTS_CLOCK_MONOTONIC"
+    if test "x$CLOCK_GETTIME_IN_LIBRT" = "xtrue"; then
+      $2JVM_CFLAGS="[$]$2JVM_CFLAGS -DNEEDS_LIBRT"
+    fi
+  fi
+
+
   # Set some additional per-OS defines.
   if test "x$OPENJDK_$1_OS" = xlinux; then
     $2JVM_CFLAGS="[$]$2JVM_CFLAGS -DLINUX"
@@ -989,7 +1017,7 @@
   elif test "x$OPENJDK_$1_OS" = xsolaris; then
     $2JVM_CFLAGS="[$]$2JVM_CFLAGS -DSOLARIS"
     $2JVM_CFLAGS="[$]$2JVM_CFLAGS -template=no%extdef -features=no%split_init \
-        -D_Crun_inline_placement -library=%none $PICFLAG -mt -features=no%except"
+        -D_Crun_inline_placement -library=stlport4 $PICFLAG -mt -features=no%except"
   elif test "x$OPENJDK_$1_OS" = xmacosx; then
     $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
     $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_ALLBSD_SOURCE"
--- a/common/autoconf/generated-configure.sh	Fri Aug 04 23:29:03 2017 +0000
+++ b/common/autoconf/generated-configure.sh	Tue Aug 08 21:15:58 2017 +0200
@@ -663,8 +663,6 @@
 JVM_FEATURES_client
 JVM_FEATURES_server
 INCLUDE_GRAAL
-ELF_LIBS
-ELF_CFLAGS
 STLPORT_LIB
 LIBZIP_CAN_USE_MMAP
 LIBDL
@@ -790,6 +788,7 @@
 COMPILER_BINDCMD_FILE_FLAG
 COMPILER_COMMAND_FILE_FLAG
 COMPILER_TARGET_BITS_FLAG
+JIB_JAR
 JT_HOME
 JTREGEXE
 HOTSPOT_TOOLCHAIN_TYPE
@@ -1182,6 +1181,7 @@
 with_toolchain_version
 with_build_devkit
 with_jtreg
+with_jib
 with_abi_profile
 with_macosx_version_max
 enable_warnings_as_errors
@@ -1219,9 +1219,6 @@
 with_dxsdk
 with_dxsdk_lib
 with_dxsdk_include
-with_libelf
-with_libelf_include
-with_libelf_lib
 with_jvm_features
 with_jvm_interpreter
 enable_jtreg_failure_handler
@@ -1351,8 +1348,6 @@
 PNG_LIBS
 LCMS_CFLAGS
 LCMS_LIBS
-ELF_CFLAGS
-ELF_LIBS
 ICECC_CMD
 ICECC_CREATE_ENV
 ICECC_WRAPPER
@@ -2130,6 +2125,7 @@
                           dependent]
   --with-build-devkit     Devkit to use for the build platform toolchain
   --with-jtreg            Regression Test Harness [probed]
+  --with-jib              Jib dependency management tool [not used]
   --with-abi-profile      specify ABI profile for ARM builds
                           (arm-vfp-sflt,arm-vfp-hflt,arm-sflt,
                           armv5-vfp-sflt,armv6-vfp-hflt,arm64,aarch64)
@@ -2186,11 +2182,6 @@
                           compatibility and is ignored
   --with-dxsdk-include    Deprecated. Option is kept for backwards
                           compatibility and is ignored
-  --with-libelf           specify prefix directory for the libelf package
-                          (expecting the libraries under PATH/lib and the
-                          headers under PATH/include)
-  --with-libelf-include   specify directory for the libelf include files
-  --with-libelf-lib       specify directory for the libelf library
   --with-jvm-features     additional JVM features to enable (separated by
                           comma), use '--help' to show possible values [none]
   --with-jvm-interpreter  Deprecated. Option is kept for backwards
@@ -2327,8 +2318,6 @@
   PNG_LIBS    linker flags for PNG, overriding pkg-config
   LCMS_CFLAGS C compiler flags for LCMS, overriding pkg-config
   LCMS_LIBS   linker flags for LCMS, overriding pkg-config
-  ELF_CFLAGS  C compiler flags for ELF, overriding pkg-config
-  ELF_LIBS    linker flags for ELF, overriding pkg-config
   ICECC_CMD   Override default value for ICECC_CMD
   ICECC_CREATE_ENV
               Override default value for ICECC_CREATE_ENV
@@ -4516,7 +4505,7 @@
 
 
 #
-# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -4793,8 +4782,36 @@
 ################################################################################
 
 
-#
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+
+################################################################################
+# Determine which libraries are needed for this configuration
+################################################################################
+
+
+################################################################################
+# Parse library options, and setup needed libraries
+################################################################################
+
+
+################################################################################
+# Setup llvm (Low-Level VM)
+################################################################################
+
+
+################################################################################
+# Setup various libraries, typically small system libraries
+################################################################################
+
+
+################################################################################
+# libstlport.so.1 is needed for running gtest on Solaris. Find it to
+# redistribute it in the test image.
+################################################################################
+
+
+
+#
+# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -4818,41 +4835,55 @@
 # questions.
 #
 
-################################################################################
-# Setup libelf (ELF library)
-################################################################################
-
-
-
-################################################################################
-# Determine which libraries are needed for this configuration
-################################################################################
-
-
-################################################################################
-# Parse library options, and setup needed libraries
-################################################################################
-
-
-################################################################################
-# Setup llvm (Low-Level VM)
-################################################################################
-
-
-################################################################################
-# Setup various libraries, typically small system libraries
-################################################################################
-
-
-################################################################################
-# libstlport.so.1 is needed for running gtest on Solaris. Find it to
-# redistribute it in the test image.
-################################################################################
-
-
-
-#
-# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+# Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
+# Converts autoconf style CPU name to OpenJDK style, into
+# VAR_CPU, VAR_CPU_ARCH, VAR_CPU_BITS and VAR_CPU_ENDIAN.
+
+
+# Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
+# Converts autoconf style OS name to OpenJDK style, into
+# VAR_OS, VAR_OS_TYPE and VAR_OS_ENV.
+
+
+# Expects $host_os $host_cpu $build_os and $build_cpu
+# and $with_target_bits to have been setup!
+#
+# Translate the standard triplet(quadruplet) definition
+# of the target/build system into OPENJDK_TARGET_OS, OPENJDK_TARGET_CPU,
+# OPENJDK_BUILD_OS, etc.
+
+
+# Check if a reduced build (32-bit on 64-bit platforms) is requested, and modify behaviour
+# accordingly. Must be done after setting up build and target system, but before
+# doing anything else with these values.
+
+
+# Setup the legacy variables, for controlling the old makefiles.
+#
+
+
+# $1 - Either TARGET or BUILD to setup the variables for.
+
+
+
+
+
+
+#%%% Build and target systems %%%
+
+
+
+
+# Support macro for PLATFORM_SETUP_OPENJDK_TARGET_BITS.
+# Add -mX to various FLAGS variables.
+
+
+
+
+
+
+#
+# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -4876,78 +4907,6 @@
 # questions.
 #
 
-# Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
-# Converts autoconf style CPU name to OpenJDK style, into
-# VAR_CPU, VAR_CPU_ARCH, VAR_CPU_BITS and VAR_CPU_ENDIAN.
-
-
-# Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
-# Converts autoconf style OS name to OpenJDK style, into
-# VAR_OS, VAR_OS_TYPE and VAR_OS_ENV.
-
-
-# Expects $host_os $host_cpu $build_os and $build_cpu
-# and $with_target_bits to have been setup!
-#
-# Translate the standard triplet(quadruplet) definition
-# of the target/build system into OPENJDK_TARGET_OS, OPENJDK_TARGET_CPU,
-# OPENJDK_BUILD_OS, etc.
-
-
-# Check if a reduced build (32-bit on 64-bit platforms) is requested, and modify behaviour
-# accordingly. Must be done after setting up build and target system, but before
-# doing anything else with these values.
-
-
-# Setup the legacy variables, for controlling the old makefiles.
-#
-
-
-# $1 - Either TARGET or BUILD to setup the variables for.
-
-
-
-
-
-
-#%%% Build and target systems %%%
-
-
-
-
-# Support macro for PLATFORM_SETUP_OPENJDK_TARGET_BITS.
-# Add -mX to various FLAGS variables.
-
-
-
-
-
-
-#
-# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
 
 
 
@@ -4961,7 +4920,7 @@
 
 
 #
-# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -5092,6 +5051,9 @@
 # Setup the JTReg Regression Test Harness.
 
 
+# Setup the JIB dependency resolver
+
+
 #
 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -5193,7 +5155,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1500423205
+DATE_WHEN_GENERATED=1502219751
 
 ###############################################################################
 #
@@ -49524,6 +49486,41 @@
 
 
 
+# Setup Jib dependency tool
+
+
+# Check whether --with-jib was given.
+if test "${with_jib+set}" = set; then :
+  withval=$with_jib;
+fi
+
+
+  if test "x$with_jib" = xno || test "x$with_jib" = x; then
+    # jib disabled
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jib" >&5
+$as_echo_n "checking for jib... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  elif test "x$with_jib" = xyes; then
+    as_fn_error $? "Must supply a value to --with-jib" "$LINENO" 5
+  else
+    JIB_HOME="${with_jib}"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jib" >&5
+$as_echo_n "checking for jib... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${JIB_HOME}" >&5
+$as_echo "${JIB_HOME}" >&6; }
+    if test ! -d "${JIB_HOME}"; then
+      as_fn_error $? "--with-jib must be a directory" "$LINENO" 5
+    fi
+    JIB_JAR=$(ls ${JIB_HOME}/lib/jib-*.jar)
+    if test ! -f "${JIB_JAR}"; then
+      as_fn_error $? "Could not find jib jar file in ${JIB_HOME}" "$LINENO" 5
+    fi
+  fi
+
+
+
+
 
   # COMPILER_TARGET_BITS_FLAG  : option for selecting 32- or 64-bit output
   # COMPILER_COMMAND_FILE_FLAG : option for passing a command file to the compiler
@@ -51066,6 +51063,74 @@
   fi
 
 
+  # Optional POSIX functionality needed by the JVM
+  #
+  # Check if clock_gettime is available and in which library. This indicates
+  # availability of CLOCK_MONOTONIC for hotspot. But we don't need to link, so
+  # don't let it update LIBS.
+  save_LIBS="$LIBS"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5
+$as_echo_n "checking for library containing clock_gettime... " >&6; }
+if ${ac_cv_search_clock_gettime+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char clock_gettime ();
+int
+main ()
+{
+return clock_gettime ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' rt; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_cxx_try_link "$LINENO"; then :
+  ac_cv_search_clock_gettime=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_clock_gettime+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_clock_gettime+:} false; then :
+
+else
+  ac_cv_search_clock_gettime=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5
+$as_echo "$ac_cv_search_clock_gettime" >&6; }
+ac_res=$ac_cv_search_clock_gettime
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+  HAS_CLOCK_GETTIME=true
+fi
+
+  if test "x$LIBS" = "x-lrt "; then
+    CLOCK_GETTIME_IN_LIBRT=true
+  fi
+  LIBS="$save_LIBS"
+
+
   # Special extras...
   if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
     if test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then
@@ -51366,7 +51431,7 @@
     CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal"
     CXXFLAGS_JDK="$CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX -norunpath -xnolib"
   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
-    JVM_CFLAGS="$JVM_CFLAGS -D_REENTRANT -D__STDC_FORMAT_MACROS"
+    JVM_CFLAGS="$JVM_CFLAGS -D_REENTRANT"
     CFLAGS_JDK="$CFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
     CXXFLAGS_JDK="$CXXFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
@@ -51431,6 +51496,11 @@
     fi
   fi
 
+  # Always enable optional macros for VM.
+  JVM_CFLAGS="$JVM_CFLAGS -D__STDC_FORMAT_MACROS"
+  JVM_CFLAGS="$JVM_CFLAGS -D__STDC_LIMIT_MACROS"
+  JVM_CFLAGS="$JVM_CFLAGS -D__STDC_CONSTANT_MACROS"
+
   # Setup target OS define. Use OS target name but in upper case.
   OPENJDK_TARGET_OS_UPPERCASE=`$ECHO $OPENJDK_TARGET_OS | $TR 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
   COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D$OPENJDK_TARGET_OS_UPPERCASE"
@@ -51450,6 +51520,16 @@
     COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DDEBUG"
   fi
 
+  # Optional POSIX functionality needed by the VM
+
+  if test "x$HAS_CLOCK_GETTIME" = "xtrue"; then
+    JVM_CFLAGS="$JVM_CFLAGS -DSUPPORTS_CLOCK_MONOTONIC"
+    if test "x$CLOCK_GETTIME_IN_LIBRT" = "xtrue"; then
+      JVM_CFLAGS="$JVM_CFLAGS -DNEEDS_LIBRT"
+    fi
+  fi
+
+
   # Set some additional per-OS defines.
   if test "x$OPENJDK_TARGET_OS" = xlinux; then
     JVM_CFLAGS="$JVM_CFLAGS -DLINUX"
@@ -51458,7 +51538,7 @@
   elif test "x$OPENJDK_TARGET_OS" = xsolaris; then
     JVM_CFLAGS="$JVM_CFLAGS -DSOLARIS"
     JVM_CFLAGS="$JVM_CFLAGS -template=no%extdef -features=no%split_init \
-        -D_Crun_inline_placement -library=%none $PICFLAG -mt -features=no%except"
+        -D_Crun_inline_placement -library=stlport4 $PICFLAG -mt -features=no%except"
   elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
     COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
     JVM_CFLAGS="$JVM_CFLAGS -D_ALLBSD_SOURCE"
@@ -52230,7 +52310,7 @@
     OPENJDK_BUILD_CFLAGS_JDK="$OPENJDK_BUILD_CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal"
     OPENJDK_BUILD_CXXFLAGS_JDK="$OPENJDK_BUILD_CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX -norunpath -xnolib"
   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
-    OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -D_REENTRANT -D__STDC_FORMAT_MACROS"
+    OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -D_REENTRANT"
     OPENJDK_BUILD_CFLAGS_JDK="$OPENJDK_BUILD_CFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
     OPENJDK_BUILD_CXXFLAGS_JDK="$OPENJDK_BUILD_CXXFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
@@ -52295,6 +52375,11 @@
     fi
   fi
 
+  # Always enable optional macros for VM.
+  OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -D__STDC_FORMAT_MACROS"
+  OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -D__STDC_LIMIT_MACROS"
+  OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -D__STDC_CONSTANT_MACROS"
+
   # Setup target OS define. Use OS target name but in upper case.
   OPENJDK_BUILD_OS_UPPERCASE=`$ECHO $OPENJDK_BUILD_OS | $TR 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
   OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK="$OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK -D$OPENJDK_BUILD_OS_UPPERCASE"
@@ -52314,6 +52399,16 @@
     OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK="$OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK -DDEBUG"
   fi
 
+  # Optional POSIX functionality needed by the VM
+
+  if test "x$HAS_CLOCK_GETTIME" = "xtrue"; then
+    OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -DSUPPORTS_CLOCK_MONOTONIC"
+    if test "x$CLOCK_GETTIME_IN_LIBRT" = "xtrue"; then
+      OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -DNEEDS_LIBRT"
+    fi
+  fi
+
+
   # Set some additional per-OS defines.
   if test "x$OPENJDK_BUILD_OS" = xlinux; then
     OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -DLINUX"
@@ -52322,7 +52417,7 @@
   elif test "x$OPENJDK_BUILD_OS" = xsolaris; then
     OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -DSOLARIS"
     OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -template=no%extdef -features=no%split_init \
-        -D_Crun_inline_placement -library=%none $PICFLAG -mt -features=no%except"
+        -D_Crun_inline_placement -library=stlport4 $PICFLAG -mt -features=no%except"
   elif test "x$OPENJDK_BUILD_OS" = xmacosx; then
     OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK="$OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
     OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -D_ALLBSD_SOURCE"
@@ -53989,8 +54084,8 @@
   fi
 
   if test "x$ENABLE_AOT" = "xtrue"; then
-    # Only enable AOT on linux-X64.
-    if test "x$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU" = "xlinux-x86_64"; then
+    # Only enable AOT on X64 platforms.
+    if test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
       if test -e "$HOTSPOT_TOPDIR/src/jdk.aot"; then
         if test -e "$HOTSPOT_TOPDIR/src/jdk.internal.vm.compiler"; then
           ENABLE_AOT="true"
@@ -54009,7 +54104,7 @@
     else
       ENABLE_AOT="false"
       if test "x$enable_aot" = "xyes"; then
-        as_fn_error $? "AOT is currently only supported on Linux-x86_64. Remove --enable-aot." "$LINENO" 5
+        as_fn_error $? "AOT is currently only supported on x86_64. Remove --enable-aot." "$LINENO" 5
       fi
     fi
   fi
@@ -65499,286 +65594,6 @@
 
 
 
-# Check whether --with-libelf was given.
-if test "${with_libelf+set}" = set; then :
-  withval=$with_libelf;
-fi
-
-
-# Check whether --with-libelf-include was given.
-if test "${with_libelf_include+set}" = set; then :
-  withval=$with_libelf_include;
-fi
-
-
-# Check whether --with-libelf-lib was given.
-if test "${with_libelf_lib+set}" = set; then :
-  withval=$with_libelf_lib;
-fi
-
-
-  if test "x$ENABLE_AOT" = xfalse; then
-    if (test "x${with_libelf}" != x && test "x${with_libelf}" != xno) || \
-        (test "x${with_libelf_include}" != x && test "x${with_libelf_include}" != xno) || \
-        (test "x${with_libelf_lib}" != x && test "x${with_libelf_lib}" != xno); then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libelf is not used, so --with-libelf[-*] is ignored" >&5
-$as_echo "$as_me: WARNING: libelf is not used, so --with-libelf[-*] is ignored" >&2;}
-    fi
-    LIBELF_CFLAGS=
-    LIBELF_LIBS=
-  else
-    LIBELF_FOUND=no
-
-    if test "x${with_libelf}" = xno || test "x${with_libelf_include}" = xno || test "x${with_libelf_lib}" = xno; then
-      ENABLE_AOT="false"
-      if test "x${enable_aot}" = xyes; then
-        as_fn_error $? "libelf is explicitly disabled, cannot build AOT. Enable libelf or remove --enable-aot to disable AOT." "$LINENO" 5
-      fi
-    else
-      if test "x${with_libelf}" != x; then
-        ELF_LIBS="-L${with_libelf}/lib -lelf"
-        ELF_CFLAGS="-I${with_libelf}/include"
-        LIBELF_FOUND=yes
-      fi
-      if test "x${with_libelf_include}" != x; then
-        ELF_CFLAGS="-I${with_libelf_include}"
-        LIBELF_FOUND=yes
-      fi
-      if test "x${with_libelf_lib}" != x; then
-        ELF_LIBS="-L${with_libelf_lib} -lelf"
-        LIBELF_FOUND=yes
-      fi
-      # Do not try pkg-config if we have a sysroot set.
-      if test "x$SYSROOT" = x; then
-        if test "x$LIBELF_FOUND" = xno; then
-          # Figure out ELF_CFLAGS and ELF_LIBS
-
-pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ELF" >&5
-$as_echo_n "checking for ELF... " >&6; }
-
-if test -n "$ELF_CFLAGS"; then
-    pkg_cv_ELF_CFLAGS="$ELF_CFLAGS"
- elif test -n "$PKG_CONFIG"; then
-    if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libelf\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "libelf") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-  pkg_cv_ELF_CFLAGS=`$PKG_CONFIG --cflags "libelf" 2>/dev/null`
-else
-  pkg_failed=yes
-fi
- else
-    pkg_failed=untried
-fi
-if test -n "$ELF_LIBS"; then
-    pkg_cv_ELF_LIBS="$ELF_LIBS"
- elif test -n "$PKG_CONFIG"; then
-    if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libelf\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "libelf") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-  pkg_cv_ELF_LIBS=`$PKG_CONFIG --libs "libelf" 2>/dev/null`
-else
-  pkg_failed=yes
-fi
- else
-    pkg_failed=untried
-fi
-
-
-
-if test $pkg_failed = yes; then
-
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
-        _pkg_short_errors_supported=yes
-else
-        _pkg_short_errors_supported=no
-fi
-        if test $_pkg_short_errors_supported = yes; then
-	        ELF_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libelf" 2>&1`
-        else
-	        ELF_PKG_ERRORS=`$PKG_CONFIG --print-errors "libelf" 2>&1`
-        fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$ELF_PKG_ERRORS" >&5
-
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-                LIBELF_FOUND=no
-elif test $pkg_failed = untried; then
-	LIBELF_FOUND=no
-else
-	ELF_CFLAGS=$pkg_cv_ELF_CFLAGS
-	ELF_LIBS=$pkg_cv_ELF_LIBS
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-	LIBELF_FOUND=yes
-fi
-        fi
-      fi
-      if test "x$LIBELF_FOUND" = xno; then
-        for ac_header in libelf.h
-do :
-  ac_fn_cxx_check_header_mongrel "$LINENO" "libelf.h" "ac_cv_header_libelf_h" "$ac_includes_default"
-if test "x$ac_cv_header_libelf_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBELF_H 1
-_ACEOF
-
-              LIBELF_FOUND=yes
-              ELF_CFLAGS=
-              ELF_LIBS=-lelf
-
-else
-  LIBELF_FOUND=no
-
-fi
-
-done
-
-      fi
-      if test "x$LIBELF_FOUND" = xno; then
-        ENABLE_AOT="false"
-
-  # Print a helpful message on how to acquire the necessary build dependency.
-  # elf is the help tag: freetype, cups, alsa etc
-  MISSING_DEPENDENCY=elf
-
-  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
-    cygwin_help $MISSING_DEPENDENCY
-  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
-    msys_help $MISSING_DEPENDENCY
-  else
-    PKGHANDLER_COMMAND=
-
-    case $PKGHANDLER in
-      apt-get)
-        apt_help     $MISSING_DEPENDENCY ;;
-      yum)
-        yum_help     $MISSING_DEPENDENCY ;;
-      brew)
-        brew_help    $MISSING_DEPENDENCY ;;
-      port)
-        port_help    $MISSING_DEPENDENCY ;;
-      pkgutil)
-        pkgutil_help $MISSING_DEPENDENCY ;;
-      pkgadd)
-        pkgadd_help  $MISSING_DEPENDENCY ;;
-    esac
-
-    if test "x$PKGHANDLER_COMMAND" != x; then
-      HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
-    fi
-  fi
-
-        if test "x${enable_aot}" = xyes; then
-          as_fn_error $? "libelf not found, cannot build AOT. Remove --enable-aot to disable AOT or: $HELP_MSG" "$LINENO" 5
-        else
-          { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libelf not found, cannot build AOT. $HELP_MSG" >&5
-$as_echo "$as_me: WARNING: libelf not found, cannot build AOT. $HELP_MSG" >&2;}
-        fi
-      else
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libelf works" >&5
-$as_echo_n "checking if libelf works... " >&6; }
-        ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-        OLD_CFLAGS="$CFLAGS"
-        CFLAGS="$CFLAGS $ELF_CFLAGS"
-        OLD_LIBS="$LIBS"
-        LIBS="$LIBS $ELF_LIBS"
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <libelf.h>
-int
-main ()
-{
-
-              elf_version(0);
-              return 0;
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  LIBELF_WORKS=yes
-else
-  LIBELF_WORKS=no
-
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-        CFLAGS="$OLD_CFLAGS"
-        LIBS="$OLD_LIBS"
-        ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBELF_WORKS" >&5
-$as_echo "$LIBELF_WORKS" >&6; }
-
-        if test "x$LIBELF_WORKS" = xno; then
-          ENABLE_AOT="false"
-
-  # Print a helpful message on how to acquire the necessary build dependency.
-  # elf is the help tag: freetype, cups, alsa etc
-  MISSING_DEPENDENCY=elf
-
-  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
-    cygwin_help $MISSING_DEPENDENCY
-  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
-    msys_help $MISSING_DEPENDENCY
-  else
-    PKGHANDLER_COMMAND=
-
-    case $PKGHANDLER in
-      apt-get)
-        apt_help     $MISSING_DEPENDENCY ;;
-      yum)
-        yum_help     $MISSING_DEPENDENCY ;;
-      brew)
-        brew_help    $MISSING_DEPENDENCY ;;
-      port)
-        port_help    $MISSING_DEPENDENCY ;;
-      pkgutil)
-        pkgutil_help $MISSING_DEPENDENCY ;;
-      pkgadd)
-        pkgadd_help  $MISSING_DEPENDENCY ;;
-    esac
-
-    if test "x$PKGHANDLER_COMMAND" != x; then
-      HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
-    fi
-  fi
-
-          if test "x$enable_aot" = "xyes"; then
-            as_fn_error $? "Found libelf but could not link and compile with it. Remove --enable-aot to disable AOT or: $HELP_MSG" "$LINENO" 5
-          else
-            { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Found libelf but could not link and compile with it. $HELP_MSG" >&5
-$as_echo "$as_me: WARNING: Found libelf but could not link and compile with it. $HELP_MSG" >&2;}
-          fi
-        fi
-      fi
-    fi
-  fi
-
-
-
-
-
-
-
 
 
 
--- a/common/autoconf/hotspot.m4	Fri Aug 04 23:29:03 2017 +0000
+++ b/common/autoconf/hotspot.m4	Tue Aug 08 21:15:58 2017 +0200
@@ -212,8 +212,8 @@
   fi
 
   if test "x$ENABLE_AOT" = "xtrue"; then
-    # Only enable AOT on linux-X64.
-    if test "x$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU" = "xlinux-x86_64"; then
+    # Only enable AOT on X64 platforms.
+    if test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
       if test -e "$HOTSPOT_TOPDIR/src/jdk.aot"; then
         if test -e "$HOTSPOT_TOPDIR/src/jdk.internal.vm.compiler"; then
           ENABLE_AOT="true"
@@ -232,7 +232,7 @@
     else
       ENABLE_AOT="false"
       if test "x$enable_aot" = "xyes"; then
-        AC_MSG_ERROR([AOT is currently only supported on Linux-x86_64. Remove --enable-aot.])
+        AC_MSG_ERROR([AOT is currently only supported on x86_64. Remove --enable-aot.])
       fi
     fi
   fi
--- a/common/autoconf/lib-elf.m4	Fri Aug 04 23:29:03 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-#
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-################################################################################
-# Setup libelf (ELF library)
-################################################################################
-AC_DEFUN_ONCE([LIB_SETUP_LIBELF],
-[
-  AC_ARG_WITH(libelf, [AS_HELP_STRING([--with-libelf],
-      [specify prefix directory for the libelf package
-      (expecting the libraries under PATH/lib and the headers under PATH/include)])])
-  AC_ARG_WITH(libelf-include, [AS_HELP_STRING([--with-libelf-include],
-      [specify directory for the libelf include files])])
-  AC_ARG_WITH(libelf-lib, [AS_HELP_STRING([--with-libelf-lib],
-      [specify directory for the libelf library])])
-
-  if test "x$ENABLE_AOT" = xfalse; then
-    if (test "x${with_libelf}" != x && test "x${with_libelf}" != xno) || \
-        (test "x${with_libelf_include}" != x && test "x${with_libelf_include}" != xno) || \
-        (test "x${with_libelf_lib}" != x && test "x${with_libelf_lib}" != xno); then
-      AC_MSG_WARN([[libelf is not used, so --with-libelf[-*] is ignored]])
-    fi
-    LIBELF_CFLAGS=
-    LIBELF_LIBS=
-  else
-    LIBELF_FOUND=no
-
-    if test "x${with_libelf}" = xno || test "x${with_libelf_include}" = xno || test "x${with_libelf_lib}" = xno; then
-      ENABLE_AOT="false"
-      if test "x${enable_aot}" = xyes; then
-        AC_MSG_ERROR([libelf is explicitly disabled, cannot build AOT. Enable libelf or remove --enable-aot to disable AOT.])
-      fi
-    else
-      if test "x${with_libelf}" != x; then
-        ELF_LIBS="-L${with_libelf}/lib -lelf"
-        ELF_CFLAGS="-I${with_libelf}/include"
-        LIBELF_FOUND=yes
-      fi
-      if test "x${with_libelf_include}" != x; then
-        ELF_CFLAGS="-I${with_libelf_include}"
-        LIBELF_FOUND=yes
-      fi
-      if test "x${with_libelf_lib}" != x; then
-        ELF_LIBS="-L${with_libelf_lib} -lelf"
-        LIBELF_FOUND=yes
-      fi
-      # Do not try pkg-config if we have a sysroot set.
-      if test "x$SYSROOT" = x; then
-        if test "x$LIBELF_FOUND" = xno; then
-          # Figure out ELF_CFLAGS and ELF_LIBS
-          PKG_CHECK_MODULES([ELF], [libelf], [LIBELF_FOUND=yes], [LIBELF_FOUND=no])
-        fi
-      fi
-      if test "x$LIBELF_FOUND" = xno; then
-        AC_CHECK_HEADERS([libelf.h],
-            [
-              LIBELF_FOUND=yes
-              ELF_CFLAGS=
-              ELF_LIBS=-lelf
-            ],
-            [LIBELF_FOUND=no]
-        )
-      fi
-      if test "x$LIBELF_FOUND" = xno; then
-        ENABLE_AOT="false"
-        HELP_MSG_MISSING_DEPENDENCY([elf])
-        if test "x${enable_aot}" = xyes; then
-          AC_MSG_ERROR([libelf not found, cannot build AOT. Remove --enable-aot to disable AOT or: $HELP_MSG])
-        else
-          AC_MSG_WARN([libelf not found, cannot build AOT. $HELP_MSG])
-        fi
-      else
-        AC_MSG_CHECKING([if libelf works])
-        AC_LANG_PUSH(C)
-        OLD_CFLAGS="$CFLAGS"
-        CFLAGS="$CFLAGS $ELF_CFLAGS"
-        OLD_LIBS="$LIBS"
-        LIBS="$LIBS $ELF_LIBS"
-        AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <libelf.h>],
-            [
-              elf_version(0);
-              return 0;
-            ])],
-            [LIBELF_WORKS=yes],
-            [LIBELF_WORKS=no]
-        )
-        CFLAGS="$OLD_CFLAGS"
-        LIBS="$OLD_LIBS"
-        AC_LANG_POP(C)
-        AC_MSG_RESULT([$LIBELF_WORKS])
-
-        if test "x$LIBELF_WORKS" = xno; then
-          ENABLE_AOT="false"
-          HELP_MSG_MISSING_DEPENDENCY([elf])
-          if test "x$enable_aot" = "xyes"; then
-            AC_MSG_ERROR([Found libelf but could not link and compile with it. Remove --enable-aot to disable AOT or: $HELP_MSG])
-          else
-            AC_MSG_WARN([Found libelf but could not link and compile with it. $HELP_MSG])
-          fi
-        fi
-      fi
-    fi
-  fi
-
-  AC_SUBST(ELF_CFLAGS)
-  AC_SUBST(ELF_LIBS)
-])
--- a/common/autoconf/libraries.m4	Fri Aug 04 23:29:03 2017 +0000
+++ b/common/autoconf/libraries.m4	Tue Aug 08 21:15:58 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,6 @@
 m4_include([lib-freetype.m4])
 m4_include([lib-std.m4])
 m4_include([lib-x11.m4])
-m4_include([lib-elf.m4])
 
 ################################################################################
 # Determine which libraries are needed for this configuration
@@ -91,7 +90,6 @@
   LIB_SETUP_BUNDLED_LIBS
   LIB_SETUP_MISC_LIBS
   LIB_SETUP_SOLARIS_STLPORT
-  LIB_SETUP_LIBELF
 ])
 
 ################################################################################
--- a/common/autoconf/spec.gmk.in	Fri Aug 04 23:29:03 2017 +0000
+++ b/common/autoconf/spec.gmk.in	Tue Aug 08 21:15:58 2017 +0200
@@ -690,6 +690,7 @@
 XATTR:=@XATTR@
 JT_HOME:=@JT_HOME@
 JTREGEXE:=@JTREGEXE@
+JIB_JAR:=@JIB_JAR@
 XCODEBUILD=@XCODEBUILD@
 DTRACE := @DTRACE@
 FIXPATH:=@FIXPATH@
@@ -774,9 +775,6 @@
 PNG_LIBS:=@PNG_LIBS@
 PNG_CFLAGS:=@PNG_CFLAGS@
 
-ELF_CFLAGS:=@ELF_CFLAGS@
-ELF_LIBS:=@ELF_LIBS@
-
 ####################################################
 #
 # Misc
--- a/common/autoconf/toolchain.m4	Fri Aug 04 23:29:03 2017 +0000
+++ b/common/autoconf/toolchain.m4	Tue Aug 08 21:15:58 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -1005,3 +1005,31 @@
   AC_SUBST(JT_HOME)
   AC_SUBST(JTREGEXE)
 ])
+
+# Setup the JIB dependency resolver
+AC_DEFUN_ONCE([TOOLCHAIN_SETUP_JIB],
+[
+  AC_ARG_WITH(jib, [AS_HELP_STRING([--with-jib],
+      [Jib dependency management tool @<:@not used@:>@])])
+
+  if test "x$with_jib" = xno || test "x$with_jib" = x; then
+    # jib disabled
+    AC_MSG_CHECKING([for jib])
+    AC_MSG_RESULT(no)
+  elif test "x$with_jib" = xyes; then
+    AC_MSG_ERROR([Must supply a value to --with-jib])
+  else
+    JIB_HOME="${with_jib}"
+    AC_MSG_CHECKING([for jib])
+    AC_MSG_RESULT(${JIB_HOME})
+    if test ! -d "${JIB_HOME}"; then
+      AC_MSG_ERROR([--with-jib must be a directory])
+    fi
+    JIB_JAR=$(ls ${JIB_HOME}/lib/jib-*.jar)
+    if test ! -f "${JIB_JAR}"; then
+      AC_MSG_ERROR([Could not find jib jar file in ${JIB_HOME}])
+    fi
+  fi
+
+  AC_SUBST(JIB_JAR)
+])
--- a/common/conf/jib-profiles.js	Fri Aug 04 23:29:03 2017 +0000
+++ b/common/conf/jib-profiles.js	Tue Aug 08 21:15:58 2017 +0200
@@ -237,7 +237,7 @@
 
     // These are the base setttings for all the main build profiles.
     common.main_profile_base = {
-        dependencies: ["boot_jdk", "gnumake", "jtreg"],
+        dependencies: ["boot_jdk", "gnumake", "jtreg", "jib"],
         default_make_targets: ["product-bundles", "test-bundles"],
         configure_args: concat(["--enable-jtreg-failure-handler"],
                                versionArgs(input, common))
@@ -590,7 +590,7 @@
         "run-test-jprt": {
             target_os: input.build_os,
             target_cpu: input.build_cpu,
-            dependencies: [ "jtreg", "gnumake", "boot_jdk" ],
+            dependencies: [ "jtreg", "gnumake", "boot_jdk", "devkit", "jib" ],
             labels: "test",
             environment: {
                 "JT_JAVA": common.boot_jdk_home
@@ -600,7 +600,7 @@
         "run-test": {
             target_os: input.build_os,
             target_cpu: input.build_cpu,
-            dependencies: [ "jtreg", "gnumake", "boot_jdk" ],
+            dependencies: [ "jtreg", "gnumake", "boot_jdk", "devkit", "jib" ],
             labels: "test",
             environment: {
                 "JT_JAVA": common.boot_jdk_home
@@ -619,7 +619,7 @@
             target_os: input.build_os,
             target_cpu: input.build_cpu,
             src: "src.conf",
-            dependencies: [ "jtreg", "gnumake", "boot_jdk", testedProfile + ".jdk",
+            dependencies: [ "jtreg", "gnumake", "boot_jdk", "jib", testedProfile + ".jdk",
                 testedProfile + ".test", "src.full"
             ],
             work_dir: input.get("src.full", "install_path") + "/test",
@@ -1023,8 +1023,26 @@
             configure_args: "PANDOC=" + input.get("pandoc", "install_path") + "/pandoc/pandoc",
             environment_path: input.get("pandoc", "install_path") + "/pandoc"
         },
+        // This adds java jib as a dependency for the test artifacts resolver
+        jib: {
+            organization: "com.oracle.java.jib",
+            ext: "zip",
+            classifier: "distribution",
+            revision: "3.0-SNAPSHOT",
+            environment_name: "JIB_JAR",
+            environment_value: input.get("jib", "install_path")
+                + "/jib-3.0-SNAPSHOT-distribution/lib/jib-3.0-SNAPSHOT.jar"
+       }
     };
 
+    // Need to add a value for the Visual Studio tools variable to make
+    // jaot be able to pick up the Visual Studio linker in testing.
+    if (input.target_os == "windows") {
+        dependencies.devkit.environment = {
+            VS120COMNTOOLS: input.get("devkit", "install_path") + "/Common7/Tools"
+        };
+    }
+
     return dependencies;
 };
 
--- a/make/CompileJavaModules.gmk	Fri Aug 04 23:29:03 2017 +0000
+++ b/make/CompileJavaModules.gmk	Tue Aug 08 21:15:58 2017 +0200
@@ -508,6 +508,7 @@
     org.graalvm.compiler.jtt \
     org.graalvm.compiler.lir.jtt \
     org.graalvm.compiler.lir.test \
+    org.graalvm.compiler.loop.test \
     org.graalvm.compiler.microbenchmarks \
     org.graalvm.compiler.nodes.test \
     org.graalvm.compiler.options.test \
@@ -515,6 +516,7 @@
     org.graalvm.compiler.replacements.test \
     org.graalvm.compiler.test \
     org.graalvm.compiler.virtual.bench \
+    org.graalvm.util.test \
     #
 
 ################################################################################
--- a/make/MainSupport.gmk	Fri Aug 04 23:29:03 2017 +0000
+++ b/make/MainSupport.gmk	Tue Aug 08 21:15:58 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,7 @@
 	    JT_HOME=$(JT_HOME) PRODUCT_HOME=$(strip $2) \
 	    TEST_IMAGE_DIR=$(TEST_IMAGE_DIR) \
 	    ALT_OUTPUTDIR=$(OUTPUT_ROOT) TEST_JOBS=$(TEST_JOBS) \
-	    JT_JAVA=$(BOOT_JDK) \
+	    JT_JAVA=$(BOOT_JDK) JIB_JAR=$(JIB_JAR) \
 	    JOBS=$(JOBS) $1) || true
 endef
 
--- a/make/RunTests.gmk	Fri Aug 04 23:29:03 2017 +0000
+++ b/make/RunTests.gmk	Tue Aug 08 21:15:58 2017 +0200
@@ -364,6 +364,10 @@
     $1_JTREG_BASIC_OPTIONS += -nativepath:$$($1_JTREG_NATIVEPATH)
   endif
 
+  ifneq ($$(JIB_JAR), )
+    $1_JTREG_BASIC_OPTIONS += -cpa:$$(JIB_JAR)
+  endif
+
   run-test-$1:
 	$$(call LogWarn)
 	$$(call LogWarn, Running test '$$($1_TEST)')
--- a/make/jprt.properties	Fri Aug 04 23:29:03 2017 +0000
+++ b/make/jprt.properties	Tue Aug 08 21:15:58 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -417,15 +417,6 @@
 
 # Make file based test targets
 
-my.make.rule.test.targets.hotspot.basicvmtests=                         \
-  linux_i586_3.8-*-default-hotspot_basicvmtest,                         \
-  linux_x64_3.8-*-default-hotspot_basicvmtest,                          \
-  macosx_x64_10.9-*-default-hotspot_basicvmtest,                        \
-  solaris_sparcv9_5.11-*-default-hotspot_basicvmtest,                   \
-  solaris_x64_5.11-*-default-hotspot_basicvmtest,                       \
-  windows_i586_6.3-*-default-hotspot_basicvmtest,                       \
-  windows_x64_6.3-*-default-hotspot_basicvmtest
-
 my.make.rule.test.targets.hotspot.gtest= \
   linux_i586_3.8-*-default-hotspot_gtest, \
   linux_x64_3.8-*-default-hotspot_gtest, \
@@ -447,30 +438,29 @@
 
 # Hotspot jtreg tests
 my.make.rule.test.targets.hotspot.reg=							\
-  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_fast_compiler_1},		\
-  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_fast_compiler_2},		\
-  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_fast_compiler_3},		\
-  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_fast_compiler_closed},	\
-  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_fast_gc_1},		\
-  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_fast_gc_2},		\
-  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_fast_gc_closed},		\
-  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_fast_gc_gcold},		\
-  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_fast_gc_gcbasher},	\
-  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_fast_runtime},		\
-  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_fast_serviceability},	\
+  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_tier1_compiler_1},		\
+  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_tier1_compiler_2},		\
+  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_tier1_compiler_3},		\
+  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_tier1_compiler_closed},	\
+  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_tier1_gc_1},		\
+  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_tier1_gc_2},		\
+  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_tier1_gc_closed},		\
+  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_tier1_gc_gcold},		\
+  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_tier1_gc_gcbasher},	\
+  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_tier1_runtime},		\
+  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_tier1_serviceability},	\
   ${my.make.rule.test.targets.hotspot.reg.group:GROUP=jdk_svc_sanity},			\
-  solaris_sparcv9_5.11-product-c2-hotspot_fast_gc_gcbasher,				\
-  solaris_x64_5.11-product-c2-hotspot_fast_gc_gcbasher,					\
-  linux_i586_3.8-product-c2-hotspot_fast_gc_gcbasher,					\
-  linux_x64_3.8-product-c2-hotspot_fast_gc_gcbasher,					\
-  macosx_x64_10.9-product-c2-hotspot_fast_gc_gcbasher,					\
-  windows_i586_6.3-product-c2-hotspot_fast_gc_gcbasher,					\
-  windows_x64_6.3-product-c2-hotspot_fast_gc_gcbasher,                                  \
+  solaris_sparcv9_5.11-product-c2-hotspot_tier1_gc_gcbasher,				\
+  solaris_x64_5.11-product-c2-hotspot_tier1_gc_gcbasher,					\
+  linux_i586_3.8-product-c2-hotspot_tier1_gc_gcbasher,					\
+  linux_x64_3.8-product-c2-hotspot_tier1_gc_gcbasher,					\
+  macosx_x64_10.9-product-c2-hotspot_tier1_gc_gcbasher,					\
+  windows_i586_6.3-product-c2-hotspot_tier1_gc_gcbasher,					\
+  windows_x64_6.3-product-c2-hotspot_tier1_gc_gcbasher,                                  \
   ${my.additional.make.rule.test.targets.hotspot.reg}
 
 # Other Makefile based Hotspot tests
 my.make.rule.test.targets.hotspot.other=                                \
-  ${my.make.rule.test.targets.hotspot.basicvmtests},                    \
   ${my.make.rule.test.targets.hotspot.gtest},                           \
   ${my.additional.make.rule.test.targets.hotspot.other}
 
--- a/test/TestCommon.gmk	Fri Aug 04 23:29:03 2017 +0000
+++ b/test/TestCommon.gmk	Tue Aug 08 21:15:58 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -369,9 +369,15 @@
 endif
 # Give tests access to JT_JAVA, see JDK-8141609
 JTREG_BASIC_OPTIONS += -e:JDK8_HOME=${JT_JAVA}
+# Give aot tests access to Visual Studio installation
+ifneq ($(VS120COMNTOOLS), )
+  JTREG_BASIC_OPTIONS += -e:VS120COMNTOOLS=$(shell $(GETMIXEDPATH) "$(VS120COMNTOOLS)")
+endif
 # Set other vm and test options
 JTREG_TEST_OPTIONS += $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_OPTIONS:%=-vmoption:%) $(JAVA_VM_ARGS:%=-vmoption:%)
-
+ifneq ($(JIB_JAR), )
+  JTREG_BASIC_OPTIONS += -cpa:$(shell $(GETMIXEDPATH) "$(JIB_JAR)")
+endif
 ifeq ($(IGNORE_MARKED_TESTS), true)
   # Option to tell jtreg to not run tests marked with "ignore"
   ifeq ($(PLATFORM), windows)
--- a/test/jtreg-ext/requires/VMProps.java	Fri Aug 04 23:29:03 2017 +0000
+++ b/test/jtreg-ext/requires/VMProps.java	Tue Aug 08 21:15:58 2017 +0200
@@ -24,6 +24,7 @@
 
 import java.io.IOException;
 import java.nio.file.Files;
+import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.nio.file.StandardOpenOption;
 import java.util.ArrayList;
@@ -37,6 +38,7 @@
 import sun.hotspot.cpuinfo.CPUInfo;
 import sun.hotspot.gc.GC;
 import sun.hotspot.WhiteBox;
+import jdk.test.lib.Platform;
 
 /**
  * The Class to be invoked by jtreg prior Test Suite execution to
@@ -66,6 +68,9 @@
         map.put("vm.jvmci", vmJvmci());
         map.put("vm.emulatedClient", vmEmulatedClient());
         map.put("vm.cpu.features", cpuFeatures());
+        map.put("vm.rtm.cpu", vmRTMCPU());
+        map.put("vm.rtm.os", vmRTMOS());
+        map.put("vm.aot", vmAOT());
         vmGC(map); // vm.gc.X = true/false
 
         VMProps.dump(map);
@@ -227,6 +232,52 @@
     }
 
     /**
+     * @return true if VM runs RTM supported OS and false otherwise.
+     */
+    protected String vmRTMOS() {
+        boolean isRTMOS = true;
+
+        if (Platform.isAix()) {
+            // Actually, this works since AIX 7.1.3.30, but os.version property
+            // is set to 7.1.
+            isRTMOS = (Platform.getOsVersionMajor()  > 7) ||
+                      (Platform.getOsVersionMajor() == 7 && Platform.getOsVersionMinor() > 1);
+
+        } else if (Platform.isLinux()) {
+            if (Platform.isPPC()) {
+                isRTMOS = (Platform.getOsVersionMajor()  > 4) ||
+                          (Platform.getOsVersionMajor() == 4 && Platform.getOsVersionMinor() > 1);
+            }
+        }
+        return "" + isRTMOS;
+    }
+
+    /**
+     * @return true if VM runs RTM supported CPU and false otherwise.
+     */
+    protected String vmRTMCPU() {
+        boolean vmRTMCPU = (Platform.isPPC() ? CPUInfo.hasFeature("tcheck") : CPUInfo.hasFeature("rtm"));
+
+        return "" + vmRTMCPU;
+    }
+
+    /**
+     * @return true if VM supports AOT and false otherwise
+     */
+    protected String vmAOT() {
+        // builds with aot have jaotc in <JDK>/bin
+        Path bin = Paths.get(System.getProperty("java.home"))
+                        .resolve("bin");
+        Path jaotc;
+        if (Platform.isWindows()) {
+            jaotc = bin.resolve("jaotc.exe");
+        } else {
+            jaotc = bin.resolve("jaotc");
+        }
+        return "" + Files.exists(jaotc);
+    }
+
+    /**
      * Dumps the map to the file if the file name is given as the property.
      * This functionality could be helpful to know context in the real
      * execution.
--- a/test/lib/jdk/test/lib/Utils.java	Fri Aug 04 23:29:03 2017 +0000
+++ b/test/lib/jdk/test/lib/Utils.java	Tue Aug 08 21:15:58 2017 +0200
@@ -90,6 +90,11 @@
      */
     public static final String TEST_JDK = System.getProperty("test.jdk");
 
+    /*
+     * Returns the value of 'compile.jdk' system property
+     */
+    public static final String COMPILE_JDK= System.getProperty("compile.jdk", TEST_JDK);
+
     /**
      * Returns the value of 'test.classes' system property
      */
@@ -701,5 +706,58 @@
             throw new RuntimeException("Failed to determine distro.", t);
         }
     }
+
+    // This method is intended to be called from a jtreg test.
+    // It will identify the name of the test by means of stack walking.
+    // It can handle both jtreg tests and a testng tests wrapped inside jtreg tests.
+    // For jtreg tests the name of the test will be searched by stack-walking
+    // until the method main() is found; the class containing that method is the
+    // main test class and will be returned as the name of the test.
+    // Special handling is used for testng tests.
+    public static String getTestName() {
+        String result = null;
+        // If we are using testng, then we should be able to load the "Test" annotation.
+        Class testClassAnnotation;
+
+        try {
+            testClassAnnotation = Class.forName("org.testng.annotations.Test");
+        } catch (ClassNotFoundException e) {
+            testClassAnnotation = null;
+        }
+
+        StackTraceElement[] elms = (new Throwable()).getStackTrace();
+        for (StackTraceElement n: elms) {
+            String className = n.getClassName();
+
+            // If this is a "main" method, then use its class name, but only
+            // if we are not using testng.
+            if (testClassAnnotation == null && "main".equals(n.getMethodName())) {
+                result = className;
+                break;
+            }
+
+            // If this is a testng test, the test will have no "main" method. We can
+            // detect a testng test class by looking for the org.testng.annotations.Test
+            // annotation. If present, then use the name of this class.
+            if (testClassAnnotation != null) {
+                try {
+                    Class c = Class.forName(className);
+                    if (c.isAnnotationPresent(testClassAnnotation)) {
+                        result = className;
+                        break;
+                    }
+                } catch (ClassNotFoundException e) {
+                    throw new RuntimeException("Unexpected exception: " + e, e);
+                }
+            }
+        }
+
+        if (result == null) {
+            throw new RuntimeException("Couldn't find main test class in stack trace");
+        }
+
+        return result;
+    }
+
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/jdk/test/lib/artifacts/Artifact.java	Tue Aug 08 21:15:58 2017 +0200
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.test.lib.artifacts;
+
+import java.lang.annotation.*;
+
+@Target(ElementType.TYPE)
+@Repeatable(ArtifactContainer.class)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Artifact {
+    String organization();
+    String name();
+    String revision();
+    String extension();
+    String classifier() default "";
+    boolean unpack() default true;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/jdk/test/lib/artifacts/ArtifactContainer.java	Tue Aug 08 21:15:58 2017 +0200
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.test.lib.artifacts;
+
+import java.lang.annotation.*;
+
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ArtifactContainer {
+    Artifact[] value();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/jdk/test/lib/artifacts/ArtifactManager.java	Tue Aug 08 21:15:58 2017 +0200
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.test.lib.artifacts;
+
+import java.io.FileNotFoundException;
+import java.nio.file.Path;
+
+public interface ArtifactManager {
+    public Path resolve(Artifact artifact) throws FileNotFoundException;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/jdk/test/lib/artifacts/ArtifactResolver.java	Tue Aug 08 21:15:58 2017 +0200
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.test.lib.artifacts;
+
+import java.io.FileNotFoundException;
+import java.nio.file.Path;
+import java.util.HashMap;
+import java.util.Map;
+
+public class ArtifactResolver {
+    public static Map<String, Path> resolve(Class<?> klass) throws FileNotFoundException {
+        ArtifactManager manager = new DefaultArtifactManager();
+        try {
+            String managerName = System.getProperty("jdk.test.lib.artifacts.artifactmanager");
+            if (managerName != null) {
+                manager = (ArtifactManager) Class.forName(managerName).newInstance();
+            } else {
+                manager = JibArtifactManager.newInstance();
+            }
+        } catch (Exception e) {
+            // If we end up here, we'll use the DefaultArtifactManager
+        }
+
+        ArtifactContainer artifactContainer = klass.getAnnotation(ArtifactContainer.class);
+        HashMap<String, Path> locations = new HashMap<>();
+        Artifact[] artifacts;
+
+        if (artifactContainer == null) {
+            artifacts = new Artifact[]{klass.getAnnotation(Artifact.class)};
+        } else {
+            artifacts = artifactContainer.value();
+        }
+        for (Artifact artifact : artifacts) {
+            locations.put(artifactName(artifact), manager.resolve(artifact));
+        }
+
+        return locations;
+    }
+
+    private static String artifactName(Artifact artifact) {
+        // Format of the artifact name is <organization>.<name>-<revision>(-<classifier>)
+        String name = String.format("%s.%s-%s", artifact.organization(), artifact.name(), artifact.revision());
+        if (artifact.classifier().length() != 0) {
+            name = name +"-" + artifact.classifier();
+        }
+        return name;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/jdk/test/lib/artifacts/DefaultArtifactManager.java	Tue Aug 08 21:15:58 2017 +0200
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.test.lib.artifacts;
+
+import java.io.FileNotFoundException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public class DefaultArtifactManager implements ArtifactManager {
+    @Override
+    public Path resolve(Artifact artifact) throws FileNotFoundException {
+        String name = artifact.name();
+        String location = System.getProperty(artifactProperty(name));
+        if (location == null) {
+            throw new FileNotFoundException("Couldn't automatically resolve dependency for " + name + " , revision " + artifact.revision() + "\n" +
+                                            "Please specify the location using " + artifactProperty(name));
+        }
+        return Paths.get(location);
+    }
+
+    private static String artifactProperty(String name) {
+        return "jdk.test.lib.artifacts." + name;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/jdk/test/lib/artifacts/JibArtifactManager.java	Tue Aug 08 21:15:58 2017 +0200
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.test.lib.artifacts;
+
+import java.io.FileNotFoundException;
+import java.lang.reflect.Method;
+import java.nio.file.Path;
+import java.util.HashMap;
+import java.util.Map;
+
+public class JibArtifactManager implements ArtifactManager {
+    private static String jibVersion = "1.0";
+    private Object installerObject;
+
+    private JibArtifactManager(Object o) {
+        installerObject = o;
+    }
+
+    public static JibArtifactManager newInstance() throws ClassNotFoundException {
+        try {
+            Class jibServiceFactory = Class.forName("com.oracle.jib.api.JibServiceFactory");
+            Object jibArtifactInstaller = jibServiceFactory.getMethod("createJibArtifactInstaller").invoke(null);
+            return new JibArtifactManager(jibArtifactInstaller);
+        } catch (Exception e) {
+            throw new ClassNotFoundException();
+        }
+    }
+
+    private Path download(String jibVersion, HashMap<String, Object> artifactDescription) throws Exception {
+        return invokeInstallerMethod("download", jibVersion, artifactDescription);
+    }
+
+    private Path install(String jibVersion, HashMap<String, Object> artifactDescription) throws Exception {
+        return invokeInstallerMethod("install", jibVersion, artifactDescription);
+    }
+
+    private Path invokeInstallerMethod(String methodName, String jibVersion, HashMap<String, Object> artifactDescription) throws Exception {
+        Method m = Class.forName("com.oracle.jib.api.JibArtifactInstaller").getMethod(methodName, String.class, Map.class);
+        return (Path)m.invoke(installerObject, jibVersion, artifactDescription);
+    }
+
+    @Override
+    public Path resolve(Artifact artifact) throws FileNotFoundException {
+        Path path;
+        // Use the DefaultArtifactManager to enable users to override locations
+        try {
+            ArtifactManager manager = new DefaultArtifactManager();
+            path = manager.resolve(artifact);
+        } catch (FileNotFoundException e) {
+            // Location hasn't been overridden, continue to automatically try to resolve the dependency
+            try {
+                HashMap<String, Object> artifactDescription = new HashMap<>();
+                artifactDescription.put("module", artifact.name());
+                artifactDescription.put("organization", artifact.organization());
+                artifactDescription.put("ext", artifact.extension());
+                artifactDescription.put("revision", artifact.revision());
+                if (artifact.classifier().length() > 0) {
+                    artifactDescription.put("classifier", artifact.classifier());
+                }
+
+                path = download(jibVersion, artifactDescription);
+                if (artifact.unpack()) {
+                    path = install(jibVersion, artifactDescription);
+                }
+            } catch (Exception exception) {
+                throw new FileNotFoundException("Failed to resolve the artifact " + artifact);
+            }
+        }
+        return path;
+   }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/jdk/test/lib/cds/CDSOptions.java	Tue Aug 08 21:15:58 2017 +0200
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.test.lib.cds;
+
+import java.util.ArrayList;
+
+// This class represents options used
+// during creation of CDS archive and/or running JVM with a CDS archive
+public class CDSOptions {
+    public String xShareMode = "on";
+    public String archiveName;
+    public ArrayList<String> prefix = new ArrayList<String>();
+    public ArrayList<String> suffix = new ArrayList<String>();
+
+    // Indicate whether to append "-version" when using CDS Archive.
+    // Most of tests will use '-version'
+    public boolean useVersion = true;
+
+
+    public CDSOptions() {
+    }
+
+
+    public CDSOptions addPrefix(String... prefix) {
+        for (String s : prefix) this.prefix.add(s);
+        return this;
+    }
+
+
+    public CDSOptions addSuffix(String... suffix) {
+        for (String s : suffix) this.suffix.add(s);
+        return this;
+    }
+
+    public CDSOptions setXShareMode(String mode) {
+        this.xShareMode = mode;
+        return this;
+    }
+
+
+    public CDSOptions setArchiveName(String name) {
+        this.archiveName = name;
+        return this;
+    }
+
+
+    public CDSOptions setUseVersion(boolean use) {
+        this.useVersion = use;
+        return this;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/jdk/test/lib/cds/CDSTestUtils.java	Tue Aug 08 21:15:58 2017 +0200
@@ -0,0 +1,380 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.test.lib.cds;
+
+import java.io.IOException;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import jdk.test.lib.Utils;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+
+// This class contains common test utilities for testing CDS
+public class CDSTestUtils {
+    // Specify this property to copy sdandard output of the child test process to
+    // the parent/main stdout of the test.
+    // By default such output is logged into a file, and is copied into the main stdout.
+    public static final boolean CopyChildStdoutToMainStdout =
+        Boolean.valueOf(System.getProperty("test.cds.copy.child.stdout", "true"));
+
+    // This property is passed to child test processes
+    public static final String TestTimeoutFactor = System.getProperty("test.timeout.factor", "1.0");
+
+    public static final String UnableToMapMsg =
+        "Unable to map shared archive: test did not complete; assumed PASS";
+
+    // Create bootstrap CDS archive,
+    // use extra JVM command line args as a prefix.
+    // For CDS tests specifying prefix makes more sense than specifying suffix, since
+    // normally there are no classes or arguments to classes, just "-version"
+    // To specify suffix explicitly use CDSOptions.addSuffix()
+    public static OutputAnalyzer createArchive(String... cliPrefix)
+        throws Exception {
+        return createArchive((new CDSOptions()).addPrefix(cliPrefix));
+    }
+
+    // Create bootstrap CDS archive
+    public static OutputAnalyzer createArchive(CDSOptions opts)
+        throws Exception {
+
+        ArrayList<String> cmd = new ArrayList<String>();
+
+        for (String p : opts.prefix) cmd.add(p);
+
+        cmd.add("-Xshare:dump");
+        cmd.add("-Xlog:cds,cds+hashtables");
+        cmd.add("-XX:+UnlockDiagnosticVMOptions");
+        if (opts.archiveName == null)
+            opts.archiveName = getDefaultArchiveName();
+        cmd.add("-XX:SharedArchiveFile=./" + opts.archiveName);
+
+        for (String s : opts.suffix) cmd.add(s);
+
+        String[] cmdLine = cmd.toArray(new String[cmd.size()]);
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, cmdLine);
+        return executeAndLog(pb, "dump");
+    }
+
+
+    // check result of 'dump-the-archive' operation, that is "-Xshare:dump"
+    public static OutputAnalyzer checkDump(OutputAnalyzer output, String... extraMatches)
+        throws Exception {
+
+        output.shouldContain("Loading classes to share");
+        output.shouldHaveExitValue(0);
+
+        for (String match : extraMatches) {
+            output.shouldContain(match);
+        }
+
+        return output;
+    }
+
+
+    // A commonly used convenience methods to create an archive and check the results
+    // Creates an archive and checks for errors
+    public static OutputAnalyzer createArchiveAndCheck(CDSOptions opts)
+        throws Exception {
+        return checkDump(createArchive(opts));
+    }
+
+
+    public static OutputAnalyzer createArchiveAndCheck(String... cliPrefix)
+        throws Exception {
+        return checkDump(createArchive(cliPrefix));
+    }
+
+
+    // This method should be used to check the output of child VM for common exceptions.
+    // Most of CDS tests deal with child VM processes for creating and using the archive.
+    // However exceptions that occur in the child process do not automatically propagate
+    // to the parent process. This mechanism aims to improve the propagation
+    // of exceptions and common errors.
+    // Exception e argument - an exception to be re-thrown if none of the common
+    // exceptions match. Pass null if you wish not to re-throw any exception.
+    public static void checkCommonExecExceptions(OutputAnalyzer output, Exception e)
+        throws Exception {
+        if (output.getStdout().contains("http://bugreport.java.com/bugreport/crash.jsp")) {
+            throw new RuntimeException("Hotspot crashed");
+        }
+        if (output.getStdout().contains("TEST FAILED")) {
+            throw new RuntimeException("Test Failed");
+        }
+        if (output.getOutput().contains("shared class paths mismatch")) {
+            throw new RuntimeException("shared class paths mismatch");
+        }
+        if (output.getOutput().contains("Unable to unmap shared space")) {
+            throw new RuntimeException("Unable to unmap shared space");
+        }
+
+        // Special case -- sometimes Xshare:on fails because it failed to map
+        // at given address. This behavior is platform-specific, machine config-specific
+        // and can be random (see ASLR).
+        if (isUnableToMap(output)) {
+            System.out.println(UnableToMapMsg);
+            return;
+        }
+
+        if (e != null)
+            throw e;
+    }
+
+
+    // Check the output for indication that mapping of the archive failed.
+    // Performance note: this check seems to be rather costly - searching the entire
+    // output stream of a child process for multiple strings. However, it is necessary
+    // to detect this condition, a failure to map an archive, since this is not a real
+    // failure of the test or VM operation, and results in a test being "skipped".
+    // Suggestions to improve:
+    // 1. VM can designate a special exit code for such condition.
+    // 2. VM can print a single distinct string indicating failure to map an archive,
+    //    instead of utilizing multiple messages.
+    // These are suggestions to improve testibility of the VM. However, implementing them
+    // could also improve usability in the field.
+    public static boolean isUnableToMap(OutputAnalyzer output) {
+        String outStr = output.getOutput();
+        if ((output.getExitValue() == 1) && (
+            outStr.contains("Unable to reserve shared space at required address") ||
+            outStr.contains("Unable to map ReadOnly shared space at required address") ||
+            outStr.contains("Unable to map ReadWrite shared space at required address") ||
+            outStr.contains("Unable to map MiscData shared space at required address") ||
+            outStr.contains("Unable to map MiscCode shared space at required address") ||
+            outStr.contains("Unable to map shared string space at required address") ||
+            outStr.contains("Could not allocate metaspace at a compatible address") ||
+            outStr.contains("Unable to allocate shared string space: range is not within java heap") ))
+        {
+            return true;
+        }
+
+        return false;
+    }
+
+
+    // Execute JVM with CDS archive, specify command line args suffix
+    public static OutputAnalyzer runWithArchive(String... cliPrefix)
+        throws Exception {
+
+        return runWithArchive( (new CDSOptions())
+                               .setArchiveName(getDefaultArchiveName())
+                               .addPrefix(cliPrefix) );
+    }
+
+
+    // Execute JVM with CDS archive, specify CDSOptions
+    public static OutputAnalyzer runWithArchive(CDSOptions opts)
+        throws Exception {
+
+        ArrayList<String> cmd = new ArrayList<String>();
+
+        for (String p : opts.prefix) cmd.add(p);
+
+        cmd.add("-Xshare:" + opts.xShareMode);
+        cmd.add("-XX:+UnlockDiagnosticVMOptions");
+        cmd.add("-Dtest.timeout.factor=" + TestTimeoutFactor);
+
+        if (opts.archiveName == null)
+            opts.archiveName = getDefaultArchiveName();
+        cmd.add("-XX:SharedArchiveFile=" + opts.archiveName);
+
+        if (opts.useVersion)
+            cmd.add("-version");
+
+        for (String s : opts.suffix) cmd.add(s);
+
+        String[] cmdLine = cmd.toArray(new String[cmd.size()]);
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, cmdLine);
+        return executeAndLog(pb, "exec");
+    }
+
+
+    // A commonly used convenience methods to create an archive and check the results
+    // Creates an archive and checks for errors
+    public static OutputAnalyzer runWithArchiveAndCheck(CDSOptions opts) throws Exception {
+        return checkExec(runWithArchive(opts));
+    }
+
+
+    public static OutputAnalyzer runWithArchiveAndCheck(String... cliPrefix) throws Exception {
+        return checkExec(runWithArchive(cliPrefix));
+    }
+
+
+    public static OutputAnalyzer checkExec(OutputAnalyzer output,
+                                     String... extraMatches) throws Exception {
+        CDSOptions opts = new CDSOptions();
+        return checkExec(output, opts, extraMatches);
+    }
+
+
+    // check result of 'exec' operation, that is when JVM is run using the archive
+    public static OutputAnalyzer checkExec(OutputAnalyzer output, CDSOptions opts,
+                                     String... extraMatches) throws Exception {
+        try {
+            if ("on".equals(opts.xShareMode)) {
+                output.shouldContain("sharing");
+            }
+            output.shouldHaveExitValue(0);
+        } catch (RuntimeException e) {
+            checkCommonExecExceptions(output, e);
+            return output;
+        }
+
+        checkExtraMatches(output, extraMatches);
+        return output;
+    }
+
+
+    public static OutputAnalyzer checkExecExpectError(OutputAnalyzer output,
+                                             int expectedExitValue,
+                                             String... extraMatches) throws Exception {
+        if (isUnableToMap(output)) {
+            System.out.println(UnableToMapMsg);
+            return output;
+        }
+
+        output.shouldHaveExitValue(expectedExitValue);
+        checkExtraMatches(output, extraMatches);
+        return output;
+    }
+
+    public static OutputAnalyzer checkExtraMatches(OutputAnalyzer output,
+                                                    String... extraMatches) throws Exception {
+        for (String match : extraMatches) {
+            output.shouldContain(match);
+        }
+        return output;
+    }
+
+
+    // get the file object for the test artifact
+    public static File getTestArtifact(String name, boolean checkExistence) {
+        File dir = new File(System.getProperty("test.classes", "."));
+        File file = new File(dir, name);
+
+        if (checkExistence && !file.exists()) {
+            throw new RuntimeException("Cannot find " + file.getPath());
+        }
+
+        return file;
+    }
+
+
+    // create file containing the specified class list
+    public static File makeClassList(String classes[])
+        throws Exception {
+        return makeClassList(getTestName() + "-", classes);
+    }
+
+    // create file containing the specified class list
+    public static File makeClassList(String testCaseName, String classes[])
+        throws Exception {
+
+        File classList = getTestArtifact(testCaseName + "test.classlist", false);
+        FileOutputStream fos = new FileOutputStream(classList);
+        PrintStream ps = new PrintStream(fos);
+
+        addToClassList(ps, classes);
+
+        ps.close();
+        fos.close();
+
+        return classList;
+    }
+
+
+    public static void addToClassList(PrintStream ps, String classes[])
+        throws IOException
+    {
+        if (classes != null) {
+            for (String s : classes) {
+                ps.println(s);
+            }
+        }
+    }
+
+
+    // Optimization for getting a test name.
+    // Test name does not change during execution of the test,
+    // but getTestName() uses stack walking hence it is expensive.
+    // Therefore cache it and reuse it.
+    private static String testName;
+    public static String getTestName() {
+        if (testName == null) {
+            testName = Utils.getTestName();
+        }
+        return testName;
+    }
+
+
+    public static String getDefaultArchiveName() {
+        return getTestName() + ".jsa";
+    }
+
+
+    // ===================== FILE ACCESS convenience methods
+    public static File getOutputFile(String name) {
+        File dir = new File(System.getProperty("test.classes", "."));
+        return new File(dir, getTestName() + "-" + name);
+    }
+
+
+    public static File getOutputSourceFile(String name) {
+        File dir = new File(System.getProperty("test.classes", "."));
+        return new File(dir, name);
+    }
+
+
+    public static File getSourceFile(String name) {
+        File dir = new File(System.getProperty("test.src", "."));
+        return new File(dir, name);
+    }
+
+
+    // ============================= Logging
+    public static OutputAnalyzer executeAndLog(ProcessBuilder pb, String logName) throws Exception {
+        long started = System.currentTimeMillis();
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+
+        writeFile(getOutputFile(logName + ".stdout"), output.getStdout());
+        writeFile(getOutputFile(logName + ".stderr"), output.getStderr());
+        System.out.println("[ELAPSED: " + (System.currentTimeMillis() - started) + " ms]");
+        System.out.println("[STDERR]\n" + output.getStderr());
+
+        if (CopyChildStdoutToMainStdout)
+            System.out.println("[STDOUT]\n" + output.getStdout());
+
+        return output;
+    }
+
+
+    private static void writeFile(File file, String content) throws Exception {
+        FileOutputStream fos = new FileOutputStream(file);
+        PrintStream ps = new PrintStream(fos);
+        ps.print(content);
+        ps.close();
+        fos.close();
+    }
+}
--- a/test/lib/jdk/test/lib/process/ProcessTools.java	Fri Aug 04 23:29:03 2017 +0000
+++ b/test/lib/jdk/test/lib/process/ProcessTools.java	Tue Aug 08 21:15:58 2017 +0200
@@ -64,7 +64,7 @@
     /**
      * Pumps stdout and stderr from running the process into a String.
      *
-     * @param processHandler ProcessHandler to run.
+     * @param processBuilder ProcessBuilder to run.
      * @return Output from process.
      * @throws IOException If an I/O error occurs.
      */
--- a/test/lib/sun/hotspot/WhiteBox.java	Fri Aug 04 23:29:03 2017 +0000
+++ b/test/lib/sun/hotspot/WhiteBox.java	Tue Aug 08 21:15:58 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -377,6 +377,7 @@
   public native long incMetaspaceCapacityUntilGC(long increment);
   public native long metaspaceCapacityUntilGC();
   public native boolean metaspaceShouldConcurrentCollect();
+  public native long metaspaceReserveAlignment();
 
   // Don't use these methods directly
   // Use sun.hotspot.gc.GC class instead.
@@ -390,6 +391,39 @@
   // Force Full GC
   public native void fullGC();
 
+  // Returns true if the current GC supports control of its concurrent
+  // phase via requestConcurrentGCPhase().  If false, a request will
+  // always fail.
+  public native boolean supportsConcurrentGCPhaseControl();
+
+  // Returns an array of concurrent phase names provided by this
+  // collector.  These are the names recognized by
+  // requestConcurrentGCPhase().
+  public native String[] getConcurrentGCPhases();
+
+  // Attempt to put the collector into the indicated concurrent phase,
+  // and attempt to remain in that state until a new request is made.
+  //
+  // Returns immediately if already in the requested phase.
+  // Otherwise, waits until the phase is reached.
+  //
+  // Throws IllegalStateException if unsupported by the current collector.
+  // Throws NullPointerException if phase is null.
+  // Throws IllegalArgumentException if phase is not valid for the current collector.
+  public void requestConcurrentGCPhase(String phase) {
+    if (!supportsConcurrentGCPhaseControl()) {
+      throw new IllegalStateException("Concurrent GC phase control not supported");
+    } else if (phase == null) {
+      throw new NullPointerException("null phase");
+    } else if (!requestConcurrentGCPhase0(phase)) {
+      throw new IllegalArgumentException("Unknown concurrent GC phase: " + phase);
+    }
+  }
+
+  // Helper for requestConcurrentGCPhase().  Returns true if request
+  // succeeded, false if the phase is invalid.
+  private native boolean requestConcurrentGCPhase0(String phase);
+
   // Method tries to start concurrent mark cycle.
   // It returns false if CM Thread is always in concurrent cycle.
   public native boolean g1StartConcMarkCycle();
@@ -449,13 +483,12 @@
   }
 
   // Jigsaw
-  public native void DefineModule(Object module, String version, String location,
-                                  Object[] packages);
+  public native void DefineModule(Object module, boolean is_open, String version,
+                                  String location, Object[] packages);
   public native void AddModuleExports(Object from_module, String pkg, Object to_module);
   public native void AddReadsModule(Object from_module, Object source_module);
   public native void AddModuleExportsToAllUnnamed(Object module, String pkg);
   public native void AddModuleExportsToAll(Object module, String pkg);
-  public native Object GetModuleByPackageName(Object ldr, String pkg);
 
   public native int getOffsetForName0(String name);
   public int getOffsetForName(String name) throws Exception {