changeset 56218:382460a0cd85 vectorSnippets

manual merge with default
author mcimadamore
date Thu, 05 Jul 2018 11:53:53 +0100
parents 2ba8091d6fcd 00b16d0457e4
children 6549e3699526
files make/CompileJavaModules.gmk src/hotspot/cpu/x86/assembler_x86.cpp src/hotspot/cpu/x86/assembler_x86.hpp src/hotspot/cpu/x86/macroAssembler_x86.cpp src/hotspot/cpu/x86/macroAssembler_x86.hpp src/hotspot/share/classfile/javaClasses.cpp src/hotspot/share/classfile/javaClasses.hpp src/hotspot/share/classfile/vmSymbols.hpp src/hotspot/share/opto/c2compiler.cpp src/hotspot/share/opto/escape.cpp src/hotspot/share/opto/library_call.cpp src/hotspot/share/runtime/globals.hpp src/hotspot/share/runtime/vmStructs.cpp src/java.base/share/classes/java/lang/invoke/MethodHandles.java src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/AltHashing.java src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/SymbolTable.java test/hotspot/jtreg/runtime/SharedArchiveFile/SASymbolTableTest.java test/hotspot/jtreg/runtime/SharedArchiveFile/SASymbolTableTestAgent.java test/hotspot/jtreg/serviceability/sa/ClhsdbSymbol.java test/hotspot/jtreg/serviceability/sa/ClhsdbSymbolTable.java test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach024/java.base/java/util/ServiceConfigurationError.java test/jdk/sun/tools/jhsdb/AlternateHashingTest.java test/jdk/sun/tools/jhsdb/LingeredAppWithAltHashing.java
diffstat 499 files changed, 13643 insertions(+), 3128 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Jun 28 05:10:01 2018 +0200
+++ b/.hgtags	Thu Jul 05 11:53:53 2018 +0100
@@ -490,6 +490,6 @@
 02934b0d661b82b7fe1052a04998d2091352e08d jdk-11+16
 64e4b1686141e57a681936a8283983341484676e jdk-11+17
 e1b3def126240d5433902f3cb0e91a4c27f6db50 jdk-11+18
-fb8b3f4672774e15654958295558a1af1b576919 jdk-11+19
-fb8b3f4672774e15654958295558a1af1b576919 jdk-11+19
 36ca515343e00b021dcfc902e986d26ec994a2e5 jdk-11+19
+95aad0c785e497f1bade3955c4e4a677b629fa9d jdk-12+0
+9816d7cc655e53ba081f938b656e31971b8f097a jdk-11+20
--- a/README	Thu Jun 28 05:10:01 2018 +0200
+++ b/README	Thu Jul 05 11:53:53 2018 +0100
@@ -1,10 +1,12 @@
-Welcome to OpenJDK!
+
+Welcome to the JDK!
 ===================
 
-For information about building OpenJDK, including how to fully retrieve all
-source code, please see either of these:
+For information about building the JDK, including how to retrieve all
+of the source code, please see either of these files:
 
   * doc/building.html   (html version)
   * doc/building.md     (markdown version)
 
-See http://openjdk.java.net/ for more information about OpenJDK.
+See http://openjdk.java.net/ for more information about the OpenJDK
+Community and the JDK.
--- a/doc/building.html	Thu Jun 28 05:10:01 2018 +0200
+++ b/doc/building.html	Thu Jul 05 11:53:53 2018 +0100
@@ -1,11 +1,16 @@
 <!DOCTYPE html>
-<html>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
 <head>
-  <meta charset="utf-8">
-  <meta name="generator" content="pandoc">
-  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
-  <title>Building OpenJDK</title>
-  <style type="text/css">code{white-space: pre;}</style>
+  <meta charset="utf-8" />
+  <meta name="generator" content="pandoc" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
+  <title>Building the JDK</title>
+  <style type="text/css">
+      code{white-space: pre-wrap;}
+      span.smallcaps{font-variant: small-caps;}
+      span.underline{text-decoration: underline;}
+      div.column{display: inline-block; vertical-align: top; width: 50%;}
+  </style>
   <link rel="stylesheet" href="../make/data/docs-resources/resources/jdk-default.css">
   <!--[if lt IE 9]>
     <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
@@ -14,7 +19,7 @@
 </head>
 <body>
 <header>
-<h1 class="title">Building OpenJDK</h1>
+<h1 class="title">Building the JDK</h1>
 </header>
 <nav id="TOC">
 <ul>
@@ -106,11 +111,11 @@
 <li><a href="#autoconf-details">Autoconf Details</a></li>
 <li><a href="#developing-the-build-system-itself">Developing the Build System Itself</a></li>
 </ul></li>
-<li><a href="#contributing-to-openjdk">Contributing to OpenJDK</a></li>
+<li><a href="#contributing-to-the-jdk">Contributing to the JDK</a></li>
 </ul>
 </nav>
 <h2 id="tldr-instructions-for-the-impatient">TL;DR (Instructions for the Impatient)</h2>
-<p>If you are eager to try out building OpenJDK, these simple steps works most of the time. They assume that you have installed Mercurial (and Cygwin if running on Windows) and cloned the top-level OpenJDK repository that you want to build.</p>
+<p>If you are eager to try out building the JDK, these simple steps works most of the time. They assume that you have installed Mercurial (and Cygwin if running on Windows) and cloned the top-level JDK repository that you want to build.</p>
 <ol type="1">
 <li><p><a href="#getting-the-source-code">Get the complete source code</a>:<br />
 <code>hg clone http://hg.openjdk.java.net/jdk/jdk</code></p></li>
@@ -126,11 +131,11 @@
 </ol>
 <p>If any of these steps failed, or if you want to know more about build requirements or build functionality, please continue reading this document.</p>
 <h2 id="introduction">Introduction</h2>
-<p>OpenJDK is a complex software project. Building it requires a certain amount of technical expertise, a fair number of dependencies on external software, and reasonably powerful hardware.</p>
-<p>If you just want to use OpenJDK and not build it yourself, this document is not for you. See for instance <a href="http://openjdk.java.net/install">OpenJDK installation</a> for some methods of installing a prebuilt OpenJDK.</p>
+<p>The JDK is a complex software project. Building it requires a certain amount of technical expertise, a fair number of dependencies on external software, and reasonably powerful hardware.</p>
+<p>If you just want to use the JDK and not build it yourself, this document is not for you. See for instance <a href="http://openjdk.java.net/install">OpenJDK installation</a> for some methods of installing a prebuilt JDK.</p>
 <h2 id="getting-the-source-code">Getting the Source Code</h2>
-<p>Make sure you are getting the correct version. As of JDK 10, the source is no longer split into separate repositories so you only need to clone one single repository. At the <a href="http://hg.openjdk.java.net/">OpenJDK Mercurial server</a> you can see a list of all available forests. If you want to build an older version, e.g. JDK 8, it is recommended that you get the <code>jdk8u</code> forest, which contains incremental updates, instead of the <code>jdk8</code> forest, which was frozen at JDK 8 GA.</p>
-<p>If you are new to Mercurial, a good place to start is the <a href="http://www.mercurial-scm.org/guide">Mercurial Beginner's Guide</a>. The rest of this document assumes a working knowledge of Mercurial.</p>
+<p>Make sure you are getting the correct version. As of JDK 10, the source is no longer split into separate repositories so you only need to clone one single repository. At the <a href="http://hg.openjdk.java.net/">OpenJDK Mercurial server</a> you can see a list of all available forests. If you want to build an older version, e.g. JDK 8, it is recommended that you get the <code>jdk8u</code> forest, which contains incremental updates, instead of the <code>jdk8</code> forest, which was frozen at JDK 8 GA.</p>
+<p>If you are new to Mercurial, a good place to start is the <a href="http://www.mercurial-scm.org/guide">Mercurial Beginner’s Guide</a>. The rest of this document assumes a working knowledge of Mercurial.</p>
 <h3 id="special-considerations">Special Considerations</h3>
 <p>For a smooth building experience, it is recommended that you follow these rules on where and how to check out the source code.</p>
 <ul>
@@ -139,14 +144,14 @@
 <li><p>Put the source code on a local disk, not a network share. If possible, use an SSD. The build process is very disk intensive, and having slow disk access will significantly increase build times. If you need to use a network share for the source code, see below for suggestions on how to keep the build artifacts on a local disk.</p></li>
 <li><p>On Windows, extra care must be taken to make sure the <a href="#cygwin">Cygwin</a> environment is consistent. It is recommended that you follow this procedure:</p>
 <ul>
-<li><p>Create the directory that is going to contain the top directory of the OpenJDK clone by using the <code>mkdir</code> command in the Cygwin bash shell. That is, do <em>not</em> create it using Windows Explorer. This will ensure that it will have proper Cygwin attributes, and that it's children will inherit those attributes.</p></li>
-<li><p>Do not put the OpenJDK clone in a path under your Cygwin home directory. This is especially important if your user name contains spaces and/or mixed upper and lower case letters.</p></li>
-<li><p>Clone the OpenJDK repository using the Cygwin command line <code>hg</code> client as instructed in this document. That is, do <em>not</em> use another Mercurial client such as TortoiseHg.</p></li>
+<li><p>Create the directory that is going to contain the top directory of the JDK clone by using the <code>mkdir</code> command in the Cygwin bash shell. That is, do <em>not</em> create it using Windows Explorer. This will ensure that it will have proper Cygwin attributes, and that it’s children will inherit those attributes.</p></li>
+<li><p>Do not put the JDK clone in a path under your Cygwin home directory. This is especially important if your user name contains spaces and/or mixed upper and lower case letters.</p></li>
+<li><p>Clone the JDK repository using the Cygwin command line <code>hg</code> client as instructed in this document. That is, do <em>not</em> use another Mercurial client such as TortoiseHg.</p></li>
 </ul>
 <p>Failure to follow this procedure might result in hard-to-debug build problems.</p></li>
 </ul>
 <h2 id="build-hardware-requirements">Build Hardware Requirements</h2>
-<p>OpenJDK is a massive project, and require machines ranging from decent to powerful to be able to build in a reasonable amount of time, or to be able to complete a build at all.</p>
+<p>The JDK is a massive project, and require machines ranging from decent to powerful to be able to build in a reasonable amount of time, or to be able to complete a build at all.</p>
 <p>We <em>strongly</em> recommend usage of an SSD disk for the build, since disk speed is one of the limiting factors for build performance.</p>
 <h3 id="building-on-x86">Building on x86</h3>
 <p>At a minimum, a machine with 2-4 cores is advisable, as well as 2-4 GB of RAM. (The more cores to use, the more memory you need.) At least 6 GB of free disk space is required (8 GB minimum for building on Solaris).</p>
@@ -156,9 +161,9 @@
 <h3 id="building-on-armaarch64">Building on arm/aarch64</h3>
 <p>This is not recommended. Instead, see the section on <a href="#cross-compiling">Cross-compiling</a>.</p>
 <h2 id="operating-system-requirements">Operating System Requirements</h2>
-<p>The mainline OpenJDK project supports Linux, Solaris, macOS, AIX and Windows. Support for other operating system, e.g. BSD, exists in separate &quot;port&quot; projects.</p>
-<p>In general, OpenJDK can be built on a wide range of versions of these operating systems, but the further you deviate from what is tested on a daily basis, the more likely you are to run into problems.</p>
-<p>This table lists the OS versions used by Oracle when building OpenJDK. Such information is always subject to change, but this table is up to date at the time of writing.</p>
+<p>The mainline JDK project supports Linux, Solaris, macOS, AIX and Windows. Support for other operating system, e.g. BSD, exists in separate “port” projects.</p>
+<p>In general, the JDK can be built on a wide range of versions of these operating systems, but the further you deviate from what is tested on a daily basis, the more likely you are to run into problems.</p>
+<p>This table lists the OS versions used by Oracle when building the JDK. Such information is always subject to change, but this table is up to date at the time of writing.</p>
 <table>
 <thead>
 <tr class="header">
@@ -185,17 +190,17 @@
 </tr>
 </tbody>
 </table>
-<p>The double version numbers for Linux, Solaris and macOS is due to the hybrid model used at Oracle, where header files and external libraries from an older version is used when building on a more modern version of the OS.</p>
-<p>The Build Group has a wiki page with <a href="https://wiki.openjdk.java.net/display/Build/Supported+Build+Platforms">Supported Build Platforms</a>. From time to time, this is updated by the community to list successes or failures of building on different platforms.</p>
+<p>The double version numbers for Linux, Solaris and macOS is due to the hybrid model used at Oracle, where header files and external libraries from an older version are used when building on a more modern version of the OS.</p>
+<p>The Build Group has a wiki page with <a href="https://wiki.openjdk.java.net/display/Build/Supported+Build+Platforms">Supported Build Platforms</a>. From time to time, this is updated by contributors to list successes or failures of building on different platforms.</p>
 <h3 id="windows">Windows</h3>
-<p>Windows XP is not a supported platform, but all newer Windows should be able to build OpenJDK.</p>
+<p>Windows XP is not a supported platform, but all newer Windows should be able to build the JDK.</p>
 <p>On Windows, it is important that you pay attention to the instructions in the <a href="#special-considerations">Special Considerations</a>.</p>
-<p>Windows is the only non-POSIX OS supported by OpenJDK, and as such, requires some extra care. A POSIX support layer is required to build on Windows. Currently, the only supported such layer is Cygwin. (Msys is no longer supported due to a too old bash; msys2 and the new Windows Subsystem for Linux (WSL) would likely be possible to support in a future version but that would require a community effort to implement.)</p>
-<p>Internally in the build system, all paths are represented as Unix-style paths, e.g. <code>/cygdrive/c/hg/jdk9/Makefile</code> rather than <code>C:\hg\jdk9\Makefile</code>. This rule also applies to input to the build system, e.g. in arguments to <code>configure</code>. So, use <code>--with-msvcr-dll=/cygdrive/c/msvcr100.dll</code> rather than <code>--with-msvcr-dll=c:\msvcr100.dll</code>. For details on this conversion, see the section on <a href="#fixpath">Fixpath</a>.</p>
+<p>Windows is the only non-POSIX OS supported by the JDK, and as such, requires some extra care. A POSIX support layer is required to build on Windows. Currently, the only supported such layer is Cygwin. (Msys is no longer supported due to a too old bash; msys2 and the new Windows Subsystem for Linux (WSL) would likely be possible to support in a future version but that would require effort to implement.)</p>
+<p>Internally in the build system, all paths are represented as Unix-style paths, e.g. <code>/cygdrive/c/hg/jdk9/Makefile</code> rather than <code>C:\hg\jdk9\Makefile</code>. This rule also applies to input to the build system, e.g. in arguments to <code>configure</code>. So, use <code>--with-msvcr-dll=/cygdrive/c/msvcr100.dll</code> rather than <code>--with-msvcr-dll=c:\msvcr100.dll</code>. For details on this conversion, see the section on <a href="#fixpath">Fixpath</a>.</p>
 <h4 id="cygwin">Cygwin</h4>
-<p>A functioning <a href="http://www.cygwin.com/">Cygwin</a> environment is thus required for building OpenJDK on Windows. If you have a 64-bit OS, we strongly recommend using the 64-bit version of Cygwin.</p>
-<p><strong>Note:</strong> Cygwin has a model of continuously updating all packages without any easy way to install or revert to a specific version of a package. This means that whenever you add or update a package in Cygwin, you might (inadvertently) update tools that are used by the OpenJDK build process, and that can cause unexpected build problems.</p>
-<p>OpenJDK requires GNU Make 4.0 or greater on Windows. This is usually not a problem, since Cygwin currently only distributes GNU Make at a version above 4.0.</p>
+<p>A functioning <a href="http://www.cygwin.com/">Cygwin</a> environment is thus required for building the JDK on Windows. If you have a 64-bit OS, we strongly recommend using the 64-bit version of Cygwin.</p>
+<p><strong>Note:</strong> Cygwin has a model of continuously updating all packages without any easy way to install or revert to a specific version of a package. This means that whenever you add or update a package in Cygwin, you might (inadvertently) update tools that are used by the JDK build process, and that can cause unexpected build problems.</p>
+<p>The JDK requires GNU Make 4.0 or greater on Windows. This is usually not a problem, since Cygwin currently only distributes GNU Make at a version above 4.0.</p>
 <p>Apart from the basic Cygwin installation, the following packages must also be installed:</p>
 <ul>
 <li><code>autoconf</code></li>
@@ -205,16 +210,16 @@
 </ul>
 <p>Often, you can install these packages using the following command line:</p>
 <pre><code>&lt;path to Cygwin setup&gt;/setup-x86_64 -q -P autoconf -P make -P unzip -P zip</code></pre>
-<p>Unfortunately, Cygwin can be unreliable in certain circumstances. If you experience build tool crashes or strange issues when building on Windows, please check the Cygwin FAQ on the <a href="https://cygwin.com/faq/faq.html#faq.using.bloda">&quot;BLODA&quot; list</a> and the section on <a href="https://cygwin.com/faq/faq.html#faq.using.fixing-fork-failures">fork() failures</a>.</p>
+<p>Unfortunately, Cygwin can be unreliable in certain circumstances. If you experience build tool crashes or strange issues when building on Windows, please check the Cygwin FAQ on the <a href="https://cygwin.com/faq/faq.html#faq.using.bloda">“BLODA” list</a> and the section on <a href="https://cygwin.com/faq/faq.html#faq.using.fixing-fork-failures">fork() failures</a>.</p>
 <h3 id="solaris">Solaris</h3>
 <p>See <code>make/devkit/solaris11.1-package-list.txt</code> for a list of recommended packages to install when building on Solaris. The versions specified in this list is the versions used by the daily builds at Oracle, and is likely to work properly.</p>
 <p>Older versions of Solaris shipped a broken version of <code>objcopy</code>. At least version 2.21.1 is needed, which is provided by Solaris 11 Update 1. Objcopy is needed if you want to have external debug symbols. Please make sure you are using at least version 2.21.1 of objcopy, or that you disable external debug symbols.</p>
 <h3 id="macos">macOS</h3>
-<p>Apple is using a quite aggressive scheme of pushing OS updates, and coupling these updates with required updates of Xcode. Unfortunately, this makes it difficult for a project like OpenJDK to keep pace with a continuously updated machine running macOS. See the section on <a href="#apple-xcode">Apple Xcode</a> on some strategies to deal with this.</p>
-<p>It is recommended that you use at least Mac OS X 10.9 (Mavericks). At the time of writing, OpenJDK has been successfully compiled on macOS versions up to 10.12.5 (Sierra), using XCode 8.3.2 and <code>--disable-warnings-as-errors</code>.</p>
-<p>The standard macOS environment contains the basic tooling needed to build, but for external libraries a package manager is recommended. OpenJDK uses <a href="https://brew.sh/">homebrew</a> in the examples, but feel free to use whatever manager you want (or none).</p>
+<p>Apple is using a quite aggressive scheme of pushing OS updates, and coupling these updates with required updates of Xcode. Unfortunately, this makes it difficult for a project such as the JDK to keep pace with a continuously updated machine running macOS. See the section on <a href="#apple-xcode">Apple Xcode</a> on some strategies to deal with this.</p>
+<p>It is recommended that you use at least Mac OS X 10.9 (Mavericks). At the time of writing, the JDK has been successfully compiled on macOS versions up to 10.12.5 (Sierra), using XCode 8.3.2 and <code>--disable-warnings-as-errors</code>.</p>
+<p>The standard macOS environment contains the basic tooling needed to build, but for external libraries a package manager is recommended. The JDK uses <a href="https://brew.sh/">homebrew</a> in the examples, but feel free to use whatever manager you want (or none).</p>
 <h3 id="linux">Linux</h3>
-<p>It is often not much problem to build OpenJDK on Linux. The only general advice is to try to use the compilers, external libraries and header files as provided by your distribution.</p>
+<p>It is often not much problem to build the JDK on Linux. The only general advice is to try to use the compilers, external libraries and header files as provided by your distribution.</p>
 <p>The basic tooling is provided as part of the core operating system, but you will most likely need to install developer packages.</p>
 <p>For apt-based distributions (Debian, Ubuntu, etc), try this:</p>
 <pre><code>sudo apt-get install build-essential</code></pre>
@@ -223,7 +228,7 @@
 <h3 id="aix">AIX</h3>
 <p>The regular builds by SAP is using AIX version 7.1, but AIX 5.3 is also supported. See the <a href="http://cr.openjdk.java.net/~simonis/ppc-aix-port">OpenJDK PowerPC Port Status Page</a> for details.</p>
 <h2 id="native-compiler-toolchain-requirements">Native Compiler (Toolchain) Requirements</h2>
-<p>Large portions of OpenJDK consists of native code, that needs to be compiled to be able to run on the target platform. In theory, toolchain and operating system should be independent factors, but in practice there's more or less a one-to-one correlation between target operating system and toolchain.</p>
+<p>Large portions of the JDK consists of native code, that needs to be compiled to be able to run on the target platform. In theory, toolchain and operating system should be independent factors, but in practice there’s more or less a one-to-one correlation between target operating system and toolchain.</p>
 <table>
 <thead>
 <tr class="header">
@@ -254,7 +259,7 @@
 </tr>
 </tbody>
 </table>
-<p>Please see the individual sections on the toolchains for version recommendations. As a reference, these versions of the toolchains are used, at the time of writing, by Oracle for the daily builds of OpenJDK. It should be possible to compile OpenJDK with both older and newer versions, but the closer you stay to this list, the more likely you are to compile successfully without issues.</p>
+<p>Please see the individual sections on the toolchains for version recommendations. As a reference, these versions of the toolchains are used, at the time of writing, by Oracle for the daily builds of the JDK. It should be possible to compile the JDK with both older and newer versions, but the closer you stay to this list, the more likely you are to compile successfully without issues.</p>
 <table>
 <thead>
 <tr class="header">
@@ -283,17 +288,17 @@
 </table>
 <h3 id="gcc">gcc</h3>
 <p>The minimum accepted version of gcc is 4.8. Older versions will generate a warning by <code>configure</code> and are unlikely to work.</p>
-<p>OpenJDK is currently known to be able to compile with at least version 7.4 of gcc.</p>
+<p>The JDK is currently known to be able to compile with at least version 7.4 of gcc.</p>
 <p>In general, any version between these two should be usable.</p>
 <h3 id="clang">clang</h3>
 <p>The minimum accepted version of clang is 3.2. Older versions will not be accepted by <code>configure</code>.</p>
 <p>To use clang instead of gcc on Linux, use <code>--with-toolchain-type=clang</code>.</p>
 <h3 id="apple-xcode">Apple Xcode</h3>
 <p>The oldest supported version of Xcode is 5.</p>
-<p>You will need the Xcode command lines developers tools to be able to build OpenJDK. (Actually, <em>only</em> the command lines tools are needed, not the IDE.) The simplest way to install these is to run:</p>
+<p>You will need the Xcode command lines developers tools to be able to build the JDK. (Actually, <em>only</em> the command lines tools are needed, not the IDE.) The simplest way to install these is to run:</p>
 <pre><code>xcode-select --install</code></pre>
-<p>It is advisable to keep an older version of Xcode for building OpenJDK when updating Xcode. This <a href="http://iosdevelopertips.com/xcode/install-multiple-versions-of-xcode.html">blog page</a> has good suggestions on managing multiple Xcode versions. To use a specific version of Xcode, use <code>xcode-select -s</code> before running <code>configure</code>, or use <code>--with-toolchain-path</code> to point to the version of Xcode to use, e.g. <code>configure --with-toolchain-path=/Applications/Xcode5.app/Contents/Developer/usr/bin</code></p>
-<p>If you have recently (inadvertently) updated your OS and/or Xcode version, and OpenJDK can no longer be built, please see the section on <a href="#problems-with-the-build-environment">Problems with the Build Environment</a>, and <a href="#getting-help">Getting Help</a> to find out if there are any recent, non-merged patches available for this update.</p>
+<p>It is advisable to keep an older version of Xcode for building the JDK when updating Xcode. This <a href="http://iosdevelopertips.com/xcode/install-multiple-versions-of-xcode.html">blog page</a> has good suggestions on managing multiple Xcode versions. To use a specific version of Xcode, use <code>xcode-select -s</code> before running <code>configure</code>, or use <code>--with-toolchain-path</code> to point to the version of Xcode to use, e.g. <code>configure --with-toolchain-path=/Applications/Xcode5.app/Contents/Developer/usr/bin</code></p>
+<p>If you have recently (inadvertently) updated your OS and/or Xcode version, and the JDK can no longer be built, please see the section on <a href="#problems-with-the-build-environment">Problems with the Build Environment</a>, and <a href="#getting-help">Getting Help</a> to find out if there are any recent, non-merged patches available for this update.</p>
 <h3 id="oracle-solaris-studio">Oracle Solaris Studio</h3>
 <p>The minimum accepted version of the Solaris Studio compilers is 5.13 (corresponding to Solaris Studio 12.4). Older versions will not be accepted by configure.</p>
 <p>The Solaris Studio installation should contain at least these packages:</p>
@@ -360,19 +365,19 @@
 <p>The regular builds by SAP is using version 12.1, described as <code>IBM XL C/C++ for AIX, V12.1 (5765-J02, 5725-C72) Version: 12.01.0000.0017</code>.</p>
 <p>See the <a href="http://cr.openjdk.java.net/~simonis/ppc-aix-port">OpenJDK PowerPC Port Status Page</a> for details.</p>
 <h2 id="boot-jdk-requirements">Boot JDK Requirements</h2>
-<p>Paradoxically, building OpenJDK requires a pre-existing JDK. This is called the &quot;boot JDK&quot;. The boot JDK does not have to be OpenJDK, though. If you are porting OpenJDK to a new platform, chances are that there already exists another JDK for that platform that is usable as boot JDK.</p>
-<p>The rule of thumb is that the boot JDK for building JDK major version <em>N</em> should be a JDK of major version <em>N-1</em>, so for building JDK 9 a JDK 8 would be suitable as boot JDK. However, OpenJDK should be able to &quot;build itself&quot;, so an up-to-date build of the current OpenJDK source is an acceptable alternative. If you are following the <em>N-1</em> rule, make sure you've got the latest update version, since JDK 8 GA might not be able to build JDK 9 on all platforms.</p>
+<p>Paradoxically, building the JDK requires a pre-existing JDK. This is called the “boot JDK”. The boot JDK does not, however, have to be a JDK built directly from the source code available in the OpenJDK Community. If you are porting the JDK to a new platform, chances are that there already exists another JDK for that platform that is usable as boot JDK.</p>
+<p>The rule of thumb is that the boot JDK for building JDK major version <em>N</em> should be a JDK of major version <em>N-1</em>, so for building JDK 9 a JDK 8 would be suitable as boot JDK. However, the JDK should be able to “build itself”, so an up-to-date build of the current JDK source is an acceptable alternative. If you are following the <em>N-1</em> rule, make sure you’ve got the latest update version, since JDK 8 GA might not be able to build JDK 9 on all platforms.</p>
 <p>Early in the release cycle, version <em>N-1</em> may not yet have been released. In that case, the preferred boot JDK will be version <em>N-2</em> until version <em>N-1</em> is available.</p>
-<p>If the Boot JDK is not automatically detected, or the wrong JDK is picked, use <code>--with-boot-jdk</code> to point to the JDK to use.</p>
+<p>If the boot JDK is not automatically detected, or the wrong JDK is picked, use <code>--with-boot-jdk</code> to point to the JDK to use.</p>
 <h3 id="getting-jdk-binaries">Getting JDK binaries</h3>
-<p>OpenJDK binaries for Linux, Windows and macOS can be downloaded from <a href="http://jdk.java.net">jdk.java.net</a>. An alternative is to download the <a href="http://www.oracle.com/technetwork/java/javase/downloads">Oracle JDK</a>. Another is the <a href="https://adoptopenjdk.net/">Adopt OpenJDK Project</a>, which publishes experimental prebuilt binaries for various platforms.</p>
-<p>On Linux you can also get OpenJDK from the Linux distribution. On apt-based distros (like Debian and Ubuntu), <code>sudo apt-get install openjdk-&lt;VERSION&gt;-jdk</code> is typically enough to install OpenJDK &lt;VERSION&gt;. On rpm-based distros (like Fedora and Red Hat), try <code>sudo yum install java-&lt;VERSION&gt;-openjdk-devel</code>.</p>
+<p>JDK binaries for Linux, Windows and macOS can be downloaded from <a href="http://jdk.java.net">jdk.java.net</a>. An alternative is to download the <a href="http://www.oracle.com/technetwork/java/javase/downloads">Oracle JDK</a>. Another is the <a href="https://adoptopenjdk.net/">Adopt OpenJDK Project</a>, which publishes experimental prebuilt binaries for various platforms.</p>
+<p>On Linux you can also get a JDK from the Linux distribution. On apt-based distros (like Debian and Ubuntu), <code>sudo apt-get install openjdk-&lt;VERSION&gt;-jdk</code> is typically enough to install a JDK &lt;VERSION&gt;. On rpm-based distros (like Fedora and Red Hat), try <code>sudo yum install java-&lt;VERSION&gt;-openjdk-devel</code>.</p>
 <h2 id="external-library-requirements">External Library Requirements</h2>
 <p>Different platforms require different external libraries. In general, libraries are not optional - that is, they are either required or not used.</p>
 <p>If a required library is not detected by <code>configure</code>, you need to provide the path to it. There are two forms of the <code>configure</code> arguments to point to an external library: <code>--with-&lt;LIB&gt;=&lt;path&gt;</code> or <code>--with-&lt;LIB&gt;-include=&lt;path to include&gt; --with-&lt;LIB&gt;-lib=&lt;path to lib&gt;</code>. The first variant is more concise, but require the include files an library files to reside in a default hierarchy under this directory. In most cases, it works fine.</p>
 <p>As a fallback, the second version allows you to point to the include directory and the lib directory separately.</p>
 <h3 id="freetype">FreeType</h3>
-<p>FreeType2 from <a href="http://www.freetype.org/">The FreeType Project</a> is not required on any platform. The exception is on Unix-based platforms when configuring such that the build artifacts will reference a system installed library, rather than bundling OpenJDK's own copy.</p>
+<p>FreeType2 from <a href="http://www.freetype.org/">The FreeType Project</a> is not required on any platform. The exception is on Unix-based platforms when configuring such that the build artifacts will reference a system installed library, rather than bundling the JDK’s own copy.</p>
 <ul>
 <li>To install on an apt-based Linux, try running <code>sudo apt-get install libfreetype6-dev</code>.</li>
 <li>To install on an rpm-based Linux, try running <code>sudo yum install freetype-devel</code>.</li>
@@ -411,7 +416,7 @@
 <p>Use <code>--with-libffi=&lt;path&gt;</code> if <code>configure</code> does not properly locate your libffi files.</p>
 <h2 id="build-tools-requirements">Build Tools Requirements</h2>
 <h3 id="autoconf">Autoconf</h3>
-<p>OpenJDK requires <a href="http://www.gnu.org/software/autoconf">Autoconf</a> on all platforms. At least version 2.69 is required.</p>
+<p>The JDK requires <a href="http://www.gnu.org/software/autoconf">Autoconf</a> on all platforms. At least version 2.69 is required.</p>
 <ul>
 <li>To install on an apt-based Linux, try running <code>sudo apt-get install autoconf</code>.</li>
 <li>To install on an rpm-based Linux, try running <code>sudo yum install autoconf</code>.</li>
@@ -421,16 +426,16 @@
 <p>If <code>configure</code> has problems locating your installation of autoconf, you can specify it using the <code>AUTOCONF</code> environment variable, like this:</p>
 <pre><code>AUTOCONF=&lt;path to autoconf&gt; configure ...</code></pre>
 <h3 id="gnu-make">GNU Make</h3>
-<p>OpenJDK requires <a href="http://www.gnu.org/software/make">GNU Make</a>. No other flavors of make are supported.</p>
+<p>The JDK requires <a href="http://www.gnu.org/software/make">GNU Make</a>. No other flavors of make are supported.</p>
 <p>At least version 3.81 of GNU Make must be used. For distributions supporting GNU Make 4.0 or above, we strongly recommend it. GNU Make 4.0 contains useful functionality to handle parallel building (supported by <code>--with-output-sync</code>) and speed and stability improvements.</p>
-<p>Note that <code>configure</code> locates and verifies a properly functioning version of <code>make</code> and stores the path to this <code>make</code> binary in the configuration. If you start a build using <code>make</code> on the command line, you will be using the version of make found first in your <code>PATH</code>, and not necessarily the one stored in the configuration. This initial make will be used as &quot;bootstrap make&quot;, and in a second stage, the make located by <code>configure</code> will be called. Normally, this will present no issues, but if you have a very old <code>make</code>, or a non-GNU Make <code>make</code> in your path, this might cause issues.</p>
+<p>Note that <code>configure</code> locates and verifies a properly functioning version of <code>make</code> and stores the path to this <code>make</code> binary in the configuration. If you start a build using <code>make</code> on the command line, you will be using the version of make found first in your <code>PATH</code>, and not necessarily the one stored in the configuration. This initial make will be used as “bootstrap make”, and in a second stage, the make located by <code>configure</code> will be called. Normally, this will present no issues, but if you have a very old <code>make</code>, or a non-GNU Make <code>make</code> in your path, this might cause issues.</p>
 <p>If you want to override the default make found by <code>configure</code>, use the <code>MAKE</code> configure variable, e.g. <code>configure MAKE=/opt/gnu/make</code>.</p>
 <p>On Solaris, it is common to call the GNU version of make by using <code>gmake</code>.</p>
 <h3 id="gnu-bash">GNU Bash</h3>
-<p>OpenJDK requires <a href="http://www.gnu.org/software/bash">GNU Bash</a>. No other shells are supported.</p>
+<p>The JDK requires <a href="http://www.gnu.org/software/bash">GNU Bash</a>. No other shells are supported.</p>
 <p>At least version 3.2 of GNU Bash must be used.</p>
 <h2 id="running-configure">Running Configure</h2>
-<p>To build OpenJDK, you need a &quot;configuration&quot;, which consists of a directory where to store the build output, coupled with information about the platform, the specific build machine, and choices that affect how OpenJDK is built.</p>
+<p>To build the JDK, you need a “configuration”, which consists of a directory where to store the build output, coupled with information about the platform, the specific build machine, and choices that affect how the JDK is built.</p>
 <p>The configuration is created by the <code>configure</code> script. The basic invocation of the <code>configure</code> script looks like this:</p>
 <pre><code>bash configure [options]</code></pre>
 <p>This will create an output directory containing the configuration and setup an area for the build result. This directory typically looks like <code>build/linux-x64-normal-server-release</code>, but the actual name depends on your specific configuration. (It can also be set directly, see <a href="#using-multiple-configurations">Using Multiple Configurations</a>). This directory is referred to as <code>$BUILD</code> in this documentation.</p>
@@ -446,7 +451,7 @@
 <p>Here follows some of the most common and important <code>configure</code> argument.</p>
 <p>To get up-to-date information on <em>all</em> available <code>configure</code> argument, please run:</p>
 <pre><code>bash configure --help</code></pre>
-<p>(Note that this help text also include general autoconf options, like <code>--dvidir</code>, that is not relevant to OpenJDK. To list only OpenJDK specific features, use <code>bash configure --help=short</code> instead.)</p>
+<p>(Note that this help text also include general autoconf options, like <code>--dvidir</code>, that is not relevant to the JDK. To list only JDK-specific features, use <code>bash configure --help=short</code> instead.)</p>
 <h4 id="configure-arguments-for-tailoring-the-build">Configure Arguments for Tailoring the Build</h4>
 <ul>
 <li><code>--enable-debug</code> - Set the debug level to <code>fastdebug</code> (this is a shorthand for <code>--with-debug-level=fastdebug</code>)</li>
@@ -478,7 +483,7 @@
 <li><code>--with-libffi=&lt;path&gt;</code> - Set the path to <a href="#libffi">libffi</a></li>
 <li><code>--with-jtreg=&lt;path&gt;</code> - Set the path to JTReg. See <a href="#running-tests">Running Tests</a></li>
 </ul>
-<p>Certain third-party libraries used by OpenJDK (libjpeg, giflib, libpng, lcms and zlib) are included in the OpenJDK repository. The default behavior of the OpenJDK build is to use this version of these libraries, but they might be replaced by an external version. To do so, specify <code>system</code> as the <code>&lt;source&gt;</code> option in these arguments. (The default is <code>bundled</code>).</p>
+<p>Certain third-party libraries used by the JDK (libjpeg, giflib, libpng, lcms and zlib) are included in the JDK repository. The default behavior of the JDK build is to use this version of these libraries, but they might be replaced by an external version. To do so, specify <code>system</code> as the <code>&lt;source&gt;</code> option in these arguments. (The default is <code>bundled</code>).</p>
 <ul>
 <li><code>--with-libjpeg=&lt;source&gt;</code> - Use the specified source for libjpeg</li>
 <li><code>--with-giflib=&lt;source&gt;</code> - Use the specified source for giflib</li>
@@ -492,13 +497,13 @@
 </ul>
 <h3 id="configure-control-variables">Configure Control Variables</h3>
 <p>It is possible to control certain aspects of <code>configure</code> by overriding the value of <code>configure</code> variables, either on the command line or in the environment.</p>
-<p>Normally, this is <strong>not recommended</strong>. If used improperly, it can lead to a broken configuration. Unless you're well versed in the build system, this is hard to use properly. Therefore, <code>configure</code> will print a warning if this is detected.</p>
+<p>Normally, this is <strong>not recommended</strong>. If used improperly, it can lead to a broken configuration. Unless you’re well versed in the build system, this is hard to use properly. Therefore, <code>configure</code> will print a warning if this is detected.</p>
 <p>However, there are a few <code>configure</code> variables, known as <em>control variables</em> that are supposed to be overriden on the command line. These are variables that describe the location of tools needed by the build, like <code>MAKE</code> or <code>GREP</code>. If any such variable is specified, <code>configure</code> will use that value instead of trying to autodetect the tool. For instance, <code>bash configure MAKE=/opt/gnumake4.0/bin/make</code>.</p>
-<p>If a configure argument exists, use that instead, e.g. use <code>--with-jtreg</code> instead of setting <code>JTREGEXE</code>.</p>
+<p>If a configure argument exists, use that instead, e.g. use <code>--with-jtreg</code> instead of setting <code>JTREGEXE</code>.</p>
 <p>Also note that, despite what autoconf claims, setting <code>CFLAGS</code> will not accomplish anything. Instead use <code>--with-extra-cflags</code> (and similar for <code>cxxflags</code> and <code>ldflags</code>).</p>
 <h2 id="running-make">Running Make</h2>
-<p>When you have a proper configuration, all you need to do to build OpenJDK is to run <code>make</code>. (But see the warning at <a href="#gnu-make">GNU Make</a> about running the correct version of make.)</p>
-<p>When running <code>make</code> without any arguments, the default target is used, which is the same as running <code>make default</code> or <code>make jdk</code>. This will build a minimal (or roughly minimal) set of compiled output (known as an &quot;exploded image&quot;) needed for a developer to actually execute the newly built JDK. The idea is that in an incremental development fashion, when doing a normal make, you should only spend time recompiling what's changed (making it purely incremental) and only do the work that's needed to actually run and test your code.</p>
+<p>When you have a proper configuration, all you need to do to build the JDK is to run <code>make</code>. (But see the warning at <a href="#gnu-make">GNU Make</a> about running the correct version of make.)</p>
+<p>When running <code>make</code> without any arguments, the default target is used, which is the same as running <code>make default</code> or <code>make jdk</code>. This will build a minimal (or roughly minimal) set of compiled output (known as an “exploded image”) needed for a developer to actually execute the newly built JDK. The idea is that in an incremental development fashion, when doing a normal make, you should only spend time recompiling what’s changed (making it purely incremental) and only do the work that’s needed to actually run and test your code.</p>
 <p>The output of the exploded image resides in <code>$BUILD/jdk</code>. You can test the newly built JDK like this: <code>$BUILD/jdk/bin/java -version</code>.</p>
 <h3 id="common-make-targets">Common Make Targets</h3>
 <p>Apart from the default target, here are some common make targets:</p>
@@ -529,8 +534,8 @@
 </ul>
 <h3 id="make-control-variables">Make Control Variables</h3>
 <p>It is possible to control <code>make</code> behavior by overriding the value of <code>make</code> variables, either on the command line or in the environment.</p>
-<p>Normally, this is <strong>not recommended</strong>. If used improperly, it can lead to a broken build. Unless you're well versed in the build system, this is hard to use properly. Therefore, <code>make</code> will print a warning if this is detected.</p>
-<p>However, there are a few <code>make</code> variables, known as <em>control variables</em> that are supposed to be overriden on the command line. These make up the &quot;make time&quot; configuration, as opposed to the &quot;configure time&quot; configuration.</p>
+<p>Normally, this is <strong>not recommended</strong>. If used improperly, it can lead to a broken build. Unless you’re well versed in the build system, this is hard to use properly. Therefore, <code>make</code> will print a warning if this is detected.</p>
+<p>However, there are a few <code>make</code> variables, known as <em>control variables</em> that are supposed to be overriden on the command line. These make up the “make time” configuration, as opposed to the “configure time” configuration.</p>
 <h4 id="general-make-control-variables">General Make Control Variables</h4>
 <ul>
 <li><code>JOBS</code> - Specify the number of jobs to build with. See <a href="#build-performance">Build Performance</a>.</li>
@@ -538,7 +543,7 @@
 <li><code>CONF</code> and <code>CONF_NAME</code> - Selecting the configuration(s) to use. See <a href="#using-multiple-configurations">Using Multiple Configurations</a></li>
 </ul>
 <h4 id="test-make-control-variables">Test Make Control Variables</h4>
-<p>These make control variables only make sense when running tests. Please see <a href="testing.html">Testing OpenJDK</a> for details.</p>
+<p>These make control variables only make sense when running tests. Please see <a href="testing.html">Testing the JDK</a> for details.</p>
 <ul>
 <li><code>TEST</code></li>
 <li><code>TEST_JOBS</code></li>
@@ -554,23 +559,23 @@
 <li><code>JDK_FILTER</code></li>
 </ul>
 <h2 id="running-tests">Running Tests</h2>
-<p>Most of the OpenJDK tests are using the <a href="http://openjdk.java.net/jtreg">JTReg</a> test framework. Make sure that your configuration knows where to find your installation of JTReg. If this is not picked up automatically, use the <code>--with-jtreg=&lt;path to jtreg home&gt;</code> option to point to the JTReg framework. Note that this option should point to the JTReg home, i.e. the top directory, containing <code>lib/jtreg.jar</code> etc.</p>
+<p>Most of the JDK tests are using the <a href="http://openjdk.java.net/jtreg">JTReg</a> test framework. Make sure that your configuration knows where to find your installation of JTReg. If this is not picked up automatically, use the <code>--with-jtreg=&lt;path to jtreg home&gt;</code> option to point to the JTReg framework. Note that this option should point to the JTReg home, i.e. the top directory, containing <code>lib/jtreg.jar</code> etc.</p>
 <p>The <a href="https://wiki.openjdk.java.net/display/Adoption">Adoption Group</a> provides recent builds of jtreg <a href="https://adopt-openjdk.ci.cloudbees.com/job/jtreg/lastSuccessfulBuild/artifact">here</a>. Download the latest <code>.tar.gz</code> file, unpack it, and point <code>--with-jtreg</code> to the <code>jtreg</code> directory that you just unpacked.</p>
 <p>To execute the most basic tests (tier 1), use:</p>
 <pre><code>make run-test-tier1</code></pre>
-<p>For more details on how to run tests, please see the <a href="testing.html">Testing OpenJDK</a> document.</p>
+<p>For more details on how to run tests, please see the <a href="testing.html">Testing the JDK</a> document.</p>
 <h2 id="cross-compiling">Cross-compiling</h2>
 <p>Cross-compiling means using one platform (the <em>build</em> platform) to generate output that can ran on another platform (the <em>target</em> platform).</p>
 <p>The typical reason for cross-compiling is that the build is performed on a more powerful desktop computer, but the resulting binaries will be able to run on a different, typically low-performing system. Most of the complications that arise when building for embedded is due to this separation of <em>build</em> and <em>target</em> systems.</p>
-<p>This requires a more complex setup and build procedure. This section assumes you are familiar with cross-compiling in general, and will only deal with the particularities of cross-compiling OpenJDK. If you are new to cross-compiling, please see the <a href="https://en.wikipedia.org/wiki/Cross_compiler#External_links">external links at Wikipedia</a> for a good start on reading materials.</p>
-<p>Cross-compiling OpenJDK requires you to be able to build both for the build platform and for the target platform. The reason for the former is that we need to build and execute tools during the build process, both native tools and Java tools.</p>
-<p>If all you want to do is to compile a 32-bit version, for the same OS, on a 64-bit machine, consider using <code>--with-target-bits=32</code> instead of doing a full-blown cross-compilation. (While this surely is possible, it's a lot more work and will take much longer to build.)</p>
+<p>This requires a more complex setup and build procedure. This section assumes you are familiar with cross-compiling in general, and will only deal with the particularities of cross-compiling the JDK. If you are new to cross-compiling, please see the <a href="https://en.wikipedia.org/wiki/Cross_compiler#External_links">external links at Wikipedia</a> for a good start on reading materials.</p>
+<p>Cross-compiling the JDK requires you to be able to build both for the build platform and for the target platform. The reason for the former is that we need to build and execute tools during the build process, both native tools and Java tools.</p>
+<p>If all you want to do is to compile a 32-bit version, for the same OS, on a 64-bit machine, consider using <code>--with-target-bits=32</code> instead of doing a full-blown cross-compilation. (While this surely is possible, it’s a lot more work and will take much longer to build.)</p>
 <h3 id="boot-jdk-and-build-jdk">Boot JDK and Build JDK</h3>
 <p>When cross-compiling, make sure you use a boot JDK that runs on the <em>build</em> system, and not on the <em>target</em> system.</p>
-<p>To be able to build, we need a &quot;Build JDK&quot;, which is a JDK built from the current sources (that is, the same as the end result of the entire build process), but able to run on the <em>build</em> system, and not the <em>target</em> system. (In contrast, the Boot JDK should be from an older release, e.g. JDK 8 when building JDK 9.)</p>
+<p>To be able to build, we need a “Build JDK”, which is a JDK built from the current sources (that is, the same as the end result of the entire build process), but able to run on the <em>build</em> system, and not the <em>target</em> system. (In contrast, the Boot JDK should be from an older release, e.g. JDK 8 when building JDK 9.)</p>
 <p>The build process will create a minimal Build JDK for you, as part of building. To speed up the build, you can use <code>--with-build-jdk</code> to <code>configure</code> to point to a pre-built Build JDK. Please note that the build result is unpredictable, and can possibly break in subtle ways, if the Build JDK does not <strong>exactly</strong> match the current sources.</p>
 <h3 id="specifying-the-target-platform">Specifying the Target Platform</h3>
-<p>You <em>must</em> specify the target platform when cross-compiling. Doing so will also automatically turn the build into a cross-compiling mode. The simplest way to do this is to use the <code>--openjdk-target</code> argument, e.g. <code>--openjdk-target=arm-linux-gnueabihf</code>. or <code>--openjdk-target=aarch64-oe-linux</code>. This will automatically set the <code>--build</code>, <code>--host</code> and <code>--target</code> options for autoconf, which can otherwise be confusing. (In autoconf terminology, the &quot;target&quot; is known as &quot;host&quot;, and &quot;target&quot; is used for building a Canadian cross-compiler.)</p>
+<p>You <em>must</em> specify the target platform when cross-compiling. Doing so will also automatically turn the build into a cross-compiling mode. The simplest way to do this is to use the <code>--openjdk-target</code> argument, e.g. <code>--openjdk-target=arm-linux-gnueabihf</code>. or <code>--openjdk-target=aarch64-oe-linux</code>. This will automatically set the <code>--build</code>, <code>--host</code> and <code>--target</code> options for autoconf, which can otherwise be confusing. (In autoconf terminology, the “target” is known as “host”, and “target” is used for building a Canadian cross-compiler.)</p>
 <h3 id="toolchain-considerations">Toolchain Considerations</h3>
 <p>You will need two copies of your toolchain, one which generates output that can run on the target system (the normal, or <em>target</em>, toolchain), and one that generates output that can run on the build system (the <em>build</em> toolchain). Note that cross-compiling is only supported for gcc at the time being. The gcc standard is to prefix cross-compiling toolchains with the target denominator. If you follow this standard, <code>configure</code> is likely to pick up the toolchain correctly.</p>
 <p>The <em>build</em> toolchain will be autodetected just the same way the normal <em>build</em>/<em>target</em> toolchain will be autodetected when not cross-compiling. If this is not what you want, or if the autodetection fails, you can specify a devkit containing the <em>build</em> toolchain using <code>--with-build-devkit</code> to <code>configure</code>, or by giving <code>BUILD_CC</code> and <code>BUILD_CXX</code> arguments.</p>
@@ -582,21 +587,23 @@
 </ul>
 <h3 id="native-libraries">Native Libraries</h3>
 <p>You will need copies of external native libraries for the <em>target</em> system, present on the <em>build</em> machine while building.</p>
-<p>Take care not to replace the <em>build</em> system's version of these libraries by mistake, since that can render the <em>build</em> machine unusable.</p>
+<p>Take care not to replace the <em>build</em> system’s version of these libraries by mistake, since that can render the <em>build</em> machine unusable.</p>
 <p>Make sure that the libraries you point to (ALSA, X11, etc) are for the <em>target</em>, not the <em>build</em>, platform.</p>
 <h4 id="alsa-1">ALSA</h4>
-<p>You will need alsa libraries suitable for your <em>target</em> system. For most cases, using Debian's pre-built libraries work fine.</p>
+<p>You will need alsa libraries suitable for your <em>target</em> system. For most cases, using Debian’s pre-built libraries work fine.</p>
 <p>Note that alsa is needed even if you only want to build a headless JDK.</p>
 <ul>
 <li><p>Go to <a href="https://www.debian.org/distrib/packages">Debian Package Search</a> and search for the <code>libasound2</code> and <code>libasound2-dev</code> packages for your <em>target</em> system. Download them to /tmp.</p></li>
-<li><p>Install the libraries into the cross-compilation toolchain. For instance:</p>
+<li>Install the libraries into the cross-compilation toolchain. For instance:</li>
+</ul>
 <pre><code>cd /tools/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux/arm-linux-gnueabihf/libc
 dpkg-deb -x /tmp/libasound2_1.0.25-4_armhf.deb .
-dpkg-deb -x /tmp/libasound2-dev_1.0.25-4_armhf.deb .</code></pre></li>
-<li><p>If alsa is not properly detected by <code>configure</code>, you can point it out by <code>--with-alsa</code>.</p></li>
+dpkg-deb -x /tmp/libasound2-dev_1.0.25-4_armhf.deb .</code></pre>
+<ul>
+<li>If alsa is not properly detected by <code>configure</code>, you can point it out by <code>--with-alsa</code>.</li>
 </ul>
 <h4 id="x11-1">X11</h4>
-<p>You will need X11 libraries suitable for your <em>target</em> system. For most cases, using Debian's pre-built libraries work fine.</p>
+<p>You will need X11 libraries suitable for your <em>target</em> system. For most cases, using Debian’s pre-built libraries work fine.</p>
 <p>Note that X11 is needed even if you only want to build a headless JDK.</p>
 <ul>
 <li>Go to <a href="https://www.debian.org/distrib/packages">Debian Package Search</a>, search for the following packages for your <em>target</em> system, and download them to /tmp/target-x11:
@@ -635,35 +642,35 @@
 <li><p>If the X11 libraries are not properly detected by <code>configure</code>, you can point them out by <code>--with-x</code>.</p></li>
 </ul>
 <h3 id="building-for-armaarch64">Building for ARM/aarch64</h3>
-<p>A common cross-compilation target is the ARM CPU. When building for ARM, it is useful to set the ABI profile. A number of pre-defined ABI profiles are available using <code>--with-abi-profile</code>: arm-vfp-sflt, arm-vfp-hflt, arm-sflt, armv5-vfp-sflt, armv6-vfp-hflt. Note that soft-float ABIs are no longer properly supported on OpenJDK.</p>
-<p>OpenJDK contains two different ports for the aarch64 platform, one is the original aarch64 port from the <a href="http://openjdk.java.net/projects/aarch64-port">AArch64 Port Project</a> and one is a 64-bit version of the Oracle contributed ARM port. When targeting aarch64, by the default the original aarch64 port is used. To select the Oracle ARM 64 port, use <code>--with-cpu-port=arm64</code>. Also set the corresponding value (<code>aarch64</code> or <code>arm64</code>) to --with-abi-profile, to ensure a consistent build.</p>
+<p>A common cross-compilation target is the ARM CPU. When building for ARM, it is useful to set the ABI profile. A number of pre-defined ABI profiles are available using <code>--with-abi-profile</code>: arm-vfp-sflt, arm-vfp-hflt, arm-sflt, armv5-vfp-sflt, armv6-vfp-hflt. Note that soft-float ABIs are no longer properly supported by the JDK.</p>
+<p>The JDK contains two different ports for the aarch64 platform, one is the original aarch64 port from the <a href="http://openjdk.java.net/projects/aarch64-port">AArch64 Port Project</a> and one is a 64-bit version of the Oracle contributed ARM port. When targeting aarch64, by the default the original aarch64 port is used. To select the Oracle ARM 64 port, use <code>--with-cpu-port=arm64</code>. Also set the corresponding value (<code>aarch64</code> or <code>arm64</code>) to –with-abi-profile, to ensure a consistent build.</p>
 <h3 id="verifying-the-build">Verifying the Build</h3>
 <p>The build will end up in a directory named like <code>build/linux-arm-normal-server-release</code>.</p>
 <p>Inside this build output directory, the <code>images/jdk</code> will contain the newly built JDK, for your <em>target</em> system.</p>
 <p>Copy these folders to your <em>target</em> system. Then you can run e.g. <code>images/jdk/bin/java -version</code>.</p>
 <h2 id="build-performance">Build Performance</h2>
-<p>Building OpenJDK requires a lot of horsepower. Some of the build tools can be adjusted to utilize more or less of resources such as parallel threads and memory. The <code>configure</code> script analyzes your system and selects reasonable values for such options based on your hardware. If you encounter resource problems, such as out of memory conditions, you can modify the detected values with:</p>
+<p>Building the JDK requires a lot of horsepower. Some of the build tools can be adjusted to utilize more or less of resources such as parallel threads and memory. The <code>configure</code> script analyzes your system and selects reasonable values for such options based on your hardware. If you encounter resource problems, such as out of memory conditions, you can modify the detected values with:</p>
 <ul>
-<li><p><code>--with-num-cores</code> -- number of cores in the build system, e.g. <code>--with-num-cores=8</code>.</p></li>
-<li><p><code>--with-memory-size</code> -- memory (in MB) available in the build system, e.g. <code>--with-memory-size=1024</code></p></li>
+<li><p><code>--with-num-cores</code> – number of cores in the build system, e.g. <code>--with-num-cores=8</code>.</p></li>
+<li><p><code>--with-memory-size</code> – memory (in MB) available in the build system, e.g. <code>--with-memory-size=1024</code></p></li>
 </ul>
 <p>You can also specify directly the number of build jobs to use with <code>--with-jobs=N</code> to <code>configure</code>, or <code>JOBS=N</code> to <code>make</code>. Do not use the <code>-j</code> flag to <code>make</code>. In most cases it will be ignored by the makefiles, but it can cause problems for some make targets.</p>
 <p>It might also be necessary to specify the JVM arguments passed to the Boot JDK, using e.g. <code>--with-boot-jdk-jvmargs=&quot;-Xmx8G&quot;</code>. Doing so will override the default JVM arguments passed to the Boot JDK.</p>
 <p>At the end of a successful execution of <code>configure</code>, you will get a performance summary, indicating how well the build will perform. Here you will also get performance hints. If you want to build fast, pay attention to those!</p>
 <p>If you want to tweak build performance, run with <code>make LOG=info</code> to get a build time summary at the end of the build process.</p>
 <h3 id="disk-speed">Disk Speed</h3>
-<p>If you are using network shares, e.g. via NFS, for your source code, make sure the build directory is situated on local disk (e.g. by <code>ln -s /localdisk/jdk-build $JDK-SHARE/build</code>). The performance penalty is extremely high for building on a network share; close to unusable.</p>
+<p>If you are using network shares, e.g. via NFS, for your source code, make sure the build directory is situated on local disk (e.g. by <code>ln -s /localdisk/jdk-build $JDK-SHARE/build</code>). The performance penalty is extremely high for building on a network share; close to unusable.</p>
 <p>Also, make sure that your build tools (including Boot JDK and toolchain) is located on a local disk and not a network share.</p>
 <p>As has been stressed elsewhere, do use SSD for source code and build directory, as well as (if possible) the build tools.</p>
 <h3 id="virus-checking">Virus Checking</h3>
-<p>The use of virus checking software, especially on Windows, can <em>significantly</em> slow down building of OpenJDK. If possible, turn off such software, or exclude the directory containing the OpenJDK source code from on-the-fly checking.</p>
+<p>The use of virus checking software, especially on Windows, can <em>significantly</em> slow down building of the JDK. If possible, turn off such software, or exclude the directory containing the JDK source code from on-the-fly checking.</p>
 <h3 id="ccache">Ccache</h3>
-<p>The OpenJDK build supports building with ccache when using gcc or clang. Using ccache can radically speed up compilation of native code if you often rebuild the same sources. Your milage may vary however, so we recommend evaluating it for yourself. To enable it, make sure it's on the path and configure with <code>--enable-ccache</code>.</p>
+<p>The JDK build supports building with ccache when using gcc or clang. Using ccache can radically speed up compilation of native code if you often rebuild the same sources. Your milage may vary however, so we recommend evaluating it for yourself. To enable it, make sure it’s on the path and configure with <code>--enable-ccache</code>.</p>
 <h3 id="precompiled-headers">Precompiled Headers</h3>
 <p>By default, the Hotspot build uses preccompiled headers (PCH) on the toolchains were it is properly supported (clang, gcc, and Visual Studio). Normally, this speeds up the build process, but in some circumstances, it can actually slow things down.</p>
 <p>You can experiment by disabling precompiled headers using <code>--disable-precompiled-headers</code>.</p>
 <h3 id="icecc-icecream">Icecc / icecream</h3>
-<p><a href="http://github.com/icecc/icecream">icecc/icecream</a> is a simple way to setup a distributed compiler network. If you have multiple machines available for building OpenJDK, you can drastically cut individual build times by utilizing it.</p>
+<p><a href="http://github.com/icecc/icecream">icecc/icecream</a> is a simple way to setup a distributed compiler network. If you have multiple machines available for building the JDK, you can drastically cut individual build times by utilizing it.</p>
 <p>To use, setup an icecc network, and install icecc on the build machine. Then run <code>configure</code> using <code>--enable-icecc</code>.</p>
 <h3 id="using-sjavac">Using sjavac</h3>
 <p>To speed up Java compilation, especially incremental compilations, you can try the experimental sjavac compiler by using <code>--enable-sjavac</code>.</p>
@@ -693,22 +700,22 @@
 
 Hint: Try searching the build log for the name of the first failed target.
 Hint: If caused by a warning, try configure --disable-warnings-as-errors.</code></pre>
-<p>Let's break it down! First, the selected configuration, and the top-level target you entered on the command line that caused the failure is printed.</p>
+<p>Let’s break it down! First, the selected configuration, and the top-level target you entered on the command line that caused the failure is printed.</p>
 <p>Then, between the <code>Output from failing command(s) repeated here</code> and <code>End of repeated output</code> the first lines of output (stdout and stderr) from the actual failing command is repeated. In most cases, this is the error message that caused the build to fail. If multiple commands were failing (this can happen in a parallel build), output from all failed commands will be printed here.</p>
 <p>The path to the <code>failure-logs</code> directory is printed. In this file you will find a <code>&lt;target&gt;.log</code> file that contains the output from this command in its entirety, and also a <code>&lt;target&gt;.cmd</code>, which contain the complete command line used for running this command. You can re-run the failing command by executing <code>. &lt;path to failure-logs&gt;/&lt;target&gt;.cmd</code> in your shell.</p>
 <p>Another way to trace the failure is to follow the chain of make targets, from top-level targets to individual file targets. Between <code>Make failed targets repeated here</code> and <code>End of repeated output</code> the output from make showing this chain is repeated. The first failed recipe will typically contain the full path to the file in question that failed to compile. Following lines will show a trace of make targets why we ended up trying to compile that file.</p>
-<p>Finally, some hints are given on how to locate the error in the complete log. In this example, we would try searching the log file for &quot;<code>psMemoryPool.o</code>&quot;. Another way to quickly locate make errors in the log is to search for &quot;<code>] Error</code>&quot; or &quot;<code>***</code>&quot;.</p>
+<p>Finally, some hints are given on how to locate the error in the complete log. In this example, we would try searching the log file for “<code>psMemoryPool.o</code>”. Another way to quickly locate make errors in the log is to search for “<code>] Error</code>” or “<code>***</code>”.</p>
 <p>Note that the build failure summary will only help you if the issue was a compilation failure or similar. If the problem is more esoteric, or is due to errors in the build machinery, you will likely get empty output logs, and <code>No indication of failed target found</code> instead of the make target chain.</p>
 <h4 id="checking-the-build-log-file">Checking the Build Log File</h4>
 <p>The output (stdout and stderr) from the latest build is always stored in <code>$BUILD/build.log</code>. The previous build log is stored as <code>build.log.old</code>. This means that it is not necessary to redirect the build output yourself if you want to process it.</p>
 <p>You can increase the verbosity of the log file, by the <code>LOG</code> control variable to <code>make</code>. If you want to see the command lines used in compilations, use <code>LOG=cmdlines</code>. To increase the general verbosity, use <code>LOG=info</code>, <code>LOG=debug</code> or <code>LOG=trace</code>. Both of these can be combined with <code>cmdlines</code>, e.g. <code>LOG=info,cmdlines</code>. The <code>debug</code> log level will show most shell commands executed by make, and <code>trace</code> will show all. Beware that both these log levels will produce a massive build log!</p>
 <h3 id="fixing-unexpected-build-failures">Fixing Unexpected Build Failures</h3>
 <p>Most of the time, the build will fail due to incorrect changes in the source code.</p>
-<p>Sometimes the build can fail with no apparent changes that have caused the failure. If this is the first time you are building OpenJDK on this particular computer, and the build fails, the problem is likely with your build environment. But even if you have previously built OpenJDK with success, and it now fails, your build environment might have changed (perhaps due to OS upgrades or similar). But most likely, such failures are due to problems with the incremental rebuild.</p>
+<p>Sometimes the build can fail with no apparent changes that have caused the failure. If this is the first time you are building the JDK on this particular computer, and the build fails, the problem is likely with your build environment. But even if you have previously built the JDK with success, and it now fails, your build environment might have changed (perhaps due to OS upgrades or similar). But most likely, such failures are due to problems with the incremental rebuild.</p>
 <h4 id="problems-with-the-build-environment">Problems with the Build Environment</h4>
 <p>Make sure your configuration is correct. Re-run <code>configure</code>, and look for any warnings. Warnings that appear in the middle of the <code>configure</code> output is also repeated at the end, after the summary. The entire log is stored in <code>$BUILD/configure.log</code>.</p>
 <p>Verify that the summary at the end looks correct. Are you indeed using the Boot JDK and native toolchain that you expect?</p>
-<p>By default, OpenJDK has a strict approach where warnings from the compiler is considered errors which fail the build. For very new or very old compiler versions, this can trigger new classes of warnings, which thus fails the build. Run <code>configure</code> with <code>--disable-warnings-as-errors</code> to turn of this behavior. (The warnings will still show, but not make the build fail.)</p>
+<p>By default, the JDK has a strict approach where warnings from the compiler is considered errors which fail the build. For very new or very old compiler versions, this can trigger new classes of warnings, which thus fails the build. Run <code>configure</code> with <code>--disable-warnings-as-errors</code> to turn of this behavior. (The warnings will still show, but not make the build fail.)</p>
 <h4 id="problems-with-incremental-rebuilds">Problems with Incremental Rebuilds</h4>
 <p>Incremental rebuilds mean that when you modify part of the product, only the affected parts get rebuilt. While this works great in most cases, and significantly speed up the development process, from time to time complex interdependencies will result in an incorrect build result. This is the most common cause for unexpected build problems, together with inconsistencies between the different Mercurial repositories in the forest.</p>
 <p>Here are a suggested list of things to try if you are having unexpected build problems. Each step requires more time than the one before, so try them in order. Most issues will be solved at step 1 or 2.</p>
@@ -718,13 +725,13 @@
 <li><p>Clean build results</p>
 <p>The simplest way to fix incremental rebuild issues is to run <code>make clean</code>. This will remove all build results, but not the configuration or any build system support artifacts. In most cases, this will solve build errors resulting from incremental build mismatches.</p></li>
 <li><p>Completely clean the build directory.</p>
-<p>If this does not work, the next step is to run <code>make dist-clean</code>, or removing the build output directory (<code>$BUILD</code>). This will clean all generated output, including your configuration. You will need to re-run <code>configure</code> after this step. A good idea is to run <code>make print-configuration</code> before running <code>make dist-clean</code>, as this will print your current <code>configure</code> command line. Here's a way to do this:</p>
+<p>If this does not work, the next step is to run <code>make dist-clean</code>, or removing the build output directory (<code>$BUILD</code>). This will clean all generated output, including your configuration. You will need to re-run <code>configure</code> after this step. A good idea is to run <code>make print-configuration</code> before running <code>make dist-clean</code>, as this will print your current <code>configure</code> command line. Here’s a way to do this:</p>
 <pre><code>make print-configuration &gt; current-configuration
 make dist-clean
 bash configure $(cat current-configuration)
 make</code></pre></li>
 <li><p>Re-clone the Mercurial forest</p>
-<p>Sometimes the Mercurial repositories themselves gets in a state that causes the product to be un-buildable. In such a case, the simplest solution is often the &quot;sledgehammer approach&quot;: delete the entire forest, and re-clone it. If you have local changes, save them first to a different location using <code>hg export</code>.</p></li>
+<p>Sometimes the Mercurial repositories themselves gets in a state that causes the product to be un-buildable. In such a case, the simplest solution is often the “sledgehammer approach”: delete the entire forest, and re-clone it. If you have local changes, save them first to a different location using <code>hg export</code>.</p></li>
 </ol>
 <h3 id="specific-build-issues">Specific Build Issues</h3>
 <h4 id="clock-skew">Clock Skew</h4>
@@ -744,11 +751,11 @@
 <p>This can be a sign of a Cygwin problem. See the information about solving problems in the <a href="#cygwin">Cygwin</a> section. Rebooting the computer might help temporarily.</p>
 <h3 id="getting-help">Getting Help</h3>
 <p>If none of the suggestions in this document helps you, or if you find what you believe is a bug in the build system, please contact the Build Group by sending a mail to <a href="mailto:build-dev@openjdk.java.net">build-dev@openjdk.java.net</a>. Please include the relevant parts of the configure and/or build log.</p>
-<p>If you need general help or advice about developing for OpenJDK, you can also contact the Adoption Group. See the section on <a href="#contributing-to-openjdk">Contributing to OpenJDK</a> for more information.</p>
+<p>If you need general help or advice about developing for the JDK, you can also contact the Adoption Group. See the section on <a href="#contributing-to-openjdk">Contributing to OpenJDK</a> for more information.</p>
 <h2 id="hints-and-suggestions-for-advanced-users">Hints and Suggestions for Advanced Users</h2>
 <h3 id="setting-up-a-forest-for-pushing-changes-defpath">Setting Up a Forest for Pushing Changes (defpath)</h3>
-<p>To help you prepare a proper push path for a Mercurial repository, there exists a useful tool known as <a href="http://openjdk.java.net/projects/code-tools/defpath">defpath</a>. It will help you setup a proper push path for pushing changes to OpenJDK.</p>
-<p>Install the extension by cloning <code>http://hg.openjdk.java.net/code-tools/defpath</code> and updating your <code>.hgrc</code> file. Here's one way to do this:</p>
+<p>To help you prepare a proper push path for a Mercurial repository, there exists a useful tool known as <a href="http://openjdk.java.net/projects/code-tools/defpath">defpath</a>. It will help you setup a proper push path for pushing changes to the JDK.</p>
+<p>Install the extension by cloning <code>http://hg.openjdk.java.net/code-tools/defpath</code> and updating your <code>.hgrc</code> file. Here’s one way to do this:</p>
 <pre><code>cd ~
 mkdir hg-ext
 cd hg-ext
@@ -782,13 +789,13 @@
 <h3 id="handling-reconfigurations">Handling Reconfigurations</h3>
 <p>If you update the forest and part of the configure script has changed, the build system will force you to re-run <code>configure</code>.</p>
 <p>Most of the time, you will be fine by running <code>configure</code> again with the same arguments as the last time, which can easily be performed by <code>make reconfigure</code>. To simplify this, you can use the <code>CONF_CHECK</code> make control variable, either as <code>make CONF_CHECK=auto</code>, or by setting an environment variable. For instance, if you add <code>export CONF_CHECK=auto</code> to your <code>.bashrc</code> file, <code>make</code> will always run <code>reconfigure</code> automatically whenever the configure script has changed.</p>
-<p>You can also use <code>CONF_CHECK=ignore</code> to skip the check for a needed configure update. This might speed up the build, but comes at the risk of an incorrect build result. This is only recommended if you know what you're doing.</p>
+<p>You can also use <code>CONF_CHECK=ignore</code> to skip the check for a needed configure update. This might speed up the build, but comes at the risk of an incorrect build result. This is only recommended if you know what you’re doing.</p>
 <p>From time to time, you will also need to modify the command line to <code>configure</code> due to changes. Use <code>make print-configure</code> to show the command line used for your current configuration.</p>
 <h3 id="using-fine-grained-make-targets">Using Fine-Grained Make Targets</h3>
 <p>The default behavior for make is to create consistent and correct output, at the expense of build speed, if necessary.</p>
 <p>If you are prepared to take some risk of an incorrect build, and know enough of the system to understand how things build and interact, you can speed up the build process considerably by instructing make to only build a portion of the product.</p>
 <h4 id="building-individual-modules">Building Individual Modules</h4>
-<p>The safe way to use fine-grained make targets is to use the module specific make targets. All source code in OpenJDK is organized so it belongs to a module, e.g. <code>java.base</code> or <code>jdk.jdwp.agent</code>. You can build only a specific module, by giving it as make target: <code>make jdk.jdwp.agent</code>. If the specified module depends on other modules (e.g. <code>java.base</code>), those modules will be built first.</p>
+<p>The safe way to use fine-grained make targets is to use the module specific make targets. All source code in the JDK is organized so it belongs to a module, e.g. <code>java.base</code> or <code>jdk.jdwp.agent</code>. You can build only a specific module, by giving it as make target: <code>make jdk.jdwp.agent</code>. If the specified module depends on other modules (e.g. <code>java.base</code>), those modules will be built first.</p>
 <p>You can also specify a set of modules, just as you can always specify a set of make targets: <code>make jdk.crypto.cryptoki jdk.crypto.ec jdk.crypto.mscapi jdk.crypto.ucrypto</code></p>
 <h4 id="building-individual-module-phases">Building Individual Module Phases</h4>
 <p>The build process for each module is divided into separate phases. Not all modules need all phases. Which are needed depends on what kind of source code and other artifact the module consists of. The phases are:</p>
@@ -811,10 +818,10 @@
 <p>To achieve this, append <code>-only</code> to the build target. For instance, <code>make jdk.jdwp.agent-java-only</code> will <em>only</em> build the <code>java</code> phase of the <code>jdk.jdwp.agent</code> module. If the required dependencies are not present, the build can fail. On the other hand, the execution time measures in milliseconds.</p>
 <p>A useful pattern is to build the first time normally (e.g. <code>make jdk.jdwp.agent</code>) and then on subsequent builds, use the <code>-only</code> make target.</p>
 <h4 id="rebuilding-part-of-java.base-jdk_filter">Rebuilding Part of java.base (JDK_FILTER)</h4>
-<p>If you are modifying files in <code>java.base</code>, which is the by far largest module in OpenJDK, then you need to rebuild all those files whenever a single file has changed. (This inefficiency will hopefully be addressed in JDK 10.)</p>
+<p>If you are modifying files in <code>java.base</code>, which is the by far largest module in the JDK, then you need to rebuild all those files whenever a single file has changed. (This inefficiency will hopefully be addressed in JDK 10.)</p>
 <p>As a hack, you can use the make control variable <code>JDK_FILTER</code> to specify a pattern that will be used to limit the set of files being recompiled. For instance, <code>make java.base JDK_FILTER=javax/crypto</code> (or, to combine methods, <code>make java.base-java-only JDK_FILTER=javax/crypto</code>) will limit the compilation to files in the <code>javax.crypto</code> package.</p>
 <h3 id="learn-about-mercurial">Learn About Mercurial</h3>
-<p>To become an efficient OpenJDK developer, it is recommended that you invest in learning Mercurial properly. Here are some links that can get you started:</p>
+<p>To become an efficient JDK developer, it is recommended that you invest in learning Mercurial properly. Here are some links that can get you started:</p>
 <ul>
 <li><a href="http://www.mercurial-scm.org/wiki/GitConcepts">Mercurial for git users</a></li>
 <li><a href="http://www.mercurial-scm.org/wiki/Tutorial">The official Mercurial tutorial</a></li>
@@ -840,20 +847,20 @@
 <p>This is what they are used for:</p>
 <ul>
 <li><p><code>images</code>: This is the directory were the output of the <code>*-image</code> make targets end up. For instance, <code>make jdk-image</code> ends up in <code>images/jdk</code>.</p></li>
-<li><p><code>jdk</code>: This is the &quot;exploded image&quot;. After <code>make jdk</code>, you will be able to launch the newly built JDK by running <code>$BUILD/jdk/bin/java</code>.</p></li>
+<li><p><code>jdk</code>: This is the “exploded image”. After <code>make jdk</code>, you will be able to launch the newly built JDK by running <code>$BUILD/jdk/bin/java</code>.</p></li>
 <li><p><code>test-results</code>: This directory contains the results from running tests.</p></li>
-<li><p><code>support</code>: This is an area for intermediate files needed during the build, e.g. generated source code, object files and class files. Some noteworthy directories in <code>support</code> is <code>gensrc</code>, which contains the generated source code, and the <code>modules_*</code> directories, which contains the files in a per-module hierarchy that will later be collapsed into the <code>jdk</code> directory of the exploded image.</p></li>
+<li><p><code>support</code>: This is an area for intermediate files needed during the build, e.g. generated source code, object files and class files. Some noteworthy directories in <code>support</code> is <code>gensrc</code>, which contains the generated source code, and the <code>modules_*</code> directories, which contains the files in a per-module hierarchy that will later be collapsed into the <code>jdk</code> directory of the exploded image.</p></li>
 <li><p><code>buildtools</code>: This is an area for tools compiled for the build platform that are used during the rest of the build.</p></li>
 <li><p><code>hotspot</code>: This is an area for intermediate files needed when building hotspot.</p></li>
 <li><p><code>configure-support</code>, <code>make-support</code> and <code>test-support</code>: These directories contain files that are needed by the build system for <code>configure</code>, <code>make</code> and for running tests.</p></li>
 </ul>
 <h3 id="fixpath">Fixpath</h3>
 <p>Windows path typically look like <code>C:\User\foo</code>, while Unix paths look like <code>/home/foo</code>. Tools with roots from Unix often experience issues related to this mismatch when running on Windows.</p>
-<p>In the OpenJDK build, we always use Unix paths internally, and only just before calling a tool that does not understand Unix paths do we convert them to Windows paths.</p>
+<p>In the JDK build, we always use Unix paths internally, and only just before calling a tool that does not understand Unix paths do we convert them to Windows paths.</p>
 <p>This conversion is done by the <code>fixpath</code> tool, which is a small wrapper that modifies unix-style paths to Windows-style paths in command lines. Fixpath is compiled automatically by <code>configure</code>.</p>
 <h3 id="native-debug-symbols">Native Debug Symbols</h3>
 <p>Native libraries and executables can have debug symbol (and other debug information) associated with them. How this works is very much platform dependent, but a common problem is that debug symbol information takes a lot of disk space, but is rarely needed by the end user.</p>
-<p>The OpenJDK supports different methods on how to handle debug symbols. The method used is selected by <code>--with-native-debug-symbols</code>, and available methods are <code>none</code>, <code>internal</code>, <code>external</code>, <code>zipped</code>.</p>
+<p>The JDK supports different methods on how to handle debug symbols. The method used is selected by <code>--with-native-debug-symbols</code>, and available methods are <code>none</code>, <code>internal</code>, <code>external</code>, <code>zipped</code>.</p>
 <ul>
 <li><p><code>none</code> means that no debug symbols will be generated during the build.</p></li>
 <li><p><code>internal</code> means that debug symbols will be generated during the build, and they will be stored in the generated binary.</p></li>
@@ -863,12 +870,12 @@
 <p>When building for distribution, <code>zipped</code> is a good solution. Binaries built with <code>internal</code> is suitable for use by developers, since they facilitate debugging, but should be stripped before distributed to end users.</p>
 <h3 id="autoconf-details">Autoconf Details</h3>
 <p>The <code>configure</code> script is based on the autoconf framework, but in some details deviate from a normal autoconf <code>configure</code> script.</p>
-<p>The <code>configure</code> script in the top level directory of OpenJDK is just a thin wrapper that calls <code>make/autoconf/configure</code>. This in turn will run <code>autoconf</code> to create the runnable (generated) configure script, as <code>.build/generated-configure.sh</code>. Apart from being responsible for the generation of the runnable script, the <code>configure</code> script also provides functionality that is not easily expressed in the normal Autoconf framework. As part of this functionality, the generated script is called.</p>
+<p>The <code>configure</code> script in the top level directory of the JDK is just a thin wrapper that calls <code>make/autoconf/configure</code>. This in turn will run <code>autoconf</code> to create the runnable (generated) configure script, as <code>.build/generated-configure.sh</code>. Apart from being responsible for the generation of the runnable script, the <code>configure</code> script also provides functionality that is not easily expressed in the normal Autoconf framework. As part of this functionality, the generated script is called.</p>
 <p>The build system will detect if the Autoconf source files have changed, and will trigger a regeneration of the generated script if needed. You can also manually request such an update by <code>bash configure autogen</code>.</p>
-<p>In previous versions of the OpenJDK, the generated script was checked in at <code>make/autoconf/generated-configure.sh</code>. This is no longer the case.</p>
+<p>In previous versions of the JDK, the generated script was checked in at <code>make/autoconf/generated-configure.sh</code>. This is no longer the case.</p>
 <h3 id="developing-the-build-system-itself">Developing the Build System Itself</h3>
 <p>This section contains a few remarks about how to develop for the build system itself. It is not relevant if you are only making changes in the product source code.</p>
-<p>While technically using <code>make</code>, the make source files of the OpenJDK does not resemble most other Makefiles. Instead of listing specific targets and actions (perhaps using patterns), the basic modus operandi is to call a high-level function (or properly, macro) from the API in <code>make/common</code>. For instance, to compile all classes in the <code>jdk.internal.foo</code> package in the <code>jdk.foo</code> module, a call like this would be made:</p>
+<p>While technically using <code>make</code>, the make source files of the JDK does not resemble most other Makefiles. Instead of listing specific targets and actions (perhaps using patterns), the basic modus operandi is to call a high-level function (or properly, macro) from the API in <code>make/common</code>. For instance, to compile all classes in the <code>jdk.internal.foo</code> package in the <code>jdk.foo</code> module, a call like this would be made:</p>
 <pre><code>$(eval $(call SetupJavaCompilation, BUILD_FOO_CLASSES, \
     SETUP := GENERATE_OLDBYTECODE, \
     SRC := $(TOPDIR)/src/jkd.foo/share/classes, \
@@ -877,17 +884,17 @@
 ))</code></pre>
 <p>By encapsulating and expressing the high-level knowledge of <em>what</em> should be done, rather than <em>how</em> it should be done (as is normal in Makefiles), we can build a much more powerful and flexible build system.</p>
 <p>Correct dependency tracking is paramount. Sloppy dependency tracking will lead to improper parallelization, or worse, race conditions.</p>
-<p>To test for/debug race conditions, try running <code>make JOBS=1</code> and <code>make JOBS=100</code> and see if it makes any difference. (It shouldn't).</p>
+<p>To test for/debug race conditions, try running <code>make JOBS=1</code> and <code>make JOBS=100</code> and see if it makes any difference. (It shouldn’t).</p>
 <p>To compare the output of two different builds and see if, and how, they differ, run <code>$BUILD1/compare.sh -o $BUILD2</code>, where <code>$BUILD1</code> and <code>$BUILD2</code> are the two builds you want to compare.</p>
 <p>To automatically build two consecutive versions and compare them, use <code>COMPARE_BUILD</code>. The value of <code>COMPARE_BUILD</code> is a set of variable=value assignments, like this:</p>
 <pre><code>make COMPARE_BUILD=CONF=--enable-new-hotspot-feature:MAKE=hotspot</code></pre>
 <p>See <code>make/InitSupport.gmk</code> for details on how to use <code>COMPARE_BUILD</code>.</p>
 <p>To analyze build performance, run with <code>LOG=trace</code> and check <code>$BUILD/build-trace-time.log</code>. Use <code>JOBS=1</code> to avoid parallelism.</p>
 <p>Please check that you adhere to the <a href="http://openjdk.java.net/groups/build/doc/code-conventions.html">Code Conventions for the Build System</a> before submitting patches.</p>
-<h2 id="contributing-to-openjdk">Contributing to OpenJDK</h2>
-<p>So, now you've build your OpenJDK, and made your first patch, and want to contribute it back to the OpenJDK community.</p>
-<p>First of all: Thank you! We gladly welcome your contribution to the OpenJDK. However, please bear in mind that OpenJDK is a massive project, and we must ask you to follow our rules and guidelines to be able to accept your contribution.</p>
-<p>The official place to start is the <a href="http://openjdk.java.net/contribute/">'How to contribute' page</a>. There is also an official (but somewhat outdated and skimpy on details) <a href="http://openjdk.java.net/guide/">Developer's Guide</a>.</p>
-<p>If this seems overwhelming to you, the Adoption Group is there to help you! A good place to start is their <a href="https://wiki.openjdk.java.net/display/Adoption/New+Contributor">'New Contributor' page</a>, or start reading the comprehensive <a href="https://adoptopenjdk.gitbooks.io/adoptopenjdk-getting-started-kit/en/">Getting Started Kit</a>. The Adoption Group will also happily answer any questions you have about contributing. Contact them by <a href="http://mail.openjdk.java.net/mailman/listinfo/adoption-discuss">mail</a> or <a href="http://openjdk.java.net/irc/">IRC</a>.</p>
+<h2 id="contributing-to-the-jdk">Contributing to the JDK</h2>
+<p>So, now you’ve built your JDK, and made your first patch, and want to contribute it back to the OpenJDK Community.</p>
+<p>First of all: Thank you! We gladly welcome your contribution. However, please bear in mind that the JDK is a massive project, and we must ask you to follow our rules and guidelines to be able to accept your contribution.</p>
+<p>The official place to start is the <a href="http://openjdk.java.net/contribute/">‘How to contribute’ page</a>. There is also an official (but somewhat outdated and skimpy on details) <a href="http://openjdk.java.net/guide/">Developer’s Guide</a>.</p>
+<p>If this seems overwhelming to you, the Adoption Group is there to help you! A good place to start is their <a href="https://wiki.openjdk.java.net/display/Adoption/New+Contributor">‘New Contributor’ page</a>, or start reading the comprehensive <a href="https://adoptopenjdk.gitbooks.io/adoptopenjdk-getting-started-kit/en/">Getting Started Kit</a>. The Adoption Group will also happily answer any questions you have about contributing. Contact them by <a href="http://mail.openjdk.java.net/mailman/listinfo/adoption-discuss">mail</a> or <a href="http://openjdk.java.net/irc/">IRC</a>.</p>
 </body>
 </html>
--- a/doc/building.md	Thu Jun 28 05:10:01 2018 +0200
+++ b/doc/building.md	Thu Jul 05 11:53:53 2018 +0100
@@ -1,10 +1,10 @@
-% Building OpenJDK
+% Building the JDK
 
 ## TL;DR (Instructions for the Impatient)
 
-If you are eager to try out building OpenJDK, these simple steps works most of
+If you are eager to try out building the JDK, these simple steps works most of
 the time. They assume that you have installed Mercurial (and Cygwin if running
-on Windows) and cloned the top-level OpenJDK repository that you want to build.
+on Windows) and cloned the top-level JDK repository that you want to build.
 
  1. [Get the complete source code](#getting-the-source-code): \
     `hg clone http://hg.openjdk.java.net/jdk/jdk`
@@ -34,14 +34,14 @@
 
 ## Introduction
 
-OpenJDK is a complex software project. Building it requires a certain amount of
+The JDK is a complex software project. Building it requires a certain amount of
 technical expertise, a fair number of dependencies on external software, and
 reasonably powerful hardware.
 
-If you just want to use OpenJDK and not build it yourself, this document is not
+If you just want to use the JDK and not build it yourself, this document is not
 for you. See for instance [OpenJDK installation](
 http://openjdk.java.net/install) for some methods of installing a prebuilt
-OpenJDK.
+JDK.
 
 ## Getting the Source Code
 
@@ -80,16 +80,16 @@
     procedure:
 
       * Create the directory that is going to contain the top directory of the
-        OpenJDK clone by using the `mkdir` command in the Cygwin bash shell.
+        JDK clone by using the `mkdir` command in the Cygwin bash shell.
         That is, do *not* create it using Windows Explorer. This will ensure
         that it will have proper Cygwin attributes, and that it's children will
         inherit those attributes.
 
-      * Do not put the OpenJDK clone in a path under your Cygwin home
+      * Do not put the JDK clone in a path under your Cygwin home
         directory. This is especially important if your user name contains
         spaces and/or mixed upper and lower case letters.
 
-      * Clone the OpenJDK repository using the Cygwin command line `hg` client
+      * Clone the JDK repository using the Cygwin command line `hg` client
         as instructed in this document. That is, do *not* use another Mercurial
         client such as TortoiseHg.
 
@@ -98,7 +98,7 @@
 
 ## Build Hardware Requirements
 
-OpenJDK is a massive project, and require machines ranging from decent to
+The JDK is a massive project, and require machines ranging from decent to
 powerful to be able to build in a reasonable amount of time, or to be able to
 complete a build at all.
 
@@ -127,15 +127,15 @@
 
 ## Operating System Requirements
 
-The mainline OpenJDK project supports Linux, Solaris, macOS, AIX and Windows.
+The mainline JDK project supports Linux, Solaris, macOS, AIX and Windows.
 Support for other operating system, e.g. BSD, exists in separate "port"
 projects.
 
-In general, OpenJDK can be built on a wide range of versions of these operating
+In general, the JDK can be built on a wide range of versions of these operating
 systems, but the further you deviate from what is tested on a daily basis, the
 more likely you are to run into problems.
 
-This table lists the OS versions used by Oracle when building OpenJDK. Such
+This table lists the OS versions used by Oracle when building the JDK. Such
 information is always subject to change, but this table is up to date at the
 time of writing.
 
@@ -148,27 +148,27 @@
 
 The double version numbers for Linux, Solaris and macOS is due to the hybrid
 model used at Oracle, where header files and external libraries from an older
-version is used when building on a more modern version of the OS.
+version are used when building on a more modern version of the OS.
 
 The Build Group has a wiki page with [Supported Build Platforms](
 https://wiki.openjdk.java.net/display/Build/Supported+Build+Platforms). From
-time to time, this is updated by the community to list successes or failures of
+time to time, this is updated by contributors to list successes or failures of
 building on different platforms.
 
 ### Windows
 
 Windows XP is not a supported platform, but all newer Windows should be able to
-build OpenJDK.
+build the JDK.
 
 On Windows, it is important that you pay attention to the instructions in the
 [Special Considerations](#special-considerations).
 
-Windows is the only non-POSIX OS supported by OpenJDK, and as such, requires
+Windows is the only non-POSIX OS supported by the JDK, and as such, requires
 some extra care. A POSIX support layer is required to build on Windows.
 Currently, the only supported such layer is Cygwin. (Msys is no longer
 supported due to a too old bash; msys2 and the new Windows Subsystem for Linux
 (WSL) would likely be possible to support in a future version but that would
-require a community effort to implement.)
+require effort to implement.)
 
 Internally in the build system, all paths are represented as Unix-style paths,
 e.g. `/cygdrive/c/hg/jdk9/Makefile` rather than `C:\hg\jdk9\Makefile`. This
@@ -180,16 +180,16 @@
 #### Cygwin
 
 A functioning [Cygwin](http://www.cygwin.com/) environment is thus required for
-building OpenJDK on Windows. If you have a 64-bit OS, we strongly recommend
+building the JDK on Windows. If you have a 64-bit OS, we strongly recommend
 using the 64-bit version of Cygwin.
 
 **Note:** Cygwin has a model of continuously updating all packages without any
 easy way to install or revert to a specific version of a package. This means
 that whenever you add or update a package in Cygwin, you might (inadvertently)
-update tools that are used by the OpenJDK build process, and that can cause
+update tools that are used by the JDK build process, and that can cause
 unexpected build problems.
 
-OpenJDK requires GNU Make 4.0 or greater on Windows. This is usually not a
+The JDK requires GNU Make 4.0 or greater on Windows. This is usually not a
 problem, since Cygwin currently only distributes GNU Make at a version above
 4.0.
 
@@ -229,22 +229,22 @@
 
 Apple is using a quite aggressive scheme of pushing OS updates, and coupling
 these updates with required updates of Xcode. Unfortunately, this makes it
-difficult for a project like OpenJDK to keep pace with a continuously updated
+difficult for a project such as the JDK to keep pace with a continuously updated
 machine running macOS. See the section on [Apple Xcode](#apple-xcode) on some
 strategies to deal with this.
 
 It is recommended that you use at least Mac OS X 10.9 (Mavericks). At the time
-of writing, OpenJDK has been successfully compiled on macOS versions up to
+of writing, the JDK has been successfully compiled on macOS versions up to
 10.12.5 (Sierra), using XCode 8.3.2 and `--disable-warnings-as-errors`.
 
 The standard macOS environment contains the basic tooling needed to build, but
-for external libraries a package manager is recommended. OpenJDK uses
+for external libraries a package manager is recommended. The JDK uses
 [homebrew](https://brew.sh/) in the examples, but feel free to use whatever
 manager you want (or none).
 
 ### Linux
 
-It is often not much problem to build OpenJDK on Linux. The only general advice
+It is often not much problem to build the JDK on Linux. The only general advice
 is to try to use the compilers, external libraries and header files as provided
 by your distribution.
 
@@ -269,7 +269,7 @@
 
 ## Native Compiler (Toolchain) Requirements
 
-Large portions of OpenJDK consists of native code, that needs to be compiled to
+Large portions of the JDK consists of native code, that needs to be compiled to
 be able to run on the target platform. In theory, toolchain and operating
 system should be independent factors, but in practice there's more or less a
 one-to-one correlation between target operating system and toolchain.
@@ -284,8 +284,8 @@
 
 Please see the individual sections on the toolchains for version
 recommendations. As a reference, these versions of the toolchains are used, at
-the time of writing, by Oracle for the daily builds of OpenJDK. It should be
-possible to compile OpenJDK with both older and newer versions, but the closer
+the time of writing, by Oracle for the daily builds of the JDK. It should be
+possible to compile the JDK with both older and newer versions, but the closer
 you stay to this list, the more likely you are to compile successfully without
 issues.
 
@@ -301,7 +301,7 @@
 The minimum accepted version of gcc is 4.8. Older versions will generate a warning
 by `configure` and are unlikely to work.
 
-OpenJDK is currently known to be able to compile with at least version 7.4 of
+The JDK is currently known to be able to compile with at least version 7.4 of
 gcc.
 
 In general, any version between these two should be usable.
@@ -318,13 +318,13 @@
 The oldest supported version of Xcode is 5.
 
 You will need the Xcode command lines developers tools to be able to build
-OpenJDK. (Actually, *only* the command lines tools are needed, not the IDE.)
+the JDK. (Actually, *only* the command lines tools are needed, not the IDE.)
 The simplest way to install these is to run:
 ```
 xcode-select --install
 ```
 
-It is advisable to keep an older version of Xcode for building OpenJDK when
+It is advisable to keep an older version of Xcode for building the JDK when
 updating Xcode. This [blog page](
 http://iosdevelopertips.com/xcode/install-multiple-versions-of-xcode.html) has
 good suggestions on managing multiple Xcode versions. To use a specific version
@@ -333,7 +333,7 @@
 `configure --with-toolchain-path=/Applications/Xcode5.app/Contents/Developer/usr/bin`
 
 If you have recently (inadvertently) updated your OS and/or Xcode version, and
-OpenJDK can no longer be built, please see the section on [Problems with the
+the JDK can no longer be built, please see the section on [Problems with the
 Build Environment](#problems-with-the-build-environment), and [Getting
 Help](#getting-help) to find out if there are any recent, non-merged patches
 available for this update.
@@ -395,15 +395,16 @@
 
 ## Boot JDK Requirements
 
-Paradoxically, building OpenJDK requires a pre-existing JDK. This is called the
-"boot JDK". The boot JDK does not have to be OpenJDK, though. If you are
-porting OpenJDK to a new platform, chances are that there already exists
-another JDK for that platform that is usable as boot JDK.
+Paradoxically, building the JDK requires a pre-existing JDK. This is called the
+"boot JDK". The boot JDK does not, however, have to be a JDK built directly from
+the source code available in the OpenJDK Community.  If you are porting the JDK
+to a new platform, chances are that there already exists another JDK for that
+platform that is usable as boot JDK.
 
 The rule of thumb is that the boot JDK for building JDK major version *N*
 should be a JDK of major version *N-1*, so for building JDK 9 a JDK 8 would be
-suitable as boot JDK. However, OpenJDK should be able to "build itself", so an
-up-to-date build of the current OpenJDK source is an acceptable alternative. If
+suitable as boot JDK. However, the JDK should be able to "build itself", so an
+up-to-date build of the current JDK source is an acceptable alternative. If
 you are following the *N-1* rule, make sure you've got the latest update
 version, since JDK 8 GA might not be able to build JDK 9 on all platforms.
 
@@ -411,20 +412,20 @@
 that case, the preferred boot JDK will be version *N-2* until version *N-1*
 is available.
 
-If the Boot JDK is not automatically detected, or the wrong JDK is picked, use
+If the boot JDK is not automatically detected, or the wrong JDK is picked, use
 `--with-boot-jdk` to point to the JDK to use.
 
 ### Getting JDK binaries
 
-OpenJDK binaries for Linux, Windows and macOS can be downloaded from
+JDK binaries for Linux, Windows and macOS can be downloaded from
 [jdk.java.net](http://jdk.java.net). An alternative is to download the
 [Oracle JDK](http://www.oracle.com/technetwork/java/javase/downloads). Another
 is the [Adopt OpenJDK Project](https://adoptopenjdk.net/), which publishes
 experimental prebuilt binaries for various platforms.
 
-On Linux you can also get OpenJDK from the Linux distribution. On apt-based
+On Linux you can also get a JDK from the Linux distribution. On apt-based
 distros (like Debian and Ubuntu), `sudo apt-get install openjdk-<VERSION>-jdk`
-is typically enough to install OpenJDK \<VERSION\>. On rpm-based distros (like
+is typically enough to install a JDK \<VERSION\>. On rpm-based distros (like
 Fedora and Red Hat), try `sudo yum install java-<VERSION>-openjdk-devel`.
 
 ## External Library Requirements
@@ -447,7 +448,7 @@
 FreeType2 from [The FreeType Project](http://www.freetype.org/) is not required
 on any platform. The exception is on Unix-based platforms when configuring such
 that the build artifacts will reference a system installed library,
-rather than bundling OpenJDK's own copy.
+rather than bundling the JDK’s own copy.
 
   * To install on an apt-based Linux, try running `sudo apt-get install
     libfreetype6-dev`.
@@ -522,7 +523,7 @@
 
 ### Autoconf
 
-OpenJDK requires [Autoconf](http://www.gnu.org/software/autoconf) on all
+The JDK requires [Autoconf](http://www.gnu.org/software/autoconf) on all
 platforms. At least version 2.69 is required.
 
   * To install on an apt-based Linux, try running `sudo apt-get install
@@ -542,7 +543,7 @@
 
 ### GNU Make
 
-OpenJDK requires [GNU Make](http://www.gnu.org/software/make). No other flavors
+The JDK requires [GNU Make](http://www.gnu.org/software/make). No other flavors
 of make are supported.
 
 At least version 3.81 of GNU Make must be used. For distributions supporting
@@ -566,16 +567,16 @@
 
 ### GNU Bash
 
-OpenJDK requires [GNU Bash](http://www.gnu.org/software/bash). No other shells
+The JDK requires [GNU Bash](http://www.gnu.org/software/bash). No other shells
 are supported.
 
 At least version 3.2 of GNU Bash must be used.
 
 ## Running Configure
 
-To build OpenJDK, you need a "configuration", which consists of a directory
+To build the JDK, you need a "configuration", which consists of a directory
 where to store the build output, coupled with information about the platform,
-the specific build machine, and choices that affect how OpenJDK is built.
+the specific build machine, and choices that affect how the JDK is built.
 
 The configuration is created by the `configure` script. The basic invocation of
 the `configure` script looks like this:
@@ -619,7 +620,7 @@
 ```
 
 (Note that this help text also include general autoconf options, like
-`--dvidir`, that is not relevant to OpenJDK. To list only OpenJDK specific
+`--dvidir`, that is not relevant to the JDK. To list only JDK-specific
 features, use `bash configure --help=short` instead.)
 
 #### Configure Arguments for Tailoring the Build
@@ -680,9 +681,9 @@
   * `--with-jtreg=<path>` - Set the path to JTReg. See [Running Tests](
     #running-tests)
 
-Certain third-party libraries used by OpenJDK (libjpeg, giflib, libpng, lcms
-and zlib) are included in the OpenJDK repository. The default behavior of the
-OpenJDK build is to use this version of these libraries, but they might be
+Certain third-party libraries used by the JDK (libjpeg, giflib, libpng, lcms
+and zlib) are included in the JDK repository. The default behavior of the
+JDK build is to use this version of these libraries, but they might be
 replaced by an external version. To do so, specify `system` as the `<source>`
 option in these arguments. (The default is `bundled`).
 
@@ -726,7 +727,7 @@
 
 ## Running Make
 
-When you have a proper configuration, all you need to do to build OpenJDK is to
+When you have a proper configuration, all you need to do to build the JDK is to
 run `make`. (But see the warning at [GNU Make](#gnu-make) about running the
 correct version of make.)
 
@@ -806,7 +807,7 @@
 #### Test Make Control Variables
 
 These make control variables only make sense when running tests. Please see
-[Testing OpenJDK](testing.html) for details.
+[Testing the JDK](testing.html) for details.
 
   * `TEST`
   * `TEST_JOBS`
@@ -826,7 +827,7 @@
 
 ## Running Tests
 
-Most of the OpenJDK tests are using the [JTReg](http://openjdk.java.net/jtreg)
+Most of the JDK tests are using the [JTReg](http://openjdk.java.net/jtreg)
 test framework. Make sure that your configuration knows where to find your
 installation of JTReg. If this is not picked up automatically, use the
 `--with-jtreg=<path to jtreg home>` option to point to the JTReg framework.
@@ -845,7 +846,7 @@
 ```
 
 For more details on how to run tests, please see the [Testing
-OpenJDK](testing.html) document.
+the JDK](testing.html) document.
 
 ## Cross-compiling
 
@@ -860,12 +861,12 @@
 
 This requires a more complex setup and build procedure. This section assumes
 you are familiar with cross-compiling in general, and will only deal with the
-particularities of cross-compiling OpenJDK. If you are new to cross-compiling,
+particularities of cross-compiling the JDK. If you are new to cross-compiling,
 please see the [external links at Wikipedia](
 https://en.wikipedia.org/wiki/Cross_compiler#External_links) for a good start
 on reading materials.
 
-Cross-compiling OpenJDK requires you to be able to build both for the build
+Cross-compiling the JDK requires you to be able to build both for the build
 platform and for the target platform. The reason for the former is that we need
 to build and execute tools during the build process, both native tools and Java
 tools.
@@ -1024,9 +1025,9 @@
 useful to set the ABI profile. A number of pre-defined ABI profiles are
 available using `--with-abi-profile`: arm-vfp-sflt, arm-vfp-hflt, arm-sflt,
 armv5-vfp-sflt, armv6-vfp-hflt. Note that soft-float ABIs are no longer
-properly supported on OpenJDK.
+properly supported by the JDK.
 
-OpenJDK contains two different ports for the aarch64 platform, one is the
+The JDK contains two different ports for the aarch64 platform, one is the
 original aarch64 port from the [AArch64 Port Project](
 http://openjdk.java.net/projects/aarch64-port) and one is a 64-bit version of
 the Oracle contributed ARM port. When targeting aarch64, by the default the
@@ -1047,7 +1048,7 @@
 
 ## Build Performance
 
-Building OpenJDK requires a lot of horsepower. Some of the build tools can be
+Building the JDK requires a lot of horsepower. Some of the build tools can be
 adjusted to utilize more or less of resources such as parallel threads and
 memory. The `configure` script analyzes your system and selects reasonable
 values for such options based on your hardware. If you encounter resource
@@ -1092,12 +1093,12 @@
 ### Virus Checking
 
 The use of virus checking software, especially on Windows, can *significantly*
-slow down building of OpenJDK. If possible, turn off such software, or exclude
-the directory containing the OpenJDK source code from on-the-fly checking.
+slow down building of the JDK. If possible, turn off such software, or exclude
+the directory containing the JDK source code from on-the-fly checking.
 
 ### Ccache
 
-The OpenJDK build supports building with ccache when using gcc or clang. Using
+The JDK build supports building with ccache when using gcc or clang. Using
 ccache can radically speed up compilation of native code if you often rebuild
 the same sources. Your milage may vary however, so we recommend evaluating it
 for yourself. To enable it, make sure it's on the path and configure with
@@ -1117,7 +1118,7 @@
 
 [icecc/icecream](http://github.com/icecc/icecream) is a simple way to setup a
 distributed compiler network. If you have multiple machines available for
-building OpenJDK, you can drastically cut individual build times by utilizing
+building the JDK, you can drastically cut individual build times by utilizing
 it.
 
 To use, setup an icecc network, and install icecc on the build machine. Then
@@ -1226,9 +1227,9 @@
 code.
 
 Sometimes the build can fail with no apparent changes that have caused the
-failure. If this is the first time you are building OpenJDK on this particular
+failure. If this is the first time you are building the JDK on this particular
 computer, and the build fails, the problem is likely with your build
-environment. But even if you have previously built OpenJDK with success, and it
+environment. But even if you have previously built the JDK with success, and it
 now fails, your build environment might have changed (perhaps due to OS
 upgrades or similar). But most likely, such failures are due to problems with
 the incremental rebuild.
@@ -1243,7 +1244,7 @@
 Verify that the summary at the end looks correct. Are you indeed using the Boot
 JDK and native toolchain that you expect?
 
-By default, OpenJDK has a strict approach where warnings from the compiler is
+By default, the JDK has a strict approach where warnings from the compiler is
 considered errors which fail the build. For very new or very old compiler
 versions, this can trigger new classes of warnings, which thus fails the build.
 Run `configure` with `--disable-warnings-as-errors` to turn of this behavior.
@@ -1341,7 +1342,7 @@
 a mail to [build-dev@openjdk.java.net](mailto:build-dev@openjdk.java.net).
 Please include the relevant parts of the configure and/or build log.
 
-If you need general help or advice about developing for OpenJDK, you can also
+If you need general help or advice about developing for the JDK, you can also
 contact the Adoption Group. See the section on [Contributing to OpenJDK](
 #contributing-to-openjdk) for more information.
 
@@ -1352,7 +1353,7 @@
 To help you prepare a proper push path for a Mercurial repository, there exists
 a useful tool known as [defpath](
 http://openjdk.java.net/projects/code-tools/defpath). It will help you setup a
-proper push path for pushing changes to OpenJDK.
+proper push path for pushing changes to the JDK.
 
 Install the extension by cloning
 `http://hg.openjdk.java.net/code-tools/defpath` and updating your `.hgrc` file.
@@ -1460,7 +1461,7 @@
 #### Building Individual Modules
 
 The safe way to use fine-grained make targets is to use the module specific
-make targets. All source code in OpenJDK is organized so it belongs to a
+make targets. All source code in the JDK is organized so it belongs to a
 module, e.g. `java.base` or `jdk.jdwp.agent`. You can build only a specific
 module, by giving it as make target: `make jdk.jdwp.agent`. If the specified
 module depends on other modules (e.g. `java.base`), those modules will be built
@@ -1512,7 +1513,7 @@
 #### Rebuilding Part of java.base (JDK\_FILTER)
 
 If you are modifying files in `java.base`, which is the by far largest module
-in OpenJDK, then you need to rebuild all those files whenever a single file has
+in the JDK, then you need to rebuild all those files whenever a single file has
 changed. (This inefficiency will hopefully be addressed in JDK 10.)
 
 As a hack, you can use the make control variable `JDK_FILTER` to specify a
@@ -1523,7 +1524,7 @@
 
 ### Learn About Mercurial
 
-To become an efficient OpenJDK developer, it is recommended that you invest in
+To become an efficient JDK developer, it is recommended that you invest in
 learning Mercurial properly. Here are some links that can get you started:
 
   * [Mercurial for git users](http://www.mercurial-scm.org/wiki/GitConcepts)
@@ -1599,7 +1600,7 @@
 `/home/foo`. Tools with roots from Unix often experience issues related to this
 mismatch when running on Windows.
 
-In the OpenJDK build, we always use Unix paths internally, and only just before
+In the JDK build, we always use Unix paths internally, and only just before
 calling a tool that does not understand Unix paths do we convert them to
 Windows paths.
 
@@ -1614,7 +1615,7 @@
 dependent, but a common problem is that debug symbol information takes a lot of
 disk space, but is rarely needed by the end user.
 
-The OpenJDK supports different methods on how to handle debug symbols. The
+The JDK supports different methods on how to handle debug symbols. The
 method used is selected by `--with-native-debug-symbols`, and available methods
 are `none`, `internal`, `external`, `zipped`.
 
@@ -1639,7 +1640,7 @@
 The `configure` script is based on the autoconf framework, but in some details
 deviate from a normal autoconf `configure` script.
 
-The `configure` script in the top level directory of OpenJDK is just a thin
+The `configure` script in the top level directory of the JDK is just a thin
 wrapper that calls `make/autoconf/configure`. This in turn will run `autoconf`
 to create the runnable (generated) configure script, as
 `.build/generated-configure.sh`. Apart from being responsible for the
@@ -1651,7 +1652,7 @@
 will trigger a regeneration of the generated script if needed. You can also
 manually request such an update by `bash configure autogen`.
 
-In previous versions of the OpenJDK, the generated script was checked in at
+In previous versions of the JDK, the generated script was checked in at
 `make/autoconf/generated-configure.sh`. This is no longer the case.
 
 ### Developing the Build System Itself
@@ -1660,7 +1661,7 @@
 itself. It is not relevant if you are only making changes in the product source
 code.
 
-While technically using `make`, the make source files of the OpenJDK does not
+While technically using `make`, the make source files of the JDK does not
 resemble most other Makefiles. Instead of listing specific targets and actions
 (perhaps using patterns), the basic modus operandi is to call a high-level
 function (or properly, macro) from the API in `make/common`. For instance, to
@@ -1705,13 +1706,13 @@
 http://openjdk.java.net/groups/build/doc/code-conventions.html) before
 submitting patches.
 
-## Contributing to OpenJDK
+## Contributing to the JDK
 
-So, now you've build your OpenJDK, and made your first patch, and want to
-contribute it back to the OpenJDK community.
+So, now you've built your JDK, and made your first patch, and want to
+contribute it back to the OpenJDK Community.
 
-First of all: Thank you! We gladly welcome your contribution to the OpenJDK.
-However, please bear in mind that OpenJDK is a massive project, and we must ask
+First of all: Thank you! We gladly welcome your contribution.
+However, please bear in mind that the JDK is a massive project, and we must ask
 you to follow our rules and guidelines to be able to accept your contribution.
 
 The official place to start is the ['How to contribute' page](
--- a/doc/testing.html	Thu Jun 28 05:10:01 2018 +0200
+++ b/doc/testing.html	Thu Jul 05 11:53:53 2018 +0100
@@ -1,11 +1,16 @@
 <!DOCTYPE html>
-<html>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
 <head>
-  <meta charset="utf-8">
-  <meta name="generator" content="pandoc">
-  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
-  <title>Testing OpenJDK</title>
-  <style type="text/css">code{white-space: pre;}</style>
+  <meta charset="utf-8" />
+  <meta name="generator" content="pandoc" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
+  <title>Testing the JDK</title>
+  <style type="text/css">
+      code{white-space: pre-wrap;}
+      span.smallcaps{font-variant: small-caps;}
+      span.underline{text-decoration: underline;}
+      div.column{display: inline-block; vertical-align: top; width: 50%;}
+  </style>
   <link rel="stylesheet" href="../make/data/docs-resources/resources/jdk-default.css">
   <!--[if lt IE 9]>
     <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
@@ -14,7 +19,7 @@
 </head>
 <body>
 <header>
-<h1 class="title">Testing OpenJDK</h1>
+<h1 class="title">Testing the JDK</h1>
 </header>
 <nav id="TOC">
 <ul>
@@ -33,8 +38,8 @@
 </ul>
 </nav>
 <h2 id="using-the-run-test-framework">Using the run-test framework</h2>
-<p>This new way of running tests is developer-centric. It assumes that you have built a jdk locally and want to test it. Running common test targets is simple, and more complex ad-hoc combination of tests is possible. The user interface is forgiving, and clearly report errors it cannot resolve.</p>
-<p>The main target &quot;run-test&quot; uses the jdk-image as the tested product. There is also an alternate target &quot;exploded-run-test&quot; that uses the exploded image instead. Not all tests will run successfully on the exploded image, but using this target can greatly improve rebuild times for certain workflows.</p>
+<p>This new way of running tests is developer-centric. It assumes that you have built a JDK locally and want to test it. Running common test targets is simple, and more complex ad-hoc combination of tests is possible. The user interface is forgiving, and clearly report errors it cannot resolve.</p>
+<p>The main target “run-test” uses the jdk-image as the tested product. There is also an alternate target “exploded-run-test” that uses the exploded image instead. Not all tests will run successfully on the exploded image, but using this target can greatly improve rebuild times for certain workflows.</p>
 <p>Some example command-lines:</p>
 <pre><code>$ make run-test-tier1
 $ make run-test-jdk_lang JTREG=&quot;JOBS=8&quot;
@@ -44,21 +49,21 @@
 $ make run-test TEST=&quot;jtreg:test/hotspot:hotspot_gc test/hotspot/jtreg/native_sanity/JniVersion.java&quot;
 $ make exploded-run-test TEST=tier2</code></pre>
 <h3 id="configuration">Configuration</h3>
-<p>To be able to run JTReg tests, <code>configure</code> needs to know where to find the JTReg test framework. If it is not picked up automatically by configure, use the <code>--with-jtreg=&lt;path to jtreg home&gt;</code> option to point to the JTReg framework. Note that this option should point to the JTReg home, i.e. the top directory, containing <code>lib/jtreg.jar</code> etc. (An alternative is to set the <code>JT_HOME</code> environment variable to point to the JTReg home before running <code>configure</code>.)</p>
+<p>To be able to run JTReg tests, <code>configure</code> needs to know where to find the JTReg test framework. If it is not picked up automatically by configure, use the <code>--with-jtreg=&lt;path to jtreg home&gt;</code> option to point to the JTReg framework. Note that this option should point to the JTReg home, i.e. the top directory, containing <code>lib/jtreg.jar</code> etc. (An alternative is to set the <code>JT_HOME</code> environment variable to point to the JTReg home before running <code>configure</code>.)</p>
 <h2 id="test-selection">Test selection</h2>
 <p>All functionality is available using the run-test make target. In this use case, the test or tests to be executed is controlled using the <code>TEST</code> variable. To speed up subsequent test runs with no source code changes, run-test-only can be used instead, which do not depend on the source and test image build.</p>
 <p>For some common top-level tests, direct make targets have been generated. This includes all JTReg test groups, the hotspot gtest, and custom tests (if present). This means that <code>make run-test-tier1</code> is equivalent to <code>make run-test TEST=&quot;tier1&quot;</code>, but the latter is more tab-completion friendly. For more complex test runs, the <code>run-test TEST=&quot;x&quot;</code> solution needs to be used.</p>
 <p>The test specifications given in <code>TEST</code> is parsed into fully qualified test descriptors, which clearly and unambigously show which tests will be run. As an example, <code>:tier1</code> will expand to <code>jtreg:$(TOPDIR)/test/hotspot/jtreg:tier1 jtreg:$(TOPDIR)/test/jdk:tier1 jtreg:$(TOPDIR)/test/langtools:tier1 jtreg:$(TOPDIR)/test/nashorn:tier1 jtreg:$(TOPDIR)/test/jaxp:tier1</code>. You can always submit a list of fully qualified test descriptors in the <code>TEST</code> variable if you want to shortcut the parser.</p>
 <h3 id="jtreg">JTReg</h3>
 <p>JTReg tests can be selected either by picking a JTReg test group, or a selection of files or directories containing JTReg tests.</p>
-<p>JTReg test groups can be specified either without a test root, e.g. <code>:tier1</code> (or <code>tier1</code>, the initial colon is optional), or with, e.g. <code>hotspot:tier1</code>, <code>test/jdk:jdk_util</code> or <code>$(TOPDIR)/test/hotspot/jtreg:hotspot_all</code>. The test root can be specified either as an absolute path, or a path relative to the OpenJDK top directory, or the <code>test</code> directory. For simplicity, the hotspot JTReg test root, which really is <code>hotspot/jtreg</code> can be abbreviated as just <code>hotspot</code>.</p>
+<p>JTReg test groups can be specified either without a test root, e.g. <code>:tier1</code> (or <code>tier1</code>, the initial colon is optional), or with, e.g. <code>hotspot:tier1</code>, <code>test/jdk:jdk_util</code> or <code>$(TOPDIR)/test/hotspot/jtreg:hotspot_all</code>. The test root can be specified either as an absolute path, or a path relative to the JDK top directory, or the <code>test</code> directory. For simplicity, the hotspot JTReg test root, which really is <code>hotspot/jtreg</code> can be abbreviated as just <code>hotspot</code>.</p>
 <p>When specified without a test root, all matching groups from all test roots will be added. Otherwise, only the group from the specified test root will be added.</p>
-<p>Individual JTReg tests or directories containing JTReg tests can also be specified, like <code>test/hotspot/jtreg/native_sanity/JniVersion.java</code> or <code>hotspot/jtreg/native_sanity</code>. Just like for test root selection, you can either specify an absolute path (which can even point to JTReg tests outside the source tree), or a path relative to either the OpenJDK top directory or the <code>test</code> directory. <code>hotspot</code> can be used as an alias for <code>hotspot/jtreg</code> here as well.</p>
+<p>Individual JTReg tests or directories containing JTReg tests can also be specified, like <code>test/hotspot/jtreg/native_sanity/JniVersion.java</code> or <code>hotspot/jtreg/native_sanity</code>. Just like for test root selection, you can either specify an absolute path (which can even point to JTReg tests outside the source tree), or a path relative to either the JDK top directory or the <code>test</code> directory. <code>hotspot</code> can be used as an alias for <code>hotspot/jtreg</code> here as well.</p>
 <p>As long as the test groups or test paths can be uniquely resolved, you do not need to enter the <code>jtreg:</code> prefix. If this is not possible, or if you want to use a fully qualified test descriptor, add <code>jtreg:</code>, e.g. <code>jtreg:test/hotspot/jtreg/native_sanity</code>.</p>
 <h3 id="gtest">Gtest</h3>
 <p>Since the Hotspot Gtest suite is so quick, the default is to run all tests. This is specified by just <code>gtest</code>, or as a fully qualified test descriptor <code>gtest:all</code>.</p>
 <p>If you want, you can single out an individual test or a group of tests, for instance <code>gtest:LogDecorations</code> or <code>gtest:LogDecorations.level_test_vm</code>. This can be particularly useful if you want to run a shaky test repeatedly.</p>
-<p>For Gtest, there is a separate test suite for each JVM variant. The JVM variant is defined by adding <code>/&lt;variant&gt;</code> to the test descriptor, e.g. <code>gtest:Log/client</code>. If you specify no variant, gtest will run once for each JVM variant present (e.g. server, client). So if you only have the server JVM present, then <code>gtest:all</code> will be equivalent to <code>gtest:all/server</code>.</p>
+<p>For Gtest, there is a separate test suite for each JVM variant. The JVM variant is defined by adding <code>/&lt;variant&gt;</code> to the test descriptor, e.g. <code>gtest:Log/client</code>. If you specify no variant, gtest will run once for each JVM variant present (e.g. server, client). So if you only have the server JVM present, then <code>gtest:all</code> will be equivalent to <code>gtest:all/server</code>.</p>
 <h2 id="test-results-and-summary">Test results and summary</h2>
 <p>At the end of the test run, a summary of all tests run will be presented. This will have a consistent look, regardless of what test suites were used. This is a sample summary:</p>
 <pre><code>==============================
@@ -73,13 +78,13 @@
 <p>Tests where the number of TOTAL tests does not equal the number of PASSed tests will be considered a test failure. These are marked with the <code>&gt;&gt; ... &lt;&lt;</code> marker for easy identification.</p>
 <p>The classification of non-passed tests differs a bit between test suites. In the summary, ERROR is used as a catch-all for tests that neither passed nor are classified as failed by the framework. This might indicate test framework error, timeout or other problems.</p>
 <p>In case of test failures, <code>make run-test</code> will exit with a non-zero exit value.</p>
-<p>All tests have their result stored in <code>build/$BUILD/test-results/$TEST_ID</code>, where TEST_ID is a path-safe conversion from the fully qualified test descriptor, e.g. for <code>jtreg:jdk/test:tier1</code> the TEST_ID is <code>jtreg_jdk_test_tier1</code>. This path is also printed in the log at the end of the test run.</p>
+<p>All tests have their result stored in <code>build/$BUILD/test-results/$TEST_ID</code>, where TEST_ID is a path-safe conversion from the fully qualified test descriptor, e.g. for <code>jtreg:jdk/test:tier1</code> the TEST_ID is <code>jtreg_jdk_test_tier1</code>. This path is also printed in the log at the end of the test run.</p>
 <p>Additional work data is stored in <code>build/$BUILD/test-support/$TEST_ID</code>. For some frameworks, this directory might contain information that is useful in determining the cause of a failed test.</p>
 <h2 id="test-suite-control">Test suite control</h2>
 <p>It is possible to control various aspects of the test suites using make control variables.</p>
 <p>These variables use a keyword=value approach to allow multiple values to be set. So, for instance, <code>JTREG=&quot;JOBS=1;TIMEOUT=8&quot;</code> will set the JTReg concurrency level to 1 and the timeout factor to 8. This is equivalent to setting <code>JTREG_JOBS=1 JTREG_TIMEOUT=8</code>, but using the keyword format means that the <code>JTREG</code> variable is parsed and verified for correctness, so <code>JTREG=&quot;TMIEOUT=8&quot;</code> would give an error, while <code>JTREG_TMIEOUT=8</code> would just pass unnoticed.</p>
 <p>To separate multiple keyword=value pairs, use <code>;</code> (semicolon). Since the shell normally eats <code>;</code>, the recommended usage is to write the assignment inside qoutes, e.g. <code>JTREG=&quot;...;...&quot;</code>. This will also make sure spaces are preserved, as in <code>JTREG=&quot;VM_OPTIONS=-XshowSettings -Xlog:gc+ref=debug&quot;</code>.</p>
-<p>(Other ways are possible, e.g. using backslash: <code>JTREG=JOBS=1\;TIMEOUT=8</code>. Also, as a special technique, the string <code>%20</code> will be replaced with space for certain options, e.g. <code>JTREG=VM_OPTIONS=-XshowSettings%20-Xlog:gc+ref=debug</code>. This can be useful if you have layers of scripts and have trouble getting proper quoting of command line arguments through.)</p>
+<p>(Other ways are possible, e.g. using backslash: <code>JTREG=JOBS=1\;TIMEOUT=8</code>. Also, as a special technique, the string <code>%20</code> will be replaced with space for certain options, e.g. <code>JTREG=VM_OPTIONS=-XshowSettings%20-Xlog:gc+ref=debug</code>. This can be useful if you have layers of scripts and have trouble getting proper quoting of command line arguments through.)</p>
 <p>As far as possible, the names of the keywords have been standardized between test suites.</p>
 <h3 id="jtreg-keywords">JTReg keywords</h3>
 <h4 id="jobs">JOBS</h4>
--- a/doc/testing.md	Thu Jun 28 05:10:01 2018 +0200
+++ b/doc/testing.md	Thu Jul 05 11:53:53 2018 +0100
@@ -1,9 +1,9 @@
-% Testing OpenJDK
+% Testing the JDK
 
 ## Using the run-test framework
 
 This new way of running tests is developer-centric. It assumes that you have
-built a jdk locally and want to test it. Running common test targets is simple,
+built a JDK locally and want to test it. Running common test targets is simple,
 and more complex ad-hoc combination of tests is possible. The user interface is
 forgiving, and clearly report errors it cannot resolve.
 
@@ -61,7 +61,7 @@
 (or `tier1`, the initial colon is optional), or with, e.g. `hotspot:tier1`,
 `test/jdk:jdk_util` or `$(TOPDIR)/test/hotspot/jtreg:hotspot_all`. The test
 root can be specified either as an absolute path, or a path relative to the
-OpenJDK top directory, or the `test` directory. For simplicity, the hotspot
+JDK top directory, or the `test` directory. For simplicity, the hotspot
 JTReg test root, which really is `hotspot/jtreg` can be abbreviated as
 just `hotspot`.
 
@@ -73,7 +73,7 @@
 specified, like `test/hotspot/jtreg/native_sanity/JniVersion.java` or
 `hotspot/jtreg/native_sanity`. Just like for test root selection, you can
 either specify an absolute path (which can even point to JTReg tests outside
-the source tree), or a path relative to either the OpenJDK top directory or the
+the source tree), or a path relative to either the JDK top directory or the
 `test` directory. `hotspot` can be used as an alias for `hotspot/jtreg` here as
 well.
 
--- a/make/CompileJavaModules.gmk	Thu Jun 28 05:10:01 2018 +0200
+++ b/make/CompileJavaModules.gmk	Thu Jul 05 11:53:53 2018 +0100
@@ -345,10 +345,12 @@
 
 ################################################################################
 
+jdk.scripting.nashorn_ADD_JAVAC_FLAGS += $(DISABLE_WARNINGS),-overrides
 jdk.scripting.nashorn_COPY := .properties .js
 
 ################################################################################
 
+jdk.scripting.nashorn.shell_ADD_JAVAC_FLAGS += $(DISABLE_WARNINGS),-overrides
 jdk.scripting.nashorn.shell_COPY += .js .properties
 
 ################################################################################
--- a/make/Main.gmk	Thu Jun 28 05:10:01 2018 +0200
+++ b/make/Main.gmk	Thu Jul 05 11:53:53 2018 +0100
@@ -487,6 +487,14 @@
 	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNativeJdk.gmk \
 	    test-image-jdk-jtreg-native)
 
+build-test-hotspot-jtreg-graal:
+	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregGraalUnit.gmk \
+	     build-test-hotspot-jtreg-graal)
+
+test-image-hotspot-jtreg-graal:
+	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregGraalUnit.gmk \
+	     test-image-hotspot-jtreg-graal)
+
 run-test:
 	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test TEST="$(TEST)")
 
@@ -523,6 +531,7 @@
     test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \
     test-image-jdk-jtreg-native build-test-lib build-test-failure-handler \
     test-failure-handler test-image-failure-handler test-image-hotspot-gtest \
+    test-image-hotspot-jtreg-graal build-test-hotspot-jtreg-graal \
     run-test exploded-run-test
 
 ################################################################################
@@ -853,10 +862,14 @@
 
   build-test-jdk-jtreg-native: buildtools-jdk java.base-libs
 
+  build-test-hotspot-jtreg-graal: exploded-image-optimize
+
   test-image-hotspot-jtreg-native: build-test-hotspot-jtreg-native
 
   test-image-jdk-jtreg-native: build-test-jdk-jtreg-native
 
+  test-image-hotspot-jtreg-graal: build-test-hotspot-jtreg-graal
+
   test-image-hotspot-gtest: hotspot
 
   test-hotspot-internal: exploded-image
@@ -993,6 +1006,10 @@
 # If not already set, set the JVM specific targets to build the test image
 JVM_TEST_IMAGE_TARGETS ?= test-image-hotspot-jtreg-native test-image-hotspot-gtest
 
+ifeq ($(INCLUDE_GRAAL), true)
+  JVM_TEST_IMAGE_TARGETS += test-image-hotspot-jtreg-graal
+endif
+
 # This target builds the test image
 test-image: prepare-test-image \
     test-image-jdk-jtreg-native test-image-failure-handler \
--- a/make/RunTests.gmk	Thu Jun 28 05:10:01 2018 +0200
+++ b/make/RunTests.gmk	Thu Jul 05 11:53:53 2018 +0100
@@ -535,6 +535,8 @@
     $1_JTREG_BASIC_OPTIONS += -cpa:$$(JIB_JAR)
   endif
 
+  $1_JTREG_BASIC_OPTIONS += -e:TEST_IMAGE_GRAAL_DIR=${TEST_IMAGE_DIR}/hotspot/jtreg/graal
+
   ifneq ($$(JTREG_FAILURE_HANDLER_OPTIONS), )
     $1_JTREG_LAUNCHER_OPTIONS += -Djava.library.path="$(JTREG_FAILURE_HANDLER_DIR)"
   endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/autoconf/lib-tests.m4	Thu Jul 05 11:53:53 2018 +0100
@@ -0,0 +1,57 @@
+#
+# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute 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.
+#
+
+###############################################################################
+#
+# Check for graalunit libs, needed for running graalunit tests.
+#
+AC_DEFUN_ONCE([LIB_TESTS_SETUP_GRAALUNIT],
+[
+  AC_ARG_WITH(graalunit-lib, [AS_HELP_STRING([--with-graalunit-lib],
+      [specify location of 3rd party libraries used by Graal unit tests])])
+
+  GRAALUNIT_LIB=
+  if test "x${with_graalunit_lib}" != x; then
+    AC_MSG_CHECKING([for graalunit libs])
+    if test "x${with_graalunit_lib}" = xno; then
+      AC_MSG_RESULT([disabled, graalunit tests can not be run])
+    elif test "x${with_graalunit_lib}" = xyes; then
+      AC_MSG_RESULT([not specified])
+      AC_MSG_ERROR([You must specify the path to 3rd party libraries used by Graal unit tests])
+    else
+      GRAALUNIT_LIB="${with_graalunit_lib}"
+      if test ! -d "${GRAALUNIT_LIB}"; then
+        AC_MSG_RESULT([no])
+        AC_MSG_ERROR([Could not find graalunit 3rd party libraries as specified. (${with_graalunit_lib})])
+      else
+        AC_MSG_RESULT([$GRAALUNIT_LIB])
+      fi
+    fi
+  fi
+
+  BASIC_FIXUP_PATH([GRAALUNIT_LIB])
+  AC_SUBST(GRAALUNIT_LIB)
+])
+
--- a/make/autoconf/libraries.m4	Thu Jun 28 05:10:01 2018 +0200
+++ b/make/autoconf/libraries.m4	Thu Jul 05 11:53:53 2018 +0100
@@ -32,6 +32,7 @@
 m4_include([lib-std.m4])
 m4_include([lib-x11.m4])
 m4_include([lib-fontconfig.m4])
+m4_include([lib-tests.m4])
 
 ################################################################################
 # Determine which libraries are needed for this configuration
@@ -101,6 +102,7 @@
   LIB_SETUP_BUNDLED_LIBS
   LIB_SETUP_MISC_LIBS
   LIB_SETUP_SOLARIS_STLPORT
+  LIB_TESTS_SETUP_GRAALUNIT
 
   if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
     GLOBAL_LIBS="-lc"
--- a/make/autoconf/spec.gmk.in	Thu Jun 28 05:10:01 2018 +0200
+++ b/make/autoconf/spec.gmk.in	Thu Jul 05 11:53:53 2018 +0100
@@ -347,6 +347,7 @@
 LIBFFI_CFLAGS:=@LIBFFI_CFLAGS@
 ENABLE_LIBFFI_BUNDLING:=@ENABLE_LIBFFI_BUNDLING@
 LIBFFI_LIB_FILE:=@LIBFFI_LIB_FILE@
+GRAALUNIT_LIB := @GRAALUNIT_LIB@
 
 PACKAGE_PATH=@PACKAGE_PATH@
 
--- a/make/autoconf/version-numbers	Thu Jun 28 05:10:01 2018 +0200
+++ b/make/autoconf/version-numbers	Thu Jul 05 11:53:53 2018 +0100
@@ -25,14 +25,14 @@
 
 # Default version numbers to use unless overridden by configure
 
-DEFAULT_VERSION_FEATURE=11
+DEFAULT_VERSION_FEATURE=12
 DEFAULT_VERSION_INTERIM=0
 DEFAULT_VERSION_UPDATE=0
 DEFAULT_VERSION_PATCH=0
-DEFAULT_VERSION_DATE=2018-09-25
-DEFAULT_VERSION_CLASSFILE_MAJOR=55  # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
+DEFAULT_VERSION_DATE=2019-03-19
+DEFAULT_VERSION_CLASSFILE_MAJOR=56  # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
 DEFAULT_VERSION_CLASSFILE_MINOR=0
-DEFAULT_ACCEPTABLE_BOOT_VERSIONS="10 11"
+DEFAULT_ACCEPTABLE_BOOT_VERSIONS="10 11 12"
 
 LAUNCHER_NAME=openjdk
 PRODUCT_NAME=OpenJDK
--- a/make/common/SetupJavaCompilers.gmk	Thu Jun 28 05:10:01 2018 +0200
+++ b/make/common/SetupJavaCompilers.gmk	Thu Jul 05 11:53:53 2018 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -72,7 +72,7 @@
 $(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE, \
     JVM := $(JAVA_JAVAC), \
     JAVAC := $(NEW_JAVAC), \
-    FLAGS := -source 11 -target 11 --doclint-format html5 \
+    FLAGS := -source 12 -target 12 --doclint-format html5 \
         -encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS), \
     SERVER_DIR := $(SJAVAC_SERVER_DIR), \
     SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
@@ -82,7 +82,7 @@
 $(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE_NOWARNINGS, \
     JVM := $(JAVA_JAVAC), \
     JAVAC := $(NEW_JAVAC), \
-    FLAGS := -source 11 -target 11 \
+    FLAGS := -source 12 -target 12 \
         -encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS), \
     SERVER_DIR := $(SJAVAC_SERVER_DIR), \
     SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
--- a/make/conf/jib-profiles.js	Thu Jun 28 05:10:01 2018 +0200
+++ b/make/conf/jib-profiles.js	Thu Jul 05 11:53:53 2018 +0100
@@ -378,7 +378,7 @@
         "linux-x64": {
             target_os: "linux",
             target_cpu: "x64",
-            dependencies: ["devkit", "autoconf", "graphviz", "pandoc"],
+            dependencies: ["devkit", "autoconf", "graphviz", "pandoc", "graalunit_lib"],
             configure_args: concat(common.configure_args_64bit,
                 "--enable-full-docs", "--with-zlib=system"),
             default_make_targets: ["docs-bundles"],
@@ -396,7 +396,7 @@
         "macosx-x64": {
             target_os: "macosx",
             target_cpu: "x64",
-            dependencies: ["devkit", "autoconf"],
+            dependencies: ["devkit", "autoconf", "graalunit_lib"],
             configure_args: concat(common.configure_args_64bit, "--with-zlib=system",
                 "--with-macosx-version-max=10.9.0"),
         },
@@ -420,7 +420,7 @@
         "windows-x64": {
             target_os: "windows",
             target_cpu: "x64",
-            dependencies: ["devkit", "autoconf"],
+            dependencies: ["devkit", "autoconf", "graalunit_lib"],
             configure_args: concat(common.configure_args_64bit),
         },
 
@@ -972,6 +972,14 @@
             configure_args: "",
         },
 
+        graalunit_lib: {
+            organization: common.organization,
+            ext: "zip",
+            revision: "619_Apr_12_2018",
+            module: "graalunit-lib",
+            configure_args: "--with-graalunit-lib=" + input.get("graalunit_lib", "install_path"),
+            environment_name: "GRAALUNIT_LIB"
+        },
     };
 
     // Need to add a value for the Visual Studio tools variable to make
--- a/make/data/publicsuffixlist/VERSION	Thu Jun 28 05:10:01 2018 +0200
+++ b/make/data/publicsuffixlist/VERSION	Thu Jul 05 11:53:53 2018 +0100
@@ -1,2 +1,2 @@
 Github: https://raw.githubusercontent.com/publicsuffix/list/2225db8d9f4a2a27ec697c883360632fa0c16261/public_suffix_list.dat
-Date: 2018-05-09
+Date: 2018-05-24
--- a/make/launcher/Launcher-jdk.pack.gmk	Thu Jun 28 05:10:01 2018 +0200
+++ b/make/launcher/Launcher-jdk.pack.gmk	Thu Jul 05 11:53:53 2018 +0100
@@ -90,7 +90,6 @@
     CFLAGS_linux := -fPIC, \
     CFLAGS_solaris := -KPIC, \
     CFLAGS_macosx := -fPIC, \
-    DISABLED_WARNINGS_gcc := unused-result implicit-fallthrough, \
     LDFLAGS := $(UNPACKEXE_ZIPOBJS) \
         $(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/make/nashorn/project.properties	Thu Jun 28 05:10:01 2018 +0200
+++ b/make/nashorn/project.properties	Thu Jul 05 11:53:53 2018 +0100
@@ -371,6 +371,7 @@
   -Duser.language=${run.test.user.language} \
   -Duser.country=${run.test.user.country} \
   -Dnashorn.typeInfo.cacheDir=${build.dir}${file.separator}test${file.separator}type_info_cache \
+  -Dnashorn.args.prepend=--no-deprecation-warning \
   ${jfr.args} \
   -XX:+HeapDumpOnOutOfMemoryError
 
--- a/make/scripts/compare.sh	Thu Jun 28 05:10:01 2018 +0200
+++ b/make/scripts/compare.sh	Thu Jul 05 11:53:53 2018 +0100
@@ -1385,26 +1385,22 @@
         echo "  $OTHER_SPARKLE_DIR"
     fi
 
-    if [ -d "$OTHER/images" ]; then
-        OTHER_SEC_DIR="$OTHER/images"
-    else
-        OTHER_SEC_DIR="$OTHER/tmp"
-    fi
-    if [ -f "$THIS_SEC_DIR/sec-bin.zip" ]; then
+    THIS_SEC_DIR="$THIS/images"
+    OTHER_SEC_DIR="$OTHER/images"
+    if [ -f "$THIS_SEC_DIR/sec-bin.zip" ] && [ -f "$OTHER_SEC_DIR/sec-bin.zip" ]; then
         OTHER_SEC_BIN="$OTHER_SEC_DIR/sec-bin.zip"
-        THIS_SEC_DIR="$THIS/images"
         THIS_SEC_BIN="$THIS_SEC_DIR/sec-bin.zip"
-    fi
-    if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
-        if [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
-            JGSS_WINDOWS_BIN="jgss-windows-x64-bin.zip"
-        else
-            JGSS_WINDOWS_BIN="jgss-windows-i586-bin.zip"
+        if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
+            if [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
+                JGSS_WINDOWS_BIN="jgss-windows-x64-bin.zip"
+            else
+                JGSS_WINDOWS_BIN="jgss-windows-i586-bin.zip"
+            fi
+            OTHER_SEC_WINDOWS_BIN="$OTHER_SEC_DIR/sec-windows-bin.zip"
+            OTHER_JGSS_WINDOWS_BIN="$OTHER_SEC_DIR/$JGSS_WINDOWS_BIN"
+            THIS_SEC_WINDOWS_BIN="$THIS_SEC_DIR/sec-windows-bin.zip"
+            THIS_JGSS_WINDOWS_BIN="$THIS_SEC_DIR/$JGSS_WINDOWS_BIN"
         fi
-        OTHER_SEC_WINDOWS_BIN="$OTHER_SEC_DIR/sec-windows-bin.zip"
-        OTHER_JGSS_WINDOWS_BIN="$OTHER_SEC_DIR/$JGSS_WINDOWS_BIN"
-        THIS_SEC_WINDOWS_BIN="$THIS_SEC_DIR/sec-windows-bin.zip"
-        THIS_JGSS_WINDOWS_BIN="$THIS_SEC_DIR/$JGSS_WINDOWS_BIN"
     fi
 
     if [ -d "$THIS/images/docs" ] && [ -d "$OTHER/images/docs" ]; then
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/test/JtregGraalUnit.gmk	Thu Jul 05 11:53:53 2018 +0100
@@ -0,0 +1,144 @@
+#
+# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute 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.
+#
+
+################################################################################
+# This file builds Graal component of the JTReg tests for Hotspot.
+# It also covers the test-image part, where the built files are copied to the
+# test image.
+################################################################################
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+include SetupJavaCompilers.gmk
+
+TARGETS_BUILD :=
+TARGETS_IMAGE :=
+TARGETS_EXTRA_LIB :=
+
+ifeq ($(INCLUDE_GRAAL), true)
+  ifneq ($(GRAALUNIT_LIB), )
+    SRC_DIR := $(TOPDIR)/src/jdk.internal.vm.compiler/share/classes
+    TEST_DIR := $(TOPDIR)/test/hotspot/jtreg/compiler/graalunit
+    COMPILE_OUTPUTDIR := $(SUPPORT_OUTPUTDIR)/test/graalunit
+    LIB_OUTPUTDIR := $(TEST_IMAGE_DIR)/hotspot/jtreg/graal
+
+    ### Copy 3rd party libs
+    $(eval $(call SetupCopyFiles, COPY_GRAALUNIT_LIBS, \
+        FILES := $(wildcard $(GRAALUNIT_LIB)/*.jar), \
+        DEST := $(LIB_OUTPUTDIR), \
+    ))
+
+    TARGETS_EXTRA_LIB += $(COPY_GRAALUNIT_LIBS)
+
+    ### Compile and build graalunit tests
+    $(eval $(call SetupJavaCompilation, BUILD_VM_COMPILER_TESTS, \
+        SETUP := GENERATE_USINGJDKBYTECODE, \
+        SRC := \
+            $(SRC_DIR)/jdk.internal.vm.compiler.collections.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.api.directives.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.api.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.asm.aarch64.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.asm.amd64.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.asm.sparc.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.asm.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.core.amd64.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.core.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.debug.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.graph.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.hotspot.amd64.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.hotspot.lir.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.hotspot.sparc.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.hotspot.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.lir.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.loop.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.nodes.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.options.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.phases.common.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.replacements.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.test/src \
+            $(SRC_DIR)/org.graalvm.util.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.jtt/src \
+            $(SRC_DIR)/org.graalvm.compiler.lir.jtt/src \
+            , \
+        BIN := $(COMPILE_OUTPUTDIR)/jdk.vm.compiler.tests, \
+        JAR := $(COMPILE_OUTPUTDIR)/jdk.vm.compiler.tests.jar, \
+        CLASSPATH := \
+            $(JDK_OUTPUTDIR)/modules/jdk.internal.vm.compiler \
+            $(JDK_OUTPUTDIR)/modules/jdk.internal.vm.ci \
+            $(LIB_OUTPUTDIR)/junit-4.12.jar \
+            $(LIB_OUTPUTDIR)/asm-5.0.4.jar \
+            $(LIB_OUTPUTDIR)/asm-tree-5.0.4.jar \
+            $(LIB_OUTPUTDIR)/java-allocation-instrumenter.jar \
+            $(LIB_OUTPUTDIR)/hamcrest-core-1.3.jar \
+            , \
+        ADD_JAVAC_FLAGS := \
+            -Xlint:none -processorpath \
+            $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.replacements.verifier.jar \
+            --add-exports jdk.unsupported/sun.misc=ALL-UNNAMED \
+            , \
+    ))
+
+    TARGETS_BUILD += $(BUILD_VM_COMPILER_TESTS)
+
+
+    ### Compile and build mxtool
+    $(eval $(call SetupJavaCompilation, BUILD_MXTOOL, \
+        SETUP := GENERATE_USINGJDKBYTECODE, \
+        SRC := $(TEST_DIR)/com.oracle.mxtool.junit, \
+        BIN := $(COMPILE_OUTPUTDIR)/com.oracle.mxtool.junit, \
+        JAR := $(COMPILE_OUTPUTDIR)/com.oracle.mxtool.junit.jar, \
+        CLASSPATH := $(LIB_OUTPUTDIR)/junit-4.12.jar, \
+    ))
+
+    TARGETS_BUILD += $(BUILD_MXTOOL)
+
+
+    ################################################################################
+    # Targets for building test-image.
+    ################################################################################
+
+    # Copy to hotspot jtreg test image
+    $(eval $(call SetupCopyFiles, COPY_HOTSPOT_JTREG_GRAAL, \
+        SRC := $(COMPILE_OUTPUTDIR), \
+        DEST := $(LIB_OUTPUTDIR), \
+        FILES := jdk.vm.compiler.tests.jar com.oracle.mxtool.junit.jar, \
+    ))
+
+    TARGETS_IMAGE += $(COPY_HOTSPOT_JTREG_GRAAL)
+  else
+    $(info Skip building of Graal unit tests because 3rd party libraries directory is not specified)
+  endif
+endif
+
+$(TARGETS_BUILD): $(TARGETS_EXTRA_LIB)
+build-test-hotspot-jtreg-graal: $(TARGETS_BUILD)
+test-image-hotspot-jtreg-graal: $(TARGETS_IMAGE)
+
+all: build-test-hotspot-jtreg-graal
+test-image: test-image-hotspot-jtreg-graal
+
+.PHONY: default all build-test-hotspot-jtreg-graal test-image-hotspot-jtreg-graal test-image
--- a/src/hotspot/cpu/aarch64/aarch64.ad	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/cpu/aarch64/aarch64.ad	Thu Jul 05 11:53:53 2018 +0100
@@ -1627,7 +1627,7 @@
   // which looks like this
   //
   //   MemBarRelease
-  //   MemBarCPUOrder_(leading)__________________
+  //  {MemBarCPUOrder}_(leading)_________________
   //     C |    M \       \\                   C \
   //       |       \    StoreN/P[mo_release]  CastP2X
   //       |    Bot \    /
@@ -1663,7 +1663,7 @@
   // The graph for a CAS varies slightly, the difference being
   // that the StoreN/P node is replaced by a CompareAndSwapP/N node
   // and the trailing MemBarVolatile by a MemBarCPUOrder +
-  // MemBarAcquire pair.
+  // MemBarAcquire pair (also the MemBarCPUOrder nodes are not optional).
   //
   //   MemBarRelease
   //   MemBarCPUOrder_(leading)_______________
@@ -1691,7 +1691,7 @@
   //          |  . . .  \  / Bot
   //          |       MergeMem
   //          |          |
-  //       {MemBarCPUOrder}
+  //        MemBarCPUOrder
   //        MemBarVolatile (trailing)
   //
   //
@@ -1716,7 +1716,8 @@
   // So with G1 the pre-write and releasing store subgraph looks like
   // this (the nested Ifs are omitted).
   //
-  //  MemBarRelease (leading)____________
+  //  MemBarRelease
+  // {MemBarCPUOrder}_(leading)___________
   //     C |  ||  M \   M \    M \  M \ . . .
   //       | LoadB   \  LoadL  LoadN   \
   //       | /        \                 \
@@ -1932,7 +1933,7 @@
   // the following 3 Mem flow subgraphs is present.
   //
   //   MemBarRelease
-  //   MemBarCPUOrder {leading}
+  //  {MemBarCPUOrder} {leading}
   //          |  \      . . .
   //          |  StoreN/P[mo_release]  . . .
   //          |   /
@@ -1961,7 +1962,7 @@
   //   MemBarAcquire {trailing}
   //
   // if the correct configuration is present returns the trailing
-  // membar otherwise NULL.
+  // or cardmark membar otherwise NULL.
   //
   // the input membar is expected to be either a cpuorder membar or a
   // release membar. in the latter case it should not have a cpu membar
@@ -2070,8 +2071,8 @@
           // for a volatile store this can be either a trailing membar
           // or a card mark membar. for a cas it must be a card mark
           // membar
-          assert(cas == NULL || is_card_mark_membar(mbar),
-                 "in CAS graph volatile membar must be a card mark");
+          guarantee(cas == NULL || is_card_mark_membar(mbar),
+                    "in CAS graph volatile membar must be a card mark");
 	} else if (cas != NULL && x->Opcode() == Op_MemBarAcquire) {
 	  mbar = x->as_MemBar();
 	}
@@ -2197,15 +2198,16 @@
       }
     }
 
-    // we should not have both a store and a cas
-    if (st == NULL & cas == NULL) {
+    // we cannot have both a store and a cas
+    if (st == NULL && cas == NULL) {
+      // we have neither -- this is not a normal graph
       return NULL;
     }
     if (st == NULL) {
       // if we started from a volatile membar and found a CAS then the
       // original membar ought to be for a card mark
-      assert((barrier_is_acquire || is_card_mark_membar(barrier)),
-             "unexpected volatile barrier (i.e. not card mark) in CAS graph");
+      guarantee((barrier_is_acquire || is_card_mark_membar(barrier)),
+                "unexpected volatile barrier (i.e. not card mark) in CAS graph");
       // check that the CAS feeds the merge we used to get here via an
       // intermediary SCMemProj
       Node *scmemproj = NULL;
@@ -2227,8 +2229,8 @@
       }
     } else {
       // we should not have found a store if we started from an acquire
-      assert(!barrier_is_acquire,
-             "unexpected trailing acquire barrier in volatile store graph");
+      guarantee(!barrier_is_acquire,
+                "unexpected trailing acquire barrier in volatile store graph");
 
       // the store should feed the merge we used to get here
       for (DUIterator_Fast imax, i = st->fast_outs(imax); i < imax; i++) {
@@ -2396,7 +2398,7 @@
     }
 
     // sanity check this feed turns up as the expected slice
-    assert(mm->as_MergeMem()->in(Compile::AliasIdxBot) == feed, "expecting membar to feed AliasIdxBot slice to Merge");
+    guarantee(mm->as_MergeMem()->in(Compile::AliasIdxBot) == feed, "expecting membar to feed AliasIdxBot slice to Merge");
 
     MemBarNode *trailing = NULL;
     // be sure we have a trailing membar fed by the merge
@@ -2831,8 +2833,8 @@
 
   // the barrier must be a cpuorder mmebar fed by a release membar
 
-  assert(barrier->Opcode() == Op_MemBarCPUOrder,
-	 "CAS not fed by cpuorder membar!");
+  guarantee(barrier->Opcode() == Op_MemBarCPUOrder,
+            "CAS not fed by cpuorder membar!");
 
   MemBarNode *b = parent_membar(barrier);
   assert ((b != NULL && b->Opcode() == Op_MemBarRelease),
@@ -2841,7 +2843,7 @@
   // does this lead a normal subgraph?
   MemBarNode *mbar = leading_to_normal(barrier);
 
-  assert(mbar != NULL, "CAS not embedded in normal graph!");
+  guarantee(mbar != NULL, "CAS not embedded in normal graph!");
 
   // if this is a card mark membar check we have a trailing acquire
 
@@ -2849,9 +2851,9 @@
     mbar = card_mark_to_trailing(mbar);
   }
 
-  assert(mbar != NULL, "card mark membar for CAS not embedded in normal graph!");
-
-  assert(mbar->Opcode() == Op_MemBarAcquire, "trailing membar should be an acquire");
+  guarantee(mbar != NULL, "card mark membar for CAS not embedded in normal graph!");
+
+  guarantee(mbar->Opcode() == Op_MemBarAcquire, "trailing membar should be an acquire");
 #endif // ASSERT
   // so we can just return true here
   return true;
@@ -2875,7 +2877,7 @@
   }
 
   // if we are implementing volatile puts using barriers then the
-  // object put as an str so we must insert the dmb ishst
+  // object put is an str so we must insert the dmb ishst
 
   if (UseBarriersForVolatile) {
     return false;
@@ -8400,7 +8402,8 @@
   predicate(unnecessary_storestore(n));
 
   ins_cost(INSN_COST);
-  format %{ "strb zr, $mem\t# byte" %}
+  format %{ "storestore (elided)\n\t"
+            "strb zr, $mem\t# byte" %}
 
   ins_encode(aarch64_enc_strb0(mem));
 
@@ -8414,8 +8417,9 @@
   match(Set mem (StoreCM mem zero));
 
   ins_cost(INSN_COST * 2);
-  format %{ "dmb ishst"
-      "\n\tstrb zr, $mem\t# byte" %}
+  format %{ "storestore\n\t"
+            "dmb ishst"
+            "\n\tstrb zr, $mem\t# byte" %}
 
   ins_encode(aarch64_enc_strb0_ordered(mem));
 
@@ -9193,7 +9197,8 @@
   match(MemBarAcquire);
   ins_cost(VOLATILE_REF_COST);
 
-  format %{ "membar_acquire" %}
+  format %{ "membar_acquire\n\t"
+            "dmb ish" %}
 
   ins_encode %{
     __ block_comment("membar_acquire");
@@ -9246,7 +9251,8 @@
   match(MemBarRelease);
   ins_cost(VOLATILE_REF_COST);
 
-  format %{ "membar_release" %}
+  format %{ "membar_release\n\t"
+            "dmb ish" %}
 
   ins_encode %{
     __ block_comment("membar_release");
@@ -9298,7 +9304,8 @@
   match(MemBarVolatile);
   ins_cost(VOLATILE_REF_COST*100);
 
-  format %{ "membar_volatile" %}
+  format %{ "membar_volatile\n\t"
+             "dmb ish"%}
 
   ins_encode %{
     __ block_comment("membar_volatile");
--- a/src/hotspot/cpu/x86/assembler_x86.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/cpu/x86/assembler_x86.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -133,6 +133,8 @@
   _index = noreg;
   _scale = no_scale;
   _disp  = disp;
+  _xmmindex = xnoreg;
+  _isxmmindex = false;
   switch (rtype) {
     case relocInfo::external_word_type:
       _rspec = external_word_Relocation::spec(loc);
@@ -172,6 +174,8 @@
   _scale = no_scale;
   _disp  = (intptr_t) loc;
   _rspec = spec;
+  _xmmindex = xnoreg;
+  _isxmmindex = false;
 }
 
 #endif // _LP64
@@ -604,6 +608,21 @@
   emit_operand((Register)reg, base, index, scale, disp, rspec);
 }
 
+void Assembler::emit_operand(XMMRegister reg, Register base, XMMRegister index,
+                             Address::ScaleFactor scale, int disp,
+                             RelocationHolder const& rspec) {
+  if (UseAVX > 2) {
+    int xreg_enc = reg->encoding();
+    int xmmindex_enc = index->encoding();
+    XMMRegister new_reg = as_XMMRegister(xreg_enc & 0xf);
+    XMMRegister new_index = as_XMMRegister(xmmindex_enc & 0xf);
+    emit_operand((Register)new_reg, base, (Register)new_index, scale, disp, rspec);
+  } else {
+    emit_operand((Register)reg, base, (Register)index, scale, disp, rspec);
+  }
+}
+
+
 // Secret local extension to Assembler::WhichOperand:
 #define end_pc_operand (_WhichOperand_limit)
 
@@ -1104,8 +1123,12 @@
 }
 
 void Assembler::emit_operand(XMMRegister reg, Address adr) {
-  emit_operand(reg, adr._base, adr._index, adr._scale, adr._disp,
-               adr._rspec);
+    if (adr.isxmmindex()) {
+       emit_operand(reg, adr._base, adr._xmmindex, adr._scale, adr._disp, adr._rspec);
+    } else {
+       emit_operand(reg, adr._base, adr._index, adr._scale, adr._disp,
+       adr._rspec);
+    }
 }
 
 // MMX operations
@@ -3419,6 +3442,15 @@
   emit_int8(imm8);
 }
 
+void Assembler::evpermi2q(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
+  assert(VM_Version::supports_evex(), "");
+  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true);
+  attributes.set_is_evex_instruction();
+  int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
+  emit_int8(0x76);
+  emit_int8((unsigned char)(0xC0 | encode));
+}
+
 
 void Assembler::pause() {
   emit_int8((unsigned char)0xF3);
@@ -3888,6 +3920,17 @@
   emit_operand(dst, src);
 }
 
+void Assembler::vpmovzxbw(XMMRegister dst, XMMRegister src, int vector_len) {
+  assert(vector_len == AVX_128bit? VM_Version::supports_avx() :
+  vector_len == AVX_256bit? VM_Version::supports_avx2() :
+  vector_len == AVX_512bit? VM_Version::supports_avx512bw() : 0, "");
+  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false);
+  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
+  emit_int8(0x30);
+  emit_int8((unsigned char) (0xC0 | encode));
+}
+
+
 void Assembler::evpmovzxbw(XMMRegister dst, KRegister mask, Address src, int vector_len) {
   assert(is_vector_masking(), "");
   assert(VM_Version::supports_avx512vlbw(), "");
@@ -3901,7 +3944,6 @@
   emit_int8(0x30);
   emit_operand(dst, src);
 }
-
 void Assembler::evpmovwb(Address dst, XMMRegister src, int vector_len) {
   assert(VM_Version::supports_avx512vlbw(), "");
   assert(src != xnoreg, "sanity");
@@ -3929,6 +3971,28 @@
   emit_operand(src, dst);
 }
 
+void Assembler::evpmovdb(Address dst, XMMRegister src, int vector_len) {
+  assert(VM_Version::supports_evex(), "");
+  assert(src != xnoreg, "sanity");
+  InstructionMark im(this);
+  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
+  attributes.set_address_attributes(/* tuple_type */ EVEX_QVM, /* input_size_in_bits */ EVEX_NObit);
+  attributes.set_is_evex_instruction();
+  vex_prefix(dst, 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F_38, &attributes);
+  emit_int8(0x31);
+  emit_operand(src, dst);
+}
+
+void Assembler::vpmovzxwd(XMMRegister dst, XMMRegister src, int vector_len) {
+  assert(vector_len == AVX_128bit? VM_Version::supports_avx() :
+  vector_len == AVX_256bit? VM_Version::supports_avx2() :
+  vector_len == AVX_512bit? VM_Version::supports_evex() : 0, " ");
+  InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false);
+  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
+  emit_int8(0x33);
+  emit_int8((unsigned char)(0xC0 | encode));
+}
+
 // generic
 void Assembler::pop(Register dst) {
   int encode = prefix_and_encode(dst->encoding());
@@ -6098,6 +6162,24 @@
   emit_int8((unsigned char)(0xC0 | encode));
 }
 
+void Assembler::evpsrlvw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
+  assert(VM_Version::supports_avx512bw(), "");
+  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  attributes.set_is_evex_instruction();
+  int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
+  emit_int8(0x10);
+  emit_int8((unsigned char)(0xC0 | encode));
+}
+
+void Assembler::evpsllvw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
+  assert(VM_Version::supports_avx512bw(), "");
+  InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  attributes.set_is_evex_instruction();
+  int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
+  emit_int8(0x12);
+  emit_int8((unsigned char)(0xC0 | encode));
+}
+
 // Shift packed integers arithmetically right by specified number of bits.
 void Assembler::psraw(XMMRegister dst, int shift) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
@@ -6199,6 +6281,15 @@
   emit_operand(dst, src);
 }
 
+void Assembler::vpandq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
+  assert(VM_Version::supports_evex(), "");
+  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
+  emit_int8((unsigned char)0xDB);
+  emit_int8((unsigned char)(0xC0 | encode));
+}
+
+
 void Assembler::pandn(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
@@ -6234,6 +6325,15 @@
   emit_operand(dst, src);
 }
 
+void Assembler::vporq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
+  assert(VM_Version::supports_evex(), "");
+  InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
+  emit_int8((unsigned char)0xEB);
+  emit_int8((unsigned char)(0xC0 | encode));
+}
+
+
 void Assembler::pxor(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
@@ -6867,6 +6967,20 @@
   emit_int8((unsigned char)(0xC0 | encode));
 }
 
+void Assembler::evpgatherdd(XMMRegister dst, KRegister mask, Address src, int vector_len) {
+  assert(VM_Version::supports_evex(), "");
+  assert(dst != xnoreg, "sanity");
+  InstructionMark im(this);
+  InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);
+  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
+  attributes.reset_is_clear_context();
+  attributes.set_embedded_opmask_register_specifier(mask);
+  attributes.set_is_evex_instruction();
+  // swap src<->dst for encoding
+  vex_prefix(src, 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
+  emit_int8((unsigned char)0x90);
+  emit_operand(dst, src);
+}
 
 // Carry-Less Multiplication Quadword
 void Assembler::pclmulqdq(XMMRegister dst, XMMRegister src, int mask) {
@@ -7492,7 +7606,12 @@
 void Assembler::vex_prefix(Address adr, int nds_enc, int xreg_enc, VexSimdPrefix pre, VexOpcode opc, InstructionAttr *attributes) {
   bool vex_r = ((xreg_enc & 8) == 8) ? 1 : 0;
   bool vex_b = adr.base_needs_rex();
-  bool vex_x = adr.index_needs_rex();
+  bool vex_x;
+  if (adr.isxmmindex()) {
+    vex_x = adr.xmmindex_needs_rex();
+  } else {
+    vex_x = adr.index_needs_rex();
+  }
   set_attributes(attributes);
   attributes->set_current_assembler(this);
 
@@ -7529,7 +7648,13 @@
   if (UseAVX > 2 && !attributes->is_legacy_mode())
   {
     bool evex_r = (xreg_enc >= 16);
-    bool evex_v = (nds_enc >= 16);
+    bool evex_v;
+    // EVEX.V' is set to true when VSIB is used as we may need to use higher order XMM registers (16-31)
+    if (adr.isxmmindex())  {
+      evex_v = ((adr._xmmindex->encoding() > 15) ? true : false);
+    } else {
+      evex_v = (nds_enc >= 16);
+    }
     attributes->set_is_evex_instruction();
     evex_prefix(vex_r, vex_b, vex_x, evex_r, evex_v, nds_enc, pre, opc);
   } else {
--- a/src/hotspot/cpu/x86/assembler_x86.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/cpu/x86/assembler_x86.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -184,8 +184,10 @@
  private:
   Register         _base;
   Register         _index;
+  XMMRegister      _xmmindex;
   ScaleFactor      _scale;
   int              _disp;
+  bool             _isxmmindex;
   RelocationHolder _rspec;
 
   // Easily misused constructors make them private
@@ -201,8 +203,10 @@
   Address()
     : _base(noreg),
       _index(noreg),
+      _xmmindex(xnoreg),
       _scale(no_scale),
-      _disp(0) {
+      _disp(0),
+      _isxmmindex(false){
   }
 
   // No default displacement otherwise Register can be implicitly
@@ -211,15 +215,19 @@
   Address(Register base, int disp)
     : _base(base),
       _index(noreg),
+      _xmmindex(xnoreg),
       _scale(no_scale),
-      _disp(disp) {
+      _disp(disp),
+      _isxmmindex(false){
   }
 
   Address(Register base, Register index, ScaleFactor scale, int disp = 0)
     : _base (base),
       _index(index),
+      _xmmindex(xnoreg),
       _scale(scale),
-      _disp (disp) {
+      _disp (disp),
+      _isxmmindex(false) {
     assert(!index->is_valid() == (scale == Address::no_scale),
            "inconsistent address");
   }
@@ -227,13 +235,26 @@
   Address(Register base, RegisterOrConstant index, ScaleFactor scale = times_1, int disp = 0)
     : _base (base),
       _index(index.register_or_noreg()),
+      _xmmindex(xnoreg),
       _scale(scale),
-      _disp (disp + (index.constant_or_zero() * scale_size(scale))) {
+      _disp (disp + (index.constant_or_zero() * scale_size(scale))),
+      _isxmmindex(false){
     if (!index.is_register())  scale = Address::no_scale;
     assert(!_index->is_valid() == (scale == Address::no_scale),
            "inconsistent address");
   }
 
+  Address(Register base, XMMRegister index, ScaleFactor scale, int disp = 0)
+    : _base (base),
+      _index(noreg),
+      _xmmindex(index),
+      _scale(scale),
+      _disp(disp),
+      _isxmmindex(true) {
+      assert(!index->is_valid() == (scale == Address::no_scale),
+             "inconsistent address");
+  }
+
   Address plus_disp(int disp) const {
     Address a = (*this);
     a._disp += disp;
@@ -269,24 +290,29 @@
   Address(Register base, ByteSize disp)
     : _base(base),
       _index(noreg),
+      _xmmindex(xnoreg),
       _scale(no_scale),
-      _disp(in_bytes(disp)) {
+      _disp(in_bytes(disp)),
+      _isxmmindex(false){
   }
 
   Address(Register base, Register index, ScaleFactor scale, ByteSize disp)
     : _base(base),
       _index(index),
+      _xmmindex(xnoreg),
       _scale(scale),
-      _disp(in_bytes(disp)) {
+      _disp(in_bytes(disp)),
+      _isxmmindex(false){
     assert(!index->is_valid() == (scale == Address::no_scale),
            "inconsistent address");
   }
-
   Address(Register base, RegisterOrConstant index, ScaleFactor scale, ByteSize disp)
     : _base (base),
       _index(index.register_or_noreg()),
+      _xmmindex(xnoreg),
       _scale(scale),
-      _disp (in_bytes(disp) + (index.constant_or_zero() * scale_size(scale))) {
+      _disp (in_bytes(disp) + (index.constant_or_zero() * scale_size(scale))),
+      _isxmmindex(false) {
     if (!index.is_register())  scale = Address::no_scale;
     assert(!_index->is_valid() == (scale == Address::no_scale),
            "inconsistent address");
@@ -298,8 +324,10 @@
   bool        uses(Register reg) const { return _base == reg || _index == reg; }
   Register    base()             const { return _base;  }
   Register    index()            const { return _index; }
+  XMMRegister xmmindex()         const { return _xmmindex; }
   ScaleFactor scale()            const { return _scale; }
   int         disp()             const { return _disp;  }
+  bool        isxmmindex()       const { return _isxmmindex; }
 
   // Convert the raw encoding form into the form expected by the constructor for
   // Address.  An index of 4 (rsp) corresponds to having no index, so convert
@@ -317,6 +345,10 @@
     return _index != noreg &&_index->encoding() >= 8;
   }
 
+  bool xmmindex_needs_rex() const {
+    return _xmmindex != xnoreg && _xmmindex->encoding() >= 8;
+  }
+
   relocInfo::relocType reloc() const { return _rspec.type(); }
 
   friend class Assembler;
@@ -683,6 +715,10 @@
                     RelocationHolder const& rspec,
                     int rip_relative_correction = 0);
 
+  void emit_operand(XMMRegister reg, Register base, XMMRegister index,
+                    Address::ScaleFactor scale,
+                    int disp, RelocationHolder const& rspec);
+
   void emit_operand(Register reg, Address adr, int rip_relative_correction = 0);
 
   // operands that only take the original 32bit registers
@@ -1554,6 +1590,7 @@
   void vpermq(XMMRegister dst, XMMRegister src, int imm8);
   void vperm2i128(XMMRegister dst,  XMMRegister nds, XMMRegister src, int imm8);
   void vperm2f128(XMMRegister dst, XMMRegister nds, XMMRegister src, int imm8);
+  void evpermi2q(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len);
 
   void pause();
 
@@ -1620,6 +1657,7 @@
   void pmovzxbw(XMMRegister dst, Address src);
 
   void vpmovzxbw( XMMRegister dst, Address src, int vector_len);
+  void vpmovzxbw(XMMRegister dst, XMMRegister src, int vector_len);
   void evpmovzxbw(XMMRegister dst, KRegister mask, Address src, int vector_len);
 
   void evpmovwb(Address dst, XMMRegister src, int vector_len);
@@ -1632,6 +1670,10 @@
   // AVX2 insert
   void vinserti128vi(XMMRegister dst, XMMRegister src, int imm8);
 
+  void vpmovzxwd(XMMRegister dst, XMMRegister src, int vector_len);
+
+  void evpmovdb(Address dst, XMMRegister src, int vector_len);
+
 #ifndef _LP64 // no 32bit push/pop on amd64
   void popl(Address dst);
 #endif
@@ -2033,6 +2075,8 @@
   void vpsrlw(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len);
   void vpsrld(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len);
   void vpsrlq(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len);
+  void evpsrlvw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len);
+  void evpsllvw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len);
 
   // Arithmetic shift right packed integers (only shorts and ints, no instructions for longs)
   void psraw(XMMRegister dst, int shift);
@@ -2048,6 +2092,7 @@
   void pand(XMMRegister dst, XMMRegister src);
   void vpand(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len);
   void vpand(XMMRegister dst, XMMRegister nds, Address src, int vector_len);
+  void vpandq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len);
 
   // Andn packed integers
   void pandn(XMMRegister dst, XMMRegister src);
@@ -2056,6 +2101,7 @@
   void por(XMMRegister dst, XMMRegister src);
   void vpor(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len);
   void vpor(XMMRegister dst, XMMRegister nds, Address src, int vector_len);
+  void vporq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len);
 
   // Xor packed integers
   void pxor(XMMRegister dst, XMMRegister src);
@@ -2126,6 +2172,8 @@
   void evpbroadcastd(XMMRegister dst, Register src, int vector_len);
   void evpbroadcastq(XMMRegister dst, Register src, int vector_len);
 
+  void evpgatherdd(XMMRegister dst, KRegister k1, Address src, int vector_len);
+
   // Carry-Less Multiplication Quadword
   void pclmulqdq(XMMRegister dst, XMMRegister src, int mask);
   void vpclmulqdq(XMMRegister dst, XMMRegister nds, XMMRegister src, int mask);
--- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -3570,6 +3570,15 @@
   }
 }
 
+void MacroAssembler::evmovdquq(XMMRegister dst, AddressLiteral src, int vector_len, Register rscratch) {
+  if (reachable(src)) {
+    Assembler::evmovdquq(dst, as_Address(src), vector_len);
+  } else {
+    lea(rscratch, src);
+    Assembler::evmovdquq(dst, Address(rscratch, 0), vector_len);
+  }
+}
+
 void MacroAssembler::movdqa(XMMRegister dst, AddressLiteral src) {
   if (reachable(src)) {
     Assembler::movdqa(dst, as_Address(src));
--- a/src/hotspot/cpu/x86/macroAssembler_x86.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/cpu/x86/macroAssembler_x86.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -1096,6 +1096,10 @@
   void vmovdqu(XMMRegister dst, Address src);
   void vmovdqu(XMMRegister dst, XMMRegister src);
   void vmovdqu(XMMRegister dst, AddressLiteral src);
+  void evmovdquq(XMMRegister dst, Address src, int vector_len) { Assembler::evmovdquq(dst, src, vector_len); }
+  void evmovdquq(XMMRegister dst, XMMRegister src, int vector_len) { Assembler::evmovdquq(dst, src, vector_len); }
+  void evmovdquq(Address dst, XMMRegister src, int vector_len) { Assembler::evmovdquq(dst, src, vector_len); }
+  void evmovdquq(XMMRegister dst, AddressLiteral src, int vector_len, Register rscratch);
 
   // Move Aligned Double Quadword
   void movdqa(XMMRegister dst, Address src)       { Assembler::movdqa(dst, src); }
@@ -1209,6 +1213,8 @@
   void vpcmpeqw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len);
 
   void vpmovzxbw(XMMRegister dst, Address src, int vector_len);
+  void vpmovzxbw(XMMRegister dst, XMMRegister src, int vector_len) { Assembler::vpmovzxbw(dst, src, vector_len); }
+
   void vpmovmskb(Register dst, XMMRegister src);
 
   void vpmullw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len);
--- a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -4547,6 +4547,408 @@
     return start;
   }
 
+  //base64 character set
+  address base64_charset_addr() {
+    __ align(CodeEntryAlignment);
+    StubCodeMark mark(this, "StubRoutines", "base64_charset");
+    address start = __ pc();
+    __ emit_data64(0x0000004200000041, relocInfo::none);
+    __ emit_data64(0x0000004400000043, relocInfo::none);
+    __ emit_data64(0x0000004600000045, relocInfo::none);
+    __ emit_data64(0x0000004800000047, relocInfo::none);
+    __ emit_data64(0x0000004a00000049, relocInfo::none);
+    __ emit_data64(0x0000004c0000004b, relocInfo::none);
+    __ emit_data64(0x0000004e0000004d, relocInfo::none);
+    __ emit_data64(0x000000500000004f, relocInfo::none);
+    __ emit_data64(0x0000005200000051, relocInfo::none);
+    __ emit_data64(0x0000005400000053, relocInfo::none);
+    __ emit_data64(0x0000005600000055, relocInfo::none);
+    __ emit_data64(0x0000005800000057, relocInfo::none);
+    __ emit_data64(0x0000005a00000059, relocInfo::none);
+    __ emit_data64(0x0000006200000061, relocInfo::none);
+    __ emit_data64(0x0000006400000063, relocInfo::none);
+    __ emit_data64(0x0000006600000065, relocInfo::none);
+    __ emit_data64(0x0000006800000067, relocInfo::none);
+    __ emit_data64(0x0000006a00000069, relocInfo::none);
+    __ emit_data64(0x0000006c0000006b, relocInfo::none);
+    __ emit_data64(0x0000006e0000006d, relocInfo::none);
+    __ emit_data64(0x000000700000006f, relocInfo::none);
+    __ emit_data64(0x0000007200000071, relocInfo::none);
+    __ emit_data64(0x0000007400000073, relocInfo::none);
+    __ emit_data64(0x0000007600000075, relocInfo::none);
+    __ emit_data64(0x0000007800000077, relocInfo::none);
+    __ emit_data64(0x0000007a00000079, relocInfo::none);
+    __ emit_data64(0x0000003100000030, relocInfo::none);
+    __ emit_data64(0x0000003300000032, relocInfo::none);
+    __ emit_data64(0x0000003500000034, relocInfo::none);
+    __ emit_data64(0x0000003700000036, relocInfo::none);
+    __ emit_data64(0x0000003900000038, relocInfo::none);
+    __ emit_data64(0x0000002f0000002b, relocInfo::none);
+    return start;
+  }
+
+  //base64 url character set
+  address base64url_charset_addr() {
+    __ align(CodeEntryAlignment);
+    StubCodeMark mark(this, "StubRoutines", "base64url_charset");
+    address start = __ pc();
+    __ emit_data64(0x0000004200000041, relocInfo::none);
+    __ emit_data64(0x0000004400000043, relocInfo::none);
+    __ emit_data64(0x0000004600000045, relocInfo::none);
+    __ emit_data64(0x0000004800000047, relocInfo::none);
+    __ emit_data64(0x0000004a00000049, relocInfo::none);
+    __ emit_data64(0x0000004c0000004b, relocInfo::none);
+    __ emit_data64(0x0000004e0000004d, relocInfo::none);
+    __ emit_data64(0x000000500000004f, relocInfo::none);
+    __ emit_data64(0x0000005200000051, relocInfo::none);
+    __ emit_data64(0x0000005400000053, relocInfo::none);
+    __ emit_data64(0x0000005600000055, relocInfo::none);
+    __ emit_data64(0x0000005800000057, relocInfo::none);
+    __ emit_data64(0x0000005a00000059, relocInfo::none);
+    __ emit_data64(0x0000006200000061, relocInfo::none);
+    __ emit_data64(0x0000006400000063, relocInfo::none);
+    __ emit_data64(0x0000006600000065, relocInfo::none);
+    __ emit_data64(0x0000006800000067, relocInfo::none);
+    __ emit_data64(0x0000006a00000069, relocInfo::none);
+    __ emit_data64(0x0000006c0000006b, relocInfo::none);
+    __ emit_data64(0x0000006e0000006d, relocInfo::none);
+    __ emit_data64(0x000000700000006f, relocInfo::none);
+    __ emit_data64(0x0000007200000071, relocInfo::none);
+    __ emit_data64(0x0000007400000073, relocInfo::none);
+    __ emit_data64(0x0000007600000075, relocInfo::none);
+    __ emit_data64(0x0000007800000077, relocInfo::none);
+    __ emit_data64(0x0000007a00000079, relocInfo::none);
+    __ emit_data64(0x0000003100000030, relocInfo::none);
+    __ emit_data64(0x0000003300000032, relocInfo::none);
+    __ emit_data64(0x0000003500000034, relocInfo::none);
+    __ emit_data64(0x0000003700000036, relocInfo::none);
+    __ emit_data64(0x0000003900000038, relocInfo::none);
+    __ emit_data64(0x0000005f0000002d, relocInfo::none);
+
+    return start;
+  }
+
+  address base64_bswap_mask_addr() {
+    __ align(CodeEntryAlignment);
+    StubCodeMark mark(this, "StubRoutines", "bswap_mask_base64");
+    address start = __ pc();
+    __ emit_data64(0x0504038002010080, relocInfo::none);
+    __ emit_data64(0x0b0a098008070680, relocInfo::none);
+    __ emit_data64(0x0908078006050480, relocInfo::none);
+    __ emit_data64(0x0f0e0d800c0b0a80, relocInfo::none);
+    __ emit_data64(0x0605048003020180, relocInfo::none);
+    __ emit_data64(0x0c0b0a8009080780, relocInfo::none);
+    __ emit_data64(0x0504038002010080, relocInfo::none);
+    __ emit_data64(0x0b0a098008070680, relocInfo::none);
+
+    return start;
+  }
+
+  address base64_right_shift_mask_addr() {
+    __ align(CodeEntryAlignment);
+    StubCodeMark mark(this, "StubRoutines", "right_shift_mask");
+    address start = __ pc();
+    __ emit_data64(0x0006000400020000, relocInfo::none);
+    __ emit_data64(0x0006000400020000, relocInfo::none);
+    __ emit_data64(0x0006000400020000, relocInfo::none);
+    __ emit_data64(0x0006000400020000, relocInfo::none);
+    __ emit_data64(0x0006000400020000, relocInfo::none);
+    __ emit_data64(0x0006000400020000, relocInfo::none);
+    __ emit_data64(0x0006000400020000, relocInfo::none);
+    __ emit_data64(0x0006000400020000, relocInfo::none);
+
+    return start;
+  }
+
+  address base64_left_shift_mask_addr() {
+    __ align(CodeEntryAlignment);
+    StubCodeMark mark(this, "StubRoutines", "left_shift_mask");
+    address start = __ pc();
+    __ emit_data64(0x0000000200040000, relocInfo::none);
+    __ emit_data64(0x0000000200040000, relocInfo::none);
+    __ emit_data64(0x0000000200040000, relocInfo::none);
+    __ emit_data64(0x0000000200040000, relocInfo::none);
+    __ emit_data64(0x0000000200040000, relocInfo::none);
+    __ emit_data64(0x0000000200040000, relocInfo::none);
+    __ emit_data64(0x0000000200040000, relocInfo::none);
+    __ emit_data64(0x0000000200040000, relocInfo::none);
+
+    return start;
+  }
+
+  address base64_and_mask_addr() {
+    __ align(CodeEntryAlignment);
+    StubCodeMark mark(this, "StubRoutines", "and_mask");
+    address start = __ pc();
+    __ emit_data64(0x3f003f003f000000, relocInfo::none);
+    __ emit_data64(0x3f003f003f000000, relocInfo::none);
+    __ emit_data64(0x3f003f003f000000, relocInfo::none);
+    __ emit_data64(0x3f003f003f000000, relocInfo::none);
+    __ emit_data64(0x3f003f003f000000, relocInfo::none);
+    __ emit_data64(0x3f003f003f000000, relocInfo::none);
+    __ emit_data64(0x3f003f003f000000, relocInfo::none);
+    __ emit_data64(0x3f003f003f000000, relocInfo::none);
+    return start;
+  }
+
+  address base64_gather_mask_addr() {
+    __ align(CodeEntryAlignment);
+    StubCodeMark mark(this, "StubRoutines", "gather_mask");
+    address start = __ pc();
+    __ emit_data64(0xffffffffffffffff, relocInfo::none);
+    return start;
+  }
+
+// Code for generating Base64 encoding.
+// Intrinsic function prototype in Base64.java:
+// private void encodeBlock(byte[] src, int sp, int sl, byte[] dst, int dp, boolean isURL) {
+  address generate_base64_encodeBlock() {
+    __ align(CodeEntryAlignment);
+    StubCodeMark mark(this, "StubRoutines", "implEncode");
+    address start = __ pc();
+    __ enter();
+
+    // Save callee-saved registers before using them
+    __ push(r12);
+    __ push(r13);
+    __ push(r14);
+    __ push(r15);
+    __ push(rbx);
+
+    // arguments
+    const Register source = c_rarg0; // Source Array
+    const Register start_offset = c_rarg1; // start offset
+    const Register end_offset = c_rarg2; // end offset
+    const Register dest = c_rarg3; // destination array
+
+#ifndef _WIN64
+    const Register dp = c_rarg4;  // Position for writing to dest array
+    const Register isURL = c_rarg5;// Base64 or URL character set
+#else
+    const Address  dp_mem(rbp, 6 * wordSize);  // length is on stack on Win64
+    const Address isURL_mem(rbp, 7 * wordSize);
+    const Register isURL = r10;      // pick the volatile windows register
+    const Register dp = r12;
+    __ movl(dp, dp_mem);
+    __ movl(isURL, isURL_mem);
+#endif
+
+    const Register length = r14;
+    Label L_process80, L_process32, L_process3, L_exit, L_processdata;
+
+    // calculate length from offsets
+    __ movl(length, end_offset);
+    __ subl(length, start_offset);
+    __ cmpl(length, 0);
+    __ jcc(Assembler::lessEqual, L_exit);
+
+    // Save k1 value in rbx
+    __ kmovql(rbx, k1);
+    __ lea(r11, ExternalAddress(StubRoutines::x86::base64_charset_addr()));
+    // check if base64 charset(isURL=0) or base64 url charset(isURL=1) needs to be loaded
+    __ cmpl(isURL, 0);
+    __ jcc(Assembler::equal, L_processdata);
+    __ lea(r11, ExternalAddress(StubRoutines::x86::base64url_charset_addr()));
+
+    // load masks required for encoding data
+    __ BIND(L_processdata);
+    __ movdqu(xmm16, ExternalAddress(StubRoutines::x86::base64_gather_mask_addr()));
+    // Set 64 bits of K register.
+    __ evpcmpeqb(k1, xmm16, xmm16, Assembler::AVX_512bit);
+    __ evmovdquq(xmm12, ExternalAddress(StubRoutines::x86::base64_bswap_mask_addr()), Assembler::AVX_256bit, r13);
+    __ evmovdquq(xmm13, ExternalAddress(StubRoutines::x86::base64_right_shift_mask_addr()), Assembler::AVX_512bit, r13);
+    __ evmovdquq(xmm14, ExternalAddress(StubRoutines::x86::base64_left_shift_mask_addr()), Assembler::AVX_512bit, r13);
+    __ evmovdquq(xmm15, ExternalAddress(StubRoutines::x86::base64_and_mask_addr()), Assembler::AVX_512bit, r13);
+
+    // Vector Base64 implementation, producing 96 bytes of encoded data
+    __ BIND(L_process80);
+    __ cmpl(length, 80);
+    __ jcc(Assembler::below, L_process32);
+    __ evmovdquq(xmm0, Address(source, start_offset, Address::times_1, 0), Assembler::AVX_256bit);
+    __ evmovdquq(xmm1, Address(source, start_offset, Address::times_1, 24), Assembler::AVX_256bit);
+    __ evmovdquq(xmm2, Address(source, start_offset, Address::times_1, 48), Assembler::AVX_256bit);
+
+    //permute the input data in such a manner that we have continuity of the source
+    __ vpermq(xmm3, xmm0, 148, Assembler::AVX_256bit);
+    __ vpermq(xmm4, xmm1, 148, Assembler::AVX_256bit);
+    __ vpermq(xmm5, xmm2, 148, Assembler::AVX_256bit);
+
+    //shuffle input and group 3 bytes of data and to it add 0 as the 4th byte.
+    //we can deal with 12 bytes at a time in a 128 bit register
+    __ vpshufb(xmm3, xmm3, xmm12, Assembler::AVX_256bit);
+    __ vpshufb(xmm4, xmm4, xmm12, Assembler::AVX_256bit);
+    __ vpshufb(xmm5, xmm5, xmm12, Assembler::AVX_256bit);
+
+    //convert byte to word. Each 128 bit register will have 6 bytes for processing
+    __ vpmovzxbw(xmm3, xmm3, Assembler::AVX_512bit);
+    __ vpmovzxbw(xmm4, xmm4, Assembler::AVX_512bit);
+    __ vpmovzxbw(xmm5, xmm5, Assembler::AVX_512bit);
+
+    // Extract bits in the following pattern 6, 4+2, 2+4, 6 to convert 3, 8 bit numbers to 4, 6 bit numbers
+    __ evpsrlvw(xmm0, xmm3, xmm13,  Assembler::AVX_512bit);
+    __ evpsrlvw(xmm1, xmm4, xmm13, Assembler::AVX_512bit);
+    __ evpsrlvw(xmm2, xmm5, xmm13, Assembler::AVX_512bit);
+
+    __ evpsllvw(xmm3, xmm3, xmm14, Assembler::AVX_512bit);
+    __ evpsllvw(xmm4, xmm4, xmm14, Assembler::AVX_512bit);
+    __ evpsllvw(xmm5, xmm5, xmm14, Assembler::AVX_512bit);
+
+    __ vpsrlq(xmm0, xmm0, 8, Assembler::AVX_512bit);
+    __ vpsrlq(xmm1, xmm1, 8, Assembler::AVX_512bit);
+    __ vpsrlq(xmm2, xmm2, 8, Assembler::AVX_512bit);
+
+    __ vpsllq(xmm3, xmm3, 8, Assembler::AVX_512bit);
+    __ vpsllq(xmm4, xmm4, 8, Assembler::AVX_512bit);
+    __ vpsllq(xmm5, xmm5, 8, Assembler::AVX_512bit);
+
+    __ vpandq(xmm3, xmm3, xmm15, Assembler::AVX_512bit);
+    __ vpandq(xmm4, xmm4, xmm15, Assembler::AVX_512bit);
+    __ vpandq(xmm5, xmm5, xmm15, Assembler::AVX_512bit);
+
+    // Get the final 4*6 bits base64 encoding
+    __ vporq(xmm3, xmm3, xmm0, Assembler::AVX_512bit);
+    __ vporq(xmm4, xmm4, xmm1, Assembler::AVX_512bit);
+    __ vporq(xmm5, xmm5, xmm2, Assembler::AVX_512bit);
+
+    // Shift
+    __ vpsrlq(xmm3, xmm3, 8, Assembler::AVX_512bit);
+    __ vpsrlq(xmm4, xmm4, 8, Assembler::AVX_512bit);
+    __ vpsrlq(xmm5, xmm5, 8, Assembler::AVX_512bit);
+
+    // look up 6 bits in the base64 character set to fetch the encoding
+    // we are converting word to dword as gather instructions need dword indices for looking up encoding
+    __ vextracti64x4(xmm6, xmm3, 0);
+    __ vpmovzxwd(xmm0, xmm6, Assembler::AVX_512bit);
+    __ vextracti64x4(xmm6, xmm3, 1);
+    __ vpmovzxwd(xmm1, xmm6, Assembler::AVX_512bit);
+
+    __ vextracti64x4(xmm6, xmm4, 0);
+    __ vpmovzxwd(xmm2, xmm6, Assembler::AVX_512bit);
+    __ vextracti64x4(xmm6, xmm4, 1);
+    __ vpmovzxwd(xmm3, xmm6, Assembler::AVX_512bit);
+
+    __ vextracti64x4(xmm4, xmm5, 0);
+    __ vpmovzxwd(xmm6, xmm4, Assembler::AVX_512bit);
+
+    __ vextracti64x4(xmm4, xmm5, 1);
+    __ vpmovzxwd(xmm7, xmm4, Assembler::AVX_512bit);
+
+    __ kmovql(k2, k1);
+    __ evpgatherdd(xmm4, k2, Address(r11, xmm0, Address::times_4, 0), Assembler::AVX_512bit);
+    __ kmovql(k2, k1);
+    __ evpgatherdd(xmm5, k2, Address(r11, xmm1, Address::times_4, 0), Assembler::AVX_512bit);
+    __ kmovql(k2, k1);
+    __ evpgatherdd(xmm8, k2, Address(r11, xmm2, Address::times_4, 0), Assembler::AVX_512bit);
+    __ kmovql(k2, k1);
+    __ evpgatherdd(xmm9, k2, Address(r11, xmm3, Address::times_4, 0), Assembler::AVX_512bit);
+    __ kmovql(k2, k1);
+    __ evpgatherdd(xmm10, k2, Address(r11, xmm6, Address::times_4, 0), Assembler::AVX_512bit);
+    __ kmovql(k2, k1);
+    __ evpgatherdd(xmm11, k2, Address(r11, xmm7, Address::times_4, 0), Assembler::AVX_512bit);
+
+    //Down convert dword to byte. Final output is 16*6 = 96 bytes long
+    __ evpmovdb(Address(dest, dp, Address::times_1, 0), xmm4, Assembler::AVX_512bit);
+    __ evpmovdb(Address(dest, dp, Address::times_1, 16), xmm5, Assembler::AVX_512bit);
+    __ evpmovdb(Address(dest, dp, Address::times_1, 32), xmm8, Assembler::AVX_512bit);
+    __ evpmovdb(Address(dest, dp, Address::times_1, 48), xmm9, Assembler::AVX_512bit);
+    __ evpmovdb(Address(dest, dp, Address::times_1, 64), xmm10, Assembler::AVX_512bit);
+    __ evpmovdb(Address(dest, dp, Address::times_1, 80), xmm11, Assembler::AVX_512bit);
+
+    __ addq(dest, 96);
+    __ addq(source, 72);
+    __ subq(length, 72);
+    __ jmp(L_process80);
+
+    // Vector Base64 implementation generating 32 bytes of encoded data
+    __ BIND(L_process32);
+    __ cmpl(length, 32);
+    __ jcc(Assembler::below, L_process3);
+    __ evmovdquq(xmm0, Address(source, start_offset), Assembler::AVX_256bit);
+    __ vpermq(xmm0, xmm0, 148, Assembler::AVX_256bit);
+    __ vpshufb(xmm6, xmm0, xmm12, Assembler::AVX_256bit);
+    __ vpmovzxbw(xmm6, xmm6, Assembler::AVX_512bit);
+    __ evpsrlvw(xmm2, xmm6, xmm13, Assembler::AVX_512bit);
+    __ evpsllvw(xmm3, xmm6, xmm14, Assembler::AVX_512bit);
+
+    __ vpsrlq(xmm2, xmm2, 8, Assembler::AVX_512bit);
+    __ vpsllq(xmm3, xmm3, 8, Assembler::AVX_512bit);
+    __ vpandq(xmm3, xmm3, xmm15, Assembler::AVX_512bit);
+    __ vporq(xmm1, xmm2, xmm3, Assembler::AVX_512bit);
+    __ vpsrlq(xmm1, xmm1, 8, Assembler::AVX_512bit);
+    __ vextracti64x4(xmm9, xmm1, 0);
+    __ vpmovzxwd(xmm6, xmm9, Assembler::AVX_512bit);
+    __ vextracti64x4(xmm9, xmm1, 1);
+    __ vpmovzxwd(xmm5, xmm9,  Assembler::AVX_512bit);
+    __ kmovql(k2, k1);
+    __ evpgatherdd(xmm8, k2, Address(r11, xmm6, Address::times_4, 0), Assembler::AVX_512bit);
+    __ kmovql(k2, k1);
+    __ evpgatherdd(xmm10, k2, Address(r11, xmm5, Address::times_4, 0), Assembler::AVX_512bit);
+    __ evpmovdb(Address(dest, dp, Address::times_1, 0), xmm8, Assembler::AVX_512bit);
+    __ evpmovdb(Address(dest, dp, Address::times_1, 16), xmm10, Assembler::AVX_512bit);
+    __ subq(length, 24);
+    __ addq(dest, 32);
+    __ addq(source, 24);
+    __ jmp(L_process32);
+
+    // Scalar data processing takes 3 bytes at a time and produces 4 bytes of encoded data
+    /* This code corresponds to the scalar version of the following snippet in Base64.java
+    ** int bits = (src[sp0++] & 0xff) << 16 |(src[sp0++] & 0xff) << 8 |(src[sp0++] & 0xff);
+    ** dst[dp0++] = (byte)base64[(bits >> > 18) & 0x3f];
+    ** dst[dp0++] = (byte)base64[(bits >> > 12) & 0x3f];
+    ** dst[dp0++] = (byte)base64[(bits >> > 6) & 0x3f];
+    ** dst[dp0++] = (byte)base64[bits & 0x3f];*/
+    __ BIND(L_process3);
+    __ cmpl(length, 3);
+    __ jcc(Assembler::below, L_exit);
+    // Read 1 byte at a time
+    __ movzbl(rax, Address(source, start_offset));
+    __ shll(rax, 0x10);
+    __ movl(r15, rax);
+    __ movzbl(rax, Address(source, start_offset, Address::times_1, 1));
+    __ shll(rax, 0x8);
+    __ movzwl(rax, rax);
+    __ orl(r15, rax);
+    __ movzbl(rax, Address(source, start_offset, Address::times_1, 2));
+    __ orl(rax, r15);
+    // Save 3 bytes read in r15
+    __ movl(r15, rax);
+    __ shrl(rax, 0x12);
+    __ andl(rax, 0x3f);
+    // rax contains the index, r11 contains base64 lookup table
+    __ movb(rax, Address(r11, rax, Address::times_4));
+    // Write the encoded byte to destination
+    __ movb(Address(dest, dp, Address::times_1, 0), rax);
+    __ movl(rax, r15);
+    __ shrl(rax, 0xc);
+    __ andl(rax, 0x3f);
+    __ movb(rax, Address(r11, rax, Address::times_4));
+    __ movb(Address(dest, dp, Address::times_1, 1), rax);
+    __ movl(rax, r15);
+    __ shrl(rax, 0x6);
+    __ andl(rax, 0x3f);
+    __ movb(rax, Address(r11, rax, Address::times_4));
+    __ movb(Address(dest, dp, Address::times_1, 2), rax);
+    __ movl(rax, r15);
+    __ andl(rax, 0x3f);
+    __ movb(rax, Address(r11, rax, Address::times_4));
+    __ movb(Address(dest, dp, Address::times_1, 3), rax);
+    __ subl(length, 3);
+    __ addq(dest, 4);
+    __ addq(source, 3);
+    __ jmp(L_process3);
+    __ BIND(L_exit);
+    // restore k1 register value
+    __ kmovql(k1, rbx);
+    __ pop(rbx);
+    __ pop(r15);
+    __ pop(r14);
+    __ pop(r13);
+    __ pop(r12);
+    __ leave();
+    __ ret(0);
+    return start;
+  }
+
   /**
    *  Arguments:
    *
@@ -5428,6 +5830,17 @@
       StubRoutines::_ghash_processBlocks = generate_ghash_processBlocks();
     }
 
+    if (UseBASE64Intrinsics) {
+      StubRoutines::x86::_and_mask = base64_and_mask_addr();
+      StubRoutines::x86::_bswap_mask = base64_bswap_mask_addr();
+      StubRoutines::x86::_base64_charset = base64_charset_addr();
+      StubRoutines::x86::_url_charset = base64url_charset_addr();
+      StubRoutines::x86::_gather_mask = base64_gather_mask_addr();
+      StubRoutines::x86::_left_shift_mask = base64_left_shift_mask_addr();
+      StubRoutines::x86::_right_shift_mask = base64_right_shift_mask_addr();
+      StubRoutines::_base64_encodeBlock = generate_base64_encodeBlock();
+    }
+
     // Safefetch stubs.
     generate_safefetch("SafeFetch32", sizeof(int),     &StubRoutines::_safefetch32_entry,
                                                        &StubRoutines::_safefetch32_fault_pc,
--- a/src/hotspot/cpu/x86/stubRoutines_x86.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/cpu/x86/stubRoutines_x86.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -45,6 +45,15 @@
 address StubRoutines::x86::_k256_W_adr = NULL;
 address StubRoutines::x86::_k512_W_addr = NULL;
 address StubRoutines::x86::_pshuffle_byte_flip_mask_addr_sha512 = NULL;
+// Base64 masks
+address StubRoutines::x86::_bswap_mask = NULL;
+address StubRoutines::x86::_base64_charset = NULL;
+address StubRoutines::x86::_gather_mask = NULL;
+address StubRoutines::x86::_right_shift_mask = NULL;
+address StubRoutines::x86::_left_shift_mask = NULL;
+address StubRoutines::x86::_and_mask = NULL;
+address StubRoutines::x86::_url_charset = NULL;
+
 #endif
 address StubRoutines::x86::_pshuffle_byte_flip_mask_addr = NULL;
 
--- a/src/hotspot/cpu/x86/stubRoutines_x86.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/cpu/x86/stubRoutines_x86.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -138,6 +138,14 @@
   static address _k512_W_addr;
   // byte flip mask for sha512
   static address _pshuffle_byte_flip_mask_addr_sha512;
+  // Masks for base64
+  static address _base64_charset;
+  static address _bswap_mask;
+  static address _gather_mask;
+  static address _right_shift_mask;
+  static address _left_shift_mask;
+  static address _and_mask;
+  static address _url_charset;
 #endif
   // byte flip mask for sha256
   static address _pshuffle_byte_flip_mask_addr;
@@ -198,6 +206,13 @@
   static address k256_W_addr()    { return _k256_W_adr; }
   static address k512_W_addr()    { return _k512_W_addr; }
   static address pshuffle_byte_flip_mask_addr_sha512() { return _pshuffle_byte_flip_mask_addr_sha512; }
+  static address base64_charset_addr() { return _base64_charset; }
+  static address base64url_charset_addr() { return _url_charset; }
+  static address base64_bswap_mask_addr() { return _bswap_mask; }
+  static address base64_gather_mask_addr() { return _gather_mask; }
+  static address base64_right_shift_mask_addr() { return _right_shift_mask; }
+  static address base64_left_shift_mask_addr() { return _left_shift_mask; }
+  static address base64_and_mask_addr() { return _and_mask; }
 #endif
   static address pshuffle_byte_flip_mask_addr() { return _pshuffle_byte_flip_mask_addr; }
   static void generate_CRC32C_table(bool is_pclmulqdq_supported);
--- a/src/hotspot/cpu/x86/vm_version_x86.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/cpu/x86/vm_version_x86.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -856,6 +856,17 @@
     FLAG_SET_DEFAULT(UseGHASHIntrinsics, false);
   }
 
+  // Base64 Intrinsics (Check the condition for which the intrinsic will be active)
+  if ((UseAVX > 2) && supports_avx512vl() && supports_avx512bw()) {
+    if (FLAG_IS_DEFAULT(UseBASE64Intrinsics)) {
+      UseBASE64Intrinsics = true;
+    }
+  } else if (UseBASE64Intrinsics) {
+     if (!FLAG_IS_DEFAULT(UseBASE64Intrinsics))
+      warning("Base64 intrinsic requires EVEX instructions on this CPU");
+    FLAG_SET_DEFAULT(UseBASE64Intrinsics, false);
+  }
+
   if (supports_fma() && UseSSE >= 2) { // Check UseSSE since FMA code uses SSE instructions
     if (FLAG_IS_DEFAULT(UseFMA)) {
       UseFMA = true;
--- a/src/hotspot/os/aix/os_aix.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/os/aix/os_aix.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -1208,22 +1208,6 @@
   ::abort();
 }
 
-// This method is a copy of JDK's sysGetLastErrorString
-// from src/solaris/hpi/src/system_md.c
-
-size_t os::lasterror(char *buf, size_t len) {
-  if (errno == 0) return 0;
-
-  const char *s = os::strerror(errno);
-  size_t n = ::strlen(s);
-  if (n >= len) {
-    n = len - 1;
-  }
-  ::strncpy(buf, s, n);
-  buf[n] = '\0';
-  return n;
-}
-
 intx os::current_thread_id() {
   return (intx)pthread_self();
 }
--- a/src/hotspot/os/aix/os_perf_aix.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/os/aix/os_perf_aix.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -1041,3 +1041,49 @@
   cpu_info = *_cpu_info; // shallow copy assignment
   return OS_OK;
 }
+
+class NetworkPerformanceInterface::NetworkPerformance : public CHeapObj<mtInternal> {
+  friend class NetworkPerformanceInterface;
+ private:
+  NetworkPerformance();
+  NetworkPerformance(const NetworkPerformance& rhs); // no impl
+  NetworkPerformance& operator=(const NetworkPerformance& rhs); // no impl
+  bool initialize();
+  ~NetworkPerformance();
+  int network_utilization(NetworkInterface** network_interfaces) const;
+};
+
+NetworkPerformanceInterface::NetworkPerformance::NetworkPerformance() {
+
+}
+
+bool NetworkPerformanceInterface::NetworkPerformance::initialize() {
+  return true;
+}
+
+NetworkPerformanceInterface::NetworkPerformance::~NetworkPerformance() {
+}
+
+int NetworkPerformanceInterface::NetworkPerformance::network_utilization(NetworkInterface** network_interfaces) const
+{
+  return FUNCTIONALITY_NOT_IMPLEMENTED;
+}
+
+NetworkPerformanceInterface::NetworkPerformanceInterface() {
+  _impl = NULL;
+}
+
+NetworkPerformanceInterface::~NetworkPerformanceInterface() {
+  if (_impl != NULL) {
+    delete _impl;
+  }
+}
+
+bool NetworkPerformanceInterface::initialize() {
+  _impl = new NetworkPerformanceInterface::NetworkPerformance();
+  return _impl != NULL && _impl->initialize();
+}
+
+int NetworkPerformanceInterface::network_utilization(NetworkInterface** network_interfaces) const {
+  return _impl->network_utilization(network_interfaces);
+}
--- a/src/hotspot/os/bsd/os_bsd.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/os/bsd/os_bsd.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -1081,22 +1081,6 @@
   ::abort();
 }
 
-// This method is a copy of JDK's sysGetLastErrorString
-// from src/solaris/hpi/src/system_md.c
-
-size_t os::lasterror(char *buf, size_t len) {
-  if (errno == 0)  return 0;
-
-  const char *s = os::strerror(errno);
-  size_t n = ::strlen(s);
-  if (n >= len) {
-    n = len - 1;
-  }
-  ::strncpy(buf, s, n);
-  buf[n] = '\0';
-  return n;
-}
-
 // Information of current thread in variety of formats
 pid_t os::Bsd::gettid() {
   int retval = -1;
--- a/src/hotspot/os/bsd/os_perf_bsd.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/os/bsd/os_perf_bsd.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -34,6 +34,10 @@
   #include <sys/sysctl.h>
   #include <mach/mach.h>
   #include <mach/task_info.h>
+  #include <sys/socket.h>
+  #include <net/if.h>
+  #include <net/if_dl.h>
+  #include <net/route.h>
 #endif
 
 static const double NANOS_PER_SEC = 1000000000.0;
@@ -403,3 +407,85 @@
   cpu_info = *_cpu_info; // shallow copy assignment
   return OS_OK;
 }
+
+class NetworkPerformanceInterface::NetworkPerformance : public CHeapObj<mtInternal> {
+  friend class NetworkPerformanceInterface;
+ private:
+  NetworkPerformance();
+  NetworkPerformance(const NetworkPerformance& rhs); // no impl
+  NetworkPerformance& operator=(const NetworkPerformance& rhs); // no impl
+  bool initialize();
+  ~NetworkPerformance();
+  int network_utilization(NetworkInterface** network_interfaces) const;
+};
+
+NetworkPerformanceInterface::NetworkPerformance::NetworkPerformance() {
+}
+
+bool NetworkPerformanceInterface::NetworkPerformance::initialize() {
+  return true;
+}
+
+NetworkPerformanceInterface::NetworkPerformance::~NetworkPerformance() {
+}
+
+int NetworkPerformanceInterface::NetworkPerformance::network_utilization(NetworkInterface** network_interfaces) const {
+  size_t len;
+  int mib[] = {CTL_NET, PF_ROUTE, /* protocol number */ 0, /* address family */ 0, NET_RT_IFLIST2, /* NET_RT_FLAGS mask*/ 0};
+  if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), NULL, &len, NULL, 0) != 0) {
+    return OS_ERR;
+  }
+  uint8_t* buf = NEW_RESOURCE_ARRAY(uint8_t, len);
+  if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), buf, &len, NULL, 0) != 0) {
+    return OS_ERR;
+  }
+
+  size_t index = 0;
+  NetworkInterface* ret = NULL;
+  while (index < len) {
+    if_msghdr* msghdr = reinterpret_cast<if_msghdr*>(buf + index);
+    index += msghdr->ifm_msglen;
+
+    if (msghdr->ifm_type != RTM_IFINFO2) {
+      continue;
+    }
+
+    if_msghdr2* msghdr2 = reinterpret_cast<if_msghdr2*>(msghdr);
+    sockaddr_dl* sockaddr = reinterpret_cast<sockaddr_dl*>(msghdr2 + 1);
+
+    // The interface name is not necessarily NUL-terminated
+    char name_buf[128];
+    size_t name_len = MIN2(sizeof(name_buf) - 1, static_cast<size_t>(sockaddr->sdl_nlen));
+    strncpy(name_buf, sockaddr->sdl_data, name_len);
+    name_buf[name_len] = '\0';
+
+    uint64_t bytes_in = msghdr2->ifm_data.ifi_ibytes;
+    uint64_t bytes_out = msghdr2->ifm_data.ifi_obytes;
+
+    NetworkInterface* cur = new NetworkInterface(name_buf, bytes_in, bytes_out, ret);
+    ret = cur;
+  }
+
+  *network_interfaces = ret;
+
+  return OS_OK;
+}
+
+NetworkPerformanceInterface::NetworkPerformanceInterface() {
+  _impl = NULL;
+}
+
+NetworkPerformanceInterface::~NetworkPerformanceInterface() {
+  if (_impl != NULL) {
+    delete _impl;
+  }
+}
+
+bool NetworkPerformanceInterface::initialize() {
+  _impl = new NetworkPerformanceInterface::NetworkPerformance();
+  return _impl != NULL && _impl->initialize();
+}
+
+int NetworkPerformanceInterface::network_utilization(NetworkInterface** network_interfaces) const {
+  return _impl->network_utilization(network_interfaces);
+}
--- a/src/hotspot/os/linux/os_linux.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/os/linux/os_linux.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -1419,23 +1419,6 @@
   ::abort();
 }
 
-
-// This method is a copy of JDK's sysGetLastErrorString
-// from src/solaris/hpi/src/system_md.c
-
-size_t os::lasterror(char *buf, size_t len) {
-  if (errno == 0)  return 0;
-
-  const char *s = os::strerror(errno);
-  size_t n = ::strlen(s);
-  if (n >= len) {
-    n = len - 1;
-  }
-  ::strncpy(buf, s, n);
-  buf[n] = '\0';
-  return n;
-}
-
 // thread_id is kernel thread id (similar to Solaris LWP id)
 intx os::current_thread_id() { return os::Linux::gettid(); }
 int os::current_process_id() {
--- a/src/hotspot/os/linux/os_perf_linux.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/os/linux/os_perf_linux.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -44,6 +44,8 @@
 #include <dlfcn.h>
 #include <pthread.h>
 #include <limits.h>
+#include <ifaddrs.h>
+#include <fcntl.h>
 
 /**
    /proc/[number]/stat
@@ -1048,3 +1050,94 @@
   cpu_info = *_cpu_info; // shallow copy assignment
   return OS_OK;
 }
+
+class NetworkPerformanceInterface::NetworkPerformance : public CHeapObj<mtInternal> {
+  friend class NetworkPerformanceInterface;
+ private:
+  NetworkPerformance();
+  NetworkPerformance(const NetworkPerformance& rhs); // no impl
+  NetworkPerformance& operator=(const NetworkPerformance& rhs); // no impl
+  bool initialize();
+  ~NetworkPerformance();
+  int64_t read_counter(const char* iface, const char* counter) const;
+  int network_utilization(NetworkInterface** network_interfaces) const;
+};
+
+NetworkPerformanceInterface::NetworkPerformance::NetworkPerformance() {
+
+}
+
+bool NetworkPerformanceInterface::NetworkPerformance::initialize() {
+  return true;
+}
+
+NetworkPerformanceInterface::NetworkPerformance::~NetworkPerformance() {
+}
+
+int64_t NetworkPerformanceInterface::NetworkPerformance::read_counter(const char* iface, const char* counter) const {
+  char buf[128];
+
+  snprintf(buf, sizeof(buf), "/sys/class/net/%s/statistics/%s", iface, counter);
+
+  int fd = open(buf, O_RDONLY);
+  if (fd == -1) {
+    return -1;
+  }
+
+  ssize_t num_bytes = read(fd, buf, sizeof(buf));
+  close(fd);
+  if ((num_bytes == -1) || (num_bytes >= static_cast<ssize_t>(sizeof(buf))) || (num_bytes < 1)) {
+    return -1;
+  }
+
+  buf[num_bytes] = '\0';
+  int64_t value = strtoll(buf, NULL, 10);
+
+  return value;
+}
+
+int NetworkPerformanceInterface::NetworkPerformance::network_utilization(NetworkInterface** network_interfaces) const
+{
+  ifaddrs* addresses;
+  ifaddrs* cur_address;
+
+  if (getifaddrs(&addresses) != 0) {
+    return OS_ERR;
+  }
+
+  NetworkInterface* ret = NULL;
+  for (cur_address = addresses; cur_address != NULL; cur_address = cur_address->ifa_next) {
+    if (cur_address->ifa_addr->sa_family != AF_PACKET) {
+      continue;
+    }
+
+    int64_t bytes_in = read_counter(cur_address->ifa_name, "rx_bytes");
+    int64_t bytes_out = read_counter(cur_address->ifa_name, "tx_bytes");
+
+    NetworkInterface* cur = new NetworkInterface(cur_address->ifa_name, bytes_in, bytes_out, ret);
+    ret = cur;
+  }
+
+  *network_interfaces = ret;
+
+  return OS_OK;
+}
+
+NetworkPerformanceInterface::NetworkPerformanceInterface() {
+  _impl = NULL;
+}
+
+NetworkPerformanceInterface::~NetworkPerformanceInterface() {
+  if (_impl != NULL) {
+    delete _impl;
+  }
+}
+
+bool NetworkPerformanceInterface::initialize() {
+  _impl = new NetworkPerformanceInterface::NetworkPerformance();
+  return _impl != NULL && _impl->initialize();
+}
+
+int NetworkPerformanceInterface::network_utilization(NetworkInterface** network_interfaces) const {
+  return _impl->network_utilization(network_interfaces);
+}
--- a/src/hotspot/os/posix/os_posix.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/os/posix/os_posix.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -150,6 +150,19 @@
   return errno;
 }
 
+size_t os::lasterror(char *buf, size_t len) {
+  if (errno == 0)  return 0;
+
+  const char *s = os::strerror(errno);
+  size_t n = ::strlen(s);
+  if (n >= len) {
+    n = len - 1;
+  }
+  ::strncpy(buf, s, n);
+  buf[n] = '\0';
+  return n;
+}
+
 bool os::is_debugger_attached() {
   // not implemented
   return false;
--- a/src/hotspot/os/solaris/os_perf_solaris.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/os/solaris/os_perf_solaris.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -754,3 +754,88 @@
   cpu_info = *_cpu_info; // shallow copy assignment
   return OS_OK;
 }
+
+class NetworkPerformanceInterface::NetworkPerformance : public CHeapObj<mtInternal> {
+  friend class NetworkPerformanceInterface;
+ private:
+  NetworkPerformance();
+  NetworkPerformance(const NetworkPerformance& rhs); // no impl
+  NetworkPerformance& operator=(const NetworkPerformance& rhs); // no impl
+  bool initialize();
+  ~NetworkPerformance();
+  int network_utilization(NetworkInterface** network_interfaces) const;
+};
+
+NetworkPerformanceInterface::NetworkPerformance::NetworkPerformance() {
+
+}
+
+bool NetworkPerformanceInterface::NetworkPerformance::initialize() {
+  return true;
+}
+
+NetworkPerformanceInterface::NetworkPerformance::~NetworkPerformance() {
+
+}
+
+int NetworkPerformanceInterface::NetworkPerformance::network_utilization(NetworkInterface** network_interfaces) const
+{
+  kstat_ctl_t* ctl = kstat_open();
+  if (ctl == NULL) {
+    return OS_ERR;
+  }
+
+  NetworkInterface* ret = NULL;
+  for (kstat_t* k = ctl->kc_chain; k != NULL; k = k->ks_next) {
+    if (strcmp(k->ks_class, "net") != 0) {
+      continue;
+    }
+    if (strcmp(k->ks_module, "link") != 0) {
+      continue;
+    }
+
+    if (kstat_read(ctl, k, NULL) == -1) {
+      return OS_ERR;
+    }
+
+    uint64_t bytes_in = UINT64_MAX;
+    uint64_t bytes_out = UINT64_MAX;
+    for (int i = 0; i < k->ks_ndata; ++i) {
+      kstat_named_t* data = &reinterpret_cast<kstat_named_t*>(k->ks_data)[i];
+      if (strcmp(data->name, "rbytes64") == 0) {
+        bytes_in = data->value.ui64;
+      }
+      else if (strcmp(data->name, "obytes64") == 0) {
+        bytes_out = data->value.ui64;
+      }
+    }
+
+    if ((bytes_in != UINT64_MAX) && (bytes_out != UINT64_MAX)) {
+      NetworkInterface* cur = new NetworkInterface(k->ks_name, bytes_in, bytes_out, ret);
+      ret = cur;
+    }
+  }
+
+  *network_interfaces = ret;
+
+  return OS_OK;
+}
+
+NetworkPerformanceInterface::NetworkPerformanceInterface() {
+  _impl = NULL;
+}
+
+NetworkPerformanceInterface::~NetworkPerformanceInterface() {
+  if (_impl != NULL) {
+    delete _impl;
+  }
+}
+
+bool NetworkPerformanceInterface::initialize() {
+  _impl = new NetworkPerformanceInterface::NetworkPerformance();
+  return _impl != NULL && _impl->initialize();
+}
+
+int NetworkPerformanceInterface::network_utilization(NetworkInterface** network_interfaces) const {
+  return _impl->network_utilization(network_interfaces);
+}
--- a/src/hotspot/os/solaris/os_solaris.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/os/solaris/os_solaris.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -2010,23 +2010,6 @@
   // no suffix required
 }
 
-// This method is a copy of JDK's sysGetLastErrorString
-// from src/solaris/hpi/src/system_md.c
-
-size_t os::lasterror(char *buf, size_t len) {
-  if (errno == 0)  return 0;
-
-  const char *s = os::strerror(errno);
-  size_t n = ::strlen(s);
-  if (n >= len) {
-    n = len - 1;
-  }
-  ::strncpy(buf, s, n);
-  buf[n] = '\0';
-  return n;
-}
-
-
 // sun.misc.Signal
 
 extern "C" {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/os/windows/iphlp_interface.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "iphlp_interface.hpp"
+#include "runtime/os.hpp"
+
+// IPHLP API
+typedef DWORD(WINAPI *GetIfTable2_Fn)(PMIB_IF_TABLE2*);
+typedef DWORD(WINAPI *FreeMibTable_Fn)(PVOID);
+
+// IPHLP statics
+GetIfTable2_Fn IphlpDll::_GetIfTable2 = NULL;
+FreeMibTable_Fn IphlpDll::_FreeMibTable = NULL;
+
+LONG IphlpDll::_critical_section = 0;
+LONG IphlpDll::_initialized = 0;
+LONG IphlpDll::_iphlp_reference_count = 0;
+HMODULE IphlpDll::_hModule = NULL;
+
+void IphlpDll::initialize(void) {
+  _hModule = os::win32::load_Windows_dll("iphlpapi.dll", NULL, 0);
+
+  if (NULL == _hModule) {
+    return;
+  }
+
+  // The 'A' at the end means the ANSI (not the UNICODE) vesions of the methods
+  _GetIfTable2 = (GetIfTable2_Fn)::GetProcAddress(_hModule, "GetIfTable2");
+  _FreeMibTable = (FreeMibTable_Fn)::GetProcAddress(_hModule, "FreeMibTable");
+
+  // interlock is used for fencing
+  InterlockedExchange(&_initialized, 1);
+}
+
+bool IphlpDll::IphlpDetach(void) {
+  LONG prev_ref_count = InterlockedExchangeAdd(&_iphlp_reference_count, -1);
+  BOOL ret = false;
+
+  if (1 == prev_ref_count) {
+    if (_initialized && _hModule != NULL) {
+      ret = FreeLibrary(_hModule);
+      if (ret) {
+        _hModule = NULL;
+        _GetIfTable2 = NULL;
+        _FreeMibTable = NULL;
+        InterlockedExchange(&_initialized, 0);
+      }
+    }
+  }
+  return ret != 0;
+}
+
+bool IphlpDll::IphlpAttach(void) {
+  InterlockedExchangeAdd(&_iphlp_reference_count, 1);
+
+  if (1 == _initialized) {
+    return true;
+  }
+
+  while (InterlockedCompareExchange(&_critical_section, 1, 0) == 1);
+
+  if (0 == _initialized) {
+    initialize();
+  }
+
+  while (InterlockedCompareExchange(&_critical_section, 0, 1) == 0);
+
+  return (_GetIfTable2 != NULL && _FreeMibTable != NULL);
+}
+
+DWORD IphlpDll::GetIfTable2(PMIB_IF_TABLE2* Table) {
+  assert(_initialized && _GetIfTable2 != NULL,
+         "IphlpAttach() not yet called");
+
+  return _GetIfTable2(Table);
+}
+
+DWORD IphlpDll::FreeMibTable(PVOID Memory) {
+  assert(_initialized && _FreeMibTable != NULL,
+         "IphlpAttach() not yet called");
+
+  return _FreeMibTable(Memory);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/os/windows/iphlp_interface.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef OS_WINDOWS_VM_IPHLP_INTERFACE_HPP
+#define OS_WINDOWS_VM_IPHLP_INTERFACE_HPP
+
+#include "memory/allocation.hpp"
+#include "utilities/macros.hpp"
+#include <WinSock2.h>
+#include <ws2ipdef.h>
+#include <iphlpapi.h>
+
+class IphlpDll : public AllStatic {
+ private:
+  static LONG       _iphlp_reference_count;
+  static LONG       _critical_section;
+  static LONG       _initialized;
+  static HMODULE    _hModule;
+  static void       initialize(void);
+  static DWORD(WINAPI *_GetIfTable2)(PMIB_IF_TABLE2*);
+  static DWORD(WINAPI *_FreeMibTable)(PVOID);
+
+ public:
+  static DWORD GetIfTable2(PMIB_IF_TABLE2*);
+  static DWORD FreeMibTable(PVOID);
+  static bool       IphlpAttach(void);
+  static bool       IphlpDetach(void);
+};
+
+#endif // OS_WINDOWS_VM_IPHLP_INTERFACE_HPP
--- a/src/hotspot/os/windows/os_perf_windows.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/os/windows/os_perf_windows.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -23,14 +23,15 @@
  */
 
 #include "precompiled.hpp"
+#include "iphlp_interface.hpp"
 #include "logging/log.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/resourceArea.hpp"
 #include "pdh_interface.hpp"
 #include "runtime/os_perf.hpp"
 #include "runtime/os.hpp"
+#include "utilities/macros.hpp"
 #include "vm_version_ext_x86.hpp"
-#include "utilities/macros.hpp"
 #include <math.h>
 #include <psapi.h>
 #include <TlHelp32.h>
@@ -1380,3 +1381,78 @@
   cpu_info = *_cpu_info; // shallow copy assignment
   return OS_OK;
 }
+
+class NetworkPerformanceInterface::NetworkPerformance : public CHeapObj<mtInternal> {
+  friend class NetworkPerformanceInterface;
+ private:
+  bool _iphlp_attached;
+
+  NetworkPerformance();
+  NetworkPerformance(const NetworkPerformance& rhs); // no impl
+  NetworkPerformance& operator=(const NetworkPerformance& rhs); // no impl
+  bool initialize();
+  ~NetworkPerformance();
+  int network_utilization(NetworkInterface** network_interfaces) const;
+};
+
+NetworkPerformanceInterface::NetworkPerformance::NetworkPerformance()
+: _iphlp_attached(false) {
+}
+
+bool NetworkPerformanceInterface::NetworkPerformance::initialize() {
+  _iphlp_attached = IphlpDll::IphlpAttach();
+  return _iphlp_attached;
+}
+
+NetworkPerformanceInterface::NetworkPerformance::~NetworkPerformance() {
+  if (_iphlp_attached) {
+    IphlpDll::IphlpDetach();
+  }
+}
+
+int NetworkPerformanceInterface::NetworkPerformance::network_utilization(NetworkInterface** network_interfaces) const {
+  MIB_IF_TABLE2* table;
+
+  if (IphlpDll::GetIfTable2(&table) != NO_ERROR) {
+    return OS_ERR;
+  }
+
+  NetworkInterface* ret = NULL;
+  for (ULONG i = 0; i < table->NumEntries; ++i) {
+    if (table->Table[i].InterfaceAndOperStatusFlags.FilterInterface) {
+      continue;
+    }
+
+    char buf[256];
+    if (WideCharToMultiByte(CP_UTF8, 0, table->Table[i].Description, -1, buf, sizeof(buf), NULL, NULL) == 0) {
+      continue;
+    }
+
+    NetworkInterface* cur = new NetworkInterface(buf, table->Table[i].InOctets, table->Table[i].OutOctets, ret);
+    ret = cur;
+  }
+
+  IphlpDll::FreeMibTable(table);
+  *network_interfaces = ret;
+
+  return OS_OK;
+}
+
+NetworkPerformanceInterface::NetworkPerformanceInterface() {
+  _impl = NULL;
+}
+
+NetworkPerformanceInterface::~NetworkPerformanceInterface() {
+  if (_impl != NULL) {
+    delete _impl;
+  }
+}
+
+bool NetworkPerformanceInterface::initialize() {
+  _impl = new NetworkPerformanceInterface::NetworkPerformance();
+  return _impl != NULL && _impl->initialize();
+}
+
+int NetworkPerformanceInterface::network_utilization(NetworkInterface** network_interfaces) const {
+  return _impl->network_utilization(network_interfaces);
+}
--- a/src/hotspot/os_cpu/linux_x86/gc/z/zBackingFile_linux_x86.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/os_cpu/linux_x86/gc/z/zBackingFile_linux_x86.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -170,7 +170,7 @@
   const int fd_anon = open(path.get(), O_TMPFILE|O_EXCL|O_RDWR|O_CLOEXEC, S_IRUSR|S_IWUSR);
   if (fd_anon == -1) {
     ZErrno err;
-    log_debug(gc, init)("Failed to create anonymouns file in %s (%s)", path.get(),
+    log_debug(gc, init)("Failed to create anonymous file in %s (%s)", path.get(),
                         (err == EINVAL ? "Not supported" : err.to_string()));
   } else {
     // Get inode number for anonymous file
@@ -224,7 +224,7 @@
       return fd;
     }
 
-    log_debug(gc, init)("Falling back to searching for an accessible moint point");
+    log_debug(gc, init)("Falling back to searching for an accessible mount point");
   }
 
   return create_file_fd(name);
--- a/src/hotspot/os_cpu/linux_x86/gc/z/zNUMA_linux_x86.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/os_cpu/linux_x86/gc/z/zNUMA_linux_x86.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -31,11 +31,11 @@
 #include <sys/syscall.h>
 
 #ifndef MPOL_F_NODE
-#define MPOL_F_NODE     (1<<0)  /* return next IL mode instead of node mask */
+#define MPOL_F_NODE     (1<<0)  // Return next IL mode instead of node mask
 #endif
 
 #ifndef MPOL_F_ADDR
-#define MPOL_F_ADDR     (1<<1)  /* look up vma using address */
+#define MPOL_F_ADDR     (1<<1)  // Look up VMA using address
 #endif
 
 static int z_get_mempolicy(uint32_t* mode, const unsigned long *nmask, unsigned long maxnode, uintptr_t addr, int flags) {
--- a/src/hotspot/share/aot/aotCodeHeap.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/aot/aotCodeHeap.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -520,6 +520,7 @@
 
     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_counterMode_AESCrypt", address, StubRoutines::_counterMode_AESCrypt);
     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_ghash_processBlocks", address, StubRoutines::_ghash_processBlocks);
+    SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_base64_encodeBlock", address, StubRoutines::_base64_encodeBlock);
     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_crc32c_table_addr", address, StubRoutines::_crc32c_table_addr);
     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_updateBytesCRC32C", address, StubRoutines::_updateBytesCRC32C);
     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_updateBytesAdler32", address, StubRoutines::_updateBytesAdler32);
--- a/src/hotspot/share/classfile/classFileParser.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/classfile/classFileParser.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -117,6 +117,8 @@
 
 #define JAVA_11_VERSION                   55
 
+#define JAVA_12_VERSION                   56
+
 void ClassFileParser::set_class_bad_constant_seen(short bad_constant) {
   assert((bad_constant == 19 || bad_constant == 20) && _major_version >= JAVA_9_VERSION,
          "Unexpected bad constant pool entry");
--- a/src/hotspot/share/classfile/classLoaderHierarchyDCmd.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/classfile/classLoaderHierarchyDCmd.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -36,11 +36,13 @@
 
 
 ClassLoaderHierarchyDCmd::ClassLoaderHierarchyDCmd(outputStream* output, bool heap)
-  : DCmdWithParser(output, heap)
-  , _show_classes("show-classes", "Print loaded classes.", "BOOLEAN", false, "false")
-  , _verbose("verbose", "Print detailed information.", "BOOLEAN", false, "false") {
+  : DCmdWithParser(output, heap),
+   _show_classes("show-classes", "Print loaded classes.", "BOOLEAN", false, "false"),
+  _verbose("verbose", "Print detailed information.", "BOOLEAN", false, "false"),
+  _fold("fold", "Show loaders of the same name and class as one.", "BOOLEAN", true, "true") {
   _dcmdparser.add_dcmd_option(&_show_classes);
   _dcmdparser.add_dcmd_option(&_verbose);
+  _dcmdparser.add_dcmd_option(&_fold);
 }
 
 
@@ -127,10 +129,12 @@
 class LoaderTreeNode : public ResourceObj {
 
   // We walk the CLDG and, for each CLD which is non-anonymous, add
-  // a tree node. To add a node we need its parent node; if it itself
-  // does not exist yet, we add a preliminary node for it. This preliminary
-  // node just contains its loader oop; later, when encountering its CLD in
-  // our CLDG walk, we complete the missing information in this node.
+  // a tree node.
+  // To add a node we need its parent node; if the parent node does not yet
+  // exist - because we have not yet encountered the CLD for the parent loader -
+  // we add a preliminary empty LoaderTreeNode for it. This preliminary node
+  // just contains the loader oop and nothing else. Once we encounter the CLD of
+  // this parent loader, we fill in all the other details.
 
   const oop _loader_oop;
   const ClassLoaderData* _cld;
@@ -144,6 +148,12 @@
   LoadedClassInfo* _anon_classes;
   int _num_anon_classes;
 
+  // In default view, similar tree nodes (same loader class, same name or no name)
+  // are folded into each other to make the output more readable.
+  // _num_folded contains the number of nodes which have been folded into this
+  // one.
+  int _num_folded;
+
   void print_with_childs(outputStream* st, BranchTracker& branchtracker,
       bool print_classes, bool verbose) const {
 
@@ -170,7 +180,9 @@
         st->print(" \"%s\",", loader_name->as_C_string());
       }
       st->print(" %s", loader_klass != NULL ? loader_klass->external_name() : "??");
-      st->print(" {" PTR_FORMAT "}", p2i(_loader_oop));
+      if (_num_folded > 0) {
+        st->print(" (+ %d more)", _num_folded);
+      }
     }
     st->cr();
 
@@ -193,6 +205,8 @@
 
       if (verbose) {
         branchtracker.print(st);
+        st->print_cr("%*s " PTR_FORMAT, indentation, "Loader Oop:", p2i(_loader_oop));
+        branchtracker.print(st);
         st->print_cr("%*s " PTR_FORMAT, indentation, "Loader Data:", p2i(_cld));
         branchtracker.print(st);
         st->print_cr("%*s " PTR_FORMAT, indentation, "Loader Klass:", p2i(loader_klass));
@@ -246,7 +260,7 @@
             // For anonymous classes, also print CLD if verbose. Should be a different one than the primary CLD.
             assert(lci->_cld != _cld, "must be");
             if (verbose) {
-              st->print("  (CLD: " PTR_FORMAT ")", p2i(lci->_cld));
+              st->print("  (Loader Data: " PTR_FORMAT ")", p2i(lci->_cld));
             }
             st->cr();
           }
@@ -272,13 +286,22 @@
 
   }
 
+  // Helper: Attempt to fold this node into the target node. If success, returns true.
+  // Folding can be done if both nodes are leaf nodes and they refer to the same loader class
+  // and they have the same name or no name (note: leaf check is done by caller).
+  bool can_fold_into(LoaderTreeNode* target_node) const {
+    assert(is_leaf() && target_node->is_leaf(), "must be leaf");
+    return _cld->class_loader_klass() == target_node->_cld->class_loader_klass() &&
+           _cld->name() == target_node->_cld->name();
+  }
+
 public:
 
   LoaderTreeNode(const oop loader_oop)
-    : _loader_oop(loader_oop), _cld(NULL)
-    , _child(NULL), _next(NULL)
-    , _classes(NULL), _anon_classes(NULL)
-    , _num_classes(0), _num_anon_classes(0) {}
+    : _loader_oop(loader_oop), _cld(NULL), _child(NULL), _next(NULL),
+      _classes(NULL), _anon_classes(NULL), _num_classes(0), _num_anon_classes(0),
+      _num_folded(0)
+    {}
 
   void set_cld(const ClassLoaderData* cld) {
     _cld = cld;
@@ -331,6 +354,39 @@
     return result;
   }
 
+  bool is_leaf() const { return _child == NULL; }
+
+  // Attempt to fold similar nodes among this node's children. We only fold leaf nodes
+  // (no child class loaders).
+  // For non-leaf nodes (class loaders with child class loaders), do this recursivly.
+  void fold_children() {
+    LoaderTreeNode* node = _child;
+    LoaderTreeNode* prev = NULL;
+    while (node != NULL) {
+      LoaderTreeNode* matching_node = NULL;
+      if (node->is_leaf()) {
+        // Look among the preceeding node siblings for a match.
+        for (LoaderTreeNode* node2 = _child; node2 != node && matching_node == NULL;
+            node2 = node2->_next) {
+          if (node2->is_leaf() && node->can_fold_into(node2)) {
+            matching_node = node2;
+          }
+        }
+      } else {
+        node->fold_children();
+      }
+      if (matching_node != NULL) {
+        // Increase fold count for the matching node and remove folded node from the child list.
+        matching_node->_num_folded ++;
+        assert(prev != NULL, "Sanity"); // can never happen since we do not fold the first node.
+        prev->_next = node->_next;
+      } else {
+        prev = node;
+      }
+      node = node->_next;
+    }
+  }
+
   void print_with_childs(outputStream* st, bool print_classes, bool print_add_info) const {
     BranchTracker bwt;
     print_with_childs(st, bwt, print_classes, print_add_info);
@@ -433,6 +489,10 @@
     fill_in_classes(info, cld);
   }
 
+  void fold() {
+    _root->fold_children();
+  }
+
 };
 
 
@@ -440,9 +500,10 @@
   outputStream* const _out;
   const bool _show_classes;
   const bool _verbose;
+  const bool _fold;
 public:
-  ClassLoaderHierarchyVMOperation(outputStream* out, bool show_classes, bool verbose) :
-    _out(out), _show_classes(show_classes), _verbose(verbose)
+  ClassLoaderHierarchyVMOperation(outputStream* out, bool show_classes, bool verbose, bool fold) :
+    _out(out), _show_classes(show_classes), _verbose(verbose), _fold(fold)
   {}
 
   VMOp_Type type() const {
@@ -454,12 +515,18 @@
     ResourceMark rm;
     LoaderInfoScanClosure cl (_show_classes, _verbose);
     ClassLoaderDataGraph::cld_do(&cl);
+    // In non-verbose and non-show-classes mode, attempt to fold the tree.
+    if (_fold) {
+      if (!_verbose && !_show_classes) {
+        cl.fold();
+      }
+    }
     cl.print_results(_out);
   }
 };
 
 // This command needs to be executed at a safepoint.
 void ClassLoaderHierarchyDCmd::execute(DCmdSource source, TRAPS) {
-  ClassLoaderHierarchyVMOperation op(output(), _show_classes.value(), _verbose.value());
+  ClassLoaderHierarchyVMOperation op(output(), _show_classes.value(), _verbose.value(), _fold.value());
   VMThread::execute(&op);
 }
--- a/src/hotspot/share/classfile/classLoaderHierarchyDCmd.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/classfile/classLoaderHierarchyDCmd.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -31,6 +31,7 @@
 class ClassLoaderHierarchyDCmd: public DCmdWithParser {
   DCmdArgument<bool> _show_classes;
   DCmdArgument<bool> _verbose;
+  DCmdArgument<bool> _fold;
 public:
 
   ClassLoaderHierarchyDCmd(outputStream* output, bool heap);
--- a/src/hotspot/share/classfile/javaClasses.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/classfile/javaClasses.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -1265,10 +1265,10 @@
   return size;
 }
 
-void java_lang_Class::set_oop_size(oop java_class, int size) {
+void java_lang_Class::set_oop_size(HeapWord* java_class, int size) {
   assert(_oop_size_offset != 0, "must be set");
   assert(size > 0, "Oop size must be greater than zero, not %d", size);
-  java_class->int_field_put(_oop_size_offset, size);
+  *(int*)(((char*)java_class) + _oop_size_offset) = size;
 }
 
 int  java_lang_Class::static_oop_field_count(oop java_class) {
--- a/src/hotspot/share/classfile/javaClasses.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/classfile/javaClasses.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -296,7 +296,7 @@
   static oop module(oop java_class);
 
   static int oop_size(oop java_class);
-  static void set_oop_size(oop java_class, int size);
+  static void set_oop_size(HeapWord* java_class, int size);
   static int static_oop_field_count(oop java_class);
   static void set_static_oop_field_count(oop java_class, int size);
 
--- a/src/hotspot/share/classfile/vmSymbols.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/classfile/vmSymbols.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -735,6 +735,9 @@
   case vmIntrinsics::_ghash_processBlocks:
     if (!UseGHASHIntrinsics) return true;
     break;
+  case vmIntrinsics::_base64_encodeBlock:
+    if (!UseBASE64Intrinsics) return true;
+    break;
   case vmIntrinsics::_updateBytesCRC32C:
   case vmIntrinsics::_updateDirectByteBufferCRC32C:
     if (!UseCRC32CIntrinsics) return true;
--- a/src/hotspot/share/classfile/vmSymbols.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/classfile/vmSymbols.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -1034,6 +1034,12 @@
    do_name(     implCompressMB_name,                               "implCompressMultiBlock0")                           \
    do_signature(implCompressMB_signature,                          "([BII)I")                                           \
                                                                                                                         \
+   /* support for java.util.Base64.Encoder*/                                                                            \
+  do_class(java_util_Base64_Encoder, "java/util/Base64$Encoder")                                                        \
+  do_intrinsic(_base64_encodeBlock, java_util_Base64_Encoder, encodeBlock_name, encodeBlock_signature, F_R)             \
+  do_name(encodeBlock_name, "encodeBlock")                                                                              \
+  do_signature(encodeBlock_signature, "([BII[BIZ)V")                                                                    \
+                                                                                                                        \
   /* support for com.sun.crypto.provider.GHASH */                                                                       \
   do_class(com_sun_crypto_provider_ghash, "com/sun/crypto/provider/GHASH")                                              \
   do_intrinsic(_ghash_processBlocks, com_sun_crypto_provider_ghash, processBlocks_name, ghash_processBlocks_signature, F_S) \
--- a/src/hotspot/share/code/nmethod.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/code/nmethod.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -1691,7 +1691,6 @@
       ls.print("" PTR_FORMAT "[offset=%d] detected scavengable oop " PTR_FORMAT " (found at " PTR_FORMAT ") ",
                p2i(_print_nm), (int)((intptr_t)p - (intptr_t)_print_nm),
                p2i(*p), p2i(p));
-      (*p)->print_value_on(&ls);
       ls.cr();
     }
   }
--- a/src/hotspot/share/compiler/compileBroker.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/compiler/compileBroker.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -1638,12 +1638,6 @@
  * out to be a problem.
  */
 void CompileBroker::shutdown_compiler_runtime(AbstractCompiler* comp, CompilerThread* thread) {
-  // Free buffer blob, if allocated
-  if (thread->get_buffer_blob() != NULL) {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
-    CodeCache::free(thread->get_buffer_blob());
-  }
-
   if (comp->should_perform_shutdown()) {
     // There are two reasons for shutting down the compiler
     // 1) compiler runtime initialization failed
--- a/src/hotspot/share/gc/shared/collectedHeap.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/shared/collectedHeap.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -33,6 +33,7 @@
 #include "gc/shared/gcTrace.hpp"
 #include "gc/shared/gcTraceTime.inline.hpp"
 #include "gc/shared/gcWhen.hpp"
+#include "gc/shared/memAllocator.hpp"
 #include "gc/shared/vmGCOperations.hpp"
 #include "logging/log.hpp"
 #include "memory/metaspace.hpp"
@@ -46,6 +47,7 @@
 #include "runtime/vmThread.hpp"
 #include "services/heapDumper.hpp"
 #include "utilities/align.hpp"
+#include "utilities/copy.hpp"
 
 class ClassLoaderData;
 
@@ -327,15 +329,6 @@
 }
 
 #ifndef PRODUCT
-void CollectedHeap::check_for_bad_heap_word_value(HeapWord* addr, size_t size) {
-  if (CheckMemoryInitialization && ZapUnusedHeapArea) {
-    for (size_t slot = 0; slot < size; slot += 1) {
-      assert((*(intptr_t*) (addr + slot)) != ((intptr_t) badHeapWordVal),
-             "Found badHeapWordValue in post-allocation check");
-    }
-  }
-}
-
 void CollectedHeap::check_for_non_bad_heap_word_value(HeapWord* addr, size_t size) {
   if (CheckMemoryInitialization && ZapUnusedHeapArea) {
     for (size_t slot = 0; slot < size; slot += 1) {
@@ -346,118 +339,6 @@
 }
 #endif // PRODUCT
 
-#ifdef ASSERT
-void CollectedHeap::check_for_valid_allocation_state() {
-  Thread *thread = Thread::current();
-  // How to choose between a pending exception and a potential
-  // OutOfMemoryError?  Don't allow pending exceptions.
-  // This is a VM policy failure, so how do we exhaustively test it?
-  assert(!thread->has_pending_exception(),
-         "shouldn't be allocating with pending exception");
-  if (StrictSafepointChecks) {
-    assert(thread->allow_allocation(),
-           "Allocation done by thread for which allocation is blocked "
-           "by No_Allocation_Verifier!");
-    // Allocation of an oop can always invoke a safepoint,
-    // hence, the true argument
-    thread->check_for_valid_safepoint_state(true);
-  }
-}
-#endif
-
-HeapWord* CollectedHeap::obj_allocate_raw(Klass* klass, size_t size,
-                                          bool* gc_overhead_limit_was_exceeded, TRAPS) {
-  if (UseTLAB) {
-    HeapWord* result = allocate_from_tlab(klass, size, THREAD);
-    if (result != NULL) {
-      return result;
-    }
-  }
-
-  return allocate_outside_tlab(klass, size, gc_overhead_limit_was_exceeded, THREAD);
-}
-
-HeapWord* CollectedHeap::allocate_from_tlab_slow(Klass* klass, size_t size, TRAPS) {
-  HeapWord* obj = NULL;
-
-  // In assertion mode, check that there was a sampling collector present
-  // in the stack. This enforces checking that no path is without a sampling
-  // collector.
-  // Only check if the sampler could actually sample something in this call path.
-  assert(!JvmtiExport::should_post_sampled_object_alloc()
-         || !JvmtiSampledObjectAllocEventCollector::object_alloc_is_safe_to_sample()
-         || THREAD->heap_sampler().sampling_collector_present(),
-         "Sampling collector not present.");
-
-  if (ThreadHeapSampler::enabled()) {
-    // Try to allocate the sampled object from TLAB, it is possible a sample
-    // point was put and the TLAB still has space.
-    obj = THREAD->tlab().allocate_sampled_object(size);
-
-    if (obj != NULL) {
-      return obj;
-    }
-  }
-
-  ThreadLocalAllocBuffer& tlab = THREAD->tlab();
-
-  // Retain tlab and allocate object in shared space if
-  // the amount free in the tlab is too large to discard.
-  if (tlab.free() > tlab.refill_waste_limit()) {
-    tlab.record_slow_allocation(size);
-    return NULL;
-  }
-
-  // Discard tlab and allocate a new one.
-  // To minimize fragmentation, the last TLAB may be smaller than the rest.
-  size_t new_tlab_size = tlab.compute_size(size);
-
-  tlab.clear_before_allocation();
-
-  if (new_tlab_size == 0) {
-    return NULL;
-  }
-
-  // Allocate a new TLAB requesting new_tlab_size. Any size
-  // between minimal and new_tlab_size is accepted.
-  size_t actual_tlab_size = 0;
-  size_t min_tlab_size = ThreadLocalAllocBuffer::compute_min_size(size);
-  obj = Universe::heap()->allocate_new_tlab(min_tlab_size, new_tlab_size, &actual_tlab_size);
-  if (obj == NULL) {
-    assert(actual_tlab_size == 0, "Allocation failed, but actual size was updated. min: " SIZE_FORMAT ", desired: " SIZE_FORMAT ", actual: " SIZE_FORMAT,
-           min_tlab_size, new_tlab_size, actual_tlab_size);
-    return NULL;
-  }
-  assert(actual_tlab_size != 0, "Allocation succeeded but actual size not updated. obj at: " PTR_FORMAT " min: " SIZE_FORMAT ", desired: " SIZE_FORMAT,
-         p2i(obj), min_tlab_size, new_tlab_size);
-
-  AllocTracer::send_allocation_in_new_tlab(klass, obj, actual_tlab_size * HeapWordSize, size * HeapWordSize, THREAD);
-
-  if (ZeroTLAB) {
-    // ..and clear it.
-    Copy::zero_to_words(obj, actual_tlab_size);
-  } else {
-    // ...and zap just allocated object.
-#ifdef ASSERT
-    // Skip mangling the space corresponding to the object header to
-    // ensure that the returned space is not considered parsable by
-    // any concurrent GC thread.
-    size_t hdr_size = oopDesc::header_size();
-    Copy::fill_to_words(obj + hdr_size, actual_tlab_size - hdr_size, badHeapWordVal);
-#endif // ASSERT
-  }
-
-  // Send the thread information about this allocation in case a sample is
-  // requested.
-  if (ThreadHeapSampler::enabled()) {
-    size_t tlab_bytes_since_last_sample = THREAD->tlab().bytes_since_last_sample_point();
-    THREAD->heap_sampler().check_for_sampling(obj, size, tlab_bytes_since_last_sample);
-  }
-
-  tlab.fill(obj, obj + size, actual_tlab_size);
-  return obj;
-}
-
 size_t CollectedHeap::max_tlab_size() const {
   // TLABs can't be bigger than we can fill with a int[Integer.MAX_VALUE].
   // This restriction could be removed by enabling filling with multiple arrays.
@@ -509,9 +390,8 @@
   const size_t len = payload_size * HeapWordSize / sizeof(jint);
   assert((int)len >= 0, "size too large " SIZE_FORMAT " becomes %d", words, (int)len);
 
-  // Set the length first for concurrent GC.
-  ((arrayOop)start)->set_length((int)len);
-  post_allocation_setup_common(Universe::intArrayKlassObj(), start);
+  ObjArrayAllocator allocator(Universe::intArrayKlassObj(), words, (int)len, /* do_zero */ false);
+  allocator.initialize(start);
   DEBUG_ONLY(zap_filler_array(start, words, zap);)
 }
 
@@ -524,7 +404,8 @@
     fill_with_array(start, words, zap);
   } else if (words > 0) {
     assert(words == min_fill_size(), "unaligned size");
-    post_allocation_setup_common(SystemDictionary::Object_klass(), start);
+    ObjAllocator allocator(SystemDictionary::Object_klass(), words);
+    allocator.initialize(start);
   }
 }
 
@@ -566,6 +447,21 @@
   return NULL;
 }
 
+oop CollectedHeap::obj_allocate(Klass* klass, int size, TRAPS) {
+  ObjAllocator allocator(klass, size, THREAD);
+  return allocator.allocate();
+}
+
+oop CollectedHeap::array_allocate(Klass* klass, int size, int length, bool do_zero, TRAPS) {
+  ObjArrayAllocator allocator(klass, size, length, do_zero, THREAD);
+  return allocator.allocate();
+}
+
+oop CollectedHeap::class_allocate(Klass* klass, int size, TRAPS) {
+  ClassAllocator allocator(klass, size, THREAD);
+  return allocator.allocate();
+}
+
 void CollectedHeap::ensure_parsability(bool retire_tlabs) {
   // The second disjunct in the assertion below makes a concession
   // for the start-up verification done while the VM is being
--- a/src/hotspot/share/gc/shared/collectedHeap.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/shared/collectedHeap.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -95,6 +95,7 @@
   friend class VMStructs;
   friend class JVMCIVMStructs;
   friend class IsGCActiveMark; // Block structured external access to _is_gc_active
+  friend class MemAllocator;
 
  private:
 #ifdef ASSERT
@@ -141,13 +142,6 @@
   // Reinitialize tlabs before resuming mutators.
   virtual void resize_all_tlabs();
 
-  // Allocate from the current thread's TLAB, with broken-out slow path.
-  inline static HeapWord* allocate_from_tlab(Klass* klass, size_t size, TRAPS);
-  static HeapWord* allocate_from_tlab_slow(Klass* klass, size_t size, TRAPS);
-
-  inline static HeapWord* allocate_outside_tlab(Klass* klass, size_t size,
-                                                bool* gc_overhead_limit_was_exceeded, TRAPS);
-
   // Raw memory allocation facilities
   // The obj and array allocate methods are covers for these methods.
   // mem_allocate() should never be
@@ -155,29 +149,6 @@
   virtual HeapWord* mem_allocate(size_t size,
                                  bool* gc_overhead_limit_was_exceeded) = 0;
 
-  // Allocate an uninitialized block of the given size, or returns NULL if
-  // this is impossible.
-  inline static HeapWord* common_mem_allocate_noinit(Klass* klass, size_t size, TRAPS);
-
-  // Like allocate_init, but the block returned by a successful allocation
-  // is guaranteed initialized to zeros.
-  inline static HeapWord* common_mem_allocate_init(Klass* klass, size_t size, TRAPS);
-
-  // Helper functions for (VM) allocation.
-  inline static void post_allocation_setup_common(Klass* klass, HeapWord* obj);
-  inline static void post_allocation_setup_no_klass_install(Klass* klass,
-                                                            HeapWord* objPtr);
-
-  inline static void post_allocation_setup_obj(Klass* klass, HeapWord* obj, int size);
-
-  inline static void post_allocation_setup_array(Klass* klass,
-                                                 HeapWord* obj, int length);
-
-  inline static void post_allocation_setup_class(Klass* klass, HeapWord* obj, int size);
-
-  // Clears an allocated object.
-  inline static void init_obj(HeapWord* obj, size_t size);
-
   // Filler object utilities.
   static inline size_t filler_array_hdr_size();
   static inline size_t filler_array_min_size();
@@ -194,21 +165,7 @@
 
   virtual void trace_heap(GCWhen::Type when, const GCTracer* tracer);
 
-  // Internal allocation methods.
-  inline static HeapWord* common_allocate_memory(Klass* klass, int size,
-                                                 void (*post_setup)(Klass*, HeapWord*, int),
-                                                 int size_for_post, bool init_memory,
-                                                 TRAPS);
-
-  // Internal allocation method for common obj/class/array allocations.
-  inline static HeapWord* allocate_memory(Klass* klass, int size,
-                                          void (*post_setup)(Klass*, HeapWord*, int),
-                                          int size_for_post, bool init_memory,
-                                          TRAPS);
-
   // Verification functions
-  virtual void check_for_bad_heap_word_value(HeapWord* addr, size_t size)
-    PRODUCT_RETURN;
   virtual void check_for_non_bad_heap_word_value(HeapWord* addr, size_t size)
     PRODUCT_RETURN;
   debug_only(static void check_for_valid_allocation_state();)
@@ -328,18 +285,9 @@
   }
   GCCause::Cause gc_cause() { return _gc_cause; }
 
-  // General obj/array allocation facilities.
-  inline static oop obj_allocate(Klass* klass, int size, TRAPS);
-  inline static oop array_allocate(Klass* klass, int size, int length, TRAPS);
-  inline static oop array_allocate_nozero(Klass* klass, int size, int length, TRAPS);
-  inline static oop class_allocate(Klass* klass, int size, TRAPS);
-
-  // Raw memory allocation. This may or may not use TLAB allocations to satisfy the
-  // allocation. A GC implementation may override this function to satisfy the allocation
-  // in any way. But the default is to try a TLAB allocation, and otherwise perform
-  // mem_allocate.
-  virtual HeapWord* obj_allocate_raw(Klass* klass, size_t size,
-                                     bool* gc_overhead_limit_was_exceeded, TRAPS);
+  virtual oop obj_allocate(Klass* klass, int size, TRAPS);
+  virtual oop array_allocate(Klass* klass, int size, int length, bool do_zero, TRAPS);
+  virtual oop class_allocate(Klass* klass, int size, TRAPS);
 
   // Utilities for turning raw memory into filler objects.
   //
--- a/src/hotspot/share/gc/shared/collectedHeap.inline.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/shared/collectedHeap.inline.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -25,297 +25,9 @@
 #ifndef SHARE_VM_GC_SHARED_COLLECTEDHEAP_INLINE_HPP
 #define SHARE_VM_GC_SHARED_COLLECTEDHEAP_INLINE_HPP
 
-#include "classfile/javaClasses.hpp"
-#include "gc/shared/allocTracer.hpp"
 #include "gc/shared/collectedHeap.hpp"
-#include "gc/shared/threadLocalAllocBuffer.inline.hpp"
-#include "memory/universe.hpp"
-#include "oops/arrayOop.hpp"
 #include "oops/oop.inline.hpp"
-#include "prims/jvmtiExport.hpp"
-#include "runtime/sharedRuntime.hpp"
-#include "runtime/handles.inline.hpp"
-#include "runtime/thread.inline.hpp"
-#include "services/lowMemoryDetector.hpp"
 #include "utilities/align.hpp"
-#include "utilities/copy.hpp"
-
-// Inline allocation implementations.
-
-void CollectedHeap::post_allocation_setup_common(Klass* klass,
-                                                 HeapWord* obj_ptr) {
-  post_allocation_setup_no_klass_install(klass, obj_ptr);
-  oop obj = (oop)obj_ptr;
-#if (INCLUDE_G1GC || INCLUDE_CMSGC)
-  // Need a release store to ensure array/class length, mark word, and
-  // object zeroing are visible before setting the klass non-NULL, for
-  // concurrent collectors.
-  obj->release_set_klass(klass);
-#else
-  obj->set_klass(klass);
-#endif
-}
-
-void CollectedHeap::post_allocation_setup_no_klass_install(Klass* klass,
-                                                           HeapWord* obj_ptr) {
-  oop obj = (oop)obj_ptr;
-
-  assert(obj != NULL, "NULL object pointer");
-  if (UseBiasedLocking && (klass != NULL)) {
-    obj->set_mark_raw(klass->prototype_header());
-  } else {
-    // May be bootstrapping
-    obj->set_mark_raw(markOopDesc::prototype());
-  }
-}
-
-// Support for jvmti and dtrace
-inline void post_allocation_notify(Klass* klass, oop obj, int size) {
-  // support low memory notifications (no-op if not enabled)
-  LowMemoryDetector::detect_low_memory_for_collected_pools();
-
-  // support for JVMTI VMObjectAlloc event (no-op if not enabled)
-  JvmtiExport::vm_object_alloc_event_collector(obj);
-
-  if (DTraceAllocProbes) {
-    // support for Dtrace object alloc event (no-op most of the time)
-    if (klass != NULL && klass->name() != NULL) {
-      SharedRuntime::dtrace_object_alloc(obj, size);
-    }
-  }
-}
-
-void CollectedHeap::post_allocation_setup_obj(Klass* klass,
-                                              HeapWord* obj_ptr,
-                                              int size) {
-  post_allocation_setup_common(klass, obj_ptr);
-  oop obj = (oop)obj_ptr;
-  assert(Universe::is_bootstrapping() ||
-         !obj->is_array(), "must not be an array");
-  // notify jvmti and dtrace
-  post_allocation_notify(klass, obj, size);
-}
-
-void CollectedHeap::post_allocation_setup_class(Klass* klass,
-                                                HeapWord* obj_ptr,
-                                                int size) {
-  // Set oop_size field before setting the _klass field because a
-  // non-NULL _klass field indicates that the object is parsable by
-  // concurrent GC.
-  oop new_cls = (oop)obj_ptr;
-  assert(size > 0, "oop_size must be positive.");
-  java_lang_Class::set_oop_size(new_cls, size);
-  post_allocation_setup_common(klass, obj_ptr);
-  assert(Universe::is_bootstrapping() ||
-         !new_cls->is_array(), "must not be an array");
-  // notify jvmti and dtrace
-  post_allocation_notify(klass, new_cls, size);
-}
-
-void CollectedHeap::post_allocation_setup_array(Klass* klass,
-                                                HeapWord* obj_ptr,
-                                                int length) {
-  // Set array length before setting the _klass field because a
-  // non-NULL klass field indicates that the object is parsable by
-  // concurrent GC.
-  assert(length >= 0, "length should be non-negative");
-  ((arrayOop)obj_ptr)->set_length(length);
-  post_allocation_setup_common(klass, obj_ptr);
-  oop new_obj = (oop)obj_ptr;
-  assert(new_obj->is_array(), "must be an array");
-  // notify jvmti and dtrace (must be after length is set for dtrace)
-  post_allocation_notify(klass, new_obj, new_obj->size());
-}
-
-HeapWord* CollectedHeap::common_mem_allocate_noinit(Klass* klass, size_t size, TRAPS) {
-
-  // Clear unhandled oops for memory allocation.  Memory allocation might
-  // not take out a lock if from tlab, so clear here.
-  CHECK_UNHANDLED_OOPS_ONLY(THREAD->clear_unhandled_oops();)
-
-  if (HAS_PENDING_EXCEPTION) {
-    NOT_PRODUCT(guarantee(false, "Should not allocate with exception pending"));
-    return NULL;  // caller does a CHECK_0 too
-  }
-
-  bool gc_overhead_limit_was_exceeded = false;
-  CollectedHeap* heap = Universe::heap();
-  HeapWord* result = heap->obj_allocate_raw(klass, size, &gc_overhead_limit_was_exceeded, THREAD);
-
-  if (result != NULL) {
-    return result;
-  }
-
-  if (!gc_overhead_limit_was_exceeded) {
-    // -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support
-    report_java_out_of_memory("Java heap space");
-
-    if (JvmtiExport::should_post_resource_exhausted()) {
-      JvmtiExport::post_resource_exhausted(
-        JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR | JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP,
-        "Java heap space");
-    }
-
-    THROW_OOP_0(Universe::out_of_memory_error_java_heap());
-  } else {
-    // -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support
-    report_java_out_of_memory("GC overhead limit exceeded");
-
-    if (JvmtiExport::should_post_resource_exhausted()) {
-      JvmtiExport::post_resource_exhausted(
-        JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR | JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP,
-        "GC overhead limit exceeded");
-    }
-
-    THROW_OOP_0(Universe::out_of_memory_error_gc_overhead_limit());
-  }
-}
-
-HeapWord* CollectedHeap::common_mem_allocate_init(Klass* klass, size_t size, TRAPS) {
-  HeapWord* obj = common_mem_allocate_noinit(klass, size, CHECK_NULL);
-  init_obj(obj, size);
-  return obj;
-}
-
-HeapWord* CollectedHeap::allocate_from_tlab(Klass* klass, size_t size, TRAPS) {
-  assert(UseTLAB, "should use UseTLAB");
-
-  HeapWord* obj = THREAD->tlab().allocate(size);
-  if (obj != NULL) {
-    return obj;
-  }
-  // Otherwise...
-  obj = allocate_from_tlab_slow(klass, size, THREAD);
-  assert(obj == NULL || !HAS_PENDING_EXCEPTION,
-         "Unexpected exception, will result in uninitialized storage");
-  return obj;
-}
-
-HeapWord* CollectedHeap::allocate_outside_tlab(Klass* klass, size_t size,
-                                               bool* gc_overhead_limit_was_exceeded, TRAPS) {
-  HeapWord* result = Universe::heap()->mem_allocate(size, gc_overhead_limit_was_exceeded);
-  if (result == NULL) {
-    return result;
-  }
-
-  NOT_PRODUCT(Universe::heap()->check_for_non_bad_heap_word_value(result, size));
-  assert(!HAS_PENDING_EXCEPTION,
-         "Unexpected exception, will result in uninitialized storage");
-  size_t size_in_bytes = size * HeapWordSize;
-  THREAD->incr_allocated_bytes(size_in_bytes);
-
-  AllocTracer::send_allocation_outside_tlab(klass, result, size_in_bytes, THREAD);
-
-  if (ThreadHeapSampler::enabled()) {
-    THREAD->heap_sampler().check_for_sampling(result, size_in_bytes);
-  }
-
-  return result;
-}
-
-void CollectedHeap::init_obj(HeapWord* obj, size_t size) {
-  assert(obj != NULL, "cannot initialize NULL object");
-  const size_t hs = oopDesc::header_size();
-  assert(size >= hs, "unexpected object size");
-  ((oop)obj)->set_klass_gap(0);
-  Copy::fill_to_aligned_words(obj + hs, size - hs);
-}
-
-HeapWord* CollectedHeap::common_allocate_memory(Klass* klass, int size,
-                                                void (*post_setup)(Klass*, HeapWord*, int),
-                                                int size_for_post, bool init_memory,
-                                                TRAPS) {
-  HeapWord* obj;
-  if (init_memory) {
-    obj = common_mem_allocate_init(klass, size, CHECK_NULL);
-  } else {
-    obj = common_mem_allocate_noinit(klass, size, CHECK_NULL);
-  }
-  post_setup(klass, obj, size_for_post);
-  return obj;
-}
-
-HeapWord* CollectedHeap::allocate_memory(Klass* klass, int size,
-                                         void (*post_setup)(Klass*, HeapWord*, int),
-                                         int size_for_post, bool init_memory,
-                                         TRAPS) {
-  HeapWord* obj;
-
-  assert(JavaThread::current()->heap_sampler().add_sampling_collector(),
-         "Should never return false.");
-
-  if (JvmtiExport::should_post_sampled_object_alloc()) {
-    HandleMark hm(THREAD);
-    Handle obj_h;
-    {
-      JvmtiSampledObjectAllocEventCollector collector;
-      obj = common_allocate_memory(klass, size, post_setup, size_for_post,
-                                   init_memory, CHECK_NULL);
-      // If we want to be sampling, protect the allocated object with a Handle
-      // before doing the callback. The callback is done in the destructor of
-      // the JvmtiSampledObjectAllocEventCollector.
-      obj_h = Handle(THREAD, (oop) obj);
-    }
-    obj = (HeapWord*) obj_h();
-  } else {
-    obj = common_allocate_memory(klass, size, post_setup, size_for_post,
-                                 init_memory, CHECK_NULL);
-  }
-
-  assert(JavaThread::current()->heap_sampler().remove_sampling_collector(),
-         "Should never return false.");
-  return obj;
-}
-
-oop CollectedHeap::obj_allocate(Klass* klass, int size, TRAPS) {
-  debug_only(check_for_valid_allocation_state());
-  assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed");
-  assert(size >= 0, "int won't convert to size_t");
-  HeapWord* obj = allocate_memory(klass, size, post_allocation_setup_obj,
-                                  size, true, CHECK_NULL);
-  NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size));
-  return (oop)obj;
-}
-
-oop CollectedHeap::class_allocate(Klass* klass, int size, TRAPS) {
-  debug_only(check_for_valid_allocation_state());
-  assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed");
-  assert(size >= 0, "int won't convert to size_t");
-  HeapWord* obj = allocate_memory(klass, size, post_allocation_setup_class,
-                                  size, true, CHECK_NULL);
-  NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size));
-  return (oop)obj;
-}
-
-oop CollectedHeap::array_allocate(Klass* klass,
-                                  int size,
-                                  int length,
-                                  TRAPS) {
-  debug_only(check_for_valid_allocation_state());
-  assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed");
-  assert(size >= 0, "int won't convert to size_t");
-  HeapWord* obj = allocate_memory(klass, size, post_allocation_setup_array,
-                                  length, true, CHECK_NULL);
-  NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size));
-  return (oop)obj;
-}
-
-oop CollectedHeap::array_allocate_nozero(Klass* klass,
-                                         int size,
-                                         int length,
-                                         TRAPS) {
-  debug_only(check_for_valid_allocation_state());
-  assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed");
-  assert(size >= 0, "int won't convert to size_t");
-
-  HeapWord* obj = allocate_memory(klass, size, post_allocation_setup_array,
-                                  length, false, CHECK_NULL);
-#ifndef PRODUCT
-  const size_t hs = oopDesc::header_size()+1;
-  Universe::heap()->check_for_non_bad_heap_word_value(obj+hs, size-hs);
-#endif
-  return (oop)obj;
-}
 
 inline HeapWord* CollectedHeap::align_allocation_or_fail(HeapWord* addr,
                                                          HeapWord* end,
--- a/src/hotspot/share/gc/shared/genCollectedHeap.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/shared/genCollectedHeap.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -275,9 +275,6 @@
 HeapWord* GenCollectedHeap::mem_allocate_work(size_t size,
                                               bool is_tlab,
                                               bool* gc_overhead_limit_was_exceeded) {
-  debug_only(check_for_valid_allocation_state());
-  assert(no_gc_in_progress(), "Allocation during gc not allowed");
-
   // In general gc_overhead_limit_was_exceeded should be false so
   // set it so here and reset it to true only if the gc time
   // limit is being exceeded as checked below.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/shared/memAllocator.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -0,0 +1,442 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "classfile/javaClasses.hpp"
+#include "gc/shared/allocTracer.hpp"
+#include "gc/shared/collectedHeap.hpp"
+#include "gc/shared/memAllocator.hpp"
+#include "gc/shared/threadLocalAllocBuffer.inline.hpp"
+#include "memory/universe.hpp"
+#include "oops/arrayOop.hpp"
+#include "oops/oop.inline.hpp"
+#include "prims/jvmtiExport.hpp"
+#include "runtime/sharedRuntime.hpp"
+#include "runtime/handles.inline.hpp"
+#include "runtime/thread.inline.hpp"
+#include "services/lowMemoryDetector.hpp"
+#include "utilities/align.hpp"
+#include "utilities/copy.hpp"
+
+class MemAllocator::Allocation: StackObj {
+  friend class MemAllocator;
+
+  const MemAllocator& _allocator;
+  Thread*             _thread;
+  oop*                _obj_ptr;
+  bool                _overhead_limit_exceeded;
+  bool                _allocated_outside_tlab;
+  size_t              _allocated_tlab_size;
+  bool                _tlab_end_reset_for_sample;
+
+  bool check_out_of_memory();
+  void verify_before();
+  void verify_after();
+  void notify_allocation();
+  void notify_allocation_jvmti_allocation_event();
+  void notify_allocation_jvmti_sampler();
+  void notify_allocation_low_memory_detector();
+  void notify_allocation_jfr_sampler();
+  void notify_allocation_dtrace_sampler();
+  void check_for_bad_heap_word_value() const;
+#ifdef ASSERT
+  void check_for_valid_allocation_state() const;
+#endif
+
+  class PreserveObj;
+
+public:
+  Allocation(const MemAllocator& allocator, oop* obj_ptr)
+    : _allocator(allocator),
+      _thread(Thread::current()),
+      _obj_ptr(obj_ptr),
+      _overhead_limit_exceeded(false),
+      _allocated_outside_tlab(false),
+      _allocated_tlab_size(0),
+      _tlab_end_reset_for_sample(false)
+  {
+    verify_before();
+  }
+
+  ~Allocation() {
+    if (!check_out_of_memory()) {
+      verify_after();
+      notify_allocation();
+    }
+  }
+
+  oop obj() const { return *_obj_ptr; }
+};
+
+class MemAllocator::Allocation::PreserveObj: StackObj {
+  HandleMark _handle_mark;
+  Handle     _handle;
+  oop* const _obj_ptr;
+
+public:
+  PreserveObj(Thread* thread, oop* obj_ptr)
+    : _handle_mark(thread),
+      _handle(thread, *obj_ptr),
+      _obj_ptr(obj_ptr)
+  {
+    *obj_ptr = NULL;
+  }
+
+  ~PreserveObj() {
+    *_obj_ptr = _handle();
+  }
+
+  oop operator()() const {
+    return _handle();
+  }
+};
+
+bool MemAllocator::Allocation::check_out_of_memory() {
+  Thread* THREAD = _thread;
+  assert(!HAS_PENDING_EXCEPTION, "Unexpected exception, will result in uninitialized storage");
+
+  if (obj() != NULL) {
+    return false;
+  }
+
+  if (!_overhead_limit_exceeded) {
+    // -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support
+    report_java_out_of_memory("Java heap space");
+
+    if (JvmtiExport::should_post_resource_exhausted()) {
+      JvmtiExport::post_resource_exhausted(
+        JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR | JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP,
+        "Java heap space");
+    }
+    THROW_OOP_(Universe::out_of_memory_error_java_heap(), true);
+  } else {
+    // -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support
+    report_java_out_of_memory("GC overhead limit exceeded");
+
+    if (JvmtiExport::should_post_resource_exhausted()) {
+      JvmtiExport::post_resource_exhausted(
+        JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR | JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP,
+        "GC overhead limit exceeded");
+    }
+
+    THROW_OOP_(Universe::out_of_memory_error_gc_overhead_limit(), true);
+  }
+}
+
+void MemAllocator::Allocation::verify_before() {
+  // Clear unhandled oops for memory allocation.  Memory allocation might
+  // not take out a lock if from tlab, so clear here.
+  Thread* THREAD = _thread;
+  CHECK_UNHANDLED_OOPS_ONLY(THREAD->clear_unhandled_oops();)
+  assert(!HAS_PENDING_EXCEPTION, "Should not allocate with exception pending");
+  debug_only(check_for_valid_allocation_state());
+  assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed");
+}
+
+void MemAllocator::Allocation::verify_after() {
+  NOT_PRODUCT(check_for_bad_heap_word_value();)
+}
+
+void MemAllocator::Allocation::check_for_bad_heap_word_value() const {
+  MemRegion obj_range = _allocator.obj_memory_range(obj());
+  HeapWord* addr = obj_range.start();
+  size_t size = obj_range.word_size();
+  if (CheckMemoryInitialization && ZapUnusedHeapArea) {
+    for (size_t slot = 0; slot < size; slot += 1) {
+      assert((*(intptr_t*) (addr + slot)) != ((intptr_t) badHeapWordVal),
+             "Found badHeapWordValue in post-allocation check");
+    }
+  }
+}
+
+#ifdef ASSERT
+void MemAllocator::Allocation::check_for_valid_allocation_state() const {
+  // How to choose between a pending exception and a potential
+  // OutOfMemoryError?  Don't allow pending exceptions.
+  // This is a VM policy failure, so how do we exhaustively test it?
+  assert(!_thread->has_pending_exception(),
+         "shouldn't be allocating with pending exception");
+  if (StrictSafepointChecks) {
+    assert(_thread->allow_allocation(),
+           "Allocation done by thread for which allocation is blocked "
+           "by No_Allocation_Verifier!");
+    // Allocation of an oop can always invoke a safepoint,
+    // hence, the true argument
+    _thread->check_for_valid_safepoint_state(true);
+  }
+}
+#endif
+
+void MemAllocator::Allocation::notify_allocation_jvmti_sampler() {
+  // support for JVMTI VMObjectAlloc event (no-op if not enabled)
+  JvmtiExport::vm_object_alloc_event_collector(obj());
+
+  if (!ThreadHeapSampler::enabled()) {
+    // Sampling disabled
+    return;
+  }
+
+  if (!_allocated_outside_tlab && _allocated_tlab_size == 0 && !_tlab_end_reset_for_sample) {
+    // Sample if it's a non-TLAB allocation, or a TLAB allocation that either refills the TLAB
+    // or expands it due to taking a sampler induced slow path.
+    return;
+  }
+
+  assert(JavaThread::current()->heap_sampler().add_sampling_collector(),
+         "Should never return false.");
+
+  // Only check if the sampler could actually sample something in this path.
+  assert(!JvmtiExport::should_post_sampled_object_alloc() ||
+         !JvmtiSampledObjectAllocEventCollector::object_alloc_is_safe_to_sample() ||
+         _thread->heap_sampler().sampling_collector_present(),
+         "Sampling collector not present.");
+
+  if (JvmtiExport::should_post_sampled_object_alloc()) {
+    // If we want to be sampling, protect the allocated object with a Handle
+    // before doing the callback. The callback is done in the destructor of
+    // the JvmtiSampledObjectAllocEventCollector.
+    PreserveObj obj_h(_thread, _obj_ptr);
+    JvmtiSampledObjectAllocEventCollector collector;
+    size_t size_in_bytes = _allocator._word_size * HeapWordSize;
+    ThreadLocalAllocBuffer& tlab = _thread->tlab();
+    size_t bytes_since_last = _allocated_outside_tlab ? 0 : tlab.bytes_since_last_sample_point();
+    _thread->heap_sampler().check_for_sampling(obj_h(), size_in_bytes, bytes_since_last);
+  }
+
+  assert(JavaThread::current()->heap_sampler().remove_sampling_collector(), "Should never return false.");
+
+  if (_tlab_end_reset_for_sample || _allocated_tlab_size != 0) {
+    _thread->tlab().set_sample_end();
+  }
+}
+
+void MemAllocator::Allocation::notify_allocation_low_memory_detector() {
+  // support low memory notifications (no-op if not enabled)
+  LowMemoryDetector::detect_low_memory_for_collected_pools();
+}
+
+void MemAllocator::Allocation::notify_allocation_jfr_sampler() {
+  HeapWord* mem = (HeapWord*)obj();
+  size_t size_in_bytes = _allocator._word_size * HeapWordSize;
+
+  if (_allocated_outside_tlab) {
+    AllocTracer::send_allocation_outside_tlab(_allocator._klass, mem, size_in_bytes, _thread);
+  } else if (_allocated_tlab_size != 0) {
+    // TLAB was refilled
+    AllocTracer::send_allocation_in_new_tlab(_allocator._klass, mem, _allocated_tlab_size * HeapWordSize,
+                                             size_in_bytes, _thread);
+  }
+}
+
+void MemAllocator::Allocation::notify_allocation_dtrace_sampler() {
+  if (DTraceAllocProbes) {
+    // support for Dtrace object alloc event (no-op most of the time)
+    Klass* klass = _allocator._klass;
+    size_t word_size = _allocator._word_size;
+    if (klass != NULL && klass->name() != NULL) {
+      SharedRuntime::dtrace_object_alloc(obj(), (int)word_size);
+    }
+  }
+}
+
+void MemAllocator::Allocation::notify_allocation() {
+  notify_allocation_low_memory_detector();
+  notify_allocation_jfr_sampler();
+  notify_allocation_dtrace_sampler();
+  notify_allocation_jvmti_sampler();
+}
+
+HeapWord* MemAllocator::allocate_outside_tlab(Allocation& allocation) const {
+  allocation._allocated_outside_tlab = true;
+  HeapWord* mem = _heap->mem_allocate(_word_size, &allocation._overhead_limit_exceeded);
+  if (mem == NULL) {
+    return mem;
+  }
+
+  NOT_PRODUCT(_heap->check_for_non_bad_heap_word_value(mem, _word_size));
+  size_t size_in_bytes = _word_size * HeapWordSize;
+  _thread->incr_allocated_bytes(size_in_bytes);
+
+  return mem;
+}
+
+HeapWord* MemAllocator::allocate_inside_tlab(Allocation& allocation) const {
+  assert(UseTLAB, "should use UseTLAB");
+
+  // Try allocating from an existing TLAB.
+  HeapWord* mem = _thread->tlab().allocate(_word_size);
+  if (mem != NULL) {
+    return mem;
+  }
+
+  // Try refilling the TLAB and allocating the object in it.
+  return allocate_inside_tlab_slow(allocation);
+}
+
+HeapWord* MemAllocator::allocate_inside_tlab_slow(Allocation& allocation) const {
+  HeapWord* mem = NULL;
+  ThreadLocalAllocBuffer& tlab = _thread->tlab();
+
+  if (ThreadHeapSampler::enabled()) {
+    // Try to allocate the sampled object from TLAB, it is possible a sample
+    // point was put and the TLAB still has space.
+    tlab.set_back_allocation_end();
+    mem = tlab.allocate(_word_size);
+    if (mem != NULL) {
+      allocation._tlab_end_reset_for_sample = true;
+      return mem;
+    }
+  }
+
+  // Retain tlab and allocate object in shared space if
+  // the amount free in the tlab is too large to discard.
+  if (tlab.free() > tlab.refill_waste_limit()) {
+    tlab.record_slow_allocation(_word_size);
+    return NULL;
+  }
+
+  // Discard tlab and allocate a new one.
+  // To minimize fragmentation, the last TLAB may be smaller than the rest.
+  size_t new_tlab_size = tlab.compute_size(_word_size);
+
+  tlab.clear_before_allocation();
+
+  if (new_tlab_size == 0) {
+    return NULL;
+  }
+
+  // Allocate a new TLAB requesting new_tlab_size. Any size
+  // between minimal and new_tlab_size is accepted.
+  size_t min_tlab_size = ThreadLocalAllocBuffer::compute_min_size(_word_size);
+  mem = _heap->allocate_new_tlab(min_tlab_size, new_tlab_size, &allocation._allocated_tlab_size);
+  if (mem == NULL) {
+    assert(allocation._allocated_tlab_size == 0,
+           "Allocation failed, but actual size was updated. min: " SIZE_FORMAT
+           ", desired: " SIZE_FORMAT ", actual: " SIZE_FORMAT,
+           min_tlab_size, new_tlab_size, allocation._allocated_tlab_size);
+    return NULL;
+  }
+  assert(allocation._allocated_tlab_size != 0, "Allocation succeeded but actual size not updated. mem at: "
+         PTR_FORMAT " min: " SIZE_FORMAT ", desired: " SIZE_FORMAT,
+         p2i(mem), min_tlab_size, new_tlab_size);
+
+  if (ZeroTLAB) {
+    // ..and clear it.
+    Copy::zero_to_words(mem, allocation._allocated_tlab_size);
+  } else {
+    // ...and zap just allocated object.
+#ifdef ASSERT
+    // Skip mangling the space corresponding to the object header to
+    // ensure that the returned space is not considered parsable by
+    // any concurrent GC thread.
+    size_t hdr_size = oopDesc::header_size();
+    Copy::fill_to_words(mem + hdr_size, allocation._allocated_tlab_size - hdr_size, badHeapWordVal);
+#endif // ASSERT
+  }
+
+  tlab.fill(mem, mem + _word_size, allocation._allocated_tlab_size);
+  return mem;
+}
+
+HeapWord* MemAllocator::mem_allocate(Allocation& allocation) const {
+  if (UseTLAB) {
+    HeapWord* result = allocate_inside_tlab(allocation);
+    if (result != NULL) {
+      return result;
+    }
+  }
+
+  return allocate_outside_tlab(allocation);
+}
+
+oop MemAllocator::allocate() const {
+  oop obj = NULL;
+  {
+    Allocation allocation(*this, &obj);
+    HeapWord* mem = mem_allocate(allocation);
+    if (mem != NULL) {
+      obj = initialize(mem);
+    }
+  }
+  return obj;
+}
+
+void MemAllocator::mem_clear(HeapWord* mem) const {
+  assert(mem != NULL, "cannot initialize NULL object");
+  const size_t hs = oopDesc::header_size();
+  assert(_word_size >= hs, "unexpected object size");
+  oopDesc::set_klass_gap(mem, 0);
+  Copy::fill_to_aligned_words(mem + hs, _word_size - hs);
+}
+
+oop MemAllocator::finish(HeapWord* mem) const {
+  assert(mem != NULL, "NULL object pointer");
+  if (UseBiasedLocking) {
+    oopDesc::set_mark_raw(mem, _klass->prototype_header());
+  } else {
+    // May be bootstrapping
+    oopDesc::set_mark_raw(mem, markOopDesc::prototype());
+  }
+  // Need a release store to ensure array/class length, mark word, and
+  // object zeroing are visible before setting the klass non-NULL, for
+  // concurrent collectors.
+  oopDesc::release_set_klass(mem, _klass);
+  return oop(mem);
+}
+
+oop ObjAllocator::initialize(HeapWord* mem) const {
+  mem_clear(mem);
+  return finish(mem);
+}
+
+MemRegion ObjArrayAllocator::obj_memory_range(oop obj) const {
+  if (_do_zero) {
+    return MemAllocator::obj_memory_range(obj);
+  }
+  ArrayKlass* array_klass = ArrayKlass::cast(_klass);
+  const size_t hs = arrayOopDesc::header_size(array_klass->element_type());
+  return MemRegion(((HeapWord*)obj) + hs, _word_size - hs);
+}
+
+oop ObjArrayAllocator::initialize(HeapWord* mem) const {
+  // Set array length before setting the _klass field because a
+  // non-NULL klass field indicates that the object is parsable by
+  // concurrent GC.
+  assert(_length >= 0, "length should be non-negative");
+  if (_do_zero) {
+    mem_clear(mem);
+  }
+  arrayOopDesc::set_length(mem, _length);
+  return finish(mem);
+}
+
+oop ClassAllocator::initialize(HeapWord* mem) const {
+  // Set oop_size field before setting the _klass field because a
+  // non-NULL _klass field indicates that the object is parsable by
+  // concurrent GC.
+  assert(_word_size > 0, "oop_size must be positive.");
+  mem_clear(mem);
+  java_lang_Class::set_oop_size(mem, (int)_word_size);
+  return finish(mem);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/shared/memAllocator.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_GC_SHARED_MEM_ALLOCATOR_HPP
+#define SHARE_GC_SHARED_MEM_ALLOCATOR_HPP
+
+#include "gc/shared/collectedHeap.hpp"
+#include "memory/memRegion.hpp"
+#include "oops/oopsHierarchy.hpp"
+#include "utilities/exceptions.hpp"
+#include "utilities/macros.hpp"
+
+// These fascilities are used for allocating, and initializing newly allocated objects.
+
+class MemAllocator: StackObj {
+  class Allocation;
+
+protected:
+  CollectedHeap* const _heap;
+  Thread* const        _thread;
+  Klass* const         _klass;
+  const size_t         _word_size;
+
+private:
+  // Allocate from the current thread's TLAB, with broken-out slow path.
+  HeapWord* allocate_inside_tlab(Allocation& allocation) const;
+  HeapWord* allocate_inside_tlab_slow(Allocation& allocation) const;
+  HeapWord* allocate_outside_tlab(Allocation& allocation) const;
+
+protected:
+  MemAllocator(Klass* klass, size_t word_size, Thread* thread)
+    : _heap(Universe::heap()),
+      _thread(thread),
+      _klass(klass),
+      _word_size(word_size)
+  { }
+
+  // This function clears the memory of the object
+  void mem_clear(HeapWord* mem) const;
+  // This finish constructing an oop by installing the mark word and the Klass* pointer
+  // last. At the point when the Klass pointer is initialized, this is a constructed object
+  // that must be parseable as an oop by concurrent collectors.
+  oop finish(HeapWord* mem) const;
+
+  // Raw memory allocation. This may or may not use TLAB allocations to satisfy the
+  // allocation. A GC implementation may override this function to satisfy the allocation
+  // in any way. But the default is to try a TLAB allocation, and otherwise perform
+  // mem_allocate.
+  virtual HeapWord* mem_allocate(Allocation& allocation) const;
+
+  virtual MemRegion obj_memory_range(oop obj) const {
+    return MemRegion((HeapWord*)obj, _word_size);
+  }
+
+public:
+  oop allocate() const;
+  virtual oop initialize(HeapWord* mem) const = 0;
+};
+
+class ObjAllocator: public MemAllocator {
+public:
+  ObjAllocator(Klass* klass, size_t word_size, Thread* thread = Thread::current())
+    : MemAllocator(klass, word_size, thread) {}
+  virtual oop initialize(HeapWord* mem) const;
+};
+
+class ObjArrayAllocator: public MemAllocator {
+  const int  _length;
+  const bool _do_zero;
+protected:
+  virtual MemRegion obj_memory_range(oop obj) const;
+
+public:
+  ObjArrayAllocator(Klass* klass, size_t word_size, int length, bool do_zero,
+                    Thread* thread = Thread::current())
+    : MemAllocator(klass, word_size, thread),
+      _length(length),
+      _do_zero(do_zero) {}
+  virtual oop initialize(HeapWord* mem) const;
+};
+
+class ClassAllocator: public MemAllocator {
+public:
+  ClassAllocator(Klass* klass, size_t word_size, Thread* thread = Thread::current())
+    : MemAllocator(klass, word_size, thread) {}
+  virtual oop initialize(HeapWord* mem) const;
+};
+
+#endif // SHARE_GC_SHARED_MEM_ALLOCATOR_HPP
--- a/src/hotspot/share/gc/shared/referenceProcessor.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/shared/referenceProcessor.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -1033,7 +1033,7 @@
   // The last ref must have its discovered field pointing to itself.
   oop next_discovered = (current_head != NULL) ? current_head : obj;
 
-  oop retest = RawAccess<>::oop_atomic_cmpxchg(next_discovered, discovered_addr, oop(NULL));
+  oop retest = HeapAccess<AS_NO_KEEPALIVE>::oop_atomic_cmpxchg(next_discovered, discovered_addr, oop(NULL));
 
   if (retest == NULL) {
     // This thread just won the right to enqueue the object.
--- a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -185,10 +185,6 @@
 
   initialize(start, top, start + new_size - alignment_reserve());
 
-  if (ThreadHeapSampler::enabled()) {
-    set_sample_end();
-  }
-
   // Reset amount of internal fragmentation
   set_refill_waste_limit(initial_refill_waste_limit());
 }
@@ -325,14 +321,14 @@
 void ThreadLocalAllocBuffer::set_sample_end() {
   size_t heap_words_remaining = pointer_delta(_end, _top);
   size_t bytes_until_sample = myThread()->heap_sampler().bytes_until_sample();
-  size_t words_until_sample = bytes_until_sample / HeapWordSize;;
+  size_t words_until_sample = bytes_until_sample / HeapWordSize;
 
   if (heap_words_remaining > words_until_sample) {
     HeapWord* new_end = _top + words_until_sample;
     set_end(new_end);
     _bytes_since_last_sample_point = bytes_until_sample;
   } else {
-    _bytes_since_last_sample_point = heap_words_remaining * HeapWordSize;;
+    _bytes_since_last_sample_point = heap_words_remaining * HeapWordSize;
   }
 }
 
@@ -346,18 +342,6 @@
   _end = _allocation_end;
 }
 
-HeapWord* ThreadLocalAllocBuffer::allocate_sampled_object(size_t size) {
-  set_back_allocation_end();
-  HeapWord* result = allocate(size);
-
-  if (result) {
-    myThread()->heap_sampler().check_for_sampling(result, size * HeapWordSize, _bytes_since_last_sample_point);
-    set_sample_end();
-  }
-
-  return result;
-}
-
 HeapWord* ThreadLocalAllocBuffer::hard_end() {
   return _allocation_end + alignment_reserve();
 }
--- a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -89,8 +89,6 @@
 
   size_t remaining();
 
-  bool is_last_allocation(HeapWord* obj, size_t size) { return pointer_delta(top(), obj) == size; }
-
   // Make parsable and release it.
   void reset();
 
@@ -141,10 +139,6 @@
 
   // Allocate size HeapWords. The memory is NOT initialized to zero.
   inline HeapWord* allocate(size_t size);
-  HeapWord* allocate_sampled_object(size_t size);
-
-  // Undo last allocation.
-  inline bool undo_allocate(HeapWord* obj, size_t size);
 
   // Reserve space at the end of TLAB
   static size_t end_reserve() {
--- a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.inline.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.inline.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,19 +53,6 @@
   return NULL;
 }
 
-inline bool ThreadLocalAllocBuffer::undo_allocate(HeapWord* obj, size_t size) {
-  invariants();
-
-  if (!is_last_allocation(obj, size)) {
-    return false;
-  }
-
-  set_top(obj);
-
-  invariants();
-  return true;
-}
-
 inline size_t ThreadLocalAllocBuffer::compute_size(size_t obj_size) {
   // Compute the size for the new TLAB.
   // The "last" tlab may be smaller to reduce fragmentation.
--- a/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -292,7 +292,7 @@
 }
 
 void LoadBarrierNode::push_dominated_barriers(PhaseIterGVN* igvn) const {
-  // change to that barrier may affect a dominated barrier so re-push those
+  // Change to that barrier may affect a dominated barrier so re-push those
   Node* val = in(LoadBarrierNode::Oop);
 
   for (DUIterator_Fast imax, i = val->fast_outs(imax); i < imax; i++) {
@@ -526,7 +526,7 @@
   phi_mem2->init_req(1, scmemproj2);
   kit->set_memory(phi_mem2, alias_idx);
 
-  // Merge outer flow - then check if first cas succeded
+  // Merge outer flow - then check if first CAS succeeded
   region->set_req(1, then);
   region->set_req(2, region2);
   phi->set_req(1, kit->intcon(1));
@@ -573,7 +573,7 @@
   Node* region2 = new RegionNode(3);
   Node* phi2    = new PhiNode(region2, adr_type);
 
-  // Check if cmpx succeded
+  // Check if cmpx succeeded
   Node* cmp     = gvn.transform(new CmpPNode(cmpx, in_expected));
   Node* bol     = gvn.transform(new BoolNode(cmp, BoolTest::eq))->as_Bool();
   IfNode* iff   = gvn.transform(new IfNode(in_ctrl, bol, likely, COUNT_UNKNOWN))->as_If();
@@ -610,7 +610,7 @@
   phi2->set_req(1, cmpx2);
   phi2->set_req(2, barrierdata);
 
-  // Merge outer flow - then check if first cas succeded
+  // Merge outer flow - then check if first cas succeeded
   region->set_req(1, then);
   region->set_req(2, region2);
   phi->set_req(1, cmpx);
@@ -802,7 +802,7 @@
   }
 }
 
-// Basic loadbarrier using conventional arg passing
+// Basic loadbarrier using conventional argument passing
 void ZBarrierSetC2::expand_loadbarrier_basic(PhaseMacroExpand* phase, LoadBarrierNode *barrier) const {
   PhaseIterGVN &igvn = phase->igvn();
 
@@ -862,7 +862,7 @@
   if (barrier->is_writeback()) {
     call->init_req(TypeFunc::Parms+1, in_adr);
   } else {
-    // when slow path is called with a null adr, the healed oop will not be written back
+    // When slow path is called with a null address, the healed oop will not be written back
     call->init_req(TypeFunc::Parms+1, igvn.zerocon(T_OBJECT));
   }
   call = igvn.transform(call);
@@ -877,7 +877,7 @@
   result_region = igvn.transform(result_region);
   result_val = igvn.transform(result_val);
 
-  if (out_ctrl != NULL) { // added if cond
+  if (out_ctrl != NULL) { // Added if cond
     igvn.replace_node(out_ctrl, result_region);
   }
   igvn.replace_node(out_res, result_val);
@@ -934,7 +934,7 @@
 
   Node *new_loadp;
   new_loadp = slow_path_surrogate;
-  // create the final region/phi pair to converge cntl/data paths to downstream code
+  // Create the final region/phi pair to converge cntl/data paths to downstream code
   Node* result_region = igvn.transform(new RegionNode(3));
   result_region->set_req(1, then);
   result_region->set_req(2, elsen);
@@ -943,7 +943,7 @@
   result_phi->set_req(1, new_loadp);
   result_phi->set_req(2, barrier->in(LoadBarrierNode::Oop));
 
-  // finally, connect the original outputs to the barrier region and phi to complete the expansion/substitution
+  // Finally, connect the original outputs to the barrier region and phi to complete the expansion/substitution
   // igvn.replace_node(out_ctrl, result_region);
   if (out_ctrl != NULL) { // added if cond
     igvn.replace_node(out_ctrl, result_region);
@@ -980,7 +980,7 @@
       int load_barrier_count = s->load_barrier_count();
       LoadBarrierNode * n = s->load_barrier_node(load_barrier_count-1-skipped);
       if (igvn.type(n) == Type::TOP || (n->in(0) != NULL && n->in(0)->is_top())) {
-        // node is unreachable, so don't try to expand it
+        // Node is unreachable, so don't try to expand it
         s->remove_load_barrier_node(n);
         continue;
       }
--- a/src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -35,8 +35,8 @@
   bool _writeback;          // Controls if the barrier writes the healed oop back to memory
                             // A swap on a memory location must never write back the healed oop
   bool _oop_reload_allowed; // Controls if the barrier are allowed to reload the oop from memory
-                            // before healing, otherwise both the oop and the address must be passed to the
-                            // barrier from the oop
+                            // before healing, otherwise both the oop and the address must be
+                            // passed to the barrier from the oop
 
   static bool is_dominator(PhaseIdealLoop* phase, bool linear_only, Node *d, Node *n);
   void push_dominated_barriers(PhaseIterGVN* igvn) const;
--- a/src/hotspot/share/gc/z/vmStructs_z.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/vmStructs_z.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -19,7 +19,6 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
- *
  */
 
 #include "precompiled.hpp"
--- a/src/hotspot/share/gc/z/vmStructs_z.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/vmStructs_z.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -19,7 +19,6 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
- *
  */
 
 #ifndef SHARE_VM_GC_Z_VMSTRUCTS_Z_HPP
--- a/src/hotspot/share/gc/z/zAllocationFlags.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zAllocationFlags.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -44,7 +44,7 @@
 //  |    |
 //  |    * 3-3 No Reserve Flag (1-bit)
 //  |
-//  * 7-5 Unused (3-bits)
+//  * 7-4 Unused (4-bits)
 //
 
 class ZAllocationFlags {
--- a/src/hotspot/share/gc/z/zBarrierSet.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zBarrierSet.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -53,7 +53,7 @@
     return true;
   }
 
-  // Barrier not neeed
+  // Barrier not needed
   return false;
 }
 
--- a/src/hotspot/share/gc/z/zBarrierSet.inline.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zBarrierSet.inline.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -141,7 +141,7 @@
   verify_decorators_present<ON_STRONG_OOP_REF | ON_UNKNOWN_OOP_REF>();
   verify_decorators_absent<AS_NO_KEEPALIVE>();
 
-  // Through Unsafe.CompareAndExchangeObject()/CompareAndSetObject() we can recieve
+  // Through Unsafe.CompareAndExchangeObject()/CompareAndSetObject() we can receive
   // calls with ON_UNKNOWN_OOP_REF set. However, we treat these as ON_STRONG_OOP_REF,
   // with the motivation that if you're doing Unsafe operations on a Reference.referent
   // field, then you're on your own anyway.
--- a/src/hotspot/share/gc/z/zBitMap.inline.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zBitMap.inline.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -51,16 +51,20 @@
   do {
     const bm_word_t new_val = old_val | pair_mask;
     if (new_val == old_val) {
+      // Someone else beat us to it
       inc_live = false;
-      return false;     // Someone else beat us to it.
+      return false;
     }
     const bm_word_t cur_val = Atomic::cmpxchg(new_val, addr, old_val);
     if (cur_val == old_val) {
+      // Success
       const bm_word_t marked_mask = bit_mask(bit);
       inc_live = !(old_val & marked_mask);
-      return true;      // Success.
+      return true;
     }
-    old_val = cur_val;  // The value changed, try again.
+
+    // The value changed, retry
+    old_val = cur_val;
   } while (true);
 }
 
--- a/src/hotspot/share/gc/z/zCollectedHeap.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zCollectedHeap.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -173,7 +173,7 @@
 void ZCollectedHeap::collect_as_vm_thread(GCCause::Cause cause) {
   // These collection requests are ignored since ZGC can't run a synchronous
   // GC cycle from within the VM thread. This is considered benign, since the
-  // only GC causes comming in here should be heap dumper and heap inspector.
+  // only GC causes coming in here should be heap dumper and heap inspector.
   // However, neither the heap dumper nor the heap inspector really need a GC
   // to happen, but the result of their heap iterations might in that case be
   // less accurate since they might include objects that would otherwise have
@@ -233,11 +233,11 @@
 }
 
 void ZCollectedHeap::object_iterate(ObjectClosure* cl) {
-  _heap.object_iterate(cl);
+  _heap.object_iterate(cl, true /* visit_referents */);
 }
 
 void ZCollectedHeap::safe_object_iterate(ObjectClosure* cl) {
-  _heap.object_iterate(cl);
+  _heap.object_iterate(cl, true /* visit_referents */);
 }
 
 HeapWord* ZCollectedHeap::block_start(const void* addr) const {
--- a/src/hotspot/share/gc/z/zDirector.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zDirector.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -101,7 +101,7 @@
   // Perform GC if the estimated max allocation rate indicates that we
   // will run out of memory. The estimated max allocation rate is based
   // on the moving average of the sampled allocation rate plus a safety
-  // margin based on variations in the allocation rate and unforseen
+  // margin based on variations in the allocation rate and unforeseen
   // allocation spikes.
 
   // Calculate amount of free memory available to Java threads. Note that
@@ -115,9 +115,9 @@
 
   // Calculate time until OOM given the max allocation rate and the amount
   // of free memory. The allocation rate is a moving average and we multiply
-  // that with an alllcation spike tolerance factor to guard against unforseen
+  // that with an allocation spike tolerance factor to guard against unforeseen
   // phase changes in the allocate rate. We then add ~3.3 sigma to account for
-  // the allocation rate variance, which means the probablility is 1 in 1000
+  // the allocation rate variance, which means the probability is 1 in 1000
   // that a sample is outside of the confidence interval.
   const double max_alloc_rate = (ZStatAllocRate::avg() * ZAllocationSpikeTolerance) + (ZStatAllocRate::avg_sd() * one_in_1000);
   const double time_until_oom = free / (max_alloc_rate + 1.0); // Plus 1.0B/s to avoid division by zero
--- a/src/hotspot/share/gc/z/zDriver.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zDriver.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -181,11 +181,11 @@
     ZStatTimer timer(ZPhasePauseMarkStart);
     ZServiceabilityMarkStartTracer tracer;
 
-    // Setup soft reference policy
+    // Set up soft reference policy
     const bool clear = should_clear_soft_references();
     ZHeap::heap()->set_soft_reference_policy(clear);
 
-    // Setup boost mode
+    // Set up boost mode
     const bool boost = should_boost_worker_threads();
     ZHeap::heap()->set_boost_worker_threads(boost);
 
@@ -373,7 +373,7 @@
     ZHeap::heap()->select_relocation_set();
   }
 
-  // Phase 8: Prepare Relocation Set
+  // Phase 8: Concurrent Prepare Relocation Set
   {
     ZStatTimer timer(ZPhaseConcurrentPrepareRelocationSet);
     ZHeap::heap()->prepare_relocation_set();
--- a/src/hotspot/share/gc/z/zForwardingTable.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zForwardingTable.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -34,7 +34,7 @@
   // Allocate table for linear probing. The size of the table must be
   // a power of two to allow for quick and inexpensive indexing/masking.
   // The table is sized to have a load factor of 50%, i.e. sized to have
-  // double the number of entries actuallly inserted.
+  // double the number of entries actually inserted.
   _size = ZUtils::round_up_power_of_2(live_objects * 2);
   _table = MallocArrayAllocator<ZForwardingTableEntry>::allocate(_size, mtGC);
 
--- a/src/hotspot/share/gc/z/zForwardingTable.inline.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zForwardingTable.inline.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -65,7 +65,7 @@
 }
 
 inline ZForwardingTableEntry ZForwardingTable::find(uintptr_t from_index, ZForwardingTableCursor* cursor) const {
-  // Reading entries in the table races with the atomic cas done for
+  // Reading entries in the table races with the atomic CAS done for
   // insertion into the table. This is safe because each entry is at
   // most updated once (from -1 to something else).
   ZForwardingTableEntry entry = first(from_index, cursor);
--- a/src/hotspot/share/gc/z/zHeap.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zHeap.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -50,12 +50,12 @@
 #include "utilities/align.hpp"
 #include "utilities/debug.hpp"
 
-static const ZStatSampler  ZSamplerHeapUsedBeforeMark("Memory", "Heap Used Before Mark", ZStatUnitBytes);
-static const ZStatSampler  ZSamplerHeapUsedAfterMark("Memory", "Heap Used After Mark", ZStatUnitBytes);
-static const ZStatSampler  ZSamplerHeapUsedBeforeRelocation("Memory", "Heap Used Before Relocation", ZStatUnitBytes);
-static const ZStatSampler  ZSamplerHeapUsedAfterRelocation("Memory", "Heap Used After Relocation", ZStatUnitBytes);
-static const ZStatCounter  ZCounterUndoPageAllocation("Memory", "Undo Page Allocation", ZStatUnitOpsPerSecond);
-static const ZStatCounter  ZCounterOutOfMemory("Memory", "Out Of Memory", ZStatUnitOpsPerSecond);
+static const ZStatSampler ZSamplerHeapUsedBeforeMark("Memory", "Heap Used Before Mark", ZStatUnitBytes);
+static const ZStatSampler ZSamplerHeapUsedAfterMark("Memory", "Heap Used After Mark", ZStatUnitBytes);
+static const ZStatSampler ZSamplerHeapUsedBeforeRelocation("Memory", "Heap Used Before Relocation", ZStatUnitBytes);
+static const ZStatSampler ZSamplerHeapUsedAfterRelocation("Memory", "Heap Used After Relocation", ZStatUnitBytes);
+static const ZStatCounter ZCounterUndoPageAllocation("Memory", "Undo Page Allocation", ZStatUnitOpsPerSecond);
+static const ZStatCounter ZCounterOutOfMemory("Memory", "Out Of Memory", ZStatUnitOpsPerSecond);
 
 ZHeap* ZHeap::_heap = NULL;
 
@@ -155,7 +155,7 @@
     // fit the smallest possible TLAB. This means that the next
     // TLAB allocation will force the allocator to get a new
     // backing page anyway, which in turn means that we can then
-    // fit the larges possible TLAB.
+    // fit the largest possible TLAB.
     size = max_tlab_size();
   }
 
@@ -503,10 +503,10 @@
                                  used(), used_high(), used_low());
 }
 
-void ZHeap::object_iterate(ObjectClosure* cl) {
+void ZHeap::object_iterate(ObjectClosure* cl, bool visit_referents) {
   assert(SafepointSynchronize::is_at_safepoint(), "Should be at safepoint");
 
-  ZHeapIterator iter;
+  ZHeapIterator iter(visit_referents);
   iter.objects_do(cl);
 }
 
@@ -577,6 +577,6 @@
 
   {
     ZVerifyObjectClosure cl;
-    object_iterate(&cl);
+    object_iterate(&cl, false /* visit_referents */);
   }
 }
--- a/src/hotspot/share/gc/z/zHeap.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zHeap.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -152,7 +152,7 @@
   void relocate();
 
   // Iteration
-  void object_iterate(ObjectClosure* cl);
+  void object_iterate(ObjectClosure* cl, bool visit_referents);
 
   // Serviceability
   void serviceability_initialize();
--- a/src/hotspot/share/gc/z/zHeapIterator.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zHeapIterator.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -78,14 +78,28 @@
 private:
   ZHeapIterator* const _iter;
   const oop            _base;
+  const bool           _visit_referents;
 
 public:
   ZHeapIteratorPushOopClosure(ZHeapIterator* iter, oop base) :
       _iter(iter),
-      _base(base) {}
+      _base(base),
+      _visit_referents(iter->visit_referents()) {}
+
+  oop load_oop(oop* p) {
+    if (_visit_referents) {
+      return HeapAccess<ON_UNKNOWN_OOP_REF>::oop_load_at(_base, _base->field_offset(p));
+    } else {
+      return HeapAccess<>::oop_load(p);
+    }
+  }
+
+  virtual ReferenceIterationMode reference_iteration_mode() {
+    return _visit_referents ? DO_FIELDS : DO_FIELDS_EXCEPT_REFERENT;
+  }
 
   virtual void do_oop(oop* p) {
-    const oop obj = HeapAccess<ON_UNKNOWN_OOP_REF>::oop_load_at(_base, _base->field_offset(p));
+    const oop obj = load_oop(p);
     _iter->push(obj);
   }
 
@@ -100,9 +114,10 @@
 #endif
 };
 
-ZHeapIterator::ZHeapIterator() :
+ZHeapIterator::ZHeapIterator(bool visit_referents) :
     _visit_stack(),
-    _visit_map() {}
+    _visit_map(),
+    _visit_referents(visit_referents) {}
 
 ZHeapIterator::~ZHeapIterator() {
   ZVisitMapIterator iter(&_visit_map);
@@ -163,12 +178,16 @@
   }
 }
 
+bool ZHeapIterator::visit_referents() const {
+  return _visit_referents;
+}
+
 void ZHeapIterator::objects_do(ObjectClosure* cl) {
   ZHeapIteratorRootOopClosure root_cl(this, cl);
   ZRootsIterator roots;
 
   // Follow roots. Note that we also visit the JVMTI weak tag map
-  // as if they where strong roots to make sure we visit all tagged
+  // as if they were strong roots to make sure we visit all tagged
   // objects, even those that might now have become unreachable.
   // If we didn't do this the user would have expected to see
   // ObjectFree events for unreachable objects in the tag map.
--- a/src/hotspot/share/gc/z/zHeapIterator.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zHeapIterator.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -42,6 +42,7 @@
 
   ZVisitStack _visit_stack;
   ZVisitMap   _visit_map;
+  const bool  _visit_referents;
 
   size_t object_index_max() const;
   size_t object_index(oop obj) const;
@@ -50,8 +51,10 @@
   void push(oop obj);
   void drain(ObjectClosure* cl);
 
+  bool visit_referents() const;
+
 public:
-  ZHeapIterator();
+  ZHeapIterator(bool visit_referents);
   ~ZHeapIterator();
 
   void objects_do(ObjectClosure* cl);
--- a/src/hotspot/share/gc/z/zList.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zList.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -29,7 +29,7 @@
 
 template <typename T> class ZList;
 
-// Element in a double linked list
+// Element in a doubly linked list
 template <typename T>
 class ZListNode {
   friend class ZList<T>;
@@ -61,7 +61,7 @@
   }
 };
 
-// Double-linked list
+// Doubly linked list
 template <typename T>
 class ZList {
 private:
--- a/src/hotspot/share/gc/z/zLiveMap.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zLiveMap.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -73,7 +73,7 @@
 
     // Mark reset contention
     if (!contention) {
-      // Count contention once, not every loop
+      // Count contention once
       ZStatInc(ZCounterMarkSeqNumResetContention);
       contention = true;
 
@@ -95,7 +95,7 @@
 
       // Mark reset contention
       if (!contention) {
-        // Count contention once, not every loop
+        // Count contention once
         ZStatInc(ZCounterMarkSegmentResetContention);
         contention = true;
 
--- a/src/hotspot/share/gc/z/zLiveMap.inline.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zLiveMap.inline.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -97,8 +97,8 @@
 
 inline bool ZLiveMap::get(size_t index) const {
   BitMap::idx_t segment = index_to_segment(index);
-  return is_marked() &&               // Page is marked
-         is_segment_live(segment) &&  // Segment is marked
+  return is_marked() &&              // Page is marked
+         is_segment_live(segment) && // Segment is marked
          _bitmap.at(index);          // Object is marked
 }
 
--- a/src/hotspot/share/gc/z/zMark.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zMark.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -398,7 +398,7 @@
 }
 
 bool ZMark::try_flush(volatile size_t* nflush) {
-  // Only flush if handhakes are enabled
+  // Only flush if handshakes are enabled
   if (!ThreadLocalHandshakes) {
     return false;
   }
@@ -681,5 +681,5 @@
   Threads::threads_do(&cl);
 
   // Verify stripe stacks
-  guarantee(_stripes.is_empty(), "Should be emtpy");
+  guarantee(_stripes.is_empty(), "Should be empty");
 }
--- a/src/hotspot/share/gc/z/zMarkStackEntry.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zMarkStackEntry.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -77,7 +77,7 @@
 
 public:
   ZMarkStackEntry() {
-    // This constructor is intentionally left emtpy and does not initialize
+    // This constructor is intentionally left empty and does not initialize
     // _entry to allow it to be optimized out when instantiating ZMarkStack,
     // which has a long array of ZMarkStackEntry elements, but doesn't care
     // what _entry is initialized to.
--- a/src/hotspot/share/gc/z/zObjectAllocator.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zObjectAllocator.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -40,7 +40,7 @@
   ZPage* alloc_page(uint8_t type, size_t size, ZAllocationFlags flags);
 
   // Allocate an object in a shared page. Allocate and
-  // atomically install a new page if neccesary.
+  // atomically install a new page if necessary.
   uintptr_t alloc_object_in_shared_page(ZPage** shared_page,
                                         uint8_t page_type,
                                         size_t page_size,
--- a/src/hotspot/share/gc/z/zOopClosures.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zOopClosures.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -40,13 +40,17 @@
             p2i(obj), p2i(p));
 }
 
-ZVerifyHeapOopClosure::ZVerifyHeapOopClosure(oop base)
-    : _base(base) {}
+OopIterateClosure::ReferenceIterationMode ZVerifyHeapOopClosure::reference_iteration_mode() {
+  // Don't visit the j.l.Reference.referents for this verification closure,
+  // since they are cleaned concurrently after ZHeap::mark_end(), and can
+  // therefore not be verified at this point.
+  return DO_FIELDS_EXCEPT_REFERENT;
+}
 
 void ZVerifyHeapOopClosure::do_oop(oop* p) {
   guarantee(ZHeap::heap()->is_in((uintptr_t)p), "oop* " PTR_FORMAT " not in heap", p2i(p));
 
-  const oop obj = HeapAccess<ON_UNKNOWN_OOP_REF>::oop_load_at(_base, _base->field_offset(p));
+  const oop obj = RawAccess<>::oop_load(p);
   z_verify_loaded_object(p, obj);
 }
 
@@ -54,10 +58,16 @@
   ShouldNotReachHere();
 }
 
+ZVerifyRootOopClosure::ZVerifyRootOopClosure() {
+  // This closure should only be used from ZHeap::mark_end(),
+  // when all roots should have been fixed by the fixup_partial_loads().
+  guarantee(ZGlobalPhase == ZPhaseMarkCompleted, "Invalid phase");
+}
+
 void ZVerifyRootOopClosure::do_oop(oop* p) {
   guarantee(!ZHeap::heap()->is_in((uintptr_t)p), "oop* " PTR_FORMAT " in heap", p2i(p));
 
-  const oop obj = NativeAccess<>::oop_load(p);
+  const oop obj = RawAccess<>::oop_load(p);
   z_verify_loaded_object(p, obj);
 }
 
@@ -66,6 +76,6 @@
 }
 
 void ZVerifyObjectClosure::do_object(oop o) {
-  ZVerifyHeapOopClosure cl(o);
+  ZVerifyHeapOopClosure cl;
   o->oop_iterate(&cl);
 }
--- a/src/hotspot/share/gc/z/zOopClosures.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zOopClosures.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -83,11 +83,8 @@
 };
 
 class ZVerifyHeapOopClosure : public BasicOopIterateClosure {
-private:
-  const oop _base;
-
 public:
-  ZVerifyHeapOopClosure(oop base);
+  virtual ReferenceIterationMode reference_iteration_mode();
 
   virtual void do_oop(oop* p);
   virtual void do_oop(narrowOop* p);
@@ -102,6 +99,8 @@
 
 class ZVerifyRootOopClosure : public OopClosure {
 public:
+  ZVerifyRootOopClosure();
+
   virtual void do_oop(oop* p);
   virtual void do_oop(narrowOop* p);
 };
--- a/src/hotspot/share/gc/z/zPageAllocator.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zPageAllocator.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -145,7 +145,7 @@
 void ZPageAllocator::increase_used(size_t size, bool relocation) {
   if (relocation) {
     // Allocating a page for the purpose of relocation has a
-    // negative contribution to the number of relcaimed bytes.
+    // negative contribution to the number of reclaimed bytes.
     _reclaimed -= size;
   }
   _allocated += size;
--- a/src/hotspot/share/gc/z/zRootsIterator.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zRootsIterator.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -244,7 +244,7 @@
 
   virtual void do_thread(Thread* thread) {
     if (thread->is_Java_thread()) {
-      // Update thread local adddress bad mask
+      // Update thread local address bad mask
       ZThreadLocalData::set_address_bad_mask(thread, ZAddressBadMask);
     }
 
--- a/src/hotspot/share/gc/z/zServiceability.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zServiceability.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -149,7 +149,7 @@
 
 ZServiceabilityCountersTracer::ZServiceabilityCountersTracer() {
   // Nothing to trace with TraceCollectorStats, since ZGC has
-  // neither a young collector or a full collector.
+  // neither a young collector nor a full collector.
 }
 
 ZServiceabilityCountersTracer::~ZServiceabilityCountersTracer() {
--- a/src/hotspot/share/gc/z/zStat.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zStat.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -482,7 +482,7 @@
 }
 
 //
-// Stat MMU (Mimimum Mutator Utilization)
+// Stat MMU (Minimum Mutator Utilization)
 //
 ZStatMMUPause::ZStatMMUPause() :
     _start(0.0),
@@ -560,9 +560,8 @@
 }
 
 void ZStatMMU::print() {
-  log_info(gc, mmu)(
-     "MMU: 2ms/%.1f%%, 5ms/%.1f%%, 10ms/%.1f%%, 20ms/%.1f%%, 50ms/%.1f%%, 100ms/%.1f%%",
-     _mmu_2ms, _mmu_5ms, _mmu_10ms, _mmu_20ms, _mmu_50ms, _mmu_100ms);
+  log_info(gc, mmu)("MMU: 2ms/%.1f%%, 5ms/%.1f%%, 10ms/%.1f%%, 20ms/%.1f%%, 50ms/%.1f%%, 100ms/%.1f%%",
+                    _mmu_2ms, _mmu_5ms, _mmu_10ms, _mmu_20ms, _mmu_50ms, _mmu_100ms);
 }
 
 //
--- a/src/hotspot/share/gc/z/zStat.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zStat.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -156,7 +156,7 @@
 };
 
 //
-// Stat MMU (Mimimum Mutator Utilization)
+// Stat MMU (Minimum Mutator Utilization)
 //
 class ZStatMMUPause {
 private:
--- a/src/hotspot/share/gc/z/zUtils.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zUtils.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -35,7 +35,7 @@
   static size_t round_up_power_of_2(size_t value);
   static size_t round_down_power_of_2(size_t value);
 
-  // Size convertion
+  // Size conversion
   static size_t bytes_to_words(size_t size_in_words);
   static size_t words_to_bytes(size_t size_in_words);
 
--- a/src/hotspot/share/gc/z/zWorkers.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/gc/z/zWorkers.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -44,7 +44,7 @@
 uint ZWorkers::calculate_nconcurrent() {
   // Use 12.5% of the CPUs, rounded up. The number of concurrent threads we
   // would like to use heavily depends on the type of workload we are running.
-  // Using too many threads will have a nagative impact on the application
+  // Using too many threads will have a negative impact on the application
   // throughput, while using too few threads will prolong the GC-cycle and
   // we then risk being out-run by the application. Using 12.5% of the active
   // processors appears to be a fairly good balance.
--- a/src/hotspot/share/jfr/jfr.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/jfr/jfr.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -85,12 +85,12 @@
   LeakProfiler::oops_do(is_alive, f);
 }
 
-bool Jfr::on_start_flight_recording_option(const JavaVMOption** option, char* tail) {
-  return JfrOptionSet::parse_start_flight_recording_option(option, tail);
+bool Jfr::on_flight_recorder_option(const JavaVMOption** option, char* delimiter) {
+  return JfrOptionSet::parse_flight_recorder_option(option, delimiter);
 }
 
-bool Jfr::on_flight_recorder_option(const JavaVMOption** option, char* tail) {
-  return JfrOptionSet::parse_flight_recorder_option(option, tail);
+bool Jfr::on_start_flight_recording_option(const JavaVMOption** option, char* delimiter) {
+  return JfrOptionSet::parse_start_flight_recording_option(option, delimiter);
 }
 
 Thread* Jfr::sampler_thread() {
--- a/src/hotspot/share/jfr/jfr.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/jfr/jfr.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -49,8 +49,8 @@
   static void on_thread_exit(JavaThread* thread);
   static void on_thread_destruct(Thread* thread);
   static void on_vm_shutdown(bool exception_handler = false);
-  static bool on_start_flight_recording_option(const JavaVMOption** option, char* tail);
-  static bool on_flight_recorder_option(const JavaVMOption** option, char* tail);
+  static bool on_flight_recorder_option(const JavaVMOption** option, char* delimiter);
+  static bool on_start_flight_recording_option(const JavaVMOption** option, char* delimiter);
   static void weak_oops_do(BoolObjectClosure* is_alive, OopClosure* f);
   static Thread* sampler_thread();
 };
--- a/src/hotspot/share/jfr/leakprofiler/emitEventOperation.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/jfr/leakprofiler/emitEventOperation.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -216,6 +216,7 @@
   e.set_starttime(GranularTimer::start_time());
   e.set_endtime(GranularTimer::end_time());
   e.set_allocationTime(sample->allocation_time());
+  e.set_lastKnownHeapUsage(sample->heap_used_at_last_gc());
   e.set_object(object_id);
   e.set_arrayElements(array_size(*object_addr));
   e.set_root(gc_root_id);
--- a/src/hotspot/share/jfr/leakprofiler/sampling/objectSample.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/jfr/leakprofiler/sampling/objectSample.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -53,6 +53,7 @@
   int _index;
   size_t _span;
   size_t _allocated;
+  size_t _heap_used_at_last_gc;
   unsigned int _stack_trace_hash;
   bool _dead;
 
@@ -88,6 +89,7 @@
                    _index(0),
                    _span(0),
                    _allocated(0),
+                   _heap_used_at_last_gc(0),
                    _stack_trace_hash(0),
                    _dead(false) {}
 
@@ -164,6 +166,14 @@
     _allocation_time = Ticks(time.value());
   }
 
+  void set_heap_used_at_last_gc(size_t heap_used) {
+    _heap_used_at_last_gc = heap_used;
+  }
+
+  size_t heap_used_at_last_gc() const {
+    return _heap_used_at_last_gc;
+  }
+
   bool has_stack_trace() const {
     return stack_trace_id() != 0;
   }
--- a/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -32,9 +32,10 @@
 #include "jfr/recorder/stacktrace/jfrStackTraceRepository.hpp"
 #include "jfr/support/jfrThreadLocal.hpp"
 #include "jfr/utilities/jfrTryLock.hpp"
+#include "logging/log.hpp"
+#include "memory/universe.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/thread.hpp"
-#include "logging/log.hpp"
 
 ObjectSampler::ObjectSampler(size_t size) :
   _priority_queue(new SamplePriorityQueue(size)),
@@ -73,8 +74,6 @@
     thread->jfr_thread_local()->set_cached_stack_trace_id(stack_trace_id, stack_trace_hash);
   }
 
-  const JfrTicks allocation_time = JfrTicks::now();
-
   JfrTryLock tryLock(&_tryLock);
   if (!tryLock.has_lock()) {
     log_trace(jfr, oldobject, sampling)("Skipping old object sample due to lock contention");
@@ -114,7 +113,8 @@
   sample->set_span(allocated);
   sample->set_object((oop)obj);
   sample->set_allocated(allocated);
-  sample->set_allocation_time(allocation_time);
+  sample->set_allocation_time(JfrTicks::now());
+  sample->set_heap_used_at_last_gc(Universe::get_heap_used_at_last_gc());
   _priority_queue->push(sample);
 }
 
--- a/src/hotspot/share/jfr/metadata/metadata.xml	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/jfr/metadata/metadata.xml	Thu Jul 05 11:53:53 2018 +0100
@@ -577,6 +577,7 @@
   <Event name="OldObjectSample" category="Java Application" label="Old Object Sample" description="A potential memory leak" stackTrace="true" thread="true"
     startTime="false" cutoff="true">
     <Field type="Ticks" name="allocationTime" label="Allocation Time" />
+    <Field type="ulong" contentType="bytes" name="lastKnownHeapUsage" label="Last Known Heap Usage" />
     <Field type="OldObject" name="object" label="Object" />
     <Field type="int" name="arrayElements" label="Array Elements" description="If the object is an array, the number of elements, or -1 if it is not an array" />
     <Field type="OldObjectGcRoot" name="root" label="GC Root" />
@@ -656,6 +657,12 @@
     <Field type="float" name="switchRate" label="Switch Rate" description="Number of context switches per second" />
   </Event>
 
+  <Event name="NetworkUtilization" category="Operating System, Network" label="Network Utilization" period="everyChunk">
+    <Field type="NetworkInterfaceName" name="networkInterface" label="Network Interface" description="Network Interface Name"/>
+    <Field type="long" contentType="bytes" name="readRate" label="Read Rate" description="Number of incoming bytes per second"/>
+    <Field type="long" contentType="bytes" name="writeRate" label="Write Rate" description="Number of outgoing bytes per second"/>
+  </Event>
+
   <Event name="JavaThreadStatistics" category="Java Application, Statistics" label="Java Thread Statistics" period="everyChunk">
     <Field type="long" name="activeCount" label="Active Threads" description="Number of live active threads including both daemon and non-daemon threads" />
     <Field type="long" name="daemonCount" label="Daemon Threads" description="Number of live daemon threads" />
@@ -918,6 +925,10 @@
     <Field type="string" name="sampler" label="Sampler" />
   </Type>
 
+  <Type name="NetworkInterfaceName" label="Network Interface">
+    <Field type="string" name="networkInterface" label="Network Interface" description="Network Interface Name" />
+  </Type>
+
   <Type name="Thread" label="Thread">
     <Field type="string" name="osName" label="OS Thread Name" />
     <Field type="long" name="osThreadId" label="OS Thread Id" />
@@ -1122,4 +1133,4 @@
   <XmlContentType name="percentage" annotationType="jdk.jfr.Percentage" />
   <XmlContentType name="millis" annotationType="jdk.jfr.Timespan" annotationValue="MILLISECONDS" />
 
-</Metadata>
\ No newline at end of file
+</Metadata>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/jfr/periodic/jfrNetworkUtilization.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "logging/log.hpp"
+#include "jfr/jfrEvents.hpp"
+#include "jfr/metadata/jfrSerializer.hpp"
+#include "jfr/periodic/jfrNetworkUtilization.hpp"
+#include "jfr/periodic/jfrOSInterface.hpp"
+#include "jfr/utilities/jfrTime.hpp"
+#include "jfr/utilities/jfrTypes.hpp"
+#include "runtime/os_perf.hpp"
+#include "utilities/globalDefinitions.hpp"
+#include "utilities/growableArray.hpp"
+
+struct InterfaceEntry {
+  char* name;
+  traceid id;
+  uint64_t bytes_in;
+  uint64_t bytes_out;
+  bool in_use;
+};
+
+static GrowableArray<InterfaceEntry>* _interfaces = NULL;
+
+void JfrNetworkUtilization::destroy() {
+  if (_interfaces != NULL) {
+    for (int i = 0; i < _interfaces->length(); ++i) {
+      FREE_C_HEAP_ARRAY(char, _interfaces->at(i).name);
+    }
+    delete _interfaces;
+    _interfaces = NULL;
+  }
+}
+
+static InterfaceEntry& new_entry(const NetworkInterface* iface, GrowableArray<InterfaceEntry>* interfaces) {
+  assert(iface != NULL, "invariant");
+  assert(interfaces != NULL, "invariant");
+
+  // single threaded premise
+  static traceid interface_id = 0;
+
+  const char* name = iface->get_name();
+  assert(name != NULL, "invariant");
+
+  InterfaceEntry entry;
+  const size_t length = strlen(name);
+  entry.name = NEW_C_HEAP_ARRAY(char, length + 1, mtInternal);
+  strncpy(entry.name, name, length + 1);
+  entry.id = ++interface_id;
+  entry.bytes_in = iface->get_bytes_in();
+  entry.bytes_out = iface->get_bytes_out();
+  entry.in_use = false;
+  return _interfaces->at(_interfaces->append(entry));
+}
+
+static GrowableArray<InterfaceEntry>* get_interfaces() {
+  if (_interfaces == NULL) {
+    _interfaces = new(ResourceObj::C_HEAP, mtTracing) GrowableArray<InterfaceEntry>(10, true, mtTracing);
+  }
+  return _interfaces;
+}
+
+static InterfaceEntry& get_entry(const NetworkInterface* iface) {
+  // Remember the index we started at last time, since we're most likely looking at them
+  // in the same order every time.
+  static int saved_index = -1;
+
+  GrowableArray<InterfaceEntry>* interfaces = get_interfaces();
+  assert(interfaces != NULL, "invariant");
+  for (int i = 0; i < _interfaces->length(); ++i) {
+    saved_index = (saved_index + 1) % _interfaces->length();
+    if (strcmp(_interfaces->at(saved_index).name, iface->get_name()) == 0) {
+      return _interfaces->at(saved_index);
+    }
+  }
+  return new_entry(iface, interfaces);
+}
+
+// If current counters are less than previous we assume the interface has been reset
+// If no bytes have been either sent or received, we'll also skip the event
+static uint64_t rate_per_second(uint64_t current, uint64_t old, const JfrTickspan& interval) {
+  assert(interval.value() > 0, "invariant");
+  if (current <= old) {
+    return 0;
+  }
+  return ((current - old) * NANOSECS_PER_SEC) / interval.nanoseconds();
+}
+
+static bool get_interfaces(NetworkInterface** network_interfaces) {
+  const int ret_val = JfrOSInterface::network_utilization(network_interfaces);
+  if (ret_val == OS_ERR) {
+    log_debug(jfr, system)("Unable to generate network utilization events");
+    return false;
+  }
+  return ret_val != FUNCTIONALITY_NOT_IMPLEMENTED;
+}
+
+class JfrNetworkInterfaceName : public JfrSerializer {
+ public:
+  void serialize(JfrCheckpointWriter& writer) {
+    assert(_interfaces != NULL, "invariant");
+    const JfrCheckpointContext ctx = writer.context();
+    const intptr_t count_offset = writer.reserve(sizeof(u4)); // Don't know how many yet
+    int active_interfaces = 0;
+    for (int i = 0; i < _interfaces->length(); ++i) {
+      InterfaceEntry& entry = _interfaces->at(i);
+      if (entry.in_use) {
+        entry.in_use = false;
+        writer.write_key(entry.id);
+        writer.write(entry.name);
+        ++active_interfaces;
+      }
+    }
+    if (active_interfaces == 0) {
+      // nothing to write, restore context
+      writer.set_context(ctx);
+      return;
+    }
+    writer.write_count(active_interfaces, count_offset);
+  }
+};
+
+static bool register_network_interface_name_serializer() {
+  assert(_interfaces != NULL, "invariant");
+  return JfrSerializer::register_serializer(TYPE_NETWORKINTERFACENAME,
+                                            false, // require safepoint
+                                            false, // disallow caching; we want a callback every rotation
+                                            new JfrNetworkInterfaceName());
+}
+
+void JfrNetworkUtilization::send_events() {
+  ResourceMark rm;
+  NetworkInterface* network_interfaces;
+  if (!get_interfaces(&network_interfaces)) {
+    return;
+  }
+  log_trace(jfr, event)("Reporting network utilization");
+  static JfrTicks last_sample_instant;
+  const JfrTicks cur_time = JfrTicks::now();
+  const JfrTickspan interval = last_sample_instant == 0 ? cur_time - cur_time : cur_time - last_sample_instant;
+  last_sample_instant = cur_time;
+  for (NetworkInterface *cur = network_interfaces; cur != NULL; cur = cur->next()) {
+    InterfaceEntry& entry = get_entry(cur);
+    if (interval.value() > 0) {
+      const uint64_t current_bytes_in = cur->get_bytes_in();
+      const uint64_t current_bytes_out = cur->get_bytes_out();
+      const uint64_t read_rate = rate_per_second(current_bytes_in, entry.bytes_in, interval);
+      const uint64_t write_rate = rate_per_second(current_bytes_out, entry.bytes_out, interval);
+      if (read_rate > 0 || write_rate > 0) {
+        entry.in_use = true;
+        EventNetworkUtilization event(UNTIMED);
+        event.set_starttime(cur_time);
+        event.set_endtime(cur_time);
+        event.set_networkInterface(entry.id);
+        event.set_readRate(read_rate);
+        event.set_writeRate(write_rate);
+        event.commit();
+      }
+      // update existing entry with new values
+      entry.bytes_in = current_bytes_in;
+      entry.bytes_out = current_bytes_out;
+    }
+  }
+
+  static bool is_serializer_registered = false;
+  if (!is_serializer_registered) {
+    is_serializer_registered = register_network_interface_name_serializer();
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/jfr/periodic/jfrNetworkUtilization.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_JFR_PERIODIC_JFRNETWORKUTILIZATION_HPP
+#define SHARE_VM_JFR_PERIODIC_JFRNETWORKUTILIZATION_HPP
+
+#include "memory/allocation.hpp"
+
+class NetworkInterface;
+
+class JfrNetworkUtilization : public AllStatic {
+public:
+  static void destroy();
+  static void send_events();
+};
+
+#endif // SHARE_VM_JFR_PERIODIC_JFRNETWORKUTILIZATION_HPP
--- a/src/hotspot/share/jfr/periodic/jfrOSInterface.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/jfr/periodic/jfrOSInterface.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "jfr/jfrEvents.hpp"
+#include "jfr/periodic/jfrNetworkUtilization.hpp"
 #include "jfr/periodic/jfrOSInterface.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/resourceArea.hpp"
@@ -54,6 +55,7 @@
 }
 
 void JfrOSInterface::destroy() {
+  JfrNetworkUtilization::destroy();
   if (_instance != NULL) {
     delete _instance;
     _instance = NULL;
@@ -66,6 +68,7 @@
   CPUInformationInterface* _cpu_info_interface;
   CPUPerformanceInterface* _cpu_perf_interface;
   SystemProcessInterface*  _system_process_interface;
+  NetworkPerformanceInterface* _network_performance_interface;
 
   // stub helper
   void functionality_not_implemented(char** str) const;
@@ -89,6 +92,8 @@
 
    // system processes information
   int system_processes(SystemProcess** system_processes, int* no_of_sys_processes);
+
+  int network_utilization(NetworkInterface** network_interfaces) const;
 };
 
 JfrOSInterface::JfrOSInterfaceImpl::JfrOSInterfaceImpl() : _cpu_info_interface(NULL),
@@ -97,18 +102,19 @@
 
 bool JfrOSInterface::JfrOSInterfaceImpl::initialize() {
   _cpu_info_interface = new CPUInformationInterface();
-  bool success = _cpu_info_interface != NULL && _cpu_info_interface->initialize();
-  if (!success) {
+  if (!(_cpu_info_interface != NULL && _cpu_info_interface->initialize())) {
     return false;
   }
   _cpu_perf_interface = new CPUPerformanceInterface();
-  success = _cpu_perf_interface != NULL && _cpu_perf_interface->initialize();
-  if (!success) {
+  if (!(_cpu_perf_interface != NULL && _cpu_perf_interface->initialize())) {
     return false;
   }
   _system_process_interface = new SystemProcessInterface();
-  success = _system_process_interface != NULL && _system_process_interface->initialize();
-  return success;
+  if (!(_system_process_interface != NULL && _system_process_interface->initialize())) {
+    return false;
+  }
+  _network_performance_interface = new NetworkPerformanceInterface();
+  return _network_performance_interface != NULL && _network_performance_interface->initialize();
 }
 
 JfrOSInterface::JfrOSInterfaceImpl::~JfrOSInterfaceImpl(void) {
@@ -124,6 +130,10 @@
     delete _system_process_interface;
     _system_process_interface = NULL;
   }
+  if (_network_performance_interface != NULL) {
+    delete _network_performance_interface;
+    _network_performance_interface = NULL;
+  }
 }
 
 int JfrOSInterface::JfrOSInterfaceImpl::cpu_load(int which_logical_cpu, double* cpu_load) {
@@ -154,6 +164,10 @@
   return _system_process_interface->system_processes(system_processes, no_of_sys_processes);
 }
 
+int JfrOSInterface::JfrOSInterfaceImpl::network_utilization(NetworkInterface** network_interfaces) const {
+  return _network_performance_interface->network_utilization(network_interfaces);
+}
+
 // assigned char* is RESOURCE_HEAP_ALLOCATED
 // caller need to ensure proper ResourceMark placement.
 int JfrOSInterface::JfrOSInterfaceImpl::os_version(char** os_version) const {
@@ -246,3 +260,7 @@
 int JfrOSInterface::system_processes(SystemProcess** sys_processes, int* no_of_sys_processes) {
   return instance()._impl->system_processes(sys_processes, no_of_sys_processes);
 }
+
+int JfrOSInterface::network_utilization(NetworkInterface** network_interfaces) {
+  return instance()._impl->network_utilization(network_interfaces);
+}
--- a/src/hotspot/share/jfr/periodic/jfrOSInterface.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/jfr/periodic/jfrOSInterface.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -26,10 +26,10 @@
 #define SHARE_VM_JFR_PERIODIC_JFROSINTERFACE_HPP
 
 #include "jfr/utilities/jfrAllocation.hpp"
-#include "utilities/globalDefinitions.hpp"
 
 class CPUInformation;
 class EnvironmentVariable;
+class NetworkInterface;
 class SystemProcess;
 
 class JfrOSInterface: public JfrCHeapObj {
@@ -54,6 +54,7 @@
   static int os_version(char** os_version);
   static int generate_initial_environment_variable_events();
   static int system_processes(SystemProcess** system_processes, int* no_of_sys_processes);
+  static int network_utilization(NetworkInterface** network_interfaces);
 };
 
 #endif // SHARE_VM_JFR_PERIODIC_JFROSINTERFACE_HPP
--- a/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -38,6 +38,7 @@
 #include "jfr/periodic/jfrOSInterface.hpp"
 #include "jfr/periodic/jfrThreadCPULoadEvent.hpp"
 #include "jfr/periodic/jfrThreadDumpEvent.hpp"
+#include "jfr/periodic/jfrNetworkUtilization.hpp"
 #include "jfr/recorder/jfrRecorder.hpp"
 #include "jfr/support/jfrThreadId.hpp"
 #include "jfr/utilities/jfrTime.hpp"
@@ -176,6 +177,10 @@
   JfrThreadCPULoadEvent::send_events();
 }
 
+TRACE_REQUEST_FUNC(NetworkUtilization) {
+  JfrNetworkUtilization::send_events();
+}
+
 TRACE_REQUEST_FUNC(CPUTimeStampCounter) {
   EventCPUTimeStampCounter event;
   event.set_fastTimeEnabled(JfrTime::is_ft_enabled());
--- a/src/hotspot/share/jfr/recorder/jfrRecorder.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/jfr/recorder/jfrRecorder.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -46,6 +46,7 @@
 #include "runtime/handles.inline.hpp"
 #include "runtime/flags/jvmFlag.hpp"
 #include "runtime/globals.hpp"
+#include "utilities/growableArray.hpp"
 
 static bool is_disabled_on_command_line() {
   static const size_t length = strlen("FlightRecorder");
@@ -85,31 +86,30 @@
   return JfrTime::initialize();
 }
 
-static JfrStartFlightRecordingDCmd* _startup_recording = NULL;
+static GrowableArray<JfrStartFlightRecordingDCmd*>* dcmd_recordings_array = NULL;
 
-static void release_startup_recording() {
-  if (_startup_recording != NULL) {
-    delete _startup_recording;
-    _startup_recording = NULL;
+static void release_recordings() {
+  if (dcmd_recordings_array != NULL) {
+    const int length = dcmd_recordings_array->length();
+    for (int i = 0; i < length; ++i) {
+      delete dcmd_recordings_array->at(i);
+    }
+    delete dcmd_recordings_array;
+    dcmd_recordings_array = NULL;
   }
 }
 
 static void teardown_startup_support() {
-  release_startup_recording();
-  JfrOptionSet::release_startup_recordings();
+  release_recordings();
+  JfrOptionSet::release_startup_recording_options();
 }
 
-
 // Parsing options here to detect errors as soon as possible
-static bool parse_recording_options(const char* options, TRAPS) {
+static bool parse_recording_options(const char* options, JfrStartFlightRecordingDCmd* dcmd_recording, TRAPS) {
   assert(options != NULL, "invariant");
-  if (_startup_recording != NULL) {
-    delete _startup_recording;
-  }
+  assert(dcmd_recording != NULL, "invariant");
   CmdLine cmdline(options, strlen(options), true);
-  _startup_recording = new (ResourceObj::C_HEAP, mtTracing) JfrStartFlightRecordingDCmd(tty, true);
-  assert(_startup_recording != NULL, "invariant");
-  _startup_recording->parse(&cmdline, ',', THREAD);
+  dcmd_recording->parse(&cmdline, ',', THREAD);
   if (HAS_PENDING_EXCEPTION) {
     java_lang_Throwable::print(PENDING_EXCEPTION, tty);
     CLEAR_PENDING_EXCEPTION;
@@ -119,24 +119,30 @@
 }
 
 static bool validate_recording_options(TRAPS) {
-  const GrowableArray<const char*>* startup_options = JfrOptionSet::startup_recordings();
-  if (startup_options == NULL) {
+  const GrowableArray<const char*>* options = JfrOptionSet::startup_recording_options();
+  if (options == NULL) {
     return true;
   }
-  const int length = startup_options->length();
+  const int length = options->length();
   assert(length >= 1, "invariant");
+  assert(dcmd_recordings_array == NULL, "invariant");
+  dcmd_recordings_array = new (ResourceObj::C_HEAP, mtTracing)GrowableArray<JfrStartFlightRecordingDCmd*>(length, true, mtTracing);
+  assert(dcmd_recordings_array != NULL, "invariant");
   for (int i = 0; i < length; ++i) {
-    if (!parse_recording_options(startup_options->at(i), THREAD)) {
+    JfrStartFlightRecordingDCmd* const dcmd_recording = new(ResourceObj::C_HEAP, mtTracing) JfrStartFlightRecordingDCmd(tty, true);
+    assert(dcmd_recording != NULL, "invariant");
+    dcmd_recordings_array->append(dcmd_recording);
+    if (!parse_recording_options(options->at(i), dcmd_recording, THREAD)) {
       return false;
     }
   }
   return true;
 }
 
-static bool launch_recording(TRAPS) {
-  assert(_startup_recording != NULL, "invariant");
+static bool launch_recording(JfrStartFlightRecordingDCmd* dcmd_recording, TRAPS) {
+  assert(dcmd_recording != NULL, "invariant");
   log_trace(jfr, system)("Starting a recording");
-  _startup_recording->execute(DCmd_Source_Internal, Thread::current());
+  dcmd_recording->execute(DCmd_Source_Internal, THREAD);
   if (HAS_PENDING_EXCEPTION) {
     log_debug(jfr, system)("Exception while starting a recording");
     CLEAR_PENDING_EXCEPTION;
@@ -146,31 +152,20 @@
   return true;
 }
 
-static bool launch_recordings(const GrowableArray<const char*>* startup_options, TRAPS) {
-  assert(startup_options != NULL, "invariant");
-  const int length = startup_options->length();
-  assert(length >= 1, "invariant");
-  if (length == 1) {
-    // already parsed and ready, launch it
-    return launch_recording(THREAD);
-  }
-  for (int i = 0; i < length; ++i) {
-    parse_recording_options(startup_options->at(i), THREAD);
-    if (!launch_recording(THREAD)) {
-      return false;
+static bool launch_recordings(TRAPS) {
+  bool result = true;
+  if (dcmd_recordings_array != NULL) {
+    const int length = dcmd_recordings_array->length();
+    assert(length >= 1, "invariant");
+    for (int i = 0; i < length; ++i) {
+      if (!launch_recording(dcmd_recordings_array->at(i), THREAD)) {
+        result = false;
+        break;
+      }
     }
   }
-  return true;
-}
-
-static bool startup_recordings(TRAPS) {
-  const GrowableArray<const char*>* startup_options = JfrOptionSet::startup_recordings();
-  if (startup_options == NULL) {
-    return true;
-  }
-  const bool ret = launch_recordings(startup_options, THREAD);
   teardown_startup_support();
-  return ret;
+  return result;
 }
 
 static void log_jdk_jfr_module_resolution_error(TRAPS) {
@@ -180,13 +175,20 @@
   JfrJavaSupport::is_jdk_jfr_module_available(&stream, THREAD);
 }
 
-bool JfrRecorder::on_vm_start() {
-  if (DumpSharedSpaces && (JfrOptionSet::startup_recordings() != NULL)) {
+static bool is_cds_dump_requested() {
+  // we will not be able to launch recordings if a cds dump is being requested
+  if (DumpSharedSpaces && (JfrOptionSet::startup_recording_options() != NULL)) {
     warning("JFR will be disabled during CDS dumping");
     teardown_startup_support();
     return true;
   }
-  const bool in_graph = JfrJavaSupport::is_jdk_jfr_module_available();
+  return false;
+}
+
+bool JfrRecorder::on_vm_start() {
+  if (is_cds_dump_requested()) {
+    return true;
+  }
   Thread* const thread = Thread::current();
   if (!JfrOptionSet::initialize(thread)) {
     return false;
@@ -194,10 +196,13 @@
   if (!register_jfr_dcmds()) {
     return false;
   }
-  if (!validate_recording_options(thread)) {
-    return false;
-  }
+
+  const bool in_graph = JfrJavaSupport::is_jdk_jfr_module_available();
+
   if (in_graph) {
+    if (!validate_recording_options(thread)) {
+      return false;
+    }
     if (!JfrJavaEventWriter::initialize()) {
       return false;
     }
@@ -205,14 +210,17 @@
       return false;
     }
   }
+
   if (!is_enabled()) {
     return true;
   }
+
   if (!in_graph) {
     log_jdk_jfr_module_resolution_error(thread);
     return false;
   }
-  return startup_recordings(thread);
+
+  return launch_recordings(thread);
 }
 
 static bool _created = false;
--- a/src/hotspot/share/jfr/recorder/service/jfrOptionSet.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/jfr/recorder/service/jfrOptionSet.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -665,59 +665,66 @@
   return true;
 }
 
-static GrowableArray<const char*>* startup_recording_array = NULL;
-
-bool JfrOptionSet::parse_start_flight_recording_option(const JavaVMOption** option, char* tail) {
+bool JfrOptionSet::parse_flight_recorder_option(const JavaVMOption** option, char* delimiter) {
   assert(option != NULL, "invariant");
-  assert(tail != NULL, "invariant");
-  assert((*option)->optionString != NULL, "invariant");
-  assert(strncmp((*option)->optionString, "-XX:StartFlightRecording", 24) == 0, "invariant");
-  const char* param_string = NULL;
-  if (*tail == '\0') {
-    // Add dummy dumponexit=false so -XX:StartFlightRecording can be used without a parameter.
-    // The existing option->optionString points to stack memory so no need to deallocate.
-    const_cast<JavaVMOption*>(*option)->optionString = (char*)"-XX:StartFlightRecording=dumponexit=false";
-    param_string = (*option)->optionString + 25;
-  } else {
-    *tail = '='; // ":" -> "="
-    param_string = tail + 1;
-  }
-  assert(param_string != NULL, "invariant");
-  const size_t param_length = strlen(param_string);
-
-  if (startup_recording_array == NULL) {
-    startup_recording_array = new (ResourceObj::C_HEAP, mtTracing) GrowableArray<const char*>(8, true, mtTracing);
-  }
-  assert(startup_recording_array != NULL, "invariant");
-  char* startup_options = NEW_C_HEAP_ARRAY(char, param_length + 1, mtTracing);
-  strncpy(startup_options, param_string, strlen(param_string) + 1);
-  assert(strncmp(param_string, startup_options, param_length) == 0, "invariant");
-  startup_recording_array->append(startup_options);
-  return false;
-}
-
-const GrowableArray<const char*>* JfrOptionSet::startup_recordings() {
-  return startup_recording_array;
-}
-
-void JfrOptionSet::release_startup_recordings() {
-  if (startup_recording_array != NULL) {
-    for (int i = 0; i < startup_recording_array->length(); ++i) {
-      FREE_C_HEAP_ARRAY(char, startup_recording_array->at(i));
-    }
-  }
-  delete startup_recording_array;
-  startup_recording_array = NULL;
-}
-
-bool JfrOptionSet::parse_flight_recorder_option(const JavaVMOption** option, char* tail) {
-  assert(option != NULL, "invariant");
-  assert(tail != NULL, "invariant");
+  assert(delimiter != NULL, "invariant");
   assert((*option)->optionString != NULL, "invariant");
   assert(strncmp((*option)->optionString, "-XX:FlightRecorderOptions", 25) == 0, "invariant");
-  if (tail != NULL) {
-    *tail = '='; // ":" -> "="
+  if (*delimiter == '\0') {
+    // -XX:FlightRecorderOptions without any delimiter and values
+  } else {
+    // -XX:FlightRecorderOptions[=|:]
+    // set delimiter to '='
+    *delimiter = '=';
   }
   return false;
 }
 
+static GrowableArray<const char*>* startup_recording_options_array = NULL;
+
+bool JfrOptionSet::parse_start_flight_recording_option(const JavaVMOption** option, char* delimiter) {
+  assert(option != NULL, "invariant");
+  assert(delimiter != NULL, "invariant");
+  assert((*option)->optionString != NULL, "invariant");
+  assert(strncmp((*option)->optionString, "-XX:StartFlightRecording", 24) == 0, "invariant");
+  const char* value = NULL;
+  if (*delimiter == '\0') {
+    // -XX:StartFlightRecording without any delimiter and values
+    // Add dummy value "dumponexit=false" so -XX:StartFlightRecording can be used without explicit values.
+    // The existing option->optionString points to stack memory so no need to deallocate.
+    const_cast<JavaVMOption*>(*option)->optionString = (char*)"-XX:StartFlightRecording=dumponexit=false";
+    value = (*option)->optionString + 25;
+  } else {
+    // -XX:StartFlightRecording[=|:]
+    // set delimiter to '='
+    *delimiter = '=';
+    value = delimiter + 1;
+  }
+  assert(value != NULL, "invariant");
+  const size_t value_length = strlen(value);
+
+  if (startup_recording_options_array == NULL) {
+    startup_recording_options_array = new (ResourceObj::C_HEAP, mtTracing) GrowableArray<const char*>(8, true, mtTracing);
+  }
+  assert(startup_recording_options_array != NULL, "invariant");
+  char* const startup_value = NEW_C_HEAP_ARRAY(char, value_length + 1, mtTracing);
+  strncpy(startup_value, value, value_length + 1);
+  assert(strncmp(startup_value, value, value_length) == 0, "invariant");
+  startup_recording_options_array->append(startup_value);
+  return false;
+}
+
+const GrowableArray<const char*>* JfrOptionSet::startup_recording_options() {
+  return startup_recording_options_array;
+}
+
+void JfrOptionSet::release_startup_recording_options() {
+  if (startup_recording_options_array != NULL) {
+    const int length = startup_recording_options_array->length();
+    for (int i = 0; i < length; ++i) {
+      FREE_C_HEAP_ARRAY(char, startup_recording_options_array->at(i));
+    }
+    delete startup_recording_options_array;
+    startup_recording_options_array = NULL;
+  }
+}
--- a/src/hotspot/share/jfr/recorder/service/jfrOptionSet.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/jfr/recorder/service/jfrOptionSet.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -78,11 +78,10 @@
   static bool sample_protection();
   DEBUG_ONLY(static void set_sample_protection(jboolean protection);)
 
-  static bool parse_start_flight_recording_option(const JavaVMOption** option, char* tail);
-  static bool parse_flight_recorder_option(const JavaVMOption** option, char* tail);
-
-  static const GrowableArray<const char*>* startup_recordings();
-  static void release_startup_recordings();
+  static bool parse_flight_recorder_option(const JavaVMOption** option, char* delimiter);
+  static bool parse_start_flight_recording_option(const JavaVMOption** option, char* delimiter);
+  static const GrowableArray<const char*>* startup_recording_options();
+  static void release_startup_recording_options();
 };
 
 #endif // SHARE_VM_JFR_RECORDER_SERVICE_JFROPTIONSET_HPP
--- a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -299,6 +299,7 @@
   static_field(StubRoutines,                _cipherBlockChaining_encryptAESCrypt,             address)                               \
   static_field(StubRoutines,                _cipherBlockChaining_decryptAESCrypt,             address)                               \
   static_field(StubRoutines,                _counterMode_AESCrypt,                            address)                               \
+  static_field(StubRoutines,                _base64_encodeBlock,                              address)                               \
   static_field(StubRoutines,                _ghash_processBlocks,                             address)                               \
   static_field(StubRoutines,                _sha1_implCompress,                               address)                               \
   static_field(StubRoutines,                _sha1_implCompressMB,                             address)                               \
--- a/src/hotspot/share/memory/iterator.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/memory/iterator.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -77,7 +77,8 @@
   enum ReferenceIterationMode {
     DO_DISCOVERY,                // Apply closure and discover references
     DO_DISCOVERED_AND_DISCOVERY, // Apply closure to discovered field and do discovery
-    DO_FIELDS                    // Apply closure to all fields
+    DO_FIELDS,                   // Apply closure to all fields
+    DO_FIELDS_EXCEPT_REFERENT    // Apply closure to all fields except the referent field
   };
 
   // The default iteration mode is to do discovery.
--- a/src/hotspot/share/oops/arrayKlass.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/oops/arrayKlass.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -142,8 +142,8 @@
   int size = objArrayOopDesc::object_size(length);
   Klass* k = array_klass(n+dimension(), CHECK_0);
   ArrayKlass* ak = ArrayKlass::cast(k);
-  objArrayOop o =
-    (objArrayOop)CollectedHeap::array_allocate(ak, size, length, CHECK_0);
+  objArrayOop o = (objArrayOop)Universe::heap()->array_allocate(ak, size, length,
+                                                                /* do_zero */ true, CHECK_0);
   // initialization to NULL not necessary, area already cleared
   return o;
 }
--- a/src/hotspot/share/oops/arrayOop.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/oops/arrayOop.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -109,7 +109,10 @@
     return *(int*)(((intptr_t)this) + length_offset_in_bytes());
   }
   void set_length(int length) {
-    *(int*)(((intptr_t)this) + length_offset_in_bytes()) = length;
+    set_length((HeapWord*)this, length);
+  }
+  static void set_length(HeapWord* mem, int length) {
+    *(int*)(((char*)mem) + length_offset_in_bytes()) = length;
   }
 
   // Should only be called with constants as argument
--- a/src/hotspot/share/oops/instanceKlass.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/oops/instanceKlass.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -1184,8 +1184,8 @@
   }
   int size = objArrayOopDesc::object_size(length);
   Klass* ak = array_klass(n, CHECK_NULL);
-  objArrayOop o =
-    (objArrayOop)CollectedHeap::array_allocate(ak, size, length, CHECK_NULL);
+  objArrayOop o = (objArrayOop)Universe::heap()->array_allocate(ak, size, length,
+                                                                /* do_zero */ true, CHECK_NULL);
   return o;
 }
 
@@ -1210,7 +1210,7 @@
 
   instanceOop i;
 
-  i = (instanceOop)CollectedHeap::obj_allocate(this, size, CHECK_NULL);
+  i = (instanceOop)Universe::heap()->obj_allocate(this, size, CHECK_NULL);
   if (has_finalizer_flag && !RegisterFinalizersAtInit) {
     i = register_finalizer(i, CHECK_NULL);
   }
--- a/src/hotspot/share/oops/instanceMirrorKlass.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/oops/instanceMirrorKlass.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -52,7 +52,7 @@
 
   // Since mirrors can be variable sized because of the static fields, store
   // the size in the mirror itself.
-  return (instanceOop)CollectedHeap::class_allocate(this, size, CHECK_NULL);
+  return (instanceOop)Universe::heap()->class_allocate(this, size, CHECK_NULL);
 }
 
 int InstanceMirrorKlass::oop_size(oop obj) const {
--- a/src/hotspot/share/oops/instanceRefKlass.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/oops/instanceRefKlass.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -131,6 +131,10 @@
   template <typename T, class OopClosureType, class Contains>
   static void oop_oop_iterate_fields(oop obj, OopClosureType* closure, Contains& contains);
 
+  // Apply the closure to all fields, except the referent field. No reference discovery is done.
+  template <typename T, class OopClosureType, class Contains>
+  static void oop_oop_iterate_fields_except_referent(oop obj, OopClosureType* closure, Contains& contains);
+
   template <typename T>
   static void trace_reference_gc(const char *s, oop obj) NOT_DEBUG_RETURN;
 
--- a/src/hotspot/share/oops/instanceRefKlass.inline.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/oops/instanceRefKlass.inline.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -89,17 +89,22 @@
 }
 
 template <typename T, class OopClosureType, class Contains>
+void InstanceRefKlass::oop_oop_iterate_discovered_and_discovery(oop obj, ReferenceType type, OopClosureType* closure, Contains& contains) {
+  // Explicitly apply closure to the discovered field.
+  do_discovered<T>(obj, closure, contains);
+  // Then do normal reference processing with discovery.
+  oop_oop_iterate_discovery<T>(obj, type, closure, contains);
+}
+
+template <typename T, class OopClosureType, class Contains>
 void InstanceRefKlass::oop_oop_iterate_fields(oop obj, OopClosureType* closure, Contains& contains) {
   do_referent<T>(obj, closure, contains);
   do_discovered<T>(obj, closure, contains);
 }
 
 template <typename T, class OopClosureType, class Contains>
-void InstanceRefKlass::oop_oop_iterate_discovered_and_discovery(oop obj, ReferenceType type, OopClosureType* closure, Contains& contains) {
-  // Explicitly apply closure to the discovered field.
+void InstanceRefKlass::oop_oop_iterate_fields_except_referent(oop obj, OopClosureType* closure, Contains& contains) {
   do_discovered<T>(obj, closure, contains);
-  // Then do normal reference processing with discovery.
-  oop_oop_iterate_discovery<T>(obj, type, closure, contains);
 }
 
 template <typename T, class OopClosureType, class Contains>
@@ -117,6 +122,10 @@
       trace_reference_gc<T>("do_fields", obj);
       oop_oop_iterate_fields<T>(obj, closure, contains);
       break;
+    case OopIterateClosure::DO_FIELDS_EXCEPT_REFERENT:
+      trace_reference_gc<T>("do_fields_except_referent", obj);
+      oop_oop_iterate_fields_except_referent<T>(obj, closure, contains);
+      break;
     default:
       ShouldNotReachHere();
   }
--- a/src/hotspot/share/oops/objArrayKlass.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/oops/objArrayKlass.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -173,7 +173,8 @@
   if (length >= 0) {
     if (length <= arrayOopDesc::max_array_length(T_OBJECT)) {
       int size = objArrayOopDesc::object_size(length);
-      return (objArrayOop)CollectedHeap::array_allocate(this, size, length, THREAD);
+      return (objArrayOop)Universe::heap()->array_allocate(this, size, length,
+                                                           /* do_zero */ true, THREAD);
     } else {
       report_java_out_of_memory("Requested array size exceeds VM limit");
       JvmtiExport::post_array_size_exhausted();
--- a/src/hotspot/share/oops/oop.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/oops/oop.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -69,6 +69,7 @@
 
   inline void set_mark(volatile markOop m);
   inline void set_mark_raw(volatile markOop m);
+  static inline void set_mark_raw(HeapWord* mem, markOop m);
 
   inline void release_set_mark(markOop m);
   inline markOop cas_set_mark(markOop new_mark, markOop old_mark);
@@ -82,15 +83,18 @@
   inline Klass* klass() const;
   inline Klass* klass_or_null() const volatile;
   inline Klass* klass_or_null_acquire() const volatile;
+  static inline Klass** klass_addr(HeapWord* mem);
+  static inline narrowKlass* compressed_klass_addr(HeapWord* mem);
   inline Klass** klass_addr();
   inline narrowKlass* compressed_klass_addr();
 
   inline void set_klass(Klass* k);
-  inline void release_set_klass(Klass* k);
+  static inline void release_set_klass(HeapWord* mem, Klass* klass);
 
   // For klass field compression
   inline int klass_gap() const;
   inline void set_klass_gap(int z);
+  static inline void set_klass_gap(HeapWord* mem, int z);
   // For when the klass pointer is being used as a linked list "next" field.
   inline void set_klass_to_list_ptr(oop k);
   inline oop list_ptr_from_klass();
--- a/src/hotspot/share/oops/oop.inline.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/oops/oop.inline.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -63,6 +63,10 @@
   _mark = m;
 }
 
+void oopDesc::set_mark_raw(HeapWord* mem, markOop m) {
+  *(markOop*)(((char*)mem) + mark_offset_in_bytes()) = m;
+}
+
 void oopDesc::release_set_mark(markOop m) {
   HeapAccess<MO_RELEASE>::store_at(as_oop(), mark_offset_in_bytes(), m);
 }
@@ -110,16 +114,26 @@
   }
 }
 
-Klass** oopDesc::klass_addr() {
+Klass** oopDesc::klass_addr(HeapWord* mem) {
   // Only used internally and with CMS and will not work with
   // UseCompressedOops
   assert(!UseCompressedClassPointers, "only supported with uncompressed klass pointers");
-  return (Klass**) &_metadata._klass;
+  ByteSize offset = byte_offset_of(oopDesc, _metadata._klass);
+  return (Klass**) (((char*)mem) + in_bytes(offset));
+}
+
+narrowKlass* oopDesc::compressed_klass_addr(HeapWord* mem) {
+  assert(UseCompressedClassPointers, "only called by compressed klass pointers");
+  ByteSize offset = byte_offset_of(oopDesc, _metadata._compressed_klass);
+  return (narrowKlass*) (((char*)mem) + in_bytes(offset));
+}
+
+Klass** oopDesc::klass_addr() {
+  return klass_addr((HeapWord*)this);
 }
 
 narrowKlass* oopDesc::compressed_klass_addr() {
-  assert(UseCompressedClassPointers, "only called by compressed klass pointers");
-  return &_metadata._compressed_klass;
+  return compressed_klass_addr((HeapWord*)this);
 }
 
 #define CHECK_SET_KLASS(k)                                                \
@@ -137,13 +151,13 @@
   }
 }
 
-void oopDesc::release_set_klass(Klass* k) {
-  CHECK_SET_KLASS(k);
+void oopDesc::release_set_klass(HeapWord* mem, Klass* klass) {
+  CHECK_SET_KLASS(klass);
   if (UseCompressedClassPointers) {
-    OrderAccess::release_store(compressed_klass_addr(),
-                               Klass::encode_klass_not_null(k));
+    OrderAccess::release_store(compressed_klass_addr(mem),
+                               Klass::encode_klass_not_null(klass));
   } else {
-    OrderAccess::release_store(klass_addr(), k);
+    OrderAccess::release_store(klass_addr(mem), klass);
   }
 }
 
@@ -153,10 +167,14 @@
   return *(int*)(((intptr_t)this) + klass_gap_offset_in_bytes());
 }
 
+void oopDesc::set_klass_gap(HeapWord* mem, int v) {
+  if (UseCompressedClassPointers) {
+    *(int*)(((char*)mem) + klass_gap_offset_in_bytes()) = v;
+  }
+}
+
 void oopDesc::set_klass_gap(int v) {
-  if (UseCompressedClassPointers) {
-    *(int*)(((intptr_t)this) + klass_gap_offset_in_bytes()) = v;
-  }
+  set_klass_gap((HeapWord*)this, v);
 }
 
 void oopDesc::set_klass_to_list_ptr(oop k) {
--- a/src/hotspot/share/oops/typeArrayKlass.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/oops/typeArrayKlass.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -102,14 +102,8 @@
   if (length >= 0) {
     if (length <= max_length()) {
       size_t size = typeArrayOopDesc::object_size(layout_helper(), length);
-      typeArrayOop t;
-      CollectedHeap* ch = Universe::heap();
-      if (do_zero) {
-        t = (typeArrayOop)CollectedHeap::array_allocate(this, (int)size, length, CHECK_NULL);
-      } else {
-        t = (typeArrayOop)CollectedHeap::array_allocate_nozero(this, (int)size, length, CHECK_NULL);
-      }
-      return t;
+      return (typeArrayOop)Universe::heap()->array_allocate(this, (int)size, length,
+                                                            do_zero, CHECK_NULL);
     } else {
       report_java_out_of_memory("Requested array size exceeds VM limit");
       JvmtiExport::post_array_size_exhausted();
--- a/src/hotspot/share/opto/c2compiler.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/opto/c2compiler.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -586,6 +586,7 @@
   case vmIntrinsics::_montgomerySquare:
   case vmIntrinsics::_vectorizedMismatch:
   case vmIntrinsics::_ghash_processBlocks:
+  case vmIntrinsics::_base64_encodeBlock:
   case vmIntrinsics::_updateCRC32:
   case vmIntrinsics::_updateBytesCRC32:
   case vmIntrinsics::_updateByteBufferCRC32:
--- a/src/hotspot/share/opto/escape.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/opto/escape.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -1024,6 +1024,7 @@
                   strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_decryptAESCrypt") == 0 ||
                   strcmp(call->as_CallLeaf()->_name, "counterMode_AESCrypt") == 0 ||
                   strcmp(call->as_CallLeaf()->_name, "ghash_processBlocks") == 0 ||
+                  strcmp(call->as_CallLeaf()->_name, "encodeBlock") == 0 ||
                   strcmp(call->as_CallLeaf()->_name, "sha1_implCompress") == 0 ||
                   strcmp(call->as_CallLeaf()->_name, "sha1_implCompressMB") == 0 ||
                   strcmp(call->as_CallLeaf()->_name, "sha256_implCompress") == 0 ||
--- a/src/hotspot/share/opto/gcm.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/opto/gcm.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -683,7 +683,7 @@
     Block* store_block = get_block_for_node(store);
     assert(store_block != NULL, "unused killing projections skipped above");
 
-    if (store->is_Phi() && store->in(0)->is_Loop()) {
+    if (store->is_Phi()) {
       // Loop-phis need to raise load before input. (Other phis are treated
       // as store below.)
       //
--- a/src/hotspot/share/opto/ifnode.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/opto/ifnode.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -1490,7 +1490,8 @@
   // be skipped. For example, range check predicate has two checks
   // for lower and upper bounds.
   ProjNode* unc_proj = proj_out(1 - prev_dom->as_Proj()->_con)->as_Proj();
-  if (unc_proj->is_uncommon_trap_proj(Deoptimization::Reason_predicate) != NULL) {
+  if (unc_proj->is_uncommon_trap_proj(Deoptimization::Reason_predicate) != NULL ||
+      unc_proj->is_uncommon_trap_proj(Deoptimization::Reason_profile_predicate) != NULL) {
     prev_dom = idom;
   }
 
--- a/src/hotspot/share/opto/library_call.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/opto/library_call.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -299,6 +299,7 @@
   Node* get_key_start_from_aescrypt_object(Node* aescrypt_object);
   Node* get_original_key_start_from_aescrypt_object(Node* aescrypt_object);
   bool inline_ghash_processBlocks();
+  bool inline_base64_encodeBlock();
   bool inline_sha_implCompress(vmIntrinsics::ID id);
   bool inline_digestBase_implCompressMB(int predicate);
   bool inline_sha_implCompressMB(Node* digestBaseObj, ciInstanceKlass* instklass_SHA,
@@ -839,6 +840,8 @@
 
   case vmIntrinsics::_ghash_processBlocks:
     return inline_ghash_processBlocks();
+  case vmIntrinsics::_base64_encodeBlock:
+    return inline_base64_encodeBlock();
 
   case vmIntrinsics::_encodeISOArray:
   case vmIntrinsics::_encodeByteISOArray:
@@ -6115,6 +6118,35 @@
   return true;
 }
 
+bool LibraryCallKit::inline_base64_encodeBlock() {
+  address stubAddr;
+  const char *stubName;
+  assert(UseBASE64Intrinsics, "need Base64 intrinsics support");
+  assert(callee()->signature()->size() == 6, "base64_encodeBlock has 6 parameters");
+  stubAddr = StubRoutines::base64_encodeBlock();
+  stubName = "encodeBlock";
+
+  if (!stubAddr) return false;
+  Node* base64obj = argument(0);
+  Node* src = argument(1);
+  Node* offset = argument(2);
+  Node* len = argument(3);
+  Node* dest = argument(4);
+  Node* dp = argument(5);
+  Node* isURL = argument(6);
+
+  Node* src_start = array_element_address(src, intcon(0), T_BYTE);
+  assert(src_start, "source array is NULL");
+  Node* dest_start = array_element_address(dest, intcon(0), T_BYTE);
+  assert(dest_start, "destination array is NULL");
+
+  Node* base64 = make_runtime_call(RC_LEAF,
+                                   OptoRuntime::base64_encodeBlock_Type(),
+                                   stubAddr, stubName, TypePtr::BOTTOM,
+                                   src_start, offset, len, dest_start, dp, isURL);
+  return true;
+}
+
 //------------------------------inline_sha_implCompress-----------------------
 //
 // Calculate SHA (i.e., SHA-1) for single-block byte[] array.
--- a/src/hotspot/share/opto/loopPredicate.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/opto/loopPredicate.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -1056,7 +1056,9 @@
           stack.push(in, 1);
           break;
         } else if (in->is_IfProj() &&
-                   in->as_Proj()->is_uncommon_trap_if_pattern(Deoptimization::Reason_none)) {
+                   in->as_Proj()->is_uncommon_trap_if_pattern(Deoptimization::Reason_none) &&
+                   (in->in(0)->Opcode() == Op_If ||
+                    in->in(0)->Opcode() == Op_RangeCheck)) {
           if (pf.to(in) * loop_trip_cnt >= 1) {
             stack.push(in, 1);
           }
@@ -1281,7 +1283,7 @@
     Node* n = skip_loop_predicates(entry);
     // Check if predicates were already added to the profile predicate
     // block
-    if (n != entry->in(0)->in(0)) {
+    if (n != entry->in(0)->in(0) || n->outcnt() != 1) {
       has_profile_predicates = true;
     }
     entry = n;
--- a/src/hotspot/share/opto/loopnode.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/opto/loopnode.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -4224,34 +4224,34 @@
   // which can inhibit range check elimination.
   if (least != early) {
     Node* ctrl_out = least->unique_ctrl_out();
-    if (ctrl_out && ctrl_out->is_CountedLoop() &&
+    if (ctrl_out && ctrl_out->is_Loop() &&
         least == ctrl_out->in(LoopNode::EntryControl)) {
+      // Move the node above predicates as far up as possible so a
+      // following pass of loop predication doesn't hoist a predicate
+      // that depends on it above that node.
       Node* new_ctrl = least;
-      // Move the node above predicates so a following pass of loop
-      // predication doesn't hoist a predicate that depends on it
-      // above that node.
-      if (find_predicate_insertion_point(new_ctrl, Deoptimization::Reason_loop_limit_check) != NULL) {
-        new_ctrl = new_ctrl->in(0)->in(0);
-        assert(is_dominator(early, new_ctrl), "least != early so we can move up the dominator tree");
-      }
-      if (find_predicate_insertion_point(new_ctrl, Deoptimization::Reason_profile_predicate) != NULL) {
+      for (;;) {
+        if (!new_ctrl->is_Proj()) {
+          break;
+        }
+        CallStaticJavaNode* call = new_ctrl->as_Proj()->is_uncommon_trap_if_pattern(Deoptimization::Reason_none);
+        if (call == NULL) {
+          break;
+        }
+        int req = call->uncommon_trap_request();
+        Deoptimization::DeoptReason trap_reason = Deoptimization::trap_request_reason(req);
+        if (trap_reason != Deoptimization::Reason_loop_limit_check &&
+            trap_reason != Deoptimization::Reason_predicate &&
+            trap_reason != Deoptimization::Reason_profile_predicate) {
+          break;
+        }
         Node* c = new_ctrl->in(0)->in(0);
-        assert(is_dominator(early, c), "least != early so we can move up the dominator tree");
+        if (is_dominator(c, early) && c != early) {
+          break;
+        }
         new_ctrl = c;
       }
-      if (find_predicate_insertion_point(new_ctrl, Deoptimization::Reason_predicate) != NULL) {
-        Node* c = new_ctrl->in(0)->in(0);
-        assert(is_dominator(early, c), "least != early so we can move up the dominator tree");
-        new_ctrl = c;
-      }
-      if (new_ctrl != ctrl_out) {
-        least = new_ctrl;
-      } else if (ctrl_out->is_CountedLoop() || ctrl_out->is_OuterStripMinedLoop()) {
-        Node* least_dom = idom(least);
-        if (get_loop(least_dom)->is_member(get_loop(least))) {
-          least = least_dom;
-        }
-      }
+      least = new_ctrl;
     }
   }
 
--- a/src/hotspot/share/opto/loopopts.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/opto/loopopts.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -257,6 +257,7 @@
   ProjNode* unc_proj = iff->as_If()->proj_out(1 - dp_proj->_con)->as_Proj();
   if (exclude_loop_predicate &&
       (unc_proj->is_uncommon_trap_proj(Deoptimization::Reason_predicate) != NULL ||
+       unc_proj->is_uncommon_trap_proj(Deoptimization::Reason_profile_predicate) != NULL ||
        unc_proj->is_uncommon_trap_proj(Deoptimization::Reason_range_check) != NULL)) {
     // If this is a range check (IfNode::is_range_check), do not
     // reorder because Compile::allow_range_check_smearing might have
--- a/src/hotspot/share/opto/memnode.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/opto/memnode.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -518,8 +518,7 @@
       if (ac->is_clonebasic()) {
         intptr_t offset;
         AllocateNode* alloc = AllocateNode::Ideal_allocation(ac->in(ArrayCopyNode::Dest), phase, offset);
-        assert(alloc != NULL && (!ReduceBulkZeroing || alloc->initialization()->is_complete_with_arraycopy()), "broken allocation");
-        if (alloc == ld_alloc) {
+        if (alloc != NULL && alloc == ld_alloc) {
           return ac;
         }
       }
--- a/src/hotspot/share/opto/runtime.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/opto/runtime.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -1123,6 +1123,27 @@
     const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields);
     return TypeFunc::make(domain, range);
 }
+// Base64 encode function
+const TypeFunc* OptoRuntime::base64_encodeBlock_Type() {
+  int argcnt = 6;
+
+  const Type** fields = TypeTuple::fields(argcnt);
+  int argp = TypeFunc::Parms;
+  fields[argp++] = TypePtr::NOTNULL;    // src array
+  fields[argp++] = TypeInt::INT;        // offset
+  fields[argp++] = TypeInt::INT;        // length
+  fields[argp++] = TypePtr::NOTNULL;    // dest array
+  fields[argp++] = TypeInt::INT;       // dp
+  fields[argp++] = TypeInt::BOOL;       // isURL
+  assert(argp == TypeFunc::Parms + argcnt, "correct decoding");
+  const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields);
+
+  // result type needed
+  fields = TypeTuple::fields(1);
+  fields[TypeFunc::Parms + 0] = NULL; // void
+  const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields);
+  return TypeFunc::make(domain, range);
+}
 
 //------------- Interpreter state access for on stack replacement
 const TypeFunc* OptoRuntime::osr_end_Type() {
--- a/src/hotspot/share/opto/runtime.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/opto/runtime.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -291,6 +291,7 @@
   static const TypeFunc* vectorizedMismatch_Type();
 
   static const TypeFunc* ghash_processBlocks_Type();
+  static const TypeFunc* base64_encodeBlock_Type();
 
   static const TypeFunc* updateBytesCRC32_Type();
   static const TypeFunc* updateBytesCRC32C_Type();
--- a/src/hotspot/share/prims/jvm.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/prims/jvm.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -38,6 +38,7 @@
 #include "gc/shared/collectedHeap.inline.hpp"
 #include "interpreter/bytecode.hpp"
 #include "jfr/jfrEvents.hpp"
+#include "logging/log.hpp"
 #include "memory/oopFactory.hpp"
 #include "memory/referenceType.hpp"
 #include "memory/resourceArea.hpp"
@@ -661,9 +662,10 @@
   oop new_obj_oop = NULL;
   if (obj->is_array()) {
     const int length = ((arrayOop)obj())->length();
-    new_obj_oop = CollectedHeap::array_allocate(klass, size, length, CHECK_NULL);
+    new_obj_oop = Universe::heap()->array_allocate(klass, size, length,
+                                                   /* do_zero */ true, CHECK_NULL);
   } else {
-    new_obj_oop = CollectedHeap::obj_allocate(klass, size, CHECK_NULL);
+    new_obj_oop = Universe::heap()->obj_allocate(klass, size, CHECK_NULL);
   }
 
   HeapAccess<>::clone(obj(), new_obj_oop, size);
--- a/src/hotspot/share/runtime/arguments.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/runtime/arguments.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -3900,13 +3900,13 @@
   jint result = set_ergonomics_flags();
   if (result != JNI_OK) return result;
 
-  set_shared_spaces_flags();
-
   // Set heap size based on available physical memory
   set_heap_size();
 
   GCConfig::arguments()->initialize();
 
+  set_shared_spaces_flags();
+
   // Initialize Metaspace flags and alignments
   Metaspace::ergo_initialize();
 
--- a/src/hotspot/share/runtime/globals.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/runtime/globals.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -345,6 +345,9 @@
   diagnostic(bool, UseGHASHIntrinsics, false,                               \
           "Use intrinsics for GHASH versions of crypto")                    \
                                                                             \
+  product(bool, UseBASE64Intrinsics, false,                                 \
+          "Use intrinsics for java.util.Base64")                            \
+                                                                            \
   product(size_t, LargePageSizeInBytes, 0,                                  \
           "Large page size (0 to let VM choose the page size)")             \
           range(0, max_uintx)                                               \
--- a/src/hotspot/share/runtime/handshake.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/runtime/handshake.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -297,12 +297,12 @@
 
 void HandshakeState::set_operation(JavaThread* target, HandshakeOperation* op) {
   _operation = op;
-  SafepointMechanism::arm_local_poll(target);
+  SafepointMechanism::arm_local_poll_release(target);
 }
 
 void HandshakeState::clear_handshake(JavaThread* target) {
   _operation = NULL;
-  SafepointMechanism::disarm_local_poll(target);
+  SafepointMechanism::disarm_local_poll_release(target);
 }
 
 void HandshakeState::process_self_inner(JavaThread* thread) {
--- a/src/hotspot/share/runtime/interfaceSupport.cpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/runtime/interfaceSupport.cpp	Thu Jul 05 11:53:53 2018 +0100
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "gc/shared/collectedHeap.hpp"
 #include "gc/shared/collectedHeap.inline.hpp"
+#include "logging/log.hpp"
 #include "memory/resourceArea.hpp"
 #include "runtime/atomic.hpp"
 #include "runtime/frame.inline.hpp"
--- a/src/hotspot/share/runtime/os_perf.hpp	Thu Jun 28 05:10:01 2018 +0200
+++ b/src/hotspot/share/runtime/os_perf.hpp	Thu Jul 05 11:53:53 2018 +0100
@@ -25,9 +25,8 @@
 #ifndef SHARE_VM_RUNTIME_OS_PERF_HPP
 #define SHARE_VM_RUNTIME_OS_PERF_HPP
 
+#include "memory/allocation.hpp"
 #include "utilities/macros.hpp"
-#include "memory/allocation.hpp"
-#include "utilities/globalDefinitions.hpp"
 
 #define FUNCTIONALITY_NOT_IMPLEMENTED -8
 
@@ -194,6 +193,47 @@
   }
 };
 
+class NetworkInterface : public ResourceObj {
+ private:
+  char* _name;
+  uint64_t _bytes_in;
+  uint64_t _bytes_out;
+  NetworkInterface* _next;
+
+  NetworkInterface(); // no impl
+  NetworkInterface(const NetworkInterface& rhs); // no impl
+  NetworkInterface& operator=(const NetworkInterface& rhs); // no impl
+ public:
+  NetworkInterface(const char* name, uint64_t bytes_in, uint64_t bytes_out, NetworkInterface* next) :
+  _name(NULL),
+  _bytes_in(bytes_in),
+  _bytes_out(bytes_out),
+  _next(next) {
+    assert(name != NULL, "invariant");
+    const size_t length = strlen(name);
+    assert(allocated_on_res_area(), "invariant");
+    _name = NEW_RESOURCE_ARRAY(char, length + 1);
+    strncpy(_name, name, length + 1);
+    assert(strncmp(_name, name, length) == 0, "invariant");
+  }
+
+  NetworkInterface* next() const {
+    return _next;
+  }
+
+  const char* get_name() const {
+    return _name;
+  }
+
+  uint64_t get_bytes_out() const {
+    return _bytes_out;
+  }
+
+  uint64_t get_bytes_in() const {
+    return _bytes_in;
+  }
+};
+
 class CPUInformationInterface : public CHeapObj<mtInternal> {
  private:
   CPUInformation* _cpu_info;
@@ -234,4 +274,17 @@
   int system_processes(SystemProcess** system_procs, int* const no_of_sys_processes) const;
 };
 
+class NetworkPerformanceInterface : public CHeapObj<mtInternal> {
+ private:
+  class NetworkPerformance;
+  NetworkPerformance* _impl;
+  NetworkPerformanceInterface(const NetworkPerformanceInterface& rhs); // no impl
+  NetworkPerformanceInterface& operator=(const NetworkPerformanceInterface& rhs); // no impl
+ public:
+  NetworkPerformanceInterface();
+  bool initialize();
+  ~NetworkPerformanceInterface();
+  int network_utilization(NetworkInterface** network_interfaces) const;
+};
+
 #endif // SHARE_VM_RUNTIME_OS_PERF_HPP<