Merge
authorjwilhelm
Fri, 05 May 2017 17:48:43 +0200
changeset 46214 b6b866fd21b2
parent 44892 ec794e820a8e (current diff)
parent 46213 02cb097768ec (diff)
child 46215 d5e1d3d5e004
child 46216 46de64cb5e2d
Merge
common/autoconf/generated-configure.sh
common/autoconf/lib-elf.m4
--- a/common/autoconf/configure.ac	Thu May 04 00:02:23 2017 +0000
+++ b/common/autoconf/configure.ac	Fri May 05 17:48:43 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/generated-configure.sh	Thu May 04 00:02:23 2017 +0000
+++ b/common/autoconf/generated-configure.sh	Fri May 05 17:48:43 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
@@ -788,6 +786,7 @@
 COMPILER_BINDCMD_FILE_FLAG
 COMPILER_COMMAND_FILE_FLAG
 COMPILER_TARGET_BITS_FLAG
+JIB_JAR
 JT_HOME
 JTREGEXE
 HOTSPOT_TOOLCHAIN_TYPE
@@ -1177,6 +1176,7 @@
 with_toolchain_version
 with_build_devkit
 with_jtreg
+with_jib
 with_abi_profile
 enable_warnings_as_errors
 with_native_debug_symbols
@@ -1212,9 +1212,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
@@ -1343,8 +1340,6 @@
 PNG_LIBS
 LCMS_CFLAGS
 LCMS_LIBS
-ELF_CFLAGS
-ELF_LIBS
 ICECC_CMD
 ICECC_CREATE_ENV
 ICECC_WRAPPER
@@ -2120,6 +2115,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)
@@ -2173,11 +2169,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
@@ -2313,8 +2304,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
@@ -4502,7 +4491,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
@@ -4779,36 +4768,6 @@
 ################################################################################
 
 
-#
-# 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)
-################################################################################
-
-
 
 ################################################################################
 # Determine which libraries are needed for this configuration
@@ -4945,7 +4904,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
@@ -5076,6 +5035,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.
@@ -5177,7 +5139,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1490900744
+DATE_WHEN_GENERATED=1493999318
 
 ###############################################################################
 #
@@ -48882,6 +48844,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
@@ -53255,8 +53252,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"
@@ -64612,286 +64609,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	Thu May 04 00:02:23 2017 +0000
+++ b/common/autoconf/hotspot.m4	Fri May 05 17:48:43 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"
--- a/common/autoconf/lib-elf.m4	Thu May 04 00:02:23 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	Thu May 04 00:02:23 2017 +0000
+++ b/common/autoconf/libraries.m4	Fri May 05 17:48:43 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	Thu May 04 00:02:23 2017 +0000
+++ b/common/autoconf/spec.gmk.in	Fri May 05 17:48:43 2017 +0200
@@ -685,6 +685,7 @@
 XATTR:=@XATTR@
 JT_HOME:=@JT_HOME@
 JTREGEXE:=@JTREGEXE@
+JIB_JAR:=@JIB_JAR@
 XCODEBUILD=@XCODEBUILD@
 DTRACE := @DTRACE@
 FIXPATH:=@FIXPATH@
@@ -769,9 +770,6 @@
 PNG_LIBS:=@PNG_LIBS@
 PNG_CFLAGS:=@PNG_CFLAGS@
 
-ELF_CFLAGS:=@ELF_CFLAGS@
-ELF_LIBS:=@ELF_LIBS@
-
 ####################################################
 #
 # Misc
--- a/common/autoconf/toolchain.m4	Thu May 04 00:02:23 2017 +0000
+++ b/common/autoconf/toolchain.m4	Fri May 05 17:48:43 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
@@ -964,3 +964,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	Thu May 04 00:02:23 2017 +0000
+++ b/common/conf/jib-profiles.js	Fri May 05 17:48:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -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: [
             "--with-version-opt=" + common.build_id,
@@ -593,7 +593,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
@@ -603,7 +603,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
@@ -620,7 +620,7 @@
     var testOnlyProfilesPrebuilt = {
         "run-test-prebuilt": {
             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",
@@ -964,9 +964,28 @@
             ext: "tar.gz",
             revision: "2.7.1-v120+1.0",
             module: "freetype-" + input.target_platform
-        }
+        },
+
+        // 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	Thu May 04 00:02:23 2017 +0000
+++ b/make/CompileJavaModules.gmk	Fri May 05 17:48:43 2017 +0200
@@ -491,6 +491,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 \
@@ -498,6 +499,7 @@
     org.graalvm.compiler.replacements.test \
     org.graalvm.compiler.test \
     org.graalvm.compiler.virtual.bench \
+    org.graalvm.util.test \
     #
 
 ################################################################################
--- a/make/Javadoc.gmk	Thu May 04 00:02:23 2017 +0000
+++ b/make/Javadoc.gmk	Fri May 05 17:48:43 2017 +0200
@@ -125,6 +125,7 @@
     org.w3c.dom.stylesheets \
     org.w3c.dom.xpath \
     org.graalvm.compiler.% \
+    org.graalvm.util% \
     #
 
 CORE_PACKAGES := $(filter-out $(CORE_EXCLUDED_PACKAGES), \
--- a/make/MainSupport.gmk	Thu May 04 00:02:23 2017 +0000
+++ b/make/MainSupport.gmk	Fri May 05 17:48:43 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/jprt.properties	Thu May 04 00:02:23 2017 +0000
+++ b/make/jprt.properties	Fri May 05 17:48:43 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
@@ -441,25 +441,25 @@
 
 # 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
--- a/test/TestCommon.gmk	Thu May 04 00:02:23 2017 +0000
+++ b/test/TestCommon.gmk	Fri May 05 17:48:43 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/lib/jdk/test/lib/Utils.java	Thu May 04 00:02:23 2017 +0000
+++ b/test/lib/jdk/test/lib/Utils.java	Fri May 05 17:48:43 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -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
      */
@@ -680,5 +685,58 @@
                 String.format("A mandatory property '%s' isn't set", propName));
         return prop;
     }
+
+    // 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	Fri May 05 17:48:43 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	Fri May 05 17:48:43 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	Fri May 05 17:48:43 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	Fri May 05 17:48:43 2017 +0200
@@ -0,0 +1,68 @@
+/*
+ * 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;
+
+public class ArtifactResolver {
+    public static HashMap<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 = (ArtifactContainer) klass.getAnnotation(ArtifactContainer.class);
+        HashMap<String, Path> locations = new HashMap<>();
+        Artifact[] artifacts;
+
+        if (artifactContainer == null) {
+            artifacts = new Artifact[]{(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	Fri May 05 17:48:43 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	Fri May 05 17:48:43 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	Fri May 05 17:48:43 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	Fri May 05 17:48:43 2017 +0200
@@ -0,0 +1,381 @@
+/*
+ * 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, but not copied into the main stdout
+    // to avoid excessive log pollution. See executeAndLog() for details
+    public static final boolean CopyChildStdoutToMainStdout =
+        Boolean.getBoolean("test.cds.copy.child.stdout");
+
+    // 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("-XX:+PrintSharedSpaces");
+        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/sun/hotspot/WhiteBox.java	Thu May 04 00:02:23 2017 +0000
+++ b/test/lib/sun/hotspot/WhiteBox.java	Fri May 05 17:48:43 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
@@ -390,6 +390,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,14 +482,13 @@
   }
 
   // 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 AddModulePackage(Object module, String pkg);
   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 {