changeset 55069:2c2b1787218f intrinsics-project

Automatic merge with default
author mcimadamore
date Thu, 21 Feb 2019 22:08:53 +0100
parents 9159a3d00041 4584d0331318
children e5ee874fff8f
files .hgtags make/autoconf/flags-cflags.m4 make/conf/jib-profiles.js src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp src/hotspot/os/linux/os_linux.cpp src/hotspot/os/windows/os_windows.hpp src/hotspot/share/gc/g1/g1Allocator.hpp src/hotspot/share/gc/g1/g1CollectedHeap.hpp src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp src/hotspot/share/gc/z/zStatTLAB.cpp src/hotspot/share/gc/z/zStatTLAB.hpp src/hotspot/share/logging/logFileOutput.hpp src/hotspot/share/memory/allocation.hpp src/hotspot/share/oops/array.inline.hpp src/hotspot/share/oops/instanceKlass.cpp src/hotspot/share/prims/jvm.cpp src/hotspot/share/runtime/arguments.cpp src/hotspot/share/utilities/exceptions.hpp src/hotspot/share/utilities/globalDefinitions.hpp src/java.desktop/share/classes/sun/awt/AWTSecurityManager.java src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DocFilesHandlerImpl.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java test/hotspot/jtreg/ProblemList.txt test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue003.java test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues001.java test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues002.java test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues003.java test/jdk/ProblemList.txt
diffstat 505 files changed, 5777 insertions(+), 2479 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Wed Feb 20 21:44:31 2019 -0500
+++ b/.hgtags	Thu Feb 21 22:08:53 2019 +0100
@@ -543,3 +543,6 @@
 021917019cda1c0c5853255322274f37693a2431 jdk-13+7
 b5f7bb57de2f797be34f6c75d45c3245ad37ab97 jdk-12+31
 a535ba736cabc6886acdff36de3a096c46e5ddc5 jdk-13+8
+4ce47bc1fb92cf94c6e3d1f49d582f02dcb851ab jdk-12+32
+c081f3ea6b9300265a4a34e38f970b1e3ddaae9f jdk-13+9
+b67884871b5fff79c5ef3eb8ac74dd48d71ea9b1 jdk-12+33
--- a/make/RunTests.gmk	Wed Feb 20 21:44:31 2019 -0500
+++ b/make/RunTests.gmk	Thu Feb 21 22:08:53 2019 +0100
@@ -112,6 +112,9 @@
 GTEST_VARIANTS := $(strip $(patsubst $(TEST_IMAGE_DIR)/hotspot/gtest/%, %, \
     $(GTEST_LAUNCHER_DIRS)))
 
+COV_ENVIRONMENT :=
+JTREG_COV_OPTIONS :=
+
 ifeq ($(TEST_OPTS_JCOV), true)
   JCOV_OUTPUT_DIR := $(TEST_RESULTS_DIR)/jcov-output
   JCOV_GRABBER_LOG := $(JCOV_OUTPUT_DIR)/grabber.log
@@ -122,12 +125,18 @@
   # Replace our normal test JDK with the JCov image.
   JDK_UNDER_TEST := $(JCOV_IMAGE_DIR)
 
-  JCOV_ENVIRONMENT := JAVA_TOOL_OPTIONS="$(JCOV_MEM_OPTIONS)" \
+  COV_ENVIRONMENT += JAVA_TOOL_OPTIONS="$(JCOV_MEM_OPTIONS)" \
       _JAVA_OPTIONS="$(JCOV_MEM_OPTIONS)"
-  JTREG_JCOV_OPTIONS := -e:JAVA_TOOL_OPTIONS='$(JCOV_MEM_OPTIONS)' \
+  JTREG_COV_OPTIONS += -e:JAVA_TOOL_OPTIONS='$(JCOV_MEM_OPTIONS)' \
       -e:_JAVA_OPTIONS='$(JCOV_MEM_OPTIONS)'
 endif
 
+ifeq ($(GCOV_ENABLED), true)
+  GCOV_OUTPUT_DIR := $(TEST_RESULTS_DIR)/gcov-output
+  COV_ENVIRONMENT += GCOV_PREFIX="$(GCOV_OUTPUT_DIR)"
+  JTREG_COV_OPTIONS += -e:GCOV_PREFIX="$(GCOV_OUTPUT_DIR)"
+endif
+
 ################################################################################
 # Optionally create AOT libraries for specified modules before running tests.
 # Note, this could not be done during JDK build time.
@@ -170,6 +179,7 @@
 	$$(call LogWarn, Generating $$(patsubst $$(OUTPUTDIR)/%, %, $$@))
 	$$(call MakeTargetDir)
 	$$(call ExecuteWithLog, $$@, \
+	    $((COV_ENVIRONMENT) \
 	    $$(FIXPATH) $$(JDK_UNDER_TEST)/bin/jaotc \
 	        $$($1_JAOTC_OPTS) --output $$@ --module $$($1_MODULE) \
 	)
@@ -658,6 +668,8 @@
 
   # Current tests needs to open java.io
   $1_MICRO_JAVA_OPTIONS += --add-opens=java.base/java.io=ALL-UNNAMED
+  # Set library path for native dependencies
+  $1_MICRO_JAVA_OPTIONS += -Djava.library.path=$$(TEST_IMAGE_DIR)/micro/native
 
   # Save output as JSON or CSV file
   ifneq ($$(MICRO_RESULTS_FORMAT), )
@@ -690,7 +702,8 @@
 	$$(call LogWarn, Running test '$$($1_TEST)')
 	$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
 	$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/micro, \
-	    $$($1_MICRO_TEST_JDK)/bin/java $$($1_MICRO_JAVA_OPTIONS) -jar $$($1_MICRO_BENCHMARKS_JAR) \
+	    $$(FIXPATH) $$($1_MICRO_TEST_JDK)/bin/java $$($1_MICRO_JAVA_OPTIONS) \
+	        -jar $$($1_MICRO_BENCHMARKS_JAR) \
 	        $$($1_MICRO_ITER) $$($1_MICRO_FORK) $$($1_MICRO_TIME) \
 	        $$($1_MICRO_WARMUP_ITER) $$($1_MICRO_WARMUP_TIME) \
 	        $$($1_MICRO_VM_OPTIONS) $$($1_MICRO_BASIC_OPTIONS) $$(MICRO_OPTIONS) \
@@ -904,7 +917,7 @@
 	$$(call LogWarn, Running test '$$($1_TEST)')
 	$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
 	$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/jtreg, \
-	    $$(JCOV_ENVIRONMENT) \
+	    $$(COV_ENVIRONMENT) \
 	    $$(JAVA) $$($1_JTREG_LAUNCHER_OPTIONS) \
 	        -Dprogram=jtreg -jar $$(JT_HOME)/lib/jtreg.jar \
 	        $$($1_JTREG_BASIC_OPTIONS) \
@@ -914,7 +927,7 @@
 	        -workDir:$$($1_TEST_SUPPORT_DIR) \
 	        $$(JTREG_OPTIONS) \
 	        $$(JTREG_FAILURE_HANDLER_OPTIONS) \
-	        $$(JTREG_JCOV_OPTIONS) \
+	        $$(JTREG_COV_OPTIONS) \
 	        $$($1_TEST_NAME) \
 	    && $$(ECHO) $$$$? > $$($1_EXITCODE) \
 	    || $$(ECHO) $$$$? > $$($1_EXITCODE) \
--- a/make/autoconf/basics.m4	Wed Feb 20 21:44:31 2019 -0500
+++ b/make/autoconf/basics.m4	Thu Feb 21 22:08:53 2019 +0100
@@ -618,14 +618,6 @@
   BASIC_PATH_PROGS(CPIO, [cpio bsdcpio])
   BASIC_PATH_PROGS(NICE, nice)
 
-  BASIC_PATH_PROGS(PANDOC, pandoc)
-  if test -n "$PANDOC"; then
-    ENABLE_PANDOC="true"
-  else
-    ENABLE_PANDOC="false"
-  fi
-  AC_SUBST(ENABLE_PANDOC)
-
   BASIC_PATH_PROGS(LSB_RELEASE, lsb_release)
   BASIC_PATH_PROGS(CMD, [cmd.exe /mnt/c/Windows/System32/cmd.exe])
 ])
@@ -1193,6 +1185,7 @@
   BASIC_CHECK_FIND_DELETE
   BASIC_CHECK_TAR
   BASIC_CHECK_GREP
+  BASIC_SETUP_PANDOC
 
   # These tools might not be installed by default,
   # need hint on how to install them.
@@ -1379,6 +1372,34 @@
 
 ################################################################################
 #
+# Setup Pandoc
+#
+AC_DEFUN_ONCE([BASIC_SETUP_PANDOC],
+[
+  BASIC_PATH_PROGS(PANDOC, pandoc)
+
+  PANDOC_MARKDOWN_FLAG="markdown"
+  if test -n "$PANDOC"; then
+    AC_MSG_CHECKING(if the pandoc smart extension needs to be disabled for markdown)
+    if $PANDOC --list-extensions | $GREP -q '\+smart'; then
+      AC_MSG_RESULT([yes])
+      PANDOC_MARKDOWN_FLAG="markdown-smart"
+    else
+      AC_MSG_RESULT([no])
+    fi
+  fi
+
+  if test -n "$PANDOC"; then
+    ENABLE_PANDOC="true"
+  else
+    ENABLE_PANDOC="false"
+  fi
+  AC_SUBST(ENABLE_PANDOC)
+  AC_SUBST(PANDOC_MARKDOWN_FLAG)
+])
+
+################################################################################
+#
 # Default make target
 #
 AC_DEFUN_ONCE([BASIC_SETUP_DEFAULT_MAKE_TARGET],
--- a/make/autoconf/flags-cflags.m4	Wed Feb 20 21:44:31 2019 -0500
+++ b/make/autoconf/flags-cflags.m4	Thu Feb 21 22:08:53 2019 +0100
@@ -121,7 +121,11 @@
     # -g0 enables debug symbols without disabling inlining.
     CFLAGS_DEBUG_SYMBOLS="-g0 -xs"
   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
-    CFLAGS_DEBUG_SYMBOLS="-g"
+    if test "x$XLC_USES_CLANG" = xtrue; then
+      CFLAGS_DEBUG_SYMBOLS="-g1"
+    else
+      CFLAGS_DEBUG_SYMBOLS="-g"
+    fi
   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
     CFLAGS_DEBUG_SYMBOLS="-Z7 -d2Zi+"
   fi
--- a/make/autoconf/jdk-options.m4	Wed Feb 20 21:44:31 2019 -0500
+++ b/make/autoconf/jdk-options.m4	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -364,7 +364,7 @@
 
 ################################################################################
 #
-# Gcov coverage data for hotspot
+# Native and Java code coverage
 #
 AC_DEFUN_ONCE([JDKOPT_SETUP_CODE_COVERAGE],
 [
@@ -372,23 +372,26 @@
       [enable native compilation with code coverage data@<:@disabled@:>@])])
   GCOV_ENABLED="false"
   if test "x$enable_native_coverage" = "xyes"; then
-    if test "x$TOOLCHAIN_TYPE" = "xgcc"; then
-      AC_MSG_CHECKING([if native coverage is enabled])
-      AC_MSG_RESULT([yes])
-      GCOV_CFLAGS="-fprofile-arcs -ftest-coverage -fno-inline"
-      GCOV_LDFLAGS="-fprofile-arcs"
-      JVM_CFLAGS="$JVM_CFLAGS $GCOV_CFLAGS"
-      JVM_LDFLAGS="$JVM_LDFLAGS $GCOV_LDFLAGS"
-      CFLAGS_JDKLIB="$CFLAGS_JDKLIB $GCOV_CFLAGS"
-      CFLAGS_JDKEXE="$CFLAGS_JDKEXE $GCOV_CFLAGS"
-      CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $GCOV_CFLAGS"
-      CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $GCOV_CFLAGS"
-      LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $GCOV_LDFLAGS"
-      LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $GCOV_LDFLAGS"
-      GCOV_ENABLED="true"
-    else
-      AC_MSG_ERROR([--enable-native-coverage only works with toolchain type gcc])
-    fi
+    case $TOOLCHAIN_TYPE in
+      gcc | clang)
+        AC_MSG_CHECKING([if native coverage is enabled])
+        AC_MSG_RESULT([yes])
+        GCOV_CFLAGS="-fprofile-arcs -ftest-coverage -fno-inline"
+        GCOV_LDFLAGS="-fprofile-arcs"
+        JVM_CFLAGS="$JVM_CFLAGS $GCOV_CFLAGS"
+        JVM_LDFLAGS="$JVM_LDFLAGS $GCOV_LDFLAGS"
+        CFLAGS_JDKLIB="$CFLAGS_JDKLIB $GCOV_CFLAGS"
+        CFLAGS_JDKEXE="$CFLAGS_JDKEXE $GCOV_CFLAGS"
+        CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $GCOV_CFLAGS"
+        CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $GCOV_CFLAGS"
+        LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $GCOV_LDFLAGS"
+        LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $GCOV_LDFLAGS"
+        GCOV_ENABLED="true"
+        ;;
+      *)
+        AC_MSG_ERROR([--enable-native-coverage only works with toolchain type gcc or clang])
+        ;;
+    esac
   elif test "x$enable_native_coverage" = "xno"; then
     AC_MSG_CHECKING([if native coverage is enabled])
     AC_MSG_RESULT([no])
--- a/make/autoconf/spec.gmk.in	Wed Feb 20 21:44:31 2019 -0500
+++ b/make/autoconf/spec.gmk.in	Thu Feb 21 22:08:53 2019 +0100
@@ -774,6 +774,7 @@
 UCRT_DLL_DIR:=@UCRT_DLL_DIR@
 STLPORT_LIB:=@STLPORT_LIB@
 ENABLE_PANDOC:=@ENABLE_PANDOC@
+PANDOC_MARKDOWN_FLAG:=@PANDOC_MARKDOWN_FLAG@
 
 ####################################################
 #
--- a/make/autoconf/toolchain.m4	Wed Feb 20 21:44:31 2019 -0500
+++ b/make/autoconf/toolchain.m4	Thu Feb 21 22:08:53 2019 +0100
@@ -276,6 +276,20 @@
   fi
   AC_SUBST(TOOLCHAIN_TYPE)
 
+  # on AIX, check for xlclang++ on the PATH and TOOLCHAIN_PATH and use it if it is available
+  if test "x$OPENJDK_TARGET_OS" = xaix; then
+    if test "x$TOOLCHAIN_PATH" != x; then
+      XLC_TEST_PATH=${TOOLCHAIN_PATH}/
+    fi
+
+    XLCLANG_VERSION_OUTPUT=`${XLC_TEST_PATH}xlclang++ -qversion 2>&1 | $HEAD -n 1`
+    $ECHO "$XLCLANG_VERSION_OUTPUT" | $GREP "IBM XL C/C++ for AIX" > /dev/null
+    if test $? -eq 0; then
+      AC_MSG_NOTICE([xlclang++ output: $XLCLANG_VERSION_OUTPUT])
+      XLC_USES_CLANG=true
+    fi
+  fi
+
   TOOLCHAIN_CC_BINARY_clang="clang"
   TOOLCHAIN_CC_BINARY_gcc="gcc"
   TOOLCHAIN_CC_BINARY_microsoft="cl$EXE_SUFFIX"
@@ -288,6 +302,14 @@
   TOOLCHAIN_CXX_BINARY_solstudio="CC"
   TOOLCHAIN_CXX_BINARY_xlc="xlC_r"
 
+  if test "x$OPENJDK_TARGET_OS" = xaix; then
+    if test "x$XLC_USES_CLANG" = xtrue; then
+      AC_MSG_NOTICE([xlclang++ detected, using it])
+      TOOLCHAIN_CC_BINARY_xlc="xlclang"
+      TOOLCHAIN_CXX_BINARY_xlc="xlclang++"
+    fi
+  fi
+
   # Use indirect variable referencing
   toolchain_var_name=TOOLCHAIN_DESCRIPTION_$TOOLCHAIN_TYPE
   TOOLCHAIN_DESCRIPTION=${!toolchain_var_name}
--- a/make/common/MakeBase.gmk	Wed Feb 20 21:44:31 2019 -0500
+++ b/make/common/MakeBase.gmk	Thu Feb 21 22:08:53 2019 +0100
@@ -392,9 +392,10 @@
   #
   # Param 1 - Dirs to find in
   # Param 2 - (optional) specialization. Normally "-a \( ... \)" expression.
+  # Param 3 - (optional) options to find.
   define CacheFind
     $(if $(filter-out $(addsuffix /%,- $(FIND_CACHE_DIRS)) $(FIND_CACHE_DIRS),$1), \
-      $(if $(wildcard $1), $(shell $(FIND) $(wildcard $1) \( -type f -o -type l \) $2 \
+      $(if $(wildcard $1), $(shell $(FIND) $3 $(wildcard $1) \( -type f -o -type l \) $2 \
           | $(TR) ' ' '?')), \
       $(filter $(addsuffix /%,$(patsubst %/,%,$1)) $1,$(FIND_CACHE)))
   endef
--- a/make/common/ProcessMarkdown.gmk	Wed Feb 20 21:44:31 2019 -0500
+++ b/make/common/ProcessMarkdown.gmk	Thu Feb 21 22:08:53 2019 +0100
@@ -80,7 +80,8 @@
 	$$(call LogInfo, Converting $2 to $$($1_FORMAT))
 	$$(call MakeDir, $$(SUPPORT_OUTPUTDIR)/markdown $$(dir $$($1_$2_PANDOC_OUTPUT)))
 	$$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER), \
-	    $$(PANDOC) $$($1_OPTIONS) -f markdown-smart -t $$($1_FORMAT) --standalone \
+	    $$(PANDOC) $$($1_OPTIONS) -f $$(PANDOC_MARKDOWN_FLAG) \
+	    -t $$($1_FORMAT) --standalone \
 	    $$($1_$2_CSS_OPTION) $$($1_$2_OPTIONS) '$$($1_$2_PANDOC_INPUT)' \
 	    -o '$$($1_$2_PANDOC_OUTPUT)')
         ifneq ($$(findstring $$(LOG_LEVEL), debug trace),)
--- a/make/common/ZipArchive.gmk	Wed Feb 20 21:44:31 2019 -0500
+++ b/make/common/ZipArchive.gmk	Thu Feb 21 22:08:53 2019 +0100
@@ -62,8 +62,9 @@
     $1_FIND_LIST := $$($1_SRC)
   endif
 
-  # Find all files in the source tree.
-  $1_ALL_SRCS := $$(call not-containing,_the.,$$(call CacheFind,$$($1_FIND_LIST)))
+  # Find all files in the source tree. Follow symlinks in this find since that is
+  # what zip does.
+  $1_ALL_SRCS := $$(call not-containing,_the.,$$(call CacheFind,$$($1_FIND_LIST), , -L))
 
   # Filter on suffixes if set
   ifneq ($$($1_SUFFIXES),)
@@ -126,10 +127,14 @@
   $$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS)
 	$$(call LogWarn, Updating $$($1_NAME))
 	$$(call MakeTargetDir)
-	$$(foreach s,$$($1_SRC),(cd $$s && $(ZIPEXE) -qru $$($1_ZIP_OPTIONS) $$@ . \
-	    $$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* \
-	    $$($1_ZIP_EXCLUDES_$$s) \
-	    || test "$$$$?" = "12" )$$(NEWLINE)) true
+	$$(foreach s,$$($1_SRC), $$(call ExecuteWithLog, \
+	    $$(SUPPORT_OUTPUTDIR)/zip/$$(patsubst $$(OUTPUTDIR)/%,%, $$@), \
+	    (cd $$s && $(ZIPEXE) -qru $$($1_ZIP_OPTIONS) $$@ . \
+	        $$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* \
+	        $$($1_ZIP_EXCLUDES_$$s) \
+	        || test "$$$$?" = "12" \
+	    ))$$(NEWLINE) \
+	) true \
 	$(TOUCH) $$@
 
   # Add zip to target list
--- a/make/conf/jib-profiles.js	Wed Feb 20 21:44:31 2019 -0500
+++ b/make/conf/jib-profiles.js	Thu Feb 21 22:08:53 2019 +0100
@@ -241,7 +241,7 @@
     common.main_profile_names = [
         "linux-x64", "linux-x86", "macosx-x64", "solaris-x64",
         "solaris-sparcv9", "windows-x64", "windows-x86",
-        "linux-aarch64", "linux-arm32"
+        "linux-aarch64", "linux-arm32", "linux-ppc64le", "linux-s390x"
     ];
 
     // These are the base setttings for all the main build profiles.
@@ -464,6 +464,28 @@
                 "--with-abi-profile=arm-vfp-hflt", "--disable-warnings-as-errors"
             ],
         },
+
+        "linux-ppc64le": {
+            target_os: "linux",
+            target_cpu: "ppc64le",
+            build_cpu: "x64",
+            dependencies: ["devkit", "build_devkit", "cups"],
+            configure_args: [
+                "--openjdk-target=ppc64le-linux-gnu", "--with-freetype=bundled",
+                "--disable-warnings-as-errors"
+            ],
+        },
+
+        "linux-s390x": {
+            target_os: "linux",
+            target_cpu: "s390x",
+            build_cpu: "x64",
+            dependencies: ["devkit", "build_devkit", "cups"],
+            configure_args: [
+                "--openjdk-target=s390x-linux-gnu", "--with-freetype=bundled",
+                "--disable-warnings-as-errors"
+            ],
+        },
     };
 
     // Add the base settings to all the main profiles
@@ -499,6 +521,15 @@
             profiles[maketestName].default_make_targets = [ "test-make" ];
         });
 
+    // Generate -gcov profiles
+    [ "linux-x64", "macosx-x64" ].forEach(function (name) {
+        var gcovName = name + "-gcov";
+        profiles[gcovName] = clone(profiles[name]);
+        profiles[gcovName].default_make_targets = ["product-bundles", "test-bundles"];
+        profiles[gcovName].configure_args = concat(profiles[gcovName].configure_args,
+            ["--enable-native-coverage", "--disable-warnings-as-errors"]);
+    });
+
     // Profiles for building the zero jvm variant. These are used for verification.
     var zeroProfiles = {
         "linux-x64-zero": {
@@ -626,6 +657,12 @@
         },
        "linux-arm32": {
             platform: "linux-arm32",
+        },
+       "linux-ppc64le": {
+            platform: "linux-ppc64le",
+        },
+       "linux-s390x": {
+            platform: "linux-s390x",
         }
     }
     // Generate common artifacts for all main profiles
@@ -744,6 +781,40 @@
             };
         });
 
+    // Artifacts of gcov (native-code-coverage) profiles
+    [ "linux-x64", "macosx-x64" ].forEach(function (name) {
+        var o = artifactData[name]
+        var pf = o.platform
+        var jdk_subdir = (o.jdk_subdir != null ? o.jdk_subdir : "jdk-" + data.version);
+        var jdk_suffix = (o.jdk_suffix != null ? o.jdk_suffix : "tar.gz");
+        var gcovName = name + "-gcov";
+        profiles[gcovName].artifacts = {
+            jdk: {
+                local: "bundles/\\(jdk.*bin." + jdk_suffix + "\\)",
+                remote: [
+                    "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-gcov." + jdk_suffix,
+                ],
+                subdir: jdk_subdir,
+                exploded: "images/jdk",
+            },
+            test: {
+                    local: "bundles/\\(jdk.*bin-tests.tar.gz\\)",
+                    remote: [
+                        "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-gcov-tests.tar.gz",
+                    ],
+                    exploded: "images/test"
+            },
+            jdk_symbols: {
+                    local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)",
+                    remote: [
+                        "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-gcov-symbols.tar.gz",
+                    ],
+                    subdir: jdk_subdir,
+                    exploded: "images/jdk"
+                },
+            };
+    });
+
     // Profiles used to run tests.
     var testOnlyProfiles = {
         "run-test": {
@@ -770,6 +841,10 @@
     } else {
         testedProfileTest = testedProfile + ".test";
     }
+    var testOnlyMake = [ "run-test-prebuilt", "LOG_CMDLINES=true", "JTREG_VERBOSE=fail,error,time" ];
+    if (testedProfile.endsWith("-gcov")) {
+        testOnlyMake = concat(testOnlyMake, "GCOV_ENABLED=true")
+    }
     var testOnlyProfilesPrebuilt = {
         "run-test-prebuilt": {
             target_os: input.build_os,
@@ -779,7 +854,7 @@
                 testedProfileTest
             ],
             src: "src.conf",
-            make_args: [ "run-test-prebuilt", "LOG_CMDLINES=true", "JTREG_VERBOSE=fail,error,time" ],
+            make_args: testOnlyMake,
             environment: {
                 "BOOT_JDK": common.boot_jdk_home,
                 "JDK_IMAGE_DIR": input.get(testedProfileJDK, "home_path"),
@@ -870,7 +945,9 @@
         solaris_sparcv9: "SS12u6-Solaris11u3+1.0",
         windows_x64: "VS2017-15.5.5+1.0",
         linux_aarch64: "gcc7.3.0-Fedora27+1.2",
-        linux_arm: "gcc7.3.0-Fedora27+1.2"
+        linux_arm: "gcc7.3.0-Fedora27+1.2",
+        linux_ppc64le: "gcc7.3.0-Fedora27+1.0",
+        linux_s390x: "gcc7.3.0-Fedora27+1.0"
     };
 
     var devkit_platform = (input.target_cpu == "x86"
@@ -930,7 +1007,7 @@
         jtreg: {
             server: "javare",
             revision: "4.2",
-            build_number: "b13",
+            build_number: "b14",
             checksum_file: "MD5_VALUES",
             file: "jtreg_bin-4.2.zip",
             environment_name: "JT_HOME",
--- a/make/copy/CopyCommon.gmk	Wed Feb 20 21:44:31 2019 -0500
+++ b/make/copy/CopyCommon.gmk	Thu Feb 21 22:08:53 2019 +0100
@@ -66,6 +66,8 @@
 # Setup make rules for copying legal files. This is only needed if the files
 # need to be filtered due to optional components being enabled/disabled.
 # Otherwise CreateJmods.gmk will find the legal files in the original src dirs.
+# If multiple license files with the same name are found, only the first one
+# found will get copied.
 #
 # Parameter 1 is the name of the rule.
 #
@@ -75,10 +77,12 @@
 define SetupCopyLegalFilesBody
   $$(foreach f, $$(filter-out $$(addprefix %/, $$($1_EXCLUDES)), \
       $$(wildcard $$(addsuffix /*, $$(call FindModuleLegalSrcDirs, $$(MODULE))))), \
-    $$(eval $$(call SetupCopyFiles, $1_$$(notdir $$f), \
-        DEST := $$(LEGAL_DST_DIR), \
-        FILES := $$f, \
-    )) \
-    $$(eval $1 += $$($1_$$(notdir $$f))) \
+    $$(if $$(filter $$($1_$$(notdir $$f)), $$($1)), , \
+      $$(eval $$(call SetupCopyFiles, $1_$$(notdir $$f), \
+          DEST := $$(LEGAL_DST_DIR), \
+          FILES := $$f, \
+      )) \
+      $$(eval $1 += $$($1_$$(notdir $$f))) \
+    ) \
   )
 endef
--- a/make/test/BuildMicrobenchmark.gmk	Wed Feb 20 21:44:31 2019 -0500
+++ b/make/test/BuildMicrobenchmark.gmk	Thu Feb 21 22:08:53 2019 +0100
@@ -30,6 +30,7 @@
 include MakeBase.gmk
 include JavaCompilation.gmk
 include SetupJavaCompilers.gmk
+include TestFilesCompilation.gmk
 
 ifeq ($(JMH_CORE_JAR), )
   $(info Error: JMH is missing. Please use configure --with-jmh.)
@@ -39,7 +40,8 @@
 #### Variables
 
 MICROBENCHMARK_SRC := $(TOPDIR)/test/micro
-MICROBENCHMARK_JAR := $(IMAGES_OUTPUTDIR)/test/micro/benchmarks.jar
+MICROBENCHMARK_IMAGE_DIR := $(TEST_IMAGE_DIR)/micro
+MICROBENCHMARK_JAR := $(MICROBENCHMARK_IMAGE_DIR)/benchmarks.jar
 
 MICROBENCHMARK_OUTPUT := $(SUPPORT_OUTPUTDIR)/test/micro
 MICROBENCHMARK_CLASSES := $(MICROBENCHMARK_OUTPUT)/classes
@@ -54,6 +56,11 @@
 
 MICROBENCHMARK_CLASSPATH := $(call PathList, $(JMH_COMPILE_JARS))
 
+# Native dependencies
+MICROBENCHMARK_NATIVE_SRC_DIRS := $(MICROBENCHMARK_SRC)
+MICROBENCHMARK_NATIVE_OUTPUT := $(MICROBENCHMARK_OUTPUT)/native
+MICROBENCHMARK_NATIVE_EXCLUDE :=
+
 ###
 
 # Need double \n to get new lines and no trailing spaces
@@ -108,6 +115,22 @@
     JAR := $(MICROBENCHMARK_JAR), \
 ))
 
-all: $(MICROBENCHMARK_JAR)
+# Setup compilation of native library dependencies
+$(eval $(call SetupTestFilesCompilation, BUILD_MICROBENCHMARK_LIBRARIES, \
+    TYPE := LIBRARY, \
+    SOURCE_DIRS := $(MICROBENCHMARK_NATIVE_SRC_DIRS), \
+    OUTPUT_DIR := $(MICROBENCHMARK_NATIVE_OUTPUT), \
+    EXCLUDE := $(MICROBENCHMARK_NATIVE_EXCLUDE), \
+))
+
+# Setup copy of native dependencies to image output dir
+$(eval $(call SetupCopyFiles, COPY_MICROBENCHMARK_NATIVE, \
+    SRC := $(MICROBENCHMARK_NATIVE_OUTPUT), \
+    DEST := $(MICROBENCHMARK_IMAGE_DIR)/native, \
+    FILES := $(BUILD_MICROBENCHMARK_LIBRARIES), \
+    FLATTEN := true, \
+))
+
+all: $(MICROBENCHMARK_JAR) $(BUILD_MICROBENCHMARK_LIBRARIES) $(COPY_MICROBENCHMARK_NATIVE)
 
 .PHONY: all
--- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -2167,6 +2167,14 @@
   hlt(0);
 }
 
+void MacroAssembler::warn(const char* msg) {
+  pusha();
+  mov(c_rarg0, (address)msg);
+  mov(lr, CAST_FROM_FN_PTR(address, warning));
+  blrt(lr, 1, 0, MacroAssembler::ret_type_void);
+  popa();
+}
+
 void MacroAssembler::unimplemented(const char* what) {
   const char* buf = NULL;
   {
--- a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1687,7 +1687,7 @@
 
 
   // Helper for generating a dynamic type check.
-  // Smashes rscratch1.
+  // Smashes rscratch1, rscratch2.
   void generate_type_check(Register sub_klass,
                            Register super_check_offset,
                            Register super_klass,
@@ -1979,6 +1979,10 @@
     const Register dst_pos    = c_rarg3;  // destination position
     const Register length     = c_rarg4;
 
+
+    // Registers used as temps
+    const Register dst_klass  = c_rarg5;
+
     __ align(CodeEntryAlignment);
 
     StubCodeMark mark(this, "StubRoutines", name);
@@ -2184,8 +2188,7 @@
       arraycopy_range_checks(src, src_pos, dst, dst_pos, scratch_length,
                              r18, L_failed);
 
-      const Register rscratch2_dst_klass = rscratch2;
-      __ load_klass(rscratch2_dst_klass, dst); // reload
+      __ load_klass(dst_klass, dst); // reload
 
       // Marshal the base address arguments now, freeing registers.
       __ lea(from, Address(src, src_pos, Address::lsl(LogBytesPerHeapOop)));
@@ -2195,24 +2198,25 @@
       __ movw(count, length);           // length (reloaded)
       Register sco_temp = c_rarg3;      // this register is free now
       assert_different_registers(from, to, count, sco_temp,
-                                 rscratch2_dst_klass, scratch_src_klass);
+                                 dst_klass, scratch_src_klass);
       // assert_clean_int(count, sco_temp);
 
       // Generate the type check.
       const int sco_offset = in_bytes(Klass::super_check_offset_offset());
-      __ ldrw(sco_temp, Address(rscratch2_dst_klass, sco_offset));
-      // assert_clean_int(sco_temp, r18);
-      generate_type_check(scratch_src_klass, sco_temp, rscratch2_dst_klass, L_plain_copy);
+      __ ldrw(sco_temp, Address(dst_klass, sco_offset));
+
+      // Smashes rscratch1, rscratch2
+      generate_type_check(scratch_src_klass, sco_temp, dst_klass, L_plain_copy);
 
       // Fetch destination element klass from the ObjArrayKlass header.
       int ek_offset = in_bytes(ObjArrayKlass::element_klass_offset());
-      __ ldr(rscratch2_dst_klass, Address(rscratch2_dst_klass, ek_offset));
-      __ ldrw(sco_temp, Address(rscratch2_dst_klass, sco_offset));
+      __ ldr(dst_klass, Address(dst_klass, ek_offset));
+      __ ldrw(sco_temp, Address(dst_klass, sco_offset));
 
       // the checkcast_copy loop needs two extra arguments:
       assert(c_rarg3 == sco_temp, "#3 already in place");
       // Set up arguments for checkcast_copy_entry.
-      __ mov(c_rarg4, rscratch2_dst_klass);  // dst.klass.element_klass
+      __ mov(c_rarg4, dst_klass);  // dst.klass.element_klass
       __ b(RuntimeAddress(checkcast_copy_entry));
     }
 
--- a/src/hotspot/cpu/ppc/nativeInst_ppc.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/cpu/ppc/nativeInst_ppc.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2015 SAP SE. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -362,8 +362,8 @@
 
 void NativeGeneralJump::insert_unconditional(address code_pos, address entry) {
   CodeBuffer cb(code_pos, BytesPerInstWord + 1);
-  MacroAssembler* a = new MacroAssembler(&cb);
-  a->b(entry);
+  MacroAssembler a(&cb);
+  a.b(entry);
   ICache::ppc64_flush_icache_bytes(code_pos, NativeGeneralJump::instruction_size);
 }
 
--- a/src/hotspot/cpu/s390/frame_s390.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/cpu/s390/frame_s390.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2016 SAP SE. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -479,6 +479,7 @@
           // name
           Method* method = *(Method**)((address)current_fp + _z_ijava_state_neg(method));
           if (method) {
+            ResourceMark rm;
             if (method->is_synchronized()) st->print("synchronized ");
             if (method->is_static()) st->print("static ");
             if (method->is_native()) st->print("native ");
@@ -543,6 +544,7 @@
           // name
           Method* method = ((nmethod *)blob)->method();
           if (method) {
+            ResourceMark rm;
             method->name_and_sig_as_C_string(buf, sizeof(buf));
             st->print("%s ", buf);
           }
--- a/src/hotspot/cpu/s390/stubGenerator_s390.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/cpu/s390/stubGenerator_s390.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2016, 2017, SAP SE. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1842,6 +1842,51 @@
   }
 
 
+  // Compute GHASH function.
+  address generate_ghash_processBlocks() {
+    __ align(CodeEntryAlignment);
+    StubCodeMark mark(this, "StubRoutines", "ghash_processBlocks");
+    unsigned int start_off = __ offset();   // Remember stub start address (is rtn value).
+
+    const Register state   = Z_ARG1;
+    const Register subkeyH = Z_ARG2;
+    const Register data    = Z_ARG3; // 1st of even-odd register pair.
+    const Register blocks  = Z_ARG4;
+    const Register len     = blocks; // 2nd of even-odd register pair.
+
+    const int param_block_size = 4 * 8;
+    const int frame_resize = param_block_size + 8; // Extra space for copy of fp.
+
+    // Reserve stack space for parameter block (R1).
+    __ z_lgr(Z_R1, Z_SP);
+    __ resize_frame(-frame_resize, Z_R0, true);
+    __ z_aghi(Z_R1, -param_block_size);
+
+    // Fill parameter block.
+    __ z_mvc(Address(Z_R1)    , Address(state)  , 16);
+    __ z_mvc(Address(Z_R1, 16), Address(subkeyH), 16);
+
+    // R4+5: data pointer + length
+    __ z_llgfr(len, blocks);  // Cast to 64-bit.
+
+    // R0: function code
+    __ load_const_optimized(Z_R0, (int)VM_Version::MsgDigest::_GHASH);
+
+    // Compute.
+    __ z_sllg(len, len, 4);  // In bytes.
+    __ kimd(data);
+
+    // Copy back result and free parameter block.
+    __ z_mvc(Address(state), Address(Z_R1), 16);
+    __ z_xc(Address(Z_R1), param_block_size, Address(Z_R1));
+    __ z_aghi(Z_SP, frame_resize);
+
+    __ z_br(Z_R14);
+
+    return __ addr_at(start_off);
+  }
+
+
   // Call interface for all SHA* stubs.
   //
   //   Z_ARG1 - source data block. Ptr to leftmost byte to be processed.
@@ -2305,6 +2350,11 @@
       StubRoutines::_cipherBlockChaining_decryptAESCrypt = generate_cipherBlockChaining_AES_decrypt("AES_decryptBlock_chaining");
     }
 
+    // Generate GHASH intrinsics code
+    if (UseGHASHIntrinsics) {
+      StubRoutines::_ghash_processBlocks = generate_ghash_processBlocks();
+    }
+
     // Generate SHA1/SHA256/SHA512 intrinsics code.
     if (UseSHA1Intrinsics) {
       StubRoutines::_sha1_implCompress     = generate_SHA1_stub(false,   "SHA1_singleBlock");
--- a/src/hotspot/cpu/s390/vm_version_s390.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/cpu/s390/vm_version_s390.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2016, 2018 SAP SE. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -165,8 +165,10 @@
     FLAG_SET_DEFAULT(UseAESCTRIntrinsics, false);
   }
 
-  // TODO: implement GHASH intrinsics
-  if (UseGHASHIntrinsics) {
+  if (FLAG_IS_DEFAULT(UseGHASHIntrinsics) && has_Crypto_GHASH()) {
+    FLAG_SET_DEFAULT(UseGHASHIntrinsics, true);
+  }
+  if (UseGHASHIntrinsics && !has_Crypto_GHASH()) {
     warning("GHASH intrinsics are not available on this CPU");
     FLAG_SET_DEFAULT(UseGHASHIntrinsics, false);
   }
--- a/src/hotspot/cpu/x86/c2_init_x86.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/cpu/x86/c2_init_x86.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -29,6 +29,8 @@
 
 // processor dependent initialization for i486
 
+LP64_ONLY(extern void reg_mask_init();)
+
 void Compile::pd_compiler2_init() {
   guarantee(CodeEntryAlignment >= InteriorEntryAlignment, "" );
   // QQQ presumably all 64bit cpu's support this. Seems like the ifdef could
@@ -58,4 +60,5 @@
       OptoReg::invalidate(i);
     }
   }
+  LP64_ONLY(reg_mask_init();)
 }
--- a/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -359,7 +359,7 @@
 // ZBarrierSetRuntime::load_barrier_on_weak_oop_field_preloaded().
 static address generate_load_barrier_stub(StubCodeGenerator* cgen, Register raddr, DecoratorSet decorators) {
   // Don't generate stub for invalid registers
-  if (raddr == rsp || raddr == r12 || raddr == r15) {
+  if (raddr == rsp || raddr == r15) {
     return NULL;
   }
 
--- a/src/hotspot/cpu/x86/gc/z/z_x86_64.ad	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/cpu/x86/gc/z/z_x86_64.ad	Thu Feb 21 22:08:53 2019 +0100
@@ -26,9 +26,8 @@
 #include "gc/z/zBarrierSetAssembler.hpp"
 
 static void z_load_barrier_slow_reg(MacroAssembler& _masm, Register dst, Address src, bool weak) {
-  assert(dst != r12, "Invalid register");
+  assert(dst != rsp, "Invalid register");
   assert(dst != r15, "Invalid register");
-  assert(dst != rsp, "Invalid register");
 
   const address stub = weak ? ZBarrierSet::assembler()->load_barrier_weak_slow_stub(dst)
                             : ZBarrierSet::assembler()->load_barrier_slow_stub(dst);
--- a/src/hotspot/cpu/x86/vm_version_x86.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/cpu/x86/vm_version_x86.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -336,7 +336,7 @@
 #define CPU_AVX512_VPOPCNTDQ ((uint64_t)UCONST64(0x2000000000)) // Vector popcount
 #define CPU_VPCLMULQDQ ((uint64_t)UCONST64(0x4000000000)) //Vector carryless multiplication
 #define CPU_VAES ((uint64_t)UCONST64(0x8000000000))    // Vector AES instructions
-#define CPU_VNNI ((uint64_t)UCONST64(0x16000000000))   // Vector Neural Network Instructions
+#define CPU_VNNI ((uint64_t)UCONST64(0x10000000000))   // Vector Neural Network Instructions
 
   enum Extended_Family {
     // AMD
--- a/src/hotspot/cpu/x86/x86_64.ad	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/cpu/x86/x86_64.ad	Thu Feb 21 22:08:53 2019 +0100
@@ -169,135 +169,94 @@
 // Empty register class.
 reg_class no_reg();
 
-// Class for all pointer registers (including RSP and RBP)
-reg_class any_reg_with_rbp(RAX, RAX_H,
-                           RDX, RDX_H,
-                           RBP, RBP_H,
-                           RDI, RDI_H,
-                           RSI, RSI_H,
-                           RCX, RCX_H,
-                           RBX, RBX_H,
-                           RSP, RSP_H,
-                           R8,  R8_H,
-                           R9,  R9_H,
-                           R10, R10_H,
-                           R11, R11_H,
-                           R12, R12_H,
-                           R13, R13_H,
-                           R14, R14_H,
-                           R15, R15_H);
-
-// Class for all pointer registers (including RSP, but excluding RBP)
-reg_class any_reg_no_rbp(RAX, RAX_H,
-                         RDX, RDX_H,
-                         RDI, RDI_H,
-                         RSI, RSI_H,
-                         RCX, RCX_H,
-                         RBX, RBX_H,
-                         RSP, RSP_H,
-                         R8,  R8_H,
-                         R9,  R9_H,
-                         R10, R10_H,
-                         R11, R11_H,
-                         R12, R12_H,
-                         R13, R13_H,
-                         R14, R14_H,
-                         R15, R15_H);
-
-// Dynamic register class that selects at runtime between register classes
-// any_reg_no_rbp and any_reg_with_rbp (depending on the value of the flag PreserveFramePointer).
-// Equivalent to: return PreserveFramePointer ? any_reg_no_rbp : any_reg_with_rbp;
-reg_class_dynamic any_reg(any_reg_no_rbp, any_reg_with_rbp, %{ PreserveFramePointer %});
+// Class for all pointer/long registers
+reg_class all_reg(RAX, RAX_H,
+                  RDX, RDX_H,
+                  RBP, RBP_H,
+                  RDI, RDI_H,
+                  RSI, RSI_H,
+                  RCX, RCX_H,
+                  RBX, RBX_H,
+                  RSP, RSP_H,
+                  R8,  R8_H,
+                  R9,  R9_H,
+                  R10, R10_H,
+                  R11, R11_H,
+                  R12, R12_H,
+                  R13, R13_H,
+                  R14, R14_H,
+                  R15, R15_H);
+
+// Class for all int registers
+reg_class all_int_reg(RAX
+                      RDX,
+                      RBP,
+                      RDI,
+                      RSI,
+                      RCX,
+                      RBX,
+                      R8,
+                      R9,
+                      R10,
+                      R11,
+                      R12,
+                      R13,
+                      R14);
+
+// Class for all pointer registers
+reg_class any_reg %{
+  return _ANY_REG_mask;
+%}
 
 // Class for all pointer registers (excluding RSP)
-reg_class ptr_reg_with_rbp(RAX, RAX_H,
-                           RDX, RDX_H,
-                           RBP, RBP_H,
-                           RDI, RDI_H,
-                           RSI, RSI_H,
-                           RCX, RCX_H,
-                           RBX, RBX_H,
-                           R8,  R8_H,
-                           R9,  R9_H,
-                           R10, R10_H,
-                           R11, R11_H,
-                           R13, R13_H,
-                           R14, R14_H);
+reg_class ptr_reg %{
+  return _PTR_REG_mask;
+%}
 
 // Class for all pointer registers (excluding RSP and RBP)
-reg_class ptr_reg_no_rbp(RAX, RAX_H,
-                         RDX, RDX_H,
-                         RDI, RDI_H,
-                         RSI, RSI_H,
-                         RCX, RCX_H,
-                         RBX, RBX_H,
-                         R8,  R8_H,
-                         R9,  R9_H,
-                         R10, R10_H,
-                         R11, R11_H,
-                         R13, R13_H,
-                         R14, R14_H);
-
-// Dynamic register class that selects between ptr_reg_no_rbp and ptr_reg_with_rbp.
-reg_class_dynamic ptr_reg(ptr_reg_no_rbp, ptr_reg_with_rbp, %{ PreserveFramePointer %});
+reg_class ptr_reg_no_rbp %{
+  return _PTR_REG_NO_RBP_mask;
+%}
 
 // Class for all pointer registers (excluding RAX and RSP)
-reg_class ptr_no_rax_reg_with_rbp(RDX, RDX_H,
-                                  RBP, RBP_H,
-                                  RDI, RDI_H,
-                                  RSI, RSI_H,
-                                  RCX, RCX_H,
-                                  RBX, RBX_H,
-                                  R8,  R8_H,
-                                  R9,  R9_H,
-                                  R10, R10_H,
-                                  R11, R11_H,
-                                  R13, R13_H,
-                                  R14, R14_H);
-
-// Class for all pointer registers (excluding RAX, RSP, and RBP)
-reg_class ptr_no_rax_reg_no_rbp(RDX, RDX_H,
-                                RDI, RDI_H,
-                                RSI, RSI_H,
-                                RCX, RCX_H,
-                                RBX, RBX_H,
-                                R8,  R8_H,
-                                R9,  R9_H,
-                                R10, R10_H,
-                                R11, R11_H,
-                                R13, R13_H,
-                                R14, R14_H);
-
-// Dynamic register class that selects between ptr_no_rax_reg_no_rbp and ptr_no_rax_reg_with_rbp.
-reg_class_dynamic ptr_no_rax_reg(ptr_no_rax_reg_no_rbp, ptr_no_rax_reg_with_rbp, %{ PreserveFramePointer %});
+reg_class ptr_no_rax_reg %{
+  return _PTR_NO_RAX_REG_mask;
+%}
 
 // Class for all pointer registers (excluding RAX, RBX, and RSP)
-reg_class ptr_no_rax_rbx_reg_with_rbp(RDX, RDX_H,
-                                      RBP, RBP_H,
-                                      RDI, RDI_H,
-                                      RSI, RSI_H,
-                                      RCX, RCX_H,
-                                      R8,  R8_H,
-                                      R9,  R9_H,
-                                      R10, R10_H,
-                                      R11, R11_H,
-                                      R13, R13_H,
-                                      R14, R14_H);
-
-// Class for all pointer registers (excluding RAX, RBX, RSP, and RBP)
-reg_class ptr_no_rax_rbx_reg_no_rbp(RDX, RDX_H,
-                                    RDI, RDI_H,
-                                    RSI, RSI_H,
-                                    RCX, RCX_H,
-                                    R8,  R8_H,
-                                    R9,  R9_H,
-                                    R10, R10_H,
-                                    R11, R11_H,
-                                    R13, R13_H,
-                                    R14, R14_H);
-
-// Dynamic register class that selects between ptr_no_rax_rbx_reg_no_rbp and ptr_no_rax_rbx_reg_with_rbp.
-reg_class_dynamic ptr_no_rax_rbx_reg(ptr_no_rax_rbx_reg_no_rbp, ptr_no_rax_rbx_reg_with_rbp, %{ PreserveFramePointer %});
+reg_class ptr_no_rax_rbx_reg %{
+  return _PTR_NO_RAX_RBX_REG_mask;
+%}
+
+// Class for all long registers (excluding RSP)
+reg_class long_reg %{
+  return _LONG_REG_mask;
+%}
+
+// Class for all long registers (excluding RAX, RDX and RSP)
+reg_class long_no_rax_rdx_reg %{
+  return _LONG_NO_RAX_RDX_REG_mask;
+%}
+
+// Class for all long registers (excluding RCX and RSP)
+reg_class long_no_rcx_reg %{
+  return _LONG_NO_RCX_REG_mask;
+%}
+
+// Class for all int registers (excluding RSP)
+reg_class int_reg %{
+  return _INT_REG_mask;
+%}
+
+// Class for all int registers (excluding RAX, RDX, and RSP)
+reg_class int_no_rax_rdx_reg %{
+  return _INT_NO_RAX_RDX_REG_mask;
+%}
+
+// Class for all int registers (excluding RCX and RSP)
+reg_class int_no_rcx_reg %{
+  return _INT_NO_RCX_REG_mask;
+%}
 
 // Singleton class for RAX pointer register
 reg_class ptr_rax_reg(RAX, RAX_H);
@@ -317,96 +276,6 @@
 // Singleton class for TLS pointer
 reg_class ptr_r15_reg(R15, R15_H);
 
-// Class for all long registers (excluding RSP)
-reg_class long_reg_with_rbp(RAX, RAX_H,
-                            RDX, RDX_H,
-                            RBP, RBP_H,
-                            RDI, RDI_H,
-                            RSI, RSI_H,
-                            RCX, RCX_H,
-                            RBX, RBX_H,
-                            R8,  R8_H,
-                            R9,  R9_H,
-                            R10, R10_H,
-                            R11, R11_H,
-                            R13, R13_H,
-                            R14, R14_H);
-
-// Class for all long registers (excluding RSP and RBP)
-reg_class long_reg_no_rbp(RAX, RAX_H,
-                          RDX, RDX_H,
-                          RDI, RDI_H,
-                          RSI, RSI_H,
-                          RCX, RCX_H,
-                          RBX, RBX_H,
-                          R8,  R8_H,
-                          R9,  R9_H,
-                          R10, R10_H,
-                          R11, R11_H,
-                          R13, R13_H,
-                          R14, R14_H);
-
-// Dynamic register class that selects between long_reg_no_rbp and long_reg_with_rbp.
-reg_class_dynamic long_reg(long_reg_no_rbp, long_reg_with_rbp, %{ PreserveFramePointer %});
-
-// Class for all long registers (excluding RAX, RDX and RSP)
-reg_class long_no_rax_rdx_reg_with_rbp(RBP, RBP_H,
-                                       RDI, RDI_H,
-                                       RSI, RSI_H,
-                                       RCX, RCX_H,
-                                       RBX, RBX_H,
-                                       R8,  R8_H,
-                                       R9,  R9_H,
-                                       R10, R10_H,
-                                       R11, R11_H,
-                                       R13, R13_H,
-                                       R14, R14_H);
-
-// Class for all long registers (excluding RAX, RDX, RSP, and RBP)
-reg_class long_no_rax_rdx_reg_no_rbp(RDI, RDI_H,
-                                     RSI, RSI_H,
-                                     RCX, RCX_H,
-                                     RBX, RBX_H,
-                                     R8,  R8_H,
-                                     R9,  R9_H,
-                                     R10, R10_H,
-                                     R11, R11_H,
-                                     R13, R13_H,
-                                     R14, R14_H);
-
-// Dynamic register class that selects between long_no_rax_rdx_reg_no_rbp and long_no_rax_rdx_reg_with_rbp.
-reg_class_dynamic long_no_rax_rdx_reg(long_no_rax_rdx_reg_no_rbp, long_no_rax_rdx_reg_with_rbp, %{ PreserveFramePointer %});
-
-// Class for all long registers (excluding RCX and RSP)
-reg_class long_no_rcx_reg_with_rbp(RBP, RBP_H,
-                                   RDI, RDI_H,
-                                   RSI, RSI_H,
-                                   RAX, RAX_H,
-                                   RDX, RDX_H,
-                                   RBX, RBX_H,
-                                   R8,  R8_H,
-                                   R9,  R9_H,
-                                   R10, R10_H,
-                                   R11, R11_H,
-                                   R13, R13_H,
-                                   R14, R14_H);
-
-// Class for all long registers (excluding RCX, RSP, and RBP)
-reg_class long_no_rcx_reg_no_rbp(RDI, RDI_H,
-                                 RSI, RSI_H,
-                                 RAX, RAX_H,
-                                 RDX, RDX_H,
-                                 RBX, RBX_H,
-                                 R8,  R8_H,
-                                 R9,  R9_H,
-                                 R10, R10_H,
-                                 R11, R11_H,
-                                 R13, R13_H,
-                                 R14, R14_H);
-
-// Dynamic register class that selects between long_no_rcx_reg_no_rbp and long_no_rcx_reg_with_rbp.
-reg_class_dynamic long_no_rcx_reg(long_no_rcx_reg_no_rbp, long_no_rcx_reg_with_rbp, %{ PreserveFramePointer %});
-
 // Singleton class for RAX long register
 reg_class long_rax_reg(RAX, RAX_H);
 
@@ -416,96 +285,6 @@
 // Singleton class for RDX long register
 reg_class long_rdx_reg(RDX, RDX_H);
 
-// Class for all int registers (excluding RSP)
-reg_class int_reg_with_rbp(RAX,
-                           RDX,
-                           RBP,
-                           RDI,
-                           RSI,
-                           RCX,
-                           RBX,
-                           R8,
-                           R9,
-                           R10,
-                           R11,
-                           R13,
-                           R14);
-
-// Class for all int registers (excluding RSP and RBP)
-reg_class int_reg_no_rbp(RAX,
-                         RDX,
-                         RDI,
-                         RSI,
-                         RCX,
-                         RBX,
-                         R8,
-                         R9,
-                         R10,
-                         R11,
-                         R13,
-                         R14);
-
-// Dynamic register class that selects between int_reg_no_rbp and int_reg_with_rbp.
-reg_class_dynamic int_reg(int_reg_no_rbp, int_reg_with_rbp, %{ PreserveFramePointer %});
-
-// Class for all int registers (excluding RCX and RSP)
-reg_class int_no_rcx_reg_with_rbp(RAX,
-                                  RDX,
-                                  RBP,
-                                  RDI,
-                                  RSI,
-                                  RBX,
-                                  R8,
-                                  R9,
-                                  R10,
-                                  R11,
-                                  R13,
-                                  R14);
-
-// Class for all int registers (excluding RCX, RSP, and RBP)
-reg_class int_no_rcx_reg_no_rbp(RAX,
-                                RDX,
-                                RDI,
-                                RSI,
-                                RBX,
-                                R8,
-                                R9,
-                                R10,
-                                R11,
-                                R13,
-                                R14);
-
-// Dynamic register class that selects between int_no_rcx_reg_no_rbp and int_no_rcx_reg_with_rbp.
-reg_class_dynamic int_no_rcx_reg(int_no_rcx_reg_no_rbp, int_no_rcx_reg_with_rbp, %{ PreserveFramePointer %});
-
-// Class for all int registers (excluding RAX, RDX, and RSP)
-reg_class int_no_rax_rdx_reg_with_rbp(RBP,
-                                      RDI,
-                                      RSI,
-                                      RCX,
-                                      RBX,
-                                      R8,
-                                      R9,
-                                      R10,
-                                      R11,
-                                      R13,
-                                      R14);
-
-// Class for all int registers (excluding RAX, RDX, RSP, and RBP)
-reg_class int_no_rax_rdx_reg_no_rbp(RDI,
-                                    RSI,
-                                    RCX,
-                                    RBX,
-                                    R8,
-                                    R9,
-                                    R10,
-                                    R11,
-                                    R13,
-                                    R14);
-
-// Dynamic register class that selects between int_no_rax_rdx_reg_no_rbp and int_no_rax_rdx_reg_with_rbp.
-reg_class_dynamic int_no_rax_rdx_reg(int_no_rax_rdx_reg_no_rbp, int_no_rax_rdx_reg_with_rbp, %{ PreserveFramePointer %});
-
 // Singleton class for RAX int register
 reg_class int_rax_reg(RAX);
 
@@ -529,12 +308,123 @@
 //----------SOURCE BLOCK-------------------------------------------------------
 // This is a block of C++ code which provides values, functions, and
 // definitions necessary in the rest of the architecture description
+source_hpp %{
+
+extern RegMask _ANY_REG_mask;
+extern RegMask _PTR_REG_mask;
+extern RegMask _PTR_REG_NO_RBP_mask;
+extern RegMask _PTR_NO_RAX_REG_mask;
+extern RegMask _PTR_NO_RAX_RBX_REG_mask;
+extern RegMask _LONG_REG_mask;
+extern RegMask _LONG_NO_RAX_RDX_REG_mask;
+extern RegMask _LONG_NO_RCX_REG_mask;
+extern RegMask _INT_REG_mask;
+extern RegMask _INT_NO_RAX_RDX_REG_mask;
+extern RegMask _INT_NO_RCX_REG_mask;
+
+extern RegMask _STACK_OR_PTR_REG_mask;
+extern RegMask _STACK_OR_LONG_REG_mask;
+extern RegMask _STACK_OR_INT_REG_mask;
+
+inline const RegMask& STACK_OR_PTR_REG_mask()  { return _STACK_OR_PTR_REG_mask;  }
+inline const RegMask& STACK_OR_LONG_REG_mask() { return _STACK_OR_LONG_REG_mask; }
+inline const RegMask& STACK_OR_INT_REG_mask()  { return _STACK_OR_INT_REG_mask;  }
+
+%}
+
 source %{
 #define   RELOC_IMM64    Assembler::imm_operand
 #define   RELOC_DISP32   Assembler::disp32_operand
 
 #define __ _masm.
 
+RegMask _ANY_REG_mask;
+RegMask _PTR_REG_mask;
+RegMask _PTR_REG_NO_RBP_mask;
+RegMask _PTR_NO_RAX_REG_mask;
+RegMask _PTR_NO_RAX_RBX_REG_mask;
+RegMask _LONG_REG_mask;
+RegMask _LONG_NO_RAX_RDX_REG_mask;
+RegMask _LONG_NO_RCX_REG_mask;
+RegMask _INT_REG_mask;
+RegMask _INT_NO_RAX_RDX_REG_mask;
+RegMask _INT_NO_RCX_REG_mask;
+RegMask _STACK_OR_PTR_REG_mask;
+RegMask _STACK_OR_LONG_REG_mask;
+RegMask _STACK_OR_INT_REG_mask;
+
+static bool need_r12_heapbase() {
+  return UseCompressedOops || UseCompressedClassPointers;
+}
+
+void reg_mask_init() {
+  // _ALL_REG_mask is generated by adlc from the all_reg register class below.
+  // We derive a number of subsets from it.
+  _ANY_REG_mask = _ALL_REG_mask;
+
+  if (PreserveFramePointer) {
+    _ANY_REG_mask.Remove(OptoReg::as_OptoReg(rbp->as_VMReg()));
+    _ANY_REG_mask.Remove(OptoReg::as_OptoReg(rbp->as_VMReg()->next()));
+  }
+  if (need_r12_heapbase()) {
+    _ANY_REG_mask.Remove(OptoReg::as_OptoReg(r12->as_VMReg()));
+    _ANY_REG_mask.Remove(OptoReg::as_OptoReg(r12->as_VMReg()->next()));
+  }
+
+  _PTR_REG_mask = _ANY_REG_mask;
+  _PTR_REG_mask.Remove(OptoReg::as_OptoReg(rsp->as_VMReg()));
+  _PTR_REG_mask.Remove(OptoReg::as_OptoReg(rsp->as_VMReg()->next()));
+  _PTR_REG_mask.Remove(OptoReg::as_OptoReg(r15->as_VMReg()));
+  _PTR_REG_mask.Remove(OptoReg::as_OptoReg(r15->as_VMReg()->next()));
+
+  _STACK_OR_PTR_REG_mask = _PTR_REG_mask;
+  _STACK_OR_PTR_REG_mask.OR(STACK_OR_STACK_SLOTS_mask());
+
+  _PTR_REG_NO_RBP_mask = _PTR_REG_mask;
+  _PTR_REG_NO_RBP_mask.Remove(OptoReg::as_OptoReg(rbp->as_VMReg()));
+  _PTR_REG_NO_RBP_mask.Remove(OptoReg::as_OptoReg(rbp->as_VMReg()->next()));
+
+  _PTR_NO_RAX_REG_mask = _PTR_REG_mask;
+  _PTR_NO_RAX_REG_mask.Remove(OptoReg::as_OptoReg(rax->as_VMReg()));
+  _PTR_NO_RAX_REG_mask.Remove(OptoReg::as_OptoReg(rax->as_VMReg()->next()));
+
+  _PTR_NO_RAX_RBX_REG_mask = _PTR_NO_RAX_REG_mask;
+  _PTR_NO_RAX_RBX_REG_mask.Remove(OptoReg::as_OptoReg(rbx->as_VMReg()));
+  _PTR_NO_RAX_RBX_REG_mask.Remove(OptoReg::as_OptoReg(rbx->as_VMReg()->next()));
+
+  _LONG_REG_mask = _PTR_REG_mask;
+  _STACK_OR_LONG_REG_mask = _LONG_REG_mask;
+  _STACK_OR_LONG_REG_mask.OR(STACK_OR_STACK_SLOTS_mask());
+
+  _LONG_NO_RAX_RDX_REG_mask = _LONG_REG_mask;
+  _LONG_NO_RAX_RDX_REG_mask.Remove(OptoReg::as_OptoReg(rax->as_VMReg()));
+  _LONG_NO_RAX_RDX_REG_mask.Remove(OptoReg::as_OptoReg(rax->as_VMReg()->next()));
+  _LONG_NO_RAX_RDX_REG_mask.Remove(OptoReg::as_OptoReg(rdx->as_VMReg()));
+  _LONG_NO_RAX_RDX_REG_mask.Remove(OptoReg::as_OptoReg(rdx->as_VMReg()->next()));
+
+  _LONG_NO_RCX_REG_mask = _LONG_REG_mask;
+  _LONG_NO_RCX_REG_mask.Remove(OptoReg::as_OptoReg(rcx->as_VMReg()));
+  _LONG_NO_RCX_REG_mask.Remove(OptoReg::as_OptoReg(rcx->as_VMReg()->next()));
+
+  _INT_REG_mask = _ALL_INT_REG_mask;
+  if (PreserveFramePointer) {
+    _INT_REG_mask.Remove(OptoReg::as_OptoReg(rbp->as_VMReg()));
+  }
+  if (need_r12_heapbase()) {
+    _INT_REG_mask.Remove(OptoReg::as_OptoReg(r12->as_VMReg()));
+  }
+
+  _STACK_OR_INT_REG_mask = _INT_REG_mask;
+  _STACK_OR_INT_REG_mask.OR(STACK_OR_STACK_SLOTS_mask());
+
+  _INT_NO_RAX_RDX_REG_mask = _INT_REG_mask;
+  _INT_NO_RAX_RDX_REG_mask.Remove(OptoReg::as_OptoReg(rax->as_VMReg()));
+  _INT_NO_RAX_RDX_REG_mask.Remove(OptoReg::as_OptoReg(rdx->as_VMReg()));
+
+  _INT_NO_RCX_REG_mask = _INT_REG_mask;
+  _INT_NO_RCX_REG_mask.Remove(OptoReg::as_OptoReg(rcx->as_VMReg()));
+}
+
 static bool generate_vzeroupper(Compile* C) {
   return (VM_Version::supports_vzeroupper() && (C->max_vector_size() > 16 || C->clear_upper_avx() == true)) ? true: false;  // Generate vzeroupper
 }
--- a/src/hotspot/os/linux/globals_linux.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/os/linux/globals_linux.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -70,7 +70,12 @@
   diagnostic(bool, DumpPrivateMappingsInCore, true,                     \
           "If true, sets bit 2 of /proc/PID/coredump_filter, thus "     \
           "resulting in file-backed private mappings of the process to "\
-          "be dumped into the corefile, if UseSharedSpaces is true.")   \
+          "be dumped into the corefile.")                               \
+                                                                        \
+  diagnostic(bool, DumpSharedMappingsInCore, true,                      \
+          "If true, sets bit 3 of /proc/PID/coredump_filter, thus "     \
+          "resulting in file-backed shared mappings of the process to " \
+          "be dumped into the corefile.")                               \
                                                                         \
   diagnostic(bool, UseCpuAllocPath, false,                              \
              "Use CPU_ALLOC code path in os::active_processor_count ")
--- a/src/hotspot/os/linux/os_linux.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/os/linux/os_linux.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -131,6 +131,7 @@
 
 enum CoredumpFilterBit {
   FILE_BACKED_PVT_BIT = 1 << 2,
+  FILE_BACKED_SHARED_BIT = 1 << 3,
   LARGEPAGES_BIT = 1 << 6,
   DAX_SHARED_BIT = 1 << 8
 };
@@ -1357,8 +1358,8 @@
 void os::abort(bool dump_core, void* siginfo, const void* context) {
   os::shutdown();
   if (dump_core) {
-#if INCLUDE_CDS
-    if (UseSharedSpaces && DumpPrivateMappingsInCore) {
+#ifndef ZERO
+    if (DumpPrivateMappingsInCore) {
       ClassLoader::close_jrt_image();
     }
 #endif
@@ -3432,8 +3433,6 @@
   return result;
 }
 
-// Set the coredump_filter bits to include largepages in core dump (bit 6)
-//
 // From the coredump_filter documentation:
 //
 // - (bit 0) anonymous private memory
@@ -5131,11 +5130,13 @@
     set_coredump_filter(DAX_SHARED_BIT);
   }
 
-#if INCLUDE_CDS
-  if (UseSharedSpaces && DumpPrivateMappingsInCore) {
+  if (DumpPrivateMappingsInCore) {
     set_coredump_filter(FILE_BACKED_PVT_BIT);
   }
-#endif
+
+  if (DumpSharedMappingsInCore) {
+    set_coredump_filter(FILE_BACKED_SHARED_BIT);
+  }
 
   return JNI_OK;
 }
--- a/src/hotspot/os/posix/os_posix.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/os/posix/os_posix.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -177,7 +177,7 @@
  * These event objects are type-stable and immortal - we never delete them.
  * Events are associated with a thread for the lifetime of the thread.
  */
-class PlatformEvent : public CHeapObj<mtInternal> {
+class PlatformEvent : public CHeapObj<mtSynchronizer> {
  private:
   double cachePad[4];        // Increase odds that _mutex is sole occupant of cache line
   volatile int _event;       // Event count/permit: -1, 0 or 1
@@ -212,7 +212,7 @@
 // API updates of course). But Parker methods use fastpaths that break that
 // level of encapsulation - so combining the two remains a future project.
 
-class PlatformParker : public CHeapObj<mtInternal> {
+class PlatformParker : public CHeapObj<mtSynchronizer> {
  protected:
   enum {
     REL_INDEX = 0,
@@ -230,7 +230,7 @@
 };
 
 // Platform specific implementation that underpins VM Monitor/Mutex class
-class PlatformMonitor : public CHeapObj<mtInternal> {
+class PlatformMonitor : public CHeapObj<mtSynchronizer> {
  private:
   pthread_mutex_t _mutex; // Native mutex for locking
   pthread_cond_t  _cond;  // Native condition variable for blocking
--- a/src/hotspot/os/solaris/os_solaris.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/os/solaris/os_solaris.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -281,7 +281,7 @@
 
 };
 
-class PlatformEvent : public CHeapObj<mtInternal> {
+class PlatformEvent : public CHeapObj<mtSynchronizer> {
  private:
   double CachePad[4];   // increase odds that _mutex is sole occupant of cache line
   volatile int _Event;
@@ -317,7 +317,7 @@
   void unpark();
 };
 
-class PlatformParker : public CHeapObj<mtInternal> {
+class PlatformParker : public CHeapObj<mtSynchronizer> {
  protected:
   mutex_t _mutex[1];
   cond_t  _cond[1];
@@ -336,7 +336,7 @@
 };
 
 // Platform specific implementation that underpins VM Monitor/Mutex class
-class PlatformMonitor : public CHeapObj<mtInternal> {
+class PlatformMonitor : public CHeapObj<mtSynchronizer> {
  private:
   mutex_t _mutex; // Native mutex for locking
   cond_t  _cond;  // Native condition variable for blocking
--- a/src/hotspot/os/windows/os_windows.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/os/windows/os_windows.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -148,7 +148,7 @@
   static volatile intptr_t _crash_mux;
 };
 
-class PlatformEvent : public CHeapObj<mtInternal> {
+class PlatformEvent : public CHeapObj<mtSynchronizer> {
   private:
     double CachePad [4] ;   // increase odds that _Event is sole occupant of cache line
     volatile int _Event ;
@@ -174,7 +174,7 @@
 
 
 
-class PlatformParker : public CHeapObj<mtInternal> {
+class PlatformParker : public CHeapObj<mtSynchronizer> {
   protected:
     HANDLE _ParkEvent ;
 
@@ -188,7 +188,7 @@
 } ;
 
 // Platform specific implementation that underpins VM Monitor/Mutex class
-class PlatformMonitor : public CHeapObj<mtInternal> {
+class PlatformMonitor : public CHeapObj<mtSynchronizer> {
  private:
   CRITICAL_SECTION   _mutex; // Native mutex for locking
   CONDITION_VARIABLE _cond;  // Native condition variable for blocking
--- a/src/hotspot/share/adlc/formsopt.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/adlc/formsopt.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -242,9 +242,6 @@
   char* code_snippet() {
     return _code_snippet;
   }
-  void set_stack_version(bool flag) {
-    assert(false, "User defined register classes are not allowed to spill to the stack.");
-  }
   void declare_register_masks(FILE* fp);
   void build_register_masks(FILE* fp) {
     // We do not need to generate register masks because we select at runtime
--- a/src/hotspot/share/c1/c1_Optimizer.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/c1/c1_Optimizer.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -174,6 +174,12 @@
   for_each_phi_fun(t_block, phi, return; );
   for_each_phi_fun(f_block, phi, return; );
 
+  // Only replace safepoint gotos if state_before information is available (if is a safepoint)
+  bool is_safepoint = if_->is_safepoint();
+  if (!is_safepoint && (t_goto->is_safepoint() || f_goto->is_safepoint())) {
+    return;
+  }
+
   // 2) substitute conditional expression
   //    with an IfOp followed by a Goto
   // cut if_ away and get node before
@@ -202,7 +208,7 @@
 
   // append Goto to successor
   ValueStack* state_before = if_->state_before();
-  Goto* goto_ = new Goto(sux, state_before, if_->is_safepoint() || t_goto->is_safepoint() || f_goto->is_safepoint());
+  Goto* goto_ = new Goto(sux, state_before, is_safepoint);
 
   // prepare state for Goto
   ValueStack* goto_state = if_state;
--- a/src/hotspot/share/ci/ciReplay.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/ci/ciReplay.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -33,6 +33,7 @@
 #include "memory/allocation.inline.hpp"
 #include "memory/oopFactory.hpp"
 #include "memory/resourceArea.hpp"
+#include "oops/constantPool.hpp"
 #include "oops/method.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/fieldDescriptor.inline.hpp"
--- a/src/hotspot/share/classfile/classLoader.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/classfile/classLoader.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -101,7 +101,6 @@
 static JImageFindResource_t            JImageFindResource     = NULL;
 static JImageGetResource_t             JImageGetResource      = NULL;
 static JImageResourceIterator_t        JImageResourceIterator = NULL;
-static JImage_ResourcePath_t           JImageResourcePath     = NULL;
 
 // Globals
 
@@ -1094,8 +1093,6 @@
   guarantee(JImageGetResource != NULL, "function JIMAGE_GetResource not found");
   JImageResourceIterator = CAST_TO_FN_PTR(JImageResourceIterator_t, os::dll_lookup(handle, "JIMAGE_ResourceIterator"));
   guarantee(JImageResourceIterator != NULL, "function JIMAGE_ResourceIterator not found");
-  JImageResourcePath = CAST_TO_FN_PTR(JImage_ResourcePath_t, os::dll_lookup(handle, "JIMAGE_ResourcePath"));
-  guarantee(JImageResourcePath != NULL, "function JIMAGE_ResourcePath not found");
 }
 
 jboolean ClassLoader::decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg) {
--- a/src/hotspot/share/classfile/stackMapTable.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/classfile/stackMapTable.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -26,6 +26,7 @@
 #include "classfile/stackMapTable.hpp"
 #include "classfile/verifier.hpp"
 #include "memory/resourceArea.hpp"
+#include "oops/constantPool.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/fieldType.hpp"
 #include "runtime/handles.inline.hpp"
--- a/src/hotspot/share/classfile/stringTable.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/classfile/stringTable.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -334,6 +334,10 @@
   if (StringTable::_alt_hash) {
     hash = hash_string(name, len, true);
   }
+  found_string = StringTable::the_table()->do_lookup(name, len, hash);
+  if (found_string != NULL) {
+    return found_string;
+  }
   return StringTable::the_table()->do_intern(string_or_null_h, name, len,
                                              hash, CHECK_NULL);
 }
--- a/src/hotspot/share/classfile/verifier.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/classfile/verifier.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -49,7 +49,7 @@
 
   // Return false if the class is loaded by the bootstrap loader,
   // or if defineClass was called requesting skipping verification
-  // -Xverify:all/none override this value
+  // -Xverify:all overrides this value
   static bool should_verify_for(oop class_loader, bool should_verify_class);
 
   // Relax certain access checks to enable some broken 1.1 apps to run on 1.2.
--- a/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -2761,7 +2761,7 @@
 CMSPhaseAccounting::~CMSPhaseAccounting() {
   _collector->gc_timer_cm()->register_gc_concurrent_end();
   _collector->stopTimer();
-  log_debug(gc)("Concurrent active time: %.3fms", TimeHelper::counter_to_seconds(_collector->timerTicks()));
+  log_debug(gc)("Concurrent active time: %.3fms", TimeHelper::counter_to_millis(_collector->timerTicks()));
   log_trace(gc)(" (CMS %s yielded %d times)", _title, _collector->yields());
 }
 
--- a/src/hotspot/share/gc/g1/g1Allocator.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1Allocator.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -321,16 +321,26 @@
   }
 }
 
-void G1PLABAllocator::waste(size_t& wasted, size_t& undo_wasted) {
-  wasted = 0;
-  undo_wasted = 0;
+size_t G1PLABAllocator::waste() const {
+  size_t result = 0;
   for (uint state = 0; state < InCSetState::Num; state++) {
     PLAB * const buf = _alloc_buffers[state];
     if (buf != NULL) {
-      wasted += buf->waste();
-      undo_wasted += buf->undo_waste();
+      result += buf->waste();
     }
   }
+  return result;
+}
+
+size_t G1PLABAllocator::undo_waste() const {
+  size_t result = 0;
+  for (uint state = 0; state < InCSetState::Num; state++) {
+    PLAB * const buf = _alloc_buffers[state];
+    if (buf != NULL) {
+      result += buf->undo_waste();
+    }
+  }
+  return result;
 }
 
 bool G1ArchiveAllocator::_archive_check_enabled = false;
--- a/src/hotspot/share/gc/g1/g1Allocator.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1Allocator.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -155,7 +155,8 @@
 public:
   G1PLABAllocator(G1Allocator* allocator);
 
-  void waste(size_t& wasted, size_t& undo_wasted);
+  size_t waste() const;
+  size_t undo_waste() const;
 
   // Allocate word_sz words in dest, either directly into the regions or by
   // allocating a new PLAB. Returns the address of the allocated memory, NULL if
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -3282,10 +3282,6 @@
 
       _root_processor->evacuate_roots(pss, worker_id);
 
-      // We pass a weak code blobs closure to the remembered set scanning because we want to avoid
-      // treating the nmethods visited to act as roots for concurrent marking.
-      // We only want to make sure that the oops in the nmethods are adjusted with regard to the
-      // objects copied by the current evacuation.
       _g1h->g1_rem_set()->oops_into_collection_set_do(pss, worker_id);
 
       double strong_roots_sec = os::elapsedTime() - start_strong_roots_sec;
@@ -3303,27 +3299,22 @@
 
         G1GCPhaseTimes* p = _g1h->g1_policy()->phase_times();
         p->add_time_secs(G1GCPhaseTimes::ObjCopy, worker_id, elapsed_sec - term_sec);
+
+        p->record_or_add_thread_work_item(G1GCPhaseTimes::ObjCopy,
+                                          worker_id,
+                                          pss->lab_waste_words() * HeapWordSize,
+                                          G1GCPhaseTimes::ObjCopyLABWaste);
+        p->record_or_add_thread_work_item(G1GCPhaseTimes::ObjCopy,
+                                          worker_id,
+                                          pss->lab_undo_waste_words() * HeapWordSize,
+                                          G1GCPhaseTimes::ObjCopyLABUndoWaste);
+
         p->record_time_secs(G1GCPhaseTimes::Termination, worker_id, term_sec);
         p->record_thread_work_item(G1GCPhaseTimes::Termination, worker_id, evac_term_attempts);
       }
 
       assert(pss->queue_is_empty(), "should be empty");
 
-      if (log_is_enabled(Debug, gc, task, stats)) {
-        MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
-        size_t lab_waste;
-        size_t lab_undo_waste;
-        pss->waste(lab_waste, lab_undo_waste);
-        _g1h->print_termination_stats(worker_id,
-                                      (os::elapsedTime() - start_sec) * 1000.0,   /* elapsed time */
-                                      strong_roots_sec * 1000.0,                  /* strong roots time */
-                                      term_sec * 1000.0,                          /* evac term time */
-                                      evac_term_attempts,                         /* evac term attempts */
-                                      lab_waste,                                  /* alloc buffer waste */
-                                      lab_undo_waste                              /* undo waste */
-                                      );
-      }
-
       // Close the inner scope so that the ResourceMark and HandleMark
       // destructors are executed here and are included as part of the
       // "GC Worker Time".
@@ -3332,31 +3323,6 @@
   }
 };
 
-void G1CollectedHeap::print_termination_stats_hdr() {
-  log_debug(gc, task, stats)("GC Termination Stats");
-  log_debug(gc, task, stats)("     elapsed  --strong roots-- -------termination------- ------waste (KiB)------");
-  log_debug(gc, task, stats)("thr     ms        ms      %%        ms      %%    attempts  total   alloc    undo");
-  log_debug(gc, task, stats)("--- --------- --------- ------ --------- ------ -------- ------- ------- -------");
-}
-
-void G1CollectedHeap::print_termination_stats(uint worker_id,
-                                              double elapsed_ms,
-                                              double strong_roots_ms,
-                                              double term_ms,
-                                              size_t term_attempts,
-                                              size_t alloc_buffer_waste,
-                                              size_t undo_waste) const {
-  log_debug(gc, task, stats)
-              ("%3d %9.2f %9.2f %6.2f "
-               "%9.2f %6.2f " SIZE_FORMAT_W(8) " "
-               SIZE_FORMAT_W(7) " " SIZE_FORMAT_W(7) " " SIZE_FORMAT_W(7),
-               worker_id, elapsed_ms, strong_roots_ms, strong_roots_ms * 100 / elapsed_ms,
-               term_ms, term_ms * 100 / elapsed_ms, term_attempts,
-               (alloc_buffer_waste + undo_waste) * HeapWordSize / K,
-               alloc_buffer_waste * HeapWordSize / K,
-               undo_waste * HeapWordSize / K);
-}
-
 void G1CollectedHeap::complete_cleaning(BoolObjectClosure* is_alive,
                                         bool class_unloading_occurred) {
   uint num_workers = workers()->active_workers();
@@ -3767,8 +3733,6 @@
     G1RootProcessor root_processor(this, n_workers);
     G1ParTask g1_par_task(this, per_thread_states, _task_queues, &root_processor, n_workers);
 
-    print_termination_stats_hdr();
-
     workers()->run_task(&g1_par_task);
     end_par_time_sec = os::elapsedTime();
 
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -738,16 +738,6 @@
   void pre_evacuate_collection_set();
   void post_evacuate_collection_set(G1EvacuationInfo& evacuation_info, G1ParScanThreadStateSet* pss);
 
-  // Print the header for the per-thread termination statistics.
-  static void print_termination_stats_hdr();
-  // Print actual per-thread termination statistics.
-  void print_termination_stats(uint worker_id,
-                               double elapsed_ms,
-                               double strong_roots_ms,
-                               double term_ms,
-                               size_t term_attempts,
-                               size_t alloc_buffer_waste,
-                               size_t undo_waste) const;
   // Update object copying statistics.
   void record_obj_copy_mem_stats();
 
--- a/src/hotspot/share/gc/g1/g1FullGCOopClosures.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1FullGCOopClosures.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -71,26 +71,19 @@
       }
       if (!_g1h->is_in_closed_subset(obj)) {
         HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
-        yy.print_cr("Field " PTR_FORMAT
-            " of live obj " PTR_FORMAT " in region "
-            "[" PTR_FORMAT ", " PTR_FORMAT ")",
-            p2i(p), p2i(_containing_obj),
-            p2i(from->bottom()), p2i(from->end()));
+        yy.print_cr("Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region " HR_FORMAT,
+                    p2i(p), p2i(_containing_obj), HR_FORMAT_PARAMS(from));
         print_object(&yy, _containing_obj);
         yy.print_cr("points to obj " PTR_FORMAT " not in the heap",
-            p2i(obj));
+                    p2i(obj));
       } else {
         HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
         HeapRegion* to   = _g1h->heap_region_containing((HeapWord*)obj);
-        yy.print_cr("Field " PTR_FORMAT
-            " of live obj " PTR_FORMAT " in region "
-            "[" PTR_FORMAT ", " PTR_FORMAT ")",
-            p2i(p), p2i(_containing_obj),
-            p2i(from->bottom()), p2i(from->end()));
+        yy.print_cr("Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region " HR_FORMAT,
+                    p2i(p), p2i(_containing_obj), HR_FORMAT_PARAMS(from));
         print_object(&yy, _containing_obj);
-        yy.print_cr("points to dead obj " PTR_FORMAT " in region "
-            "[" PTR_FORMAT ", " PTR_FORMAT ")",
-            p2i(obj), p2i(to->bottom()), p2i(to->end()));
+        yy.print_cr("points to dead obj " PTR_FORMAT " in region " HR_FORMAT,
+                    p2i(obj), HR_FORMAT_PARAMS(to));
         print_object(&yy, obj);
       }
       yy.print_cr("----------");
--- a/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -60,6 +60,9 @@
   _gc_par_phases[SystemDictionaryRoots] = new WorkerDataArray<double>(max_gc_threads, "SystemDictionary Roots (ms):");
   _gc_par_phases[CLDGRoots] = new WorkerDataArray<double>(max_gc_threads, "CLDG Roots (ms):");
   _gc_par_phases[JVMTIRoots] = new WorkerDataArray<double>(max_gc_threads, "JVMTI Roots (ms):");
+#if INCLUDE_AOT
+  _gc_par_phases[AOTCodeRoots] = new WorkerDataArray<double>(max_gc_threads, "AOT Root Scan (ms):");
+#endif
   _gc_par_phases[CMRefRoots] = new WorkerDataArray<double>(max_gc_threads, "CM RefProcessor Roots (ms):");
   _gc_par_phases[WaitForStrongCLD] = new WorkerDataArray<double>(max_gc_threads, "Wait For Strong CLD (ms):");
   _gc_par_phases[WeakCLDRoots] = new WorkerDataArray<double>(max_gc_threads, "Weak CLD Roots (ms):");
@@ -74,9 +77,6 @@
   _gc_par_phases[ScanRS] = new WorkerDataArray<double>(max_gc_threads, "Scan RS (ms):");
   _gc_par_phases[OptScanRS] = new WorkerDataArray<double>(max_gc_threads, "Optional Scan RS (ms):");
   _gc_par_phases[CodeRoots] = new WorkerDataArray<double>(max_gc_threads, "Code Root Scanning (ms):");
-#if INCLUDE_AOT
-  _gc_par_phases[AOTCodeRoots] = new WorkerDataArray<double>(max_gc_threads, "AOT Root Scanning (ms):");
-#endif
   _gc_par_phases[ObjCopy] = new WorkerDataArray<double>(max_gc_threads, "Object Copy (ms):");
   _gc_par_phases[OptObjCopy] = new WorkerDataArray<double>(max_gc_threads, "Optional Object Copy (ms):");
   _gc_par_phases[Termination] = new WorkerDataArray<double>(max_gc_threads, "Termination (ms):");
@@ -107,6 +107,11 @@
   _update_rs_skipped_cards = new WorkerDataArray<size_t>(max_gc_threads, "Skipped Cards:");
   _gc_par_phases[UpdateRS]->link_thread_work_items(_update_rs_skipped_cards, UpdateRSSkippedCards);
 
+  _obj_copy_lab_waste = new WorkerDataArray<size_t>(max_gc_threads, "LAB Waste");
+  _gc_par_phases[ObjCopy]->link_thread_work_items(_obj_copy_lab_waste, ObjCopyLABWaste);
+  _obj_copy_lab_undo_waste = new WorkerDataArray<size_t>(max_gc_threads, "LAB Undo Waste");
+  _gc_par_phases[ObjCopy]->link_thread_work_items(_obj_copy_lab_undo_waste, ObjCopyLABUndoWaste);
+
   _termination_attempts = new WorkerDataArray<size_t>(max_gc_threads, "Termination Attempts:");
   _gc_par_phases[Termination]->link_thread_work_items(_termination_attempts);
 
@@ -383,15 +388,12 @@
   for (int i = ThreadRoots; i <= SATBFiltering; i++) {
     trace_phase(_gc_par_phases[i]);
   }
+  if (G1HotCardCache::default_use_cache()) {
+    debug_phase(_gc_par_phases[ScanHCC]);
+  }
   debug_phase(_gc_par_phases[UpdateRS]);
-  if (G1HotCardCache::default_use_cache()) {
-    trace_phase(_gc_par_phases[ScanHCC]);
-  }
   debug_phase(_gc_par_phases[ScanRS]);
   debug_phase(_gc_par_phases[CodeRoots]);
-#if INCLUDE_AOT
-  debug_phase(_gc_par_phases[AOTCodeRoots]);
-#endif
   debug_phase(_gc_par_phases[ObjCopy]);
   debug_phase(_gc_par_phases[Termination]);
   debug_phase(_gc_par_phases[Other]);
@@ -503,6 +505,9 @@
       "SystemDictionaryRoots",
       "CLDGRoots",
       "JVMTIRoots",
+#if INCLUDE_AOT
+      "AOTCodeRoots",
+#endif
       "CMRefRoots",
       "WaitForStrongCLD",
       "WeakCLDRoots",
@@ -512,9 +517,6 @@
       "ScanRS",
       "OptScanRS",
       "CodeRoots",
-#if INCLUDE_AOT
-      "AOTCodeRoots",
-#endif
       "ObjCopy",
       "OptObjCopy",
       "Termination",
--- a/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -55,6 +55,9 @@
     SystemDictionaryRoots,
     CLDGRoots,
     JVMTIRoots,
+#if INCLUDE_AOT
+    AOTCodeRoots,
+#endif
     CMRefRoots,
     WaitForStrongCLD,
     WeakCLDRoots,
@@ -64,9 +67,6 @@
     ScanRS,
     OptScanRS,
     CodeRoots,
-#if INCLUDE_AOT
-    AOTCodeRoots,
-#endif
     ObjCopy,
     OptObjCopy,
     Termination,
@@ -93,6 +93,11 @@
     UpdateRSSkippedCards
   };
 
+  enum GCObjCopyWorkItems {
+    ObjCopyLABWaste,
+    ObjCopyLABUndoWaste
+  };
+
   enum GCOptCSetWorkItems {
       OptCSetScannedCards,
       OptCSetClaimedCards,
@@ -114,6 +119,9 @@
   WorkerDataArray<size_t>* _scan_rs_claimed_cards;
   WorkerDataArray<size_t>* _scan_rs_skipped_cards;
 
+  WorkerDataArray<size_t>* _obj_copy_lab_waste;
+  WorkerDataArray<size_t>* _obj_copy_lab_undo_waste;
+
   WorkerDataArray<size_t>* _opt_cset_scanned_cards;
   WorkerDataArray<size_t>* _opt_cset_claimed_cards;
   WorkerDataArray<size_t>* _opt_cset_skipped_cards;
--- a/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -106,8 +106,12 @@
   delete[] _oops_into_optional_regions;
 }
 
-void G1ParScanThreadState::waste(size_t& wasted, size_t& undo_wasted) {
-  _plab_allocator->waste(wasted, undo_wasted);
+size_t G1ParScanThreadState::lab_waste_words() const {
+  return _plab_allocator->waste();
+}
+
+size_t G1ParScanThreadState::lab_undo_waste_words() const {
+  return _plab_allocator->undo_waste();
 }
 
 #ifdef ASSERT
--- a/src/hotspot/share/gc/g1/g1ParScanThreadState.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1ParScanThreadState.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -127,9 +127,8 @@
   G1EvacuationRootClosures* closures() { return _closures; }
   uint worker_id() { return _worker_id; }
 
-  // Returns the current amount of waste due to alignment or not being able to fit
-  // objects within LABs and the undo waste.
-  virtual void waste(size_t& wasted, size_t& undo_wasted);
+  size_t lab_waste_words() const;
+  size_t lab_undo_waste_words() const;
 
   size_t* surviving_young_words() {
     // We add one to hide entry 0 which accumulates surviving words for
--- a/src/hotspot/share/gc/g1/g1RemSet.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1RemSet.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -409,6 +409,10 @@
 
 void G1ScanRSForRegionClosure::scan_strong_code_roots(HeapRegion* r) {
   EventGCPhaseParallel event;
+  // We pass a weak code blobs closure to the remembered set scanning because we want to avoid
+  // treating the nmethods visited to act as roots for concurrent marking.
+  // We only want to make sure that the oops in the nmethods are adjusted with regard to the
+  // objects copied by the current evacuation.
   r->strong_code_roots_do(_pss->closures()->weak_codeblobs());
   event.commit(GCId::current(), _worker_i, G1GCPhaseTimes::phase_name(G1GCPhaseTimes::CodeRoots));
 }
--- a/src/hotspot/share/gc/g1/heapRegion.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/g1/heapRegion.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -336,8 +336,8 @@
         // Object is in the region. Check that its less than top
         if (_hr->top() <= (HeapWord*)obj) {
           // Object is above top
-          log_error(gc, verify)("Object " PTR_FORMAT " in region [" PTR_FORMAT ", " PTR_FORMAT ") is above top " PTR_FORMAT,
-                               p2i(obj), p2i(_hr->bottom()), p2i(_hr->end()), p2i(_hr->top()));
+          log_error(gc, verify)("Object " PTR_FORMAT " in region " HR_FORMAT " is above top ",
+                                p2i(obj), HR_FORMAT_PARAMS(_hr));
           _failures = true;
           return;
         }
@@ -415,8 +415,8 @@
   // on its strong code root list
   if (is_empty()) {
     if (strong_code_roots_length > 0) {
-      log_error(gc, verify)("region [" PTR_FORMAT "," PTR_FORMAT "] is empty but has " SIZE_FORMAT " code root entries",
-                            p2i(bottom()), p2i(end()), strong_code_roots_length);
+      log_error(gc, verify)("region " HR_FORMAT " is empty but has " SIZE_FORMAT " code root entries",
+                            HR_FORMAT_PARAMS(this), strong_code_roots_length);
       *failures = true;
     }
     return;
@@ -524,21 +524,22 @@
         ResourceMark rm;
         if (!_g1h->is_in_closed_subset(obj)) {
           HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
-          log.error("Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region [" PTR_FORMAT ", " PTR_FORMAT ")",
-            p2i(p), p2i(_containing_obj), p2i(from->bottom()), p2i(from->end()));
+          log.error("Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region " HR_FORMAT,
+                    p2i(p), p2i(_containing_obj), HR_FORMAT_PARAMS(from));
           LogStream ls(log.error());
           print_object(&ls, _containing_obj);
           HeapRegion* const to = _g1h->heap_region_containing(obj);
-          log.error("points to obj " PTR_FORMAT " in region " HR_FORMAT " remset %s", p2i(obj), HR_FORMAT_PARAMS(to), to->rem_set()->get_state_str());
+          log.error("points to obj " PTR_FORMAT " in region " HR_FORMAT " remset %s",
+                    p2i(obj), HR_FORMAT_PARAMS(to), to->rem_set()->get_state_str());
         } else {
           HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
           HeapRegion* to = _g1h->heap_region_containing((HeapWord*)obj);
-          log.error("Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region [" PTR_FORMAT ", " PTR_FORMAT ")",
-            p2i(p), p2i(_containing_obj), p2i(from->bottom()), p2i(from->end()));
+          log.error("Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region " HR_FORMAT,
+                    p2i(p), p2i(_containing_obj), HR_FORMAT_PARAMS(from));
           LogStream ls(log.error());
           print_object(&ls, _containing_obj);
-          log.error("points to dead obj " PTR_FORMAT " in region [" PTR_FORMAT ", " PTR_FORMAT ")",
-            p2i(obj), p2i(to->bottom()), p2i(to->end()));
+          log.error("points to dead obj " PTR_FORMAT " in region " HR_FORMAT,
+                    p2i(obj), HR_FORMAT_PARAMS(to));
           print_object(&ls, obj);
         }
         log.error("----------");
@@ -593,12 +594,13 @@
             log.error("----------");
           }
           log.error("Missing rem set entry:");
-          log.error("Field " PTR_FORMAT " of obj " PTR_FORMAT ", in region " HR_FORMAT,
-            p2i(p), p2i(_containing_obj), HR_FORMAT_PARAMS(from));
+          log.error("Field " PTR_FORMAT " of obj " PTR_FORMAT " in region " HR_FORMAT,
+                    p2i(p), p2i(_containing_obj), HR_FORMAT_PARAMS(from));
           ResourceMark rm;
           LogStream ls(log.error());
           _containing_obj->print_on(&ls);
-          log.error("points to obj " PTR_FORMAT " in region " HR_FORMAT " remset %s", p2i(obj), HR_FORMAT_PARAMS(to), to->rem_set()->get_state_str());
+          log.error("points to obj " PTR_FORMAT " in region " HR_FORMAT " remset %s",
+                    p2i(obj), HR_FORMAT_PARAMS(to), to->rem_set()->get_state_str());
           if (oopDesc::is_oop(obj)) {
             obj->print_on(&ls);
           }
--- a/src/hotspot/share/gc/shared/genOopClosures.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/shared/genOopClosures.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -29,7 +29,6 @@
 #include "oops/oop.hpp"
 
 class Generation;
-class HeapWord;
 class CardTableRS;
 class CardTableBarrierSet;
 class DefNewGeneration;
--- a/src/hotspot/share/gc/shared/spaceDecorator.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/shared/spaceDecorator.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
 // pattern.
 bool SpaceMangler::is_mangled(HeapWord* q) {
   // This test loses precision but is good enough
-  return badHeapWord == (max_juint & (uintptr_t) q->value());
+  return badHeapWord == (max_juint & reinterpret_cast<uintptr_t>(*q));
 }
 
 
--- a/src/hotspot/share/gc/shared/vmStructs_gc.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/shared/vmStructs_gc.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -156,8 +156,6 @@
   nonstatic_field(GenCollectedHeap,            _young_gen_spec,                               GenerationSpec*)                       \
   nonstatic_field(GenCollectedHeap,            _old_gen_spec,                                 GenerationSpec*)                       \
                                                                                                                                      \
-  nonstatic_field(HeapWord,                    i,                                             char*)                                 \
-                                                                                                                                     \
   nonstatic_field(MemRegion,                   _start,                                        HeapWord*)                             \
   nonstatic_field(MemRegion,                   _word_size,                                    size_t)                                \
                                                                                                                                      \
--- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -335,7 +335,7 @@
   // Filter marked objects before hitting the SATB queues. The same predicate would
   // be used by SATBMQ::filter to eliminate already marked objects downstream, but
   // filtering here helps to avoid wasteful SATB queueing work to begin with.
-  if (!_heap->requires_marking(obj)) return;
+  if (!_heap->requires_marking<false>(obj)) return;
 
   Thread* thr = Thread::current();
   if (thr->is_Java_thread()) {
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -2639,6 +2639,10 @@
   return memory_pools;
 }
 
+MemoryUsage ShenandoahHeap::memory_usage() {
+  return _memory_pool->get_memory_usage();
+}
+
 void ShenandoahHeap::enter_evacuation() {
   _oom_evac_handler.enter_evacuation();
 }
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -511,6 +511,7 @@
 
   GrowableArray<GCMemoryManager*> memory_managers();
   GrowableArray<MemoryPool*> memory_pools();
+  MemoryUsage memory_usage();
   GCTracer* tracer();
   GCTimer* gc_timer() const;
   CollectorPolicy* collector_policy() const;
@@ -676,6 +677,7 @@
   void reset_mark_bitmap();
 
   // SATB barriers hooks
+  template<bool RESOLVE>
   inline bool requires_marking(const void* entry) const;
   void force_satb_flush_all_threads();
 
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -316,8 +316,13 @@
   }
 }
 
+template<bool RESOLVE>
 inline bool ShenandoahHeap::requires_marking(const void* entry) const {
-  return !_marking_context->is_marked(oop(entry));
+  oop obj = oop(entry);
+  if (RESOLVE) {
+    obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
+  }
+  return !_marking_context->is_marked(obj);
 }
 
 template <class T>
--- a/src/hotspot/share/gc/shenandoah/shenandoahMarkingContext.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/shenandoah/shenandoahMarkingContext.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Red Hat, Inc. All rights reserved.
+ * Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
@@ -29,8 +29,6 @@
 #include "memory/memRegion.hpp"
 #include "oops/oopsHierarchy.hpp"
 
-class HeapWord;
-
 /**
  * Encapsulate a marking bitmap with the top-at-mark-start and top-bitmaps array.
  */
--- a/src/hotspot/share/gc/shenandoah/shenandoahMemoryPool.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/shenandoah/shenandoahMemoryPool.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -26,7 +26,7 @@
 
 ShenandoahMemoryPool::ShenandoahMemoryPool(ShenandoahHeap* heap) :
         CollectedMemoryPool("Shenandoah",
-                            heap->capacity(),
+                            heap->initial_capacity(),
                             heap->max_capacity(),
                             true /* support_usage_threshold */),
                             _heap(heap) {}
@@ -37,9 +37,15 @@
   size_t used      = used_in_bytes();
   size_t committed = _heap->committed();
 
+  // These asserts can never fail: max is stable, and all updates to other values never overflow max.
   assert(initial <= max,    "initial: "   SIZE_FORMAT ", max: "       SIZE_FORMAT, initial,   max);
   assert(used <= max,       "used: "      SIZE_FORMAT ", max: "       SIZE_FORMAT, used,      max);
   assert(committed <= max,  "committed: " SIZE_FORMAT ", max: "       SIZE_FORMAT, committed, max);
+
+  // Committed and used are updated concurrently and independently. They can momentarily break
+  // the assert below, which would also fail in downstream code. To avoid that, adjust values
+  // to make sense under the race. See JDK-8207200.
+  committed = MAX2(used, committed);
   assert(used <= committed, "used: "      SIZE_FORMAT ", committed: " SIZE_FORMAT, used,      committed);
 
   return MemoryUsage(initial, used, committed, max);
--- a/src/hotspot/share/gc/shenandoah/shenandoahRuntime.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/shenandoah/shenandoahRuntime.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Red Hat, Inc. All rights reserved.
+ * Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
@@ -27,7 +27,6 @@
 #include "memory/allocation.hpp"
 #include "oops/oopsHierarchy.hpp"
 
-class HeapWord;
 class JavaThread;
 class oopDesc;
 
--- a/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -49,12 +49,9 @@
   return ShenandoahThreadLocalData::satb_mark_queue(t);
 }
 
-static inline bool discard_entry(const void* entry, ShenandoahHeap* heap) {
-  return !heap->requires_marking(entry);
-}
-
+template <bool RESOLVE>
 class ShenandoahSATBMarkQueueFilterFn {
-  ShenandoahHeap* _heap;
+  ShenandoahHeap* const _heap;
 
 public:
   ShenandoahSATBMarkQueueFilterFn(ShenandoahHeap* heap) : _heap(heap) {}
@@ -62,13 +59,17 @@
   // Return true if entry should be filtered out (removed), false if
   // it should be retained.
   bool operator()(const void* entry) const {
-    return discard_entry(entry, _heap);
+    return !_heap->requires_marking<RESOLVE>(entry);
   }
 };
 
 void ShenandoahSATBMarkQueueSet::filter(SATBMarkQueue* queue) {
   assert(_heap != NULL, "SATB queue set not initialized");
-  apply_filter(ShenandoahSATBMarkQueueFilterFn(_heap), queue);
+  if (_heap->has_forwarded_objects()) {
+    apply_filter(ShenandoahSATBMarkQueueFilterFn<true>(_heap), queue);
+  } else {
+    apply_filter(ShenandoahSATBMarkQueueFilterFn<false>(_heap), queue);
+  }
 }
 
 bool ShenandoahSATBMarkQueue::should_enqueue_buffer() {
--- a/src/hotspot/share/gc/z/vmStructs_z.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/z/vmStructs_z.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 
 ZGlobalsForVMStructs::ZGlobalsForVMStructs() :
     _ZGlobalPhase(&ZGlobalPhase),
+    _ZGlobalSeqNum(&ZGlobalSeqNum),
     _ZAddressGoodMask(&ZAddressGoodMask),
     _ZAddressBadMask(&ZAddressBadMask),
     _ZAddressWeakBadMask(&ZAddressWeakBadMask),
--- a/src/hotspot/share/gc/z/vmStructs_z.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/z/vmStructs_z.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -42,6 +42,8 @@
 
   uint32_t* _ZGlobalPhase;
 
+  uint32_t* _ZGlobalSeqNum;
+
   uintptr_t* _ZAddressGoodMask;
   uintptr_t* _ZAddressBadMask;
   uintptr_t* _ZAddressWeakBadMask;
@@ -55,6 +57,7 @@
 #define VM_STRUCTS_ZGC(nonstatic_field, volatile_nonstatic_field, static_field)                      \
   static_field(ZGlobalsForVMStructs,            _instance_p,          ZGlobalsForVMStructs*)         \
   nonstatic_field(ZGlobalsForVMStructs,         _ZGlobalPhase,        uint32_t*)                     \
+  nonstatic_field(ZGlobalsForVMStructs,         _ZGlobalSeqNum,       uint32_t*)                     \
   nonstatic_field(ZGlobalsForVMStructs,         _ZAddressGoodMask,    uintptr_t*)                    \
   nonstatic_field(ZGlobalsForVMStructs,         _ZAddressBadMask,     uintptr_t*)                    \
   nonstatic_field(ZGlobalsForVMStructs,         _ZAddressWeakBadMask, uintptr_t*)                    \
@@ -67,7 +70,10 @@
   nonstatic_field(ZHeap,                        _pagetable,           ZPageTable)                    \
                                                                                                      \
   nonstatic_field(ZPage,                        _type,                const uint8_t)                 \
+  nonstatic_field(ZPage,                        _seqnum,              uint32_t)                      \
   nonstatic_field(ZPage,                        _virtual,             const ZVirtualMemory)          \
+  volatile_nonstatic_field(ZPage,               _top,                 uintptr_t)                     \
+  volatile_nonstatic_field(ZPage,               _refcount,            uint32_t)                      \
   nonstatic_field(ZPage,                        _forwarding,          ZForwardingTable)              \
                                                                                                      \
   nonstatic_field(ZPageAllocator,               _physical,            ZPhysicalMemoryManager)        \
@@ -101,6 +107,7 @@
   declare_constant(ZAddressOffsetShift)                                                              \
   declare_constant(ZAddressOffsetBits)                                                               \
   declare_constant(ZAddressOffsetMask)                                                               \
+  declare_constant(ZAddressOffsetMax)                                                                \
   declare_constant(ZAddressSpaceStart)
 
 #define VM_TYPES_ZGC(declare_type, declare_toplevel_type, declare_integer_type)                      \
--- a/src/hotspot/share/gc/z/zCollectedHeap.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/z/zCollectedHeap.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -118,10 +118,6 @@
   return is_in(p);
 }
 
-void ZCollectedHeap::fill_with_dummy_object(HeapWord* start, HeapWord* end, bool zap) {
-  // Does nothing, not a parsable heap
-}
-
 HeapWord* ZCollectedHeap::allocate_new_tlab(size_t min_size, size_t requested_size, size_t* actual_size) {
   const size_t size_in_bytes = ZUtils::words_to_bytes(align_object_size(requested_size));
   const uintptr_t addr = _heap.alloc_tlab(size_in_bytes);
--- a/src/hotspot/share/gc/z/zCollectedHeap.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/z/zCollectedHeap.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -75,8 +75,6 @@
   virtual bool is_in(const void* p) const;
   virtual bool is_in_closed_subset(const void* p) const;
 
-  virtual void fill_with_dummy_object(HeapWord* start, HeapWord* end, bool zap);
-
   virtual HeapWord* mem_allocate(size_t size, bool* gc_overhead_limit_was_exceeded);
   virtual MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
                                                        size_t size,
--- a/src/hotspot/share/gc/z/zInitialize.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/z/zInitialize.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
 #include "gc/z/zLargePages.hpp"
 #include "gc/z/zNUMA.hpp"
 #include "gc/z/zStat.hpp"
-#include "gc/z/zStatTLAB.hpp"
+#include "gc/z/zThreadLocalAllocBuffer.hpp"
 #include "gc/z/zTracer.hpp"
 #include "logging/log.hpp"
 #include "runtime/vm_version.hpp"
@@ -46,7 +46,7 @@
   ZNUMA::initialize();
   ZCPU::initialize();
   ZStatValue::initialize();
-  ZStatTLAB::initialize();
+  ZThreadLocalAllocBuffer::initialize();
   ZTracer::initialize();
   ZLargePages::initialize();
   ZBarrierSet::set_barrier_set(barrier_set);
--- a/src/hotspot/share/gc/z/zMark.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/z/zMark.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,9 +32,9 @@
 #include "gc/z/zPageTable.inline.hpp"
 #include "gc/z/zRootsIterator.hpp"
 #include "gc/z/zStat.hpp"
-#include "gc/z/zStatTLAB.hpp"
 #include "gc/z/zTask.hpp"
 #include "gc/z/zThread.hpp"
+#include "gc/z/zThreadLocalAllocBuffer.hpp"
 #include "gc/z/zUtils.inline.hpp"
 #include "gc/z/zWorkers.inline.hpp"
 #include "logging/log.hpp"
@@ -121,24 +121,19 @@
 class ZMarkRootsIteratorClosure : public ZRootsIteratorClosure {
 public:
   ZMarkRootsIteratorClosure() {
-    ZStatTLAB::reset();
+    ZThreadLocalAllocBuffer::reset_statistics();
   }
 
   ~ZMarkRootsIteratorClosure() {
-    ZStatTLAB::publish();
+    ZThreadLocalAllocBuffer::publish_statistics();
   }
 
   virtual void do_thread(Thread* thread) {
-    ZRootsIteratorClosure::do_thread(thread);
-
     // Update thread local address bad mask
     ZThreadLocalData::set_address_bad_mask(thread, ZAddressBadMask);
 
     // Retire TLAB
-    if (UseTLAB && thread->is_Java_thread()) {
-      thread->tlab().retire(ZStatTLAB::get());
-      thread->tlab().resize();
-    }
+    ZThreadLocalAllocBuffer::retire(thread);
   }
 
   virtual void do_oop(oop* p) {
--- a/src/hotspot/share/gc/z/zRelocate.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/z/zRelocate.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,28 +31,20 @@
 #include "gc/z/zRelocationSet.inline.hpp"
 #include "gc/z/zRootsIterator.hpp"
 #include "gc/z/zTask.hpp"
+#include "gc/z/zThreadLocalAllocBuffer.hpp"
 #include "gc/z/zWorkers.hpp"
 
 ZRelocate::ZRelocate(ZWorkers* workers) :
     _workers(workers) {}
 
 class ZRelocateRootsIteratorClosure : public ZRootsIteratorClosure {
-private:
-  static void remap_address(HeapWord** p) {
-    *p = (HeapWord*)ZAddress::good_or_null((uintptr_t)*p);
-  }
-
 public:
   virtual void do_thread(Thread* thread) {
-    ZRootsIteratorClosure::do_thread(thread);
-
     // Update thread local address bad mask
     ZThreadLocalData::set_address_bad_mask(thread, ZAddressBadMask);
 
     // Remap TLAB
-    if (UseTLAB && thread->is_Java_thread()) {
-      thread->tlab().addresses_do(remap_address);
-    }
+    ZThreadLocalAllocBuffer::remap(thread);
   }
 
   virtual void do_oop(oop* p) {
--- a/src/hotspot/share/gc/z/zRootsIterator.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/z/zRootsIterator.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -135,29 +135,38 @@
   }
 }
 
-class ZCodeBlobClosure : public CodeBlobToOopClosure {
+class ZRootsIteratorCodeBlobClosure : public CodeBlobToOopClosure {
 private:
   BarrierSetNMethod* _bs;
 
 public:
-  ZCodeBlobClosure(OopClosure* cl) :
+  ZRootsIteratorCodeBlobClosure(OopClosure* cl) :
     CodeBlobToOopClosure(cl, true /* fix_relocations */),
     _bs(BarrierSet::barrier_set()->barrier_set_nmethod()) {}
 
   virtual void do_code_blob(CodeBlob* cb) {
     nmethod* const nm = cb->as_nmethod_or_null();
-    if (nm == NULL || nm->test_set_oops_do_mark()) {
-      return;
+    if (nm != NULL && !nm->test_set_oops_do_mark()) {
+      CodeBlobToOopClosure::do_code_blob(cb);
+      _bs->disarm(nm);
     }
-    CodeBlobToOopClosure::do_code_blob(cb);
-    _bs->disarm(nm);
   }
 };
 
-void ZRootsIteratorClosure::do_thread(Thread* thread) {
-  ZCodeBlobClosure code_cl(this);
-  thread->oops_do(this, ClassUnloading ? &code_cl : NULL);
-}
+class ZRootsIteratorThreadClosure : public ThreadClosure {
+private:
+  ZRootsIteratorClosure* _cl;
+
+public:
+  ZRootsIteratorThreadClosure(ZRootsIteratorClosure* cl) :
+      _cl(cl) {}
+
+  virtual void do_thread(Thread* thread) {
+    ZRootsIteratorCodeBlobClosure code_cl(_cl);
+    thread->oops_do(_cl, ClassUnloading ? &code_cl : NULL);
+    _cl->do_thread(thread);
+  }
+};
 
 ZRootsIterator::ZRootsIterator() :
     _universe(this),
@@ -227,7 +236,8 @@
 void ZRootsIterator::do_threads(ZRootsIteratorClosure* cl) {
   ZStatTimer timer(ZSubPhasePauseRootsThreads);
   ResourceMark rm;
-  Threads::possibly_parallel_threads_do(true, cl);
+  ZRootsIteratorThreadClosure thread_cl(cl);
+  Threads::possibly_parallel_threads_do(true, &thread_cl);
 }
 
 void ZRootsIterator::do_code_cache(ZRootsIteratorClosure* cl) {
--- a/src/hotspot/share/gc/z/zRootsIterator.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/gc/z/zRootsIterator.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -31,9 +31,9 @@
 #include "runtime/thread.hpp"
 #include "utilities/globalDefinitions.hpp"
 
-class ZRootsIteratorClosure : public OopClosure, public ThreadClosure {
+class ZRootsIteratorClosure : public OopClosure {
 public:
-  virtual void do_thread(Thread* thread);
+  virtual void do_thread(Thread* thread) {}
 };
 
 typedef OopStorage::ParState<true /* concurrent */, false /* is_const */> ZOopStorageIterator;
--- a/src/hotspot/share/gc/z/zStatTLAB.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * 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 "gc/z/zStatTLAB.hpp"
-
-ZPerWorker<ThreadLocalAllocStats>* ZStatTLAB::_stats = NULL;
-
-void ZStatTLAB::initialize() {
-  if (UseTLAB) {
-    assert(_stats == NULL, "Already initialized");
-    _stats = new ZPerWorker<ThreadLocalAllocStats>();
-    reset();
-  }
-}
-
-void ZStatTLAB::reset() {
-  if (UseTLAB) {
-    ZPerWorkerIterator<ThreadLocalAllocStats> iter(_stats);
-    for (ThreadLocalAllocStats* stats; iter.next(&stats);) {
-      stats->reset();
-    }
-  }
-}
-
-ThreadLocalAllocStats* ZStatTLAB::get() {
-  if (UseTLAB) {
-    return _stats->addr();
-  }
-
-  return NULL;
-}
-
-void ZStatTLAB::publish() {
-  if (UseTLAB) {
-    ThreadLocalAllocStats total;
-
-    ZPerWorkerIterator<ThreadLocalAllocStats> iter(_stats);
-    for (ThreadLocalAllocStats* stats; iter.next(&stats);) {
-      total.update(*stats);
-    }
-
-    total.publish();
-  }
-}
--- a/src/hotspot/share/gc/z/zStatTLAB.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * 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_Z_ZSTATTLAB_HPP
-#define SHARE_GC_Z_ZSTATTLAB_HPP
-
-#include "gc/shared/threadLocalAllocBuffer.hpp"
-#include "gc/z/zValue.hpp"
-#include "memory/allocation.hpp"
-
-class ZStatTLAB : public AllStatic {
-private:
-  static ZPerWorker<ThreadLocalAllocStats>* _stats;
-
-public:
-  static void initialize();
-  static void reset();
-  static ThreadLocalAllocStats* get();
-  static void publish();
-};
-
-#endif // SHARE_GC_Z_ZSTATTLAB_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/z/zThreadLocalAllocBuffer.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include "precompiled.hpp"
+#include "gc/z/zAddress.inline.hpp"
+#include "gc/z/zThreadLocalAllocBuffer.hpp"
+#include "runtime/globals.hpp"
+#include "runtime/thread.hpp"
+
+ZPerWorker<ThreadLocalAllocStats>* ZThreadLocalAllocBuffer::_stats = NULL;
+
+void ZThreadLocalAllocBuffer::initialize() {
+  if (UseTLAB) {
+    assert(_stats == NULL, "Already initialized");
+    _stats = new ZPerWorker<ThreadLocalAllocStats>();
+    reset_statistics();
+  }
+}
+
+void ZThreadLocalAllocBuffer::reset_statistics() {
+  if (UseTLAB) {
+    ZPerWorkerIterator<ThreadLocalAllocStats> iter(_stats);
+    for (ThreadLocalAllocStats* stats; iter.next(&stats);) {
+      stats->reset();
+    }
+  }
+}
+
+void ZThreadLocalAllocBuffer::publish_statistics() {
+  if (UseTLAB) {
+    ThreadLocalAllocStats total;
+
+    ZPerWorkerIterator<ThreadLocalAllocStats> iter(_stats);
+    for (ThreadLocalAllocStats* stats; iter.next(&stats);) {
+      total.update(*stats);
+    }
+
+    total.publish();
+  }
+}
+
+static void fixup_address(HeapWord** p) {
+  *p = (HeapWord*)ZAddress::good_or_null((uintptr_t)*p);
+}
+
+void ZThreadLocalAllocBuffer::retire(Thread* thread) {
+  if (UseTLAB && thread->is_Java_thread()) {
+    ThreadLocalAllocStats* const stats = _stats->addr();
+    thread->tlab().addresses_do(fixup_address);
+    thread->tlab().retire(stats);
+    thread->tlab().resize();
+  }
+}
+
+void ZThreadLocalAllocBuffer::remap(Thread* thread) {
+  if (UseTLAB && thread->is_Java_thread()) {
+    thread->tlab().addresses_do(fixup_address);
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/z/zThreadLocalAllocBuffer.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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_Z_ZTHREADLOCALALLOCBUFFER_HPP
+#define SHARE_GC_Z_ZTHREADLOCALALLOCBUFFER_HPP
+
+#include "gc/shared/threadLocalAllocBuffer.hpp"
+#include "gc/z/zValue.hpp"
+#include "memory/allocation.hpp"
+
+class ZThreadLocalAllocBuffer : public AllStatic {
+private:
+  static ZPerWorker<ThreadLocalAllocStats>* _stats;
+
+public:
+  static void initialize();
+
+  static void reset_statistics();
+  static void publish_statistics();
+
+  static void retire(Thread* thread);
+  static void remap(Thread* thread);
+};
+
+#endif // SHARE_GC_Z_ZTHREADLOCALALLOCBUFFER_HPP
--- a/src/hotspot/share/interpreter/linkResolver.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/interpreter/linkResolver.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -39,6 +39,7 @@
 #include "logging/logStream.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/universe.hpp"
+#include "oops/constantPool.hpp"
 #include "oops/cpCache.inline.hpp"
 #include "oops/instanceKlass.hpp"
 #include "oops/method.hpp"
--- a/src/hotspot/share/interpreter/rewriter.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/interpreter/rewriter.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -28,6 +28,7 @@
 #include "interpreter/rewriter.hpp"
 #include "memory/metadataFactory.hpp"
 #include "memory/resourceArea.hpp"
+#include "oops/constantPool.hpp"
 #include "oops/generateOopMap.hpp"
 #include "prims/methodHandles.hpp"
 #include "runtime/fieldDescriptor.inline.hpp"
--- a/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -43,6 +43,7 @@
 #include "memory/allocation.inline.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/array.hpp"
+#include "oops/constantPool.hpp"
 #include "oops/instanceKlass.hpp"
 #include "oops/method.hpp"
 #include "prims/jvmtiRedefineClasses.hpp"
--- a/src/hotspot/share/logging/logFileOutput.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/logging/logFileOutput.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -51,6 +51,14 @@
   _file_name = make_file_name(name + strlen(Prefix), _pid_str, _vm_start_time_str);
 }
 
+const char* LogFileOutput::cur_log_file_name() {
+  if (strlen(_archive_name) == 0) {
+    return _file_name;
+  } else {
+    return _archive_name;
+  }
+}
+
 void LogFileOutput::set_file_name_parameters(jlong vm_start_time) {
   int res = jio_snprintf(_pid_str, sizeof(_pid_str), "%d", os::current_process_id());
   assert(res > 0, "PID buffer too small");
@@ -234,6 +242,7 @@
     _file_count_max_digits = number_of_digits(_file_count - 1);
     _archive_name_len = 2 + strlen(_file_name) + _file_count_max_digits;
     _archive_name = NEW_C_HEAP_ARRAY(char, _archive_name_len, mtLogging);
+    _archive_name[0] = 0;
   }
 
   log_trace(logging)("Initializing logging to file '%s' (filecount: %u"
--- a/src/hotspot/share/logging/logFileOutput.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/logging/logFileOutput.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -92,6 +92,7 @@
     return _name;
   }
 
+  const char* cur_log_file_name();
   static const char* const Prefix;
   static void set_file_name_parameters(jlong start_time);
 };
--- a/src/hotspot/share/memory/allocation.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/memory/allocation.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -132,6 +132,7 @@
   f(mtArguments,     "Arguments")                                                   \
   f(mtModule,        "Module")                                                      \
   f(mtSafepoint,     "Safepoint")                                                   \
+  f(mtSynchronizer,  "Synchronization")                                             \
   f(mtNone,          "Unknown")                                                     \
   //end
 
--- a/src/hotspot/share/memory/memRegion.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/memory/memRegion.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -40,8 +40,6 @@
 // create MemRegions (in CardTableBarrierSet) in heap so operator
 // new and operator new [] added for this special case.
 
-class MetaWord;
-
 class MemRegion {
   friend class VMStructs;
 private:
--- a/src/hotspot/share/memory/metaspace.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/memory/metaspace.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -57,7 +57,6 @@
 
 class ClassLoaderData;
 class MetaspaceTracer;
-class MetaWord;
 class Mutex;
 class outputStream;
 
--- a/src/hotspot/share/oops/array.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/oops/array.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -27,6 +27,7 @@
 
 #include "memory/allocation.hpp"
 #include "memory/metaspace.hpp"
+#include "runtime/orderAccess.hpp"
 #include "utilities/align.hpp"
 
 // Array for metadata allocation
@@ -121,8 +122,8 @@
   T*   adr_at(const int i)             { assert(i >= 0 && i< _length, "oob: 0 <= %d < %d", i, _length); return &_data[i]; }
   int  find(const T& x)                { return index_of(x); }
 
-  T at_acquire(const int which);
-  void release_at_put(int which, T contents);
+  T at_acquire(const int i)            { return OrderAccess::load_acquire(adr_at(i)); }
+  void release_at_put(int i, T x)      { OrderAccess::release_store(adr_at(i), x); }
 
   static int size(int length) {
     size_t bytes = align_up(byte_sizeof(length), BytesPerWord);
--- a/src/hotspot/share/oops/array.inline.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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_OOPS_ARRAY_INLINE_HPP
-#define SHARE_OOPS_ARRAY_INLINE_HPP
-
-#include "oops/array.hpp"
-#include "runtime/orderAccess.hpp"
-
-template <typename T>
-inline T Array<T>::at_acquire(const int which) { return OrderAccess::load_acquire(adr_at(which)); }
-
-template <typename T>
-inline void Array<T>::release_at_put(int which, T contents) { OrderAccess::release_store(adr_at(which), contents); }
-
-#endif // SHARE_OOPS_ARRAY_INLINE_HPP
--- a/src/hotspot/share/oops/constantPool.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/oops/constantPool.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -39,7 +39,7 @@
 #include "memory/metaspaceShared.hpp"
 #include "memory/oopFactory.hpp"
 #include "memory/resourceArea.hpp"
-#include "oops/array.inline.hpp"
+#include "oops/array.hpp"
 #include "oops/constantPool.inline.hpp"
 #include "oops/cpCache.inline.hpp"
 #include "oops/instanceKlass.hpp"
@@ -56,10 +56,6 @@
 #include "runtime/vframe.inline.hpp"
 #include "utilities/copy.hpp"
 
-constantTag ConstantPool::tag_at(int which) const { return (constantTag)tags()->at_acquire(which); }
-
-void ConstantPool::release_tag_at_put(int which, jbyte t) { tags()->release_at_put(which, t); }
-
 ConstantPool* ConstantPool::allocate(ClassLoaderData* loader_data, int length, TRAPS) {
   Array<u1>* tags = MetadataFactory::new_array<u1>(loader_data, length, 0, CHECK_NULL);
   int size = ConstantPool::size(length);
--- a/src/hotspot/share/oops/constantPool.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/oops/constantPool.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -131,7 +131,7 @@
 
   void set_tags(Array<u1>* tags)               { _tags = tags; }
   void tag_at_put(int which, jbyte t)          { tags()->at_put(which, t); }
-  void release_tag_at_put(int which, jbyte t);
+  void release_tag_at_put(int which, jbyte t)  { tags()->release_at_put(which, t); }
 
   u1* tag_addr_at(int which) const             { return tags()->adr_at(which); }
 
@@ -379,7 +379,7 @@
 
   // Tag query
 
-  constantTag tag_at(int which) const;
+  constantTag tag_at(int which) const { return (constantTag)tags()->at_acquire(which); }
 
   // Fetching constants
 
--- a/src/hotspot/share/oops/generateOopMap.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/oops/generateOopMap.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -27,6 +27,7 @@
 #include "logging/log.hpp"
 #include "logging/logStream.hpp"
 #include "memory/allocation.inline.hpp"
+#include "oops/constantPool.hpp"
 #include "oops/generateOopMap.hpp"
 #include "oops/oop.inline.hpp"
 #include "oops/symbol.hpp"
--- a/src/hotspot/share/oops/instanceKlass.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/oops/instanceKlass.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -53,6 +53,7 @@
 #include "memory/oopFactory.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/fieldStreams.hpp"
+#include "oops/constantPool.hpp"
 #include "oops/instanceClassLoaderKlass.hpp"
 #include "oops/instanceKlass.inline.hpp"
 #include "oops/instanceMirrorKlass.hpp"
@@ -182,8 +183,14 @@
       if (name == k->name()) {
         log_trace(class, nestmates)("- Found it at nest_members[%d] => cp[%d]", i, cp_index);
 
-        // names match so check actual klass - this may trigger class loading if
-        // it doesn't match (but that should be impossible)
+        // Names match so check actual klass - this may trigger class loading if
+        // it doesn't match (though that should be impossible). But to be safe we
+        // have to check for a compiler thread executing here.
+        if (!THREAD->can_call_java() && !_constants->tag_at(cp_index).is_klass()) {
+          log_trace(class, nestmates)("- validation required resolution in an unsuitable thread");
+          return false;
+        }
+
         Klass* k2 = _constants->klass_at(cp_index, CHECK_false);
         if (k2 == k) {
           log_trace(class, nestmates)("- class is listed as a nest member");
@@ -295,7 +302,7 @@
            error);
       }
 
-      if (validationException != NULL) {
+      if (validationException != NULL && THREAD->can_call_java()) {
         ResourceMark rm(THREAD);
         Exceptions::fthrow(THREAD_AND_LOCATION,
                            validationException,
--- a/src/hotspot/share/oops/method.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/oops/method.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -42,6 +42,7 @@
 #include "memory/oopFactory.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/constMethod.hpp"
+#include "oops/constantPool.hpp"
 #include "oops/method.inline.hpp"
 #include "oops/methodData.hpp"
 #include "oops/objArrayOop.inline.hpp"
--- a/src/hotspot/share/oops/oopHandle.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/oops/oopHandle.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -36,6 +36,7 @@
 // future uses for read barriers.
 
 class OopHandle {
+  friend class VMStructs;
 private:
   oop* _obj;
 
--- a/src/hotspot/share/oops/reflectionAccessorImplKlassHelper.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/oops/reflectionAccessorImplKlassHelper.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -26,6 +26,7 @@
 #include "precompiled.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "memory/resourceArea.hpp"
+#include "oops/constantPool.hpp"
 #include "oops/reflectionAccessorImplKlassHelper.hpp"
 #include "utilities/constantTag.hpp"
 #include "utilities/debug.hpp"
--- a/src/hotspot/share/opto/escape.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/opto/escape.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1726,6 +1726,18 @@
     // access its field since the field value is unknown after it.
     //
     Node* n = field->ideal_node();
+
+    // Test for an unsafe access that was parsed as maybe off heap
+    // (with a CheckCastPP to raw memory).
+    assert(n->is_AddP(), "expect an address computation");
+    if (n->in(AddPNode::Base)->is_top() &&
+        n->in(AddPNode::Address)->Opcode() == Op_CheckCastPP) {
+      assert(n->in(AddPNode::Address)->bottom_type()->isa_rawptr(), "raw address so raw cast expected");
+      assert(_igvn->type(n->in(AddPNode::Address)->in(1))->isa_oopptr(), "cast pattern at unsafe access expected");
+      jobj->set_scalar_replaceable(false);
+      return;
+    }
+
     for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
       Node* u = n->fast_out(i);
       if (u->is_LoadStore() || (u->is_Mem() && u->as_Mem()->is_mismatched_access())) {
--- a/src/hotspot/share/prims/jvm.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/prims/jvm.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -45,6 +45,7 @@
 #include "memory/resourceArea.hpp"
 #include "memory/universe.hpp"
 #include "oops/access.inline.hpp"
+#include "oops/constantPool.hpp"
 #include "oops/fieldStreams.hpp"
 #include "oops/instanceKlass.hpp"
 #include "oops/method.hpp"
--- a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -39,6 +39,7 @@
 #include "memory/metaspaceShared.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/universe.hpp"
+#include "oops/constantPool.hpp"
 #include "oops/fieldStreams.hpp"
 #include "oops/klassVtable.hpp"
 #include "oops/oop.inline.hpp"
--- a/src/hotspot/share/runtime/arguments.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/runtime/arguments.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -529,6 +529,7 @@
   { "InitialRAMFraction",           JDK_Version::jdk(10),  JDK_Version::undefined(), JDK_Version::undefined() },
   { "UseMembar",                    JDK_Version::jdk(10), JDK_Version::jdk(12), JDK_Version::undefined() },
   { "CompilationPolicyChoice",      JDK_Version::jdk(13), JDK_Version::jdk(14), JDK_Version::undefined() },
+  { "FailOverToOldVerifier",        JDK_Version::jdk(13), JDK_Version::jdk(14), JDK_Version::undefined() },
 
   // --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
   { "DefaultMaxRAMFraction",        JDK_Version::jdk(8),  JDK_Version::undefined(), JDK_Version::undefined() },
@@ -555,13 +556,13 @@
   { "UseImplicitStableValues",       JDK_Version::undefined(), JDK_Version::jdk(13), JDK_Version::jdk(14) },
 
 #ifdef TEST_VERIFY_SPECIAL_JVM_FLAGS
+  // These entries will generate build errors.  Their purpose is to test the macros.
   { "dep > obs",                    JDK_Version::jdk(9), JDK_Version::jdk(8), JDK_Version::undefined() },
   { "dep > exp ",                   JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(8) },
   { "obs > exp ",                   JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(8) },
   { "not deprecated or obsolete",   JDK_Version::undefined(), JDK_Version::undefined(), JDK_Version::jdk(9) },
   { "dup option",                   JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() },
   { "dup option",                   JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() },
-  { "BytecodeVerificationRemote",   JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::undefined() },
 #endif
 
   { NULL, JDK_Version(0), JDK_Version(0) }
@@ -2749,6 +2750,7 @@
         if (FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, false) != JVMFlag::SUCCESS) {
           return JNI_EINVAL;
         }
+        warning("Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.");
       } else if (is_bad_option(option, args->ignoreUnrecognized, "verification")) {
         return JNI_EINVAL;
       }
--- a/src/hotspot/share/runtime/deoptimization.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/runtime/deoptimization.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -36,6 +36,7 @@
 #include "memory/allocation.inline.hpp"
 #include "memory/oopFactory.hpp"
 #include "memory/resourceArea.hpp"
+#include "oops/constantPool.hpp"
 #include "oops/method.hpp"
 #include "oops/objArrayOop.inline.hpp"
 #include "oops/oop.inline.hpp"
--- a/src/hotspot/share/runtime/fieldDescriptor.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/runtime/fieldDescriptor.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -28,6 +28,7 @@
 #include "memory/resourceArea.hpp"
 #include "memory/universe.hpp"
 #include "oops/annotations.hpp"
+#include "oops/constantPool.hpp"
 #include "oops/instanceKlass.hpp"
 #include "oops/oop.inline.hpp"
 #include "oops/fieldStreams.hpp"
--- a/src/hotspot/share/runtime/monitorChunk.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/runtime/monitorChunk.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
 
 MonitorChunk::MonitorChunk(int number_on_monitors) {
   _number_of_monitors = number_on_monitors;
-  _monitors           = NEW_C_HEAP_ARRAY(BasicObjectLock, number_on_monitors, mtInternal);
+  _monitors           = NEW_C_HEAP_ARRAY(BasicObjectLock, number_on_monitors, mtSynchronizer);
   _next               = NULL;
 }
 
--- a/src/hotspot/share/runtime/monitorChunk.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/runtime/monitorChunk.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -30,7 +30,7 @@
 // Data structure for holding monitors for one activation during
 // deoptimization.
 
-class MonitorChunk: public CHeapObj<mtInternal> {
+class MonitorChunk: public CHeapObj<mtSynchronizer> {
  private:
   int              _number_of_monitors;
   BasicObjectLock* _monitors;
--- a/src/hotspot/share/runtime/mutex.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/runtime/mutex.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -39,7 +39,7 @@
 // TODO: Check if _name[MONITOR_NAME_LEN] should better get replaced by const char*.
 static const int MONITOR_NAME_LEN = 64;
 
-class Monitor : public CHeapObj<mtInternal> {
+class Monitor : public CHeapObj<mtSynchronizer> {
 
  public:
   // A special lock: Is a lock where you are guaranteed not to block while you are
--- a/src/hotspot/share/runtime/safepoint.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/runtime/safepoint.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -197,7 +197,7 @@
   assert(!SafepointSynchronize::is_at_safepoint(), __VA_ARGS__)
 
 // State class for a thread suspended at a safepoint
-class ThreadSafepointState: public CHeapObj<mtInternal> {
+class ThreadSafepointState: public CHeapObj<mtThread> {
  private:
   // At polling page safepoint (NOT a poll return safepoint):
   volatile bool                   _at_poll_safepoint;
--- a/src/hotspot/share/runtime/semaphore.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/runtime/semaphore.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -40,7 +40,7 @@
 class JavaThread;
 
 // Implements the limited, platform independent Semaphore API.
-class Semaphore : public CHeapObj<mtInternal> {
+class Semaphore : public CHeapObj<mtSynchronizer> {
   SemaphoreImpl _impl;
 
   // Prevent copying and assignment of Semaphore instances.
--- a/src/hotspot/share/runtime/vmStructs.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/runtime/vmStructs.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -332,6 +332,7 @@
   unchecked_nonstatic_field(Symbol,            _body,                                         sizeof(u1)) /* NOTE: no type */        \
   nonstatic_field(Symbol,                      _body[0],                                      u1)                                    \
   nonstatic_field(TypeArrayKlass,              _max_length,                                   jint)                                  \
+  nonstatic_field(OopHandle,                   _obj,                                          oop*)                                  \
                                                                                                                                      \
   /***********************/                                                                                                          \
   /* Constant Pool Cache */                                                                                                          \
@@ -1299,7 +1300,8 @@
   declare_oop_type(oop)                                                   \
   declare_oop_type(narrowOop)                                             \
   declare_oop_type(typeArrayOop)                                          \
-  declare_oop_type(OopHandle)                                             \
+                                                                          \
+  declare_toplevel_type(OopHandle)                                        \
                                                                           \
   /*************************************/                                 \
   /* MethodOop-related data structures */                                 \
--- a/src/hotspot/share/services/attachListener.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/services/attachListener.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -257,19 +257,40 @@
 // See also: ClassHistogramDCmd class
 //
 // Input arguments :-
-//   arg0: "-live" or "-all"
+//   arg0: Name of the dump file or NULL
+//   arg1: "-live" or "-all"
 static jint heap_inspection(AttachOperation* op, outputStream* out) {
   bool live_objects_only = true;   // default is true to retain the behavior before this change is made
-  const char* arg0 = op->arg(0);
-  if (arg0 != NULL && (strlen(arg0) > 0)) {
-    if (strcmp(arg0, "-all") != 0 && strcmp(arg0, "-live") != 0) {
-      out->print_cr("Invalid argument to inspectheap operation: %s", arg0);
+  outputStream* os = out;   // if path not specified or path is NULL, use out
+  fileStream* fs = NULL;
+  const char* path = op->arg(0);
+  if (path != NULL) {
+    if (path[0] == '\0') {
+      out->print_cr("No dump file specified");
+    } else {
+      // create file
+      fs = new (ResourceObj::C_HEAP, mtInternal) fileStream(path);
+      if (fs == NULL) {
+        out->print_cr("Failed to allocate space for file: %s", path);
+        return JNI_ERR;
+      }
+      os = fs;
+    }
+  }
+  const char* arg1 = op->arg(1);
+  if (arg1 != NULL && (strlen(arg1) > 0)) {
+    if (strcmp(arg1, "-all") != 0 && strcmp(arg1, "-live") != 0) {
+      out->print_cr("Invalid argument to inspectheap operation: %s", arg1);
       return JNI_ERR;
     }
-    live_objects_only = strcmp(arg0, "-live") == 0;
+    live_objects_only = strcmp(arg1, "-live") == 0;
   }
-  VM_GC_HeapInspection heapop(out, live_objects_only /* request full gc */);
+  VM_GC_HeapInspection heapop(os, live_objects_only /* request full gc */);
   VMThread::execute(&heapop);
+  if (os != NULL && os != out) {
+    out->print_cr("Heap inspection file created: %s", path);
+    delete fs;
+  }
   return JNI_OK;
 }
 
--- a/src/hotspot/share/services/attachListener.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/services/attachListener.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -106,7 +106,7 @@
   enum {
     name_length_max = 16,       // maximum length of  name
     arg_length_max = 1024,      // maximum length of argument
-    arg_count_max = 3           // maximum number of arguments
+    arg_count_max = 4           // maximum number of arguments
   };
 
   // name of special operation that can be enqueued when all
--- a/src/hotspot/share/utilities/events.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/utilities/events.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
 
 EventLog* Events::_logs = NULL;
 StringEventLog* Events::_messages = NULL;
-StringEventLog* Events::_exceptions = NULL;
+ExceptionsEventLog* Events::_exceptions = NULL;
 StringEventLog* Events::_redefinitions = NULL;
 UnloadingEventLog* Events::_class_unloading = NULL;
 StringEventLog* Events::_deopt_messages = NULL;
@@ -67,7 +67,7 @@
 void Events::init() {
   if (LogEvents) {
     _messages = new StringEventLog("Events");
-    _exceptions = new StringEventLog("Internal exceptions");
+    _exceptions = new ExceptionsEventLog("Internal exceptions");
     _redefinitions = new StringEventLog("Classes redefined");
     _class_unloading = new UnloadingEventLog("Classes unloaded");
     _deopt_messages = new StringEventLog("Deoptimization events");
@@ -112,3 +112,20 @@
   st.print("Unloading class " INTPTR_FORMAT " ", p2i(ik));
   ik->name()->print_value_on(&st);
 }
+
+void ExceptionsEventLog::log(Thread* thread, Handle h_exception, const char* message, const char* file, int line) {
+  if (!should_log()) return;
+
+  double timestamp = fetch_timestamp();
+  MutexLockerEx ml(&_mutex, Mutex::_no_safepoint_check_flag);
+  int index = compute_log_index();
+  _records[index].thread = thread;
+  _records[index].timestamp = timestamp;
+  stringStream st = _records[index].data.stream();
+  st.print("Exception <");
+  h_exception->print_value_on(&st);
+  st.print("%s%s> (" INTPTR_FORMAT ") \n"
+           "thrown [%s, line %d]\nfor thread " INTPTR_FORMAT,
+           message ? ": " : "", message ? message : "",
+           p2i(h_exception()), file, line, p2i(thread));
+}
--- a/src/hotspot/share/utilities/events.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/utilities/events.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -135,37 +135,43 @@
 };
 
 // A simple wrapper class for fixed size text messages.
-class StringLogMessage : public FormatBuffer<256> {
+template <size_t bufsz>
+class FormatStringLogMessage : public FormatBuffer<bufsz> {
  public:
   // Wrap this buffer in a stringStream.
   stringStream stream() {
-    return stringStream(_buf, size());
+    return stringStream(this->_buf, this->size());
   }
 };
+typedef FormatStringLogMessage<256> StringLogMessage;
+typedef FormatStringLogMessage<512> ExtendedStringLogMessage;
 
 // A simple ring buffer of fixed size text messages.
-class StringEventLog : public EventLogBase<StringLogMessage> {
+template <size_t bufsz>
+class FormatStringEventLog : public EventLogBase< FormatStringLogMessage<bufsz> > {
  public:
-  StringEventLog(const char* name, int count = LogEventsBufferEntries) : EventLogBase<StringLogMessage>(name, count) {}
+  FormatStringEventLog(const char* name, int count = LogEventsBufferEntries) : EventLogBase< FormatStringLogMessage<bufsz> >(name, count) {}
 
   void logv(Thread* thread, const char* format, va_list ap) ATTRIBUTE_PRINTF(3, 0) {
-    if (!should_log()) return;
+    if (!this->should_log()) return;
 
-    double timestamp = fetch_timestamp();
-    MutexLockerEx ml(&_mutex, Mutex::_no_safepoint_check_flag);
-    int index = compute_log_index();
-    _records[index].thread = thread;
-    _records[index].timestamp = timestamp;
-    _records[index].data.printv(format, ap);
+    double timestamp = this->fetch_timestamp();
+    MutexLockerEx ml(&this->_mutex, Mutex::_no_safepoint_check_flag);
+    int index = this->compute_log_index();
+    this->_records[index].thread = thread;
+    this->_records[index].timestamp = timestamp;
+    this->_records[index].data.printv(format, ap);
   }
 
   void log(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(3, 4) {
     va_list ap;
     va_start(ap, format);
-    logv(thread, format, ap);
+    this->logv(thread, format, ap);
     va_end(ap);
   }
 };
+typedef FormatStringEventLog<256> StringEventLog;
+typedef FormatStringEventLog<512> ExtendedStringEventLog;
 
 class InstanceKlass;
 
@@ -177,6 +183,14 @@
   void log(Thread* thread, InstanceKlass* ik);
 };
 
+// Event log for exceptions
+class ExceptionsEventLog : public ExtendedStringEventLog {
+ public:
+  ExceptionsEventLog(const char* name, int count = LogEventsBufferEntries) : ExtendedStringEventLog(name, count) {}
+
+  void log(Thread* thread, Handle h_exception, const char* message, const char* file, int line);
+};
+
 
 class Events : AllStatic {
   friend class EventLog;
@@ -189,7 +203,7 @@
 
   // A log for internal exception related messages, like internal
   // throws and implicit exceptions.
-  static StringEventLog* _exceptions;
+  static ExceptionsEventLog* _exceptions;
 
   // Deoptization related messages
   static StringEventLog* _deopt_messages;
@@ -210,6 +224,7 @@
 
   // Log exception related message
   static void log_exception(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
+  static void log_exception(Thread* thread, Handle h_exception, const char* message, const char* file, int line);
 
   static void log_redefinition(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
 
@@ -239,6 +254,12 @@
   }
 }
 
+inline void Events::log_exception(Thread* thread, Handle h_exception, const char* message, const char* file, int line) {
+  if (LogEvents) {
+    _exceptions->log(thread, h_exception, message, file, line);
+  }
+}
+
 inline void Events::log_redefinition(Thread* thread, const char* format, ...) {
   if (LogEvents) {
     va_list ap;
@@ -307,6 +328,13 @@
   out->cr();
 }
 
+// Implement a printing routine for the ExtendedStringLogMessage
+template <>
+inline void EventLogBase<ExtendedStringLogMessage>::print(outputStream* out, ExtendedStringLogMessage& lm) {
+  out->print_raw(lm);
+  out->cr();
+}
+
 // Place markers for the beginning and end up of a set of events.
 // These end up in the default log.
 class EventMark : public StackObj {
--- a/src/hotspot/share/utilities/exceptions.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/utilities/exceptions.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -131,15 +131,17 @@
 }
 
 void Exceptions::_throw(Thread* thread, const char* file, int line, Handle h_exception, const char* message) {
-  ResourceMark rm;
+  ResourceMark rm(thread);
   assert(h_exception() != NULL, "exception should not be NULL");
 
   // tracing (do this up front - so it works during boot strapping)
+  // Note, the print_value_string() argument is not called unless logging is enabled!
   log_info(exceptions)("Exception <%s%s%s> (" INTPTR_FORMAT ") \n"
                        "thrown [%s, line %d]\nfor thread " INTPTR_FORMAT,
                        h_exception->print_value_string(),
                        message ? ": " : "", message ? message : "",
                        p2i(h_exception()), file, line, p2i(thread));
+
   // for AbortVMOnException flag
   Exceptions::debug_check_abort(h_exception, message);
 
@@ -162,11 +164,7 @@
   thread->set_pending_exception(h_exception(), file, line);
 
   // vm log
-  if (LogEvents){
-    Events::log_exception(thread, "Exception <%s%s%s> (" INTPTR_FORMAT ") thrown at [%s, line %d]",
-                          h_exception->print_value_string(), message ? ": " : "", message ? message : "",
-                          p2i(h_exception()), file, line);
-  }
+  Events::log_exception(thread, h_exception, message, file, line);
 }
 
 
--- a/src/hotspot/share/utilities/exceptions.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/utilities/exceptions.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -237,7 +237,11 @@
 // visible within the scope containing the THROW. Usually this is achieved by declaring the function
 // with a TRAPS argument.
 
+#ifdef THIS_FILE
+#define THREAD_AND_LOCATION                      THREAD, THIS_FILE, __LINE__
+#else
 #define THREAD_AND_LOCATION                      THREAD, __FILE__, __LINE__
+#endif
 
 #define THROW_OOP(e)                                \
   { Exceptions::_throw_oop(THREAD_AND_LOCATION, e);                             return;  }
--- a/src/hotspot/share/utilities/globalDefinitions.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/hotspot/share/utilities/globalDefinitions.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -165,29 +165,18 @@
 // Size of a char[] needed to represent a jint as a string in decimal.
 const int jintAsStringSize = 12;
 
-// An opaque struct of heap-word width, so that HeapWord* can be a generic
-// pointer into the heap.  We require that object sizes be measured in
-// units of heap words, so that that
-//   HeapWord* hw;
+// An opaque type, so that HeapWord* can be a generic pointer into the heap.
+// We require that object sizes be measured in units of heap words (e.g.
+// pointer-sized values), so that given HeapWord* hw,
 //   hw += oop(hw)->foo();
 // works, where foo is a method (like size or scavenge) that returns the
 // object size.
-class HeapWord {
-  friend class VMStructs;
- private:
-  char* i;
-#ifndef PRODUCT
- public:
-  char* value() { return i; }
-#endif
-};
+class HeapWordImpl;             // Opaque, never defined.
+typedef HeapWordImpl* HeapWord;
 
-// Analogous opaque struct for metadata allocated from
-// metaspaces.
-class MetaWord {
- private:
-  char* i;
-};
+// Analogous opaque struct for metadata allocated from metaspaces.
+class MetaWordImpl;             // Opaque, never defined.
+typedef MetaWordImpl* MetaWord;
 
 // HeapWordSize must be 2^LogHeapWordSize.
 const int HeapWordSize        = sizeof(HeapWord);
--- a/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
 
 import java.io.FileDescriptor;
 import java.lang.ref.Reference;
+import java.util.Objects;
 import jdk.internal.misc.VM;
 import jdk.internal.ref.Cleaner;
 import sun.nio.ch.DirectBuffer;
@@ -325,6 +326,40 @@
 #end[rw]
     }
 
+    public $Type$Buffer get(int index, $type$[] dst, int offset, int length) {
+#if[rw]
+        if (((long)length << $LG_BYTES_PER_VALUE$) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) {
+            Objects.checkFromIndexSize(index, length, limit());
+            Objects.checkFromIndexSize(offset, length, dst.length);
+
+            long dstOffset = ARRAY_BASE_OFFSET + ((long)offset << $LG_BYTES_PER_VALUE$);
+            try {
+#if[!byte]
+                if (order() != ByteOrder.nativeOrder())
+                    UNSAFE.copySwapMemory(null,
+                                          ix(index),
+                                          dst,
+                                          dstOffset,
+                                          (long)length << $LG_BYTES_PER_VALUE$,
+                                          (long)1 << $LG_BYTES_PER_VALUE$);
+                else
+#end[!byte]
+                    UNSAFE.copyMemory(null,
+                                      ix(index),
+                                      dst,
+                                      dstOffset,
+                                      (long)length << $LG_BYTES_PER_VALUE$);
+            } finally {
+                Reference.reachabilityFence(this);
+            }
+        } else {
+            super.get(index, dst, offset, length);
+        }
+        return this;
+#else[rw]
+        throw new ReadOnlyBufferException();
+#end[rw]
+    }
 #end[rw]
 
     public $Type$Buffer put($type$ x) {
@@ -440,6 +475,42 @@
 #end[rw]
     }
 
+    public $Type$Buffer put(int index, $type$[] src, int offset, int length) {
+#if[rw]
+        if (((long)length << $LG_BYTES_PER_VALUE$) > Bits.JNI_COPY_FROM_ARRAY_THRESHOLD) {
+            Objects.checkFromIndexSize(index, length, limit());
+            Objects.checkFromIndexSize(offset, length, src.length);
+
+
+            long srcOffset = ARRAY_BASE_OFFSET + ((long)offset << $LG_BYTES_PER_VALUE$);
+            try {
+#if[!byte]
+                if (order() != ByteOrder.nativeOrder())
+                    UNSAFE.copySwapMemory(src,
+                                          srcOffset,
+                                          null,
+                                          ix(index),
+                                          (long)length << $LG_BYTES_PER_VALUE$,
+                                          (long)1 << $LG_BYTES_PER_VALUE$);
+                else
+#end[!byte]
+                    UNSAFE.copyMemory(src,
+                                      srcOffset,
+                                      null,
+                                      ix(index),
+                                      (long)length << $LG_BYTES_PER_VALUE$);
+            } finally {
+                Reference.reachabilityFence(this);
+            }
+        } else {
+            super.put(index, src, offset, length);
+        }
+        return this;
+#else[rw]
+        throw new ReadOnlyBufferException();
+#end[rw]
+    }
+
     public $Type$Buffer compact() {
 #if[rw]
         int pos = position();
--- a/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,8 @@
 #end[rw]
  */
 
+import java.util.Objects;
+
 class Heap$Type$Buffer$RW$
     extends {#if[ro]?Heap}$Type$Buffer
 {
@@ -181,6 +183,13 @@
         return this;
     }
 
+    public $Type$Buffer get(int index, $type$[] dst, int offset, int length) {
+        Objects.checkFromIndexSize(index, length, limit());
+        Objects.checkFromIndexSize(offset, length, dst.length);
+        System.arraycopy(hb, ix(index), dst, offset, length);
+        return this;
+    }
+
     public boolean isDirect() {
         return false;
     }
@@ -250,6 +259,17 @@
 #end[rw]
     }
 
+    public $Type$Buffer put(int index, $type$[] src, int offset, int length) {
+#if[rw]
+        Objects.checkFromIndexSize(index, length, limit());
+        Objects.checkFromIndexSize(offset, length, src.length);
+        System.arraycopy(src, offset, hb, ix(index), length);
+        return this;
+#else[rw]
+        throw new ReadOnlyBufferException();
+#end[rw]
+    }
+
     public $Type$Buffer compact() {
 #if[rw]
         System.arraycopy(hb, ix(position()), hb, ix(0), remaining());
--- a/src/java.base/share/classes/java/nio/X-Buffer.java.template	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.base/share/classes/java/nio/X-Buffer.java.template	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,7 @@
 import java.util.stream.$Streamtype$Stream;
 #end[streamableType]
 
+import java.util.Objects;
 import jdk.internal.util.ArraysSupport;
 
 /**
@@ -50,11 +51,11 @@
  *   {@link #put($type$) <i>put</i>} methods that read and write
  *   single $type$s; </p></li>
  *
- *   <li><p> Relative {@link #get($type$[]) <i>bulk get</i>}
+ *   <li><p> Absolute and relative {@link #get($type$[]) <i>bulk get</i>}
  *   methods that transfer contiguous sequences of $type$s from this buffer
  *   into an array; {#if[!byte]?and}</p></li>
  *
- *   <li><p> Relative {@link #put($type$[]) <i>bulk put</i>}
+ *   <li><p> Absolute and relative {@link #put($type$[]) <i>bulk put</i>}
  *   methods that transfer contiguous sequences of $type$s from $a$
  *   $type$ array{#if[char]?,&#32;a&#32;string,} or some other $type$
  *   buffer into this buffer;{#if[!byte]?&#32;and} </p></li>
@@ -209,6 +210,8 @@
  * <p> This class implements the {@link CharSequence} interface so that
  * character buffers may be used wherever character sequences are accepted, for
  * example in the regular-expression package {@link java.util.regex}.
+ * The methods defined by {@code CharSequence} operate relative to the current
+ * position of the buffer when they are invoked.
  * </p>
  *
 #end[char]
@@ -434,7 +437,6 @@
      * @return The number of characters added to the buffer, or
      *         -1 if this source of characters is at its end
      * @throws IOException if an I/O error occurs
-     * @throws NullPointerException if target is null
      * @throws ReadOnlyBufferException if target is a read only buffer
      * @since 1.5
      */
@@ -762,6 +764,89 @@
         return get(dst, 0, dst.length);
     }
 
+    /**
+     * Absolute bulk <i>get</i> method.
+     *
+     * <p> This method transfers {@code length} $type$s from this
+     * buffer into the given array, starting at the given index in this
+     * buffer and at the given offset in the array.  The position of this
+     * buffer is unchanged.
+     *
+     * <p> An invocation of this method of the form
+     * <code>src.get(index,&nbsp;dst,&nbsp;offset,&nbsp;length)</code>
+     * has exactly the same effect as the following loop except that it first
+     * checks the consistency of the supplied parameters and it is potentially
+     * much more efficient:
+     *
+     * <pre>{@code
+     *     for (int i = offset, j = index; i < offset + length; i++, j++)
+     *         dst[i] = src.get(j);
+     * }</pre>
+     *
+     * @param  index
+     *         The index in this buffer from which the first $type$ will be
+     *         read; must be non-negative and less than {@code limit()}
+     *
+     * @param  dst
+     *         The destination array
+     *
+     * @param  offset
+     *         The offset within the array of the first $type$ to be
+     *         written; must be non-negative and less than
+     *         {@code dst.length}
+     *
+     * @param  length
+     *         The number of $type$s to be written to the given array;
+     *         must be non-negative and no larger than the smaller of
+     *         {@code limit() - index} and {@code dst.length - offset}
+     *
+     * @return  This buffer
+     *
+     * @throws  IndexOutOfBoundsException
+     *          If the preconditions on the {@code index}, {@code offset}, and
+     *          {@code length} parameters do not hold
+     *
+     * @since 13
+     */
+    public $Type$Buffer get(int index, $type$[] dst, int offset, int length) {
+        Objects.checkFromIndexSize(index, length, limit());
+        Objects.checkFromIndexSize(offset, length, dst.length);
+        int end = offset + length;
+        for (int i = offset, j = index; i < end; i++, j++)
+            dst[i] = get(j);
+        return this;
+    }
+
+    /**
+     * Absolute bulk <i>get</i> method.
+     *
+     * <p> This method transfers $type$s from this buffer into the given
+     * destination array.  The position of this buffer is unchanged.  An
+     * invocation of this method of the form
+     * <code>src.get(index,&nbsp;dst)</code> behaves in exactly the same
+     * way as the invocation:
+     *
+     * <pre>
+     *     src.get(index, dst, 0, dst.length) </pre>
+     *
+     * @param  index
+     *         The index in this buffer from which the first $type$ will be
+     *         read; must be non-negative and less than {@code limit()}
+     *
+     * @param  dst
+     *         The destination array
+     *
+     * @return  This buffer
+     *
+     * @throws  IndexOutOfBoundsException
+     *          If {@code index} is negative, not smaller than {@code limit()},
+     *          or {@code limit() - index < dst.length}
+     *
+     * @since 13
+     */
+    public $Type$Buffer get(int index, $type$[] dst) {
+        return get(index, dst, 0, dst.length);
+    }
 
     // -- Bulk put operations --
 
@@ -840,7 +925,7 @@
      *
      * <pre>{@code
      *     for (int i = off; i < off + len; i++)
-     *         dst.put(a[i]);
+     *         dst.put(src[i]);
      * }</pre>
      *
      * except that it first checks that there is sufficient space in this
@@ -851,12 +936,12 @@
      *
      * @param  offset
      *         The offset within the array of the first $type$ to be read;
-     *         must be non-negative and no larger than {@code array.length}
+     *         must be non-negative and no larger than {@code src.length}
      *
      * @param  length
      *         The number of $type$s to be read from the given array;
      *         must be non-negative and no larger than
-     *         {@code array.length - offset}
+     *         {@code src.length - offset}
      *
      * @return  This buffer
      *
@@ -906,6 +991,95 @@
         return put(src, 0, src.length);
     }
 
+    /**
+     * Absolute bulk <i>put</i> method&nbsp;&nbsp;<i>(optional operation)</i>.
+     *
+     * <p> This method transfers {@code length} $type$s from the given
+     * array, starting at the given offset in the array and at the given index
+     * in this buffer.  The position of this buffer is unchanged.
+     *
+     * <p> An invocation of this method of the form
+     * <code>dst.put(index,&nbsp;src,&nbsp;offset,&nbsp;length)</code>
+     * has exactly the same effect as the following loop except that it first
+     * checks the consistency of the supplied parameters and it is potentially
+     * much more efficient:
+     *
+     * <pre>{@code
+     *     for (int i = offset, j = index; i < offset + length; i++, j++)
+     *         dst.put(j, src[i]);
+     * }</pre>
+     *
+     * @param  index
+     *         The index in this buffer at which the first $type$ will be
+     *         written; must be non-negative and less than {@code limit()}
+     *
+     * @param  src
+     *         The array from which $type$s are to be read
+     *
+     * @param  offset
+     *         The offset within the array of the first $type$ to be read;
+     *         must be non-negative and less than {@code src.length}
+     *
+     * @param  length
+     *         The number of $type$s to be read from the given array;
+     *         must be non-negative and no larger than the smaller of
+     *         {@code limit() - index} and {@code src.length - offset}
+     *
+     * @return  This buffer
+     *
+     * @throws  IndexOutOfBoundsException
+     *          If the preconditions on the {@code index}, {@code offset}, and
+     *          {@code length} parameters do not hold
+     *
+     * @throws  ReadOnlyBufferException
+     *          If this buffer is read-only
+     *
+     * @since 13
+     */
+    public $Type$Buffer put(int index, $type$[] src, int offset, int length) {
+        if (isReadOnly())
+            throw new ReadOnlyBufferException();
+        Objects.checkFromIndexSize(index, length, limit());
+        Objects.checkFromIndexSize(offset, length, src.length);
+        int end = offset + length;
+        for (int i = offset, j = index; i < end; i++, j++)
+            this.put(j, src[i]);
+        return this;
+    }
+
+    /**
+     * Absolute bulk <i>put</i> method&nbsp;&nbsp;<i>(optional operation)</i>.
+     *
+     * <p> This method copies $type$s into this buffer from the given source
+     * array.  The position of this buffer is unchanged.  An invocation of this
+     * method of the form <code>dst.put(index,&nbsp;src)</code>
+     * behaves in exactly the same way as the invocation:
+     *
+     * <pre>
+     *     dst.put(index, src, 0, src.length); </pre>
+     *
+     * @param  index
+     *         The index in this buffer at which the first $type$ will be
+     *         written; must be non-negative and less than {@code limit()}
+     *
+     * @param  src
+     *         The array from which $type$s are to be read
+     *
+     * @return  This buffer
+     *
+     * @throws  IndexOutOfBoundsException
+     *          If {@code index} is negative, not smaller than {@code limit()},
+     *          or {@code limit() - index < src.length}
+     *
+     * @throws  ReadOnlyBufferException
+     *          If this buffer is read-only
+     *
+     * @since 13
+     */
+    public $Type$Buffer put(int index, $type$[] src) {
+        return put(index, src, 0, src.length);
+    }
+
 #if[char]
 
     /**
--- a/src/java.base/share/classes/java/util/concurrent/CyclicBarrier.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.base/share/classes/java/util/concurrent/CyclicBarrier.java	Thu Feb 21 22:08:53 2019 +0100
@@ -98,12 +98,11 @@
  *   }
  * }}</pre>
  *
- * Here, each worker thread processes a row of the matrix then waits at the
- * barrier until all rows have been processed. When all rows are processed
- * the supplied {@link Runnable} barrier action is executed and merges the
- * rows. If the merger
- * determines that a solution has been found then {@code done()} will return
- * {@code true} and each worker will terminate.
+ * Here, each worker thread processes a row of the matrix, then waits at the
+ * barrier until all rows have been processed. When all rows are processed the
+ * supplied {@link Runnable} barrier action is executed and merges the rows.
+ * If the merger determines that a solution has been found then {@code done()}
+ * will return {@code true} and each worker will terminate.
  *
  * <p>If the barrier action does not rely on the parties being suspended when
  * it is executed, then any of the threads in the party could execute that
@@ -132,6 +131,7 @@
  * corresponding {@code await()} in other threads.
  *
  * @see CountDownLatch
+ * @see Phaser
  *
  * @author Doug Lea
  * @since 1.5
@@ -214,18 +214,17 @@
 
             int index = --count;
             if (index == 0) {  // tripped
-                boolean ranAction = false;
-                try {
-                    final Runnable command = barrierCommand;
-                    if (command != null)
+                Runnable command = barrierCommand;
+                if (command != null) {
+                    try {
                         command.run();
-                    ranAction = true;
-                    nextGeneration();
-                    return 0;
-                } finally {
-                    if (!ranAction)
+                    } catch (Throwable ex) {
                         breakBarrier();
+                        throw ex;
+                    }
                 }
+                nextGeneration();
+                return 0;
             }
 
             // loop until tripped, broken, interrupted, or timed out
--- a/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java	Thu Feb 21 22:08:53 2019 +0100
@@ -445,8 +445,7 @@
      * if to its current value).  This would be extremely costly. So
      * we relax it in several ways: (1) Producers only signal when
      * their queue is possibly empty at some point during a push
-     * operation (which requires conservatively checking size zero or
-     * one to cover races). (2) Other workers propagate this signal
+     * operation. (2) Other workers propagate this signal
      * when they find tasks in a queue with size greater than one. (3)
      * Workers only enqueue after scanning (see below) and not finding
      * any tasks.  (4) Rather than CASing ctl to its current value in
@@ -762,10 +761,8 @@
 
     /**
      * The maximum number of top-level polls per worker before
-     * checking other queues, expressed as a bit shift to, in effect,
-     * multiply by pool size, and then use as random value mask, so
-     * average bound is about poolSize*(1<<TOP_BOUND_SHIFT).  See
-     * above for rationale.
+     * checking other queues, expressed as a bit shift.  See above for
+     * rationale.
      */
     static final int TOP_BOUND_SHIFT = 10;
 
@@ -841,18 +838,17 @@
          */
         final void push(ForkJoinTask<?> task) {
             ForkJoinTask<?>[] a;
-            int s = top, d, cap, m;
+            int s = top, d = s - base, cap, m;
             ForkJoinPool p = pool;
             if ((a = array) != null && (cap = a.length) > 0) {
                 QA.setRelease(a, (m = cap - 1) & s, task);
                 top = s + 1;
-                if (((d = s - (int)BASE.getAcquire(this)) & ~1) == 0 &&
-                    p != null) {                 // size 0 or 1
-                    VarHandle.fullFence();
-                    p.signalWork();
+                if (d == m)
+                    growArray(false);
+                else if (QA.getAcquire(a, m & (s - 1)) == null && p != null) {
+                    VarHandle.fullFence();  // was empty
+                    p.signalWork(null);
                 }
-                else if (d == m)
-                    growArray(false);
             }
         }
 
@@ -863,16 +859,16 @@
         final boolean lockedPush(ForkJoinTask<?> task) {
             ForkJoinTask<?>[] a;
             boolean signal = false;
-            int s = top, b = base, cap, d;
+            int s = top, d = s - base, cap, m;
             if ((a = array) != null && (cap = a.length) > 0) {
-                a[(cap - 1) & s] = task;
+                a[(m = (cap - 1)) & s] = task;
                 top = s + 1;
-                if (b - s + cap - 1 == 0)
+                if (d == m)
                     growArray(true);
                 else {
                     phase = 0; // full volatile unlock
-                    if (((s - base) & ~1) == 0) // size 0 or 1
-                        signal = true;
+                    if (a[m & (s - 1)] == null)
+                        signal = true;   // was empty
                 }
             }
             return signal;
@@ -1014,25 +1010,30 @@
          * queue, up to bound n (to avoid infinite unfairness).
          */
         final void topLevelExec(ForkJoinTask<?> t, WorkQueue q, int n) {
-            if (t != null && q != null) { // hoist checks
-                int nstolen = 1;
-                for (;;) {
+            int nstolen = 1;
+            for (int j = 0;;) {
+                if (t != null)
                     t.doExec();
-                    if (n-- < 0)
+                if (j++ <= n)
+                    t = nextLocalTask();
+                else {
+                    j = 0;
+                    t = null;
+                }
+                if (t == null) {
+                    if (q != null && (t = q.poll()) != null) {
+                        ++nstolen;
+                        j = 0;
+                    }
+                    else if (j != 0)
                         break;
-                    else if ((t = nextLocalTask()) == null) {
-                        if ((t = q.poll()) == null)
-                            break;
-                        else
-                            ++nstolen;
-                    }
                 }
-                ForkJoinWorkerThread thread = owner;
-                nsteals += nstolen;
-                source = 0;
-                if (thread != null)
-                    thread.afterTopLevelExec();
             }
+            ForkJoinWorkerThread thread = owner;
+            nsteals += nstolen;
+            source = 0;
+            if (thread != null)
+                thread.afterTopLevelExec();
         }
 
         /**
@@ -1455,7 +1456,7 @@
 
         if (!tryTerminate(false, false) &&            // possibly replace worker
             w != null && w.array != null)             // avoid repeated failures
-            signalWork();
+            signalWork(null);
 
         if (ex == null)                               // help clean on way out
             ForkJoinTask.helpExpungeStaleExceptions();
@@ -1465,8 +1466,9 @@
 
     /**
      * Tries to create or release a worker if too few are running.
+     * @param q if non-null recheck if empty on CAS failure
      */
-    final void signalWork() {
+    final void signalWork(WorkQueue q) {
         for (;;) {
             long c; int sp; WorkQueue[] ws; int i; WorkQueue v;
             if ((c = ctl) >= 0L)                      // enough workers
@@ -1493,6 +1495,8 @@
                         LockSupport.unpark(vt);
                     break;
                 }
+                else if (q != null && q.isEmpty())     // no need to retry
+                    break;
             }
         }
     }
@@ -1613,19 +1617,24 @@
                 else if (rc <= 0 && (md & SHUTDOWN) != 0 &&
                          tryTerminate(false, false))
                     break;                        // quiescent shutdown
-                else if (rc <= 0 && pred != 0 && phase == (int)c) {
-                    long nc = (UC_MASK & (c - TC_UNIT)) | (SP_MASK & pred);
-                    long d = keepAlive + System.currentTimeMillis();
-                    LockSupport.parkUntil(this, d);
-                    if (ctl == c &&               // drop on timeout if all idle
-                        d - System.currentTimeMillis() <= TIMEOUT_SLOP &&
-                        CTL.compareAndSet(this, c, nc)) {
-                        w.phase = QUIET;
-                        break;
+                else if (w.phase < 0) {
+                    if (rc <= 0 && pred != 0 && phase == (int)c) {
+                        long nc = (UC_MASK & (c - TC_UNIT)) | (SP_MASK & pred);
+                        long d = keepAlive + System.currentTimeMillis();
+                        LockSupport.parkUntil(this, d);
+                        if (ctl == c &&           // drop on timeout if all idle
+                            d - System.currentTimeMillis() <= TIMEOUT_SLOP &&
+                            CTL.compareAndSet(this, c, nc)) {
+                            w.phase = QUIET;
+                            break;
+                        }
+                    }
+                    else {
+                        LockSupport.park(this);
+                        if (w.phase < 0)          // one spurious wakeup check
+                            LockSupport.park(this);
                     }
                 }
-                else if (w.phase < 0)
-                    LockSupport.park(this);       // OK if spuriously woken
                 w.source = 0;                     // disable signal
             }
         }
@@ -1651,10 +1660,10 @@
                             QA.compareAndSet(a, k, t, null)) {
                             q.base = b;
                             w.source = qid;
-                            if (q.top - b > 0)
-                                signalWork();
+                            if (a[(cap - 1) & b] != null)
+                                signalWork(q);    // help signal if more tasks
                             w.topLevelExec(t, q,  // random fairness bound
-                                           r & ((n << TOP_BOUND_SHIFT) - 1));
+                                           (r | (1 << TOP_BOUND_SHIFT)) & SMASK);
                         }
                     }
                     return true;
@@ -1900,7 +1909,7 @@
                 r = ThreadLocalRandom.advanceProbe(r);
             else {
                 if (q.lockedPush(task))
-                    signalWork();
+                    signalWork(null);
                 return;
             }
         }
--- a/src/java.base/share/classes/java/util/concurrent/ForkJoinWorkerThread.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.base/share/classes/java/util/concurrent/ForkJoinWorkerThread.java	Thu Feb 21 22:08:53 2019 +0100
@@ -236,7 +236,8 @@
 
         @Override // paranoically
         public void setContextClassLoader(ClassLoader cl) {
-            throw new SecurityException("setContextClassLoader");
+            if (cl != null && ClassLoader.getSystemClassLoader() != cl)
+                throw new SecurityException("setContextClassLoader");
         }
     }
 }
--- a/src/java.base/share/classes/sun/security/ssl/ClientHello.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/ClientHello.java	Thu Feb 21 22:08:53 2019 +0100
@@ -803,13 +803,8 @@
                     shc.sslConfig.getEnabledExtensions(
                             SSLHandshake.CLIENT_HELLO);
 
-            ClientHelloMessage chm;
-            try {
-                chm = new ClientHelloMessage(shc, message, enabledExtensions);
-            } catch (Exception e) {
-                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
-                        "ClientHelloMessage failure", e);
-            }
+            ClientHelloMessage chm =
+                    new ClientHelloMessage(shc, message, enabledExtensions);
             if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
                 SSLLogger.fine("Consuming ClientHello handshake message", chm);
             }
--- a/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
 package sun.security.ssl;
 
 import java.io.IOException;
+import java.nio.BufferOverflowException;
+import java.nio.BufferUnderflowException;
 import java.nio.ByteBuffer;
 import java.security.AlgorithmConstraints;
 import java.security.CryptoPrimitive;
@@ -443,6 +445,10 @@
             throw conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                     "Unsupported handshake message: " +
                     SSLHandshake.nameOf(handshakeType), unsoe);
+        } catch (BufferUnderflowException | BufferOverflowException be) {
+            throw conContext.fatal(Alert.DECODE_ERROR,
+                    "Illegal handshake message: " +
+                    SSLHandshake.nameOf(handshakeType), be);
         }
 
         // update handshake hash after handshake message consumption.
--- a/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
 package sun.security.ssl;
 
 import java.io.IOException;
+import java.nio.BufferOverflowException;
+import java.nio.BufferUnderflowException;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.LinkedHashMap;
@@ -74,6 +76,10 @@
             throw conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                     "Unsupported post-handshake message: " +
                             SSLHandshake.nameOf(handshakeType), unsoe);
+        } catch (BufferUnderflowException | BufferOverflowException be) {
+            throw conContext.fatal(Alert.DECODE_ERROR,
+                    "Illegal handshake message: " +
+                    SSLHandshake.nameOf(handshakeType), be);
         }
     }
 }
--- a/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java	Thu Feb 21 22:08:53 2019 +0100
@@ -921,29 +921,45 @@
 
         static {
             Exception reserved = null;
-            TrustManager[] tmMediator;
+            TrustManager[] tmMediator = null;
             try {
                 tmMediator = getTrustManagers();
             } catch (Exception e) {
                 reserved = e;
-                tmMediator = new TrustManager[0];
+                if (SSLLogger.isOn && SSLLogger.isOn("ssl,defaultctx")) {
+                    SSLLogger.warning(
+                            "Failed to load default trust managers", e);
+                }
             }
-            trustManagers = tmMediator;
 
+            KeyManager[] kmMediator = null;
             if (reserved == null) {
-                KeyManager[] kmMediator;
                 try {
                     kmMediator = getKeyManagers();
                 } catch (Exception e) {
                     reserved = e;
-                    kmMediator = new KeyManager[0];
+                    if (SSLLogger.isOn && SSLLogger.isOn("ssl,defaultctx")) {
+                        SSLLogger.warning(
+                                "Failed to load default key managers", e);
+                    }
                 }
-                keyManagers = kmMediator;
-            } else {
-                keyManagers = new KeyManager[0];
             }
 
-            reservedException = reserved;
+            if (reserved != null) {
+                trustManagers = new TrustManager[0];
+                keyManagers = new KeyManager[0];
+
+                // Important note: please don't reserve the original exception
+                // object, which may be not garbage collection friendly as
+                // 'reservedException' is a static filed.
+                reservedException =
+                        new KeyManagementException(reserved.getMessage());
+            } else {
+                trustManagers = tmMediator;
+                keyManagers = kmMediator;
+
+                reservedException = null;
+            }
         }
 
         private static TrustManager[] getTrustManagers() throws Exception {
@@ -1071,21 +1087,30 @@
     private static final class DefaultSSLContextHolder {
 
         private static final SSLContextImpl sslContext;
-        static Exception reservedException = null;
+        private static final Exception reservedException;
 
         static {
+            Exception reserved = null;
             SSLContextImpl mediator = null;
             if (DefaultManagersHolder.reservedException != null) {
-                reservedException = DefaultManagersHolder.reservedException;
+                reserved = DefaultManagersHolder.reservedException;
             } else {
                 try {
                     mediator = new DefaultSSLContext();
                 } catch (Exception e) {
-                    reservedException = e;
+                    // Important note: please don't reserve the original
+                    // exception object, which may be not garbage collection
+                    // friendly as 'reservedException' is a static filed.
+                    reserved = new KeyManagementException(e.getMessage());
+                    if (SSLLogger.isOn && SSLLogger.isOn("ssl,defaultctx")) {
+                        SSLLogger.warning(
+                                "Failed to load default SSLContext", e);
+                    }
                 }
             }
 
             sslContext = mediator;
+            reservedException = reserved;
         }
     }
 
--- a/src/java.base/share/classes/sun/security/x509/CertificateExtensions.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.base/share/classes/sun/security/x509/CertificateExtensions.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -355,7 +355,7 @@
 
 class UnparseableExtension extends Extension {
     private String name;
-    private Throwable why;
+    private String exceptionDescription;
 
     public UnparseableExtension(Extension ext, Throwable why) {
         super(ext);
@@ -371,12 +371,13 @@
             // If we cannot find the name, just ignore it
         }
 
-        this.why = why;
+        this.exceptionDescription = why.toString();
     }
 
     @Override public String toString() {
         return super.toString() +
-                "Unparseable " + name + "extension due to\n" + why + "\n\n" +
+                "Unparseable " + name + "extension due to\n" +
+                exceptionDescription + "\n\n" +
                 new HexDumpEncoder().encodeBuffer(getExtensionValue());
     }
 }
--- a/src/java.base/share/classes/sun/util/cldr/CLDRCalendarDataProviderImpl.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.base/share/classes/sun/util/cldr/CLDRCalendarDataProviderImpl.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -80,7 +80,8 @@
         String region = locale.getCountry();
 
         if (region.isEmpty()) {
-            return 0;
+            // Use "US" as default
+            region = "US";
         }
 
         Integer val = map.get(region);
--- a/src/java.base/share/classes/sun/util/locale/provider/CalendarDataUtility.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.base/share/classes/sun/util/locale/provider/CalendarDataUtility.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -256,7 +256,9 @@
             default:
                 throw new InternalError("invalid requestID: " + requestID);
             }
-            return (value != 0) ? value : null;
+
+            assert value != 0;
+            return value;
         }
     }
 }
--- a/src/java.base/share/classes/sun/util/locale/provider/LocaleServiceProviderPool.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.base/share/classes/sun/util/locale/provider/LocaleServiceProviderPool.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -283,8 +283,8 @@
                     return providersObj;
                 } else if (isObjectProvider) {
                     config(LocaleServiceProviderPool.class,
-                        "A locale sensitive service provider returned null for a localized objects,  which should not happen.  provider: "
-                            + lsp + " locale: " + locale);
+                        "A locale sensitive service object provider returned null, " +
+                        "which should not happen. Provider: " + lsp + " Locale: " + locale);
                 }
             }
         }
--- a/src/java.base/share/native/libjimage/imageFile.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.base/share/native/libjimage/imageFile.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -481,65 +481,6 @@
     return 0;            // not found
 }
 
-// Assemble the location path from the string fragments indicated in the location attributes.
-void ImageFileReader::location_path(ImageLocation& location, char* path, size_t max) const {
-    // Manage the image string table.
-    ImageStrings strings(_string_bytes, _header.strings_size(_endian));
-    // Position to first character of the path buffer.
-    char* next = path;
-    // Temp for string length.
-    size_t length;
-    // Get module string.
-    const char* module = location.get_attribute(ImageLocation::ATTRIBUTE_MODULE, strings);
-    // If module string is not empty string.
-    if (*module != '\0') {
-        // Get length of module name.
-        length = strlen(module);
-        // Make sure there is no buffer overflow.
-        assert(next - path + length + 2 < max && "buffer overflow");
-        // Append '/module/'.
-        *next++ = '/';
-        strncpy(next, module, length); next += length;
-        *next++ = '/';
-    }
-    // Get parent (package) string.
-    const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings);
-    // If parent string is not empty string.
-    if (*parent != '\0') {
-        // Get length of module string.
-        length = strlen(parent);
-        // Make sure there is no buffer overflow.
-        assert(next - path + length + 1 < max && "buffer overflow");
-        // Append 'patent/' .
-        strncpy(next, parent, length); next += length;
-        *next++ = '/';
-    }
-    // Get base name string.
-    const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings);
-    // Get length of base name.
-    length = strlen(base);
-    // Make sure there is no buffer overflow.
-    assert(next - path + length < max && "buffer overflow");
-    // Append base name.
-    strncpy(next, base, length); next += length;
-    // Get extension string.
-    const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings);
-    // If extension string is not empty string.
-    if (*extension != '\0') {
-        // Get length of extension string.
-        length = strlen(extension);
-        // Make sure there is no buffer overflow.
-        assert(next - path + length + 1 < max && "buffer overflow");
-        // Append '.extension' .
-        *next++ = '.';
-        strncpy(next, extension, length); next += length;
-    }
-    // Make sure there is no buffer overflow.
-    assert((size_t)(next - path) < max && "buffer overflow");
-    // Terminate string.
-    *next = '\0';
-}
-
 // Verify that a found location matches the supplied path (without copying.)
 bool ImageFileReader::verify_location(ImageLocation& location, const char* path) const {
     // Manage the image string table.
--- a/src/java.base/share/native/libjimage/imageFile.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.base/share/native/libjimage/imageFile.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -564,9 +564,6 @@
     // ImageFileReader::NOT_FOUND otherwise.
     u4 find_location_index(const char* path, u8 *size) const;
 
-    // Assemble the location path.
-    void location_path(ImageLocation& location, char* path, size_t max) const;
-
     // Verify that a found location matches the supplied path.
     bool verify_location(ImageLocation& location, const char* path) const;
 
--- a/src/java.base/share/native/libjimage/jimage.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.base/share/native/libjimage/jimage.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -215,29 +215,3 @@
         }
     }
 }
-
-/*
- * JIMAGE_ResourcePath- Given an open image file, a location reference, a buffer
- * and a maximum buffer size, copy the path of the resource into the buffer.
- * Returns false if not a valid location reference.
- *
- * Ex.
- *   JImageLocationRef location = ...
- *   char path[JIMAGE_MAX_PATH];
- *    (*JImageResourcePath)(image, location, path, JIMAGE_MAX_PATH);
- */
-extern "C" JNIEXPORT bool
-JIMAGE_ResourcePath(JImageFile* image, JImageLocationRef locationRef,
-                                    char* path, size_t max) {
-    ImageFileReader* imageFile = (ImageFileReader*) image;
-
-    u4 offset = (u4) locationRef;
-    if (offset >= imageFile->locations_size()) {
-        return false;
-    }
-
-    ImageLocation location(imageFile->get_location_offset_data(offset));
-    imageFile->location_path(location, path, max);
-
-    return true;
-}
--- a/src/java.base/share/native/libjimage/jimage.hpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.base/share/native/libjimage/jimage.hpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -191,20 +191,3 @@
 
 typedef void (*JImageResourceIterator_t)(JImageFile* jimage,
         JImageResourceVisitor_t visitor, void* arg);
-
-/*
- * JIMAGE_ResourcePath- Given an open image file, a location reference, a buffer
- * and a maximum buffer size, copy the path of the resource into the buffer.
- * Returns false if not a valid location reference.
- *
- * Ex.
- *   JImageLocationRef location = ...
- *   char path[JIMAGE_MAX_PATH];
- *    (*JImageResourcePath)(image, location, path, JIMAGE_MAX_PATH);
- */
-extern "C" JNIEXPORT bool
-JIMAGE_ResourcePath(JImageFile* image, JImageLocationRef locationRef,
-                                    char* path, size_t max);
-
-typedef bool (*JImage_ResourcePath_t)(JImageFile* jimage, JImageLocationRef location,
-        char* buffer, jlong size);
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CTrayIcon.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CTrayIcon.java	Thu Feb 21 22:08:53 2019 +0100
@@ -208,11 +208,13 @@
 
         CImage cimage = CImage.getCreator().createFromImage(image, observer);
         boolean imageAutoSize = target.isImageAutoSize();
-        cimage.execute(imagePtr -> {
-            execute(ptr -> {
-                setNativeImage(ptr, imagePtr, imageAutoSize);
+        if (cimage != null) {
+            cimage.execute(imagePtr -> {
+                execute(ptr -> {
+                    setNativeImage(ptr, imagePtr, imageAutoSize);
+                });
             });
-        });
+        }
     }
 
     private native void setNativeImage(final long model, final long nsimage, final boolean autosize);
@@ -357,7 +359,7 @@
     class IconObserver implements ImageObserver {
         @Override
         public boolean imageUpdate(Image image, int flags, int x, int y, int width, int height) {
-            if (image != target.getImage()) // if the image has been changed
+            if (target == null || image != target.getImage()) //if the image has been changed
             {
                 return false;
             }
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java	Thu Feb 21 22:08:53 2019 +0100
@@ -739,7 +739,8 @@
               region == Region.TOOL_BAR_DRAG_WINDOW ||
               region == Region.TOOL_TIP ||
               region == Region.TREE ||
-              region == Region.VIEWPORT) {
+              region == Region.VIEWPORT ||
+              region == Region.TEXT_PANE) {
             return true;
         }
         if (!GTKLookAndFeel.is3()) {
@@ -747,8 +748,7 @@
                   region == Region.FORMATTED_TEXT_FIELD ||
                   region == Region.PASSWORD_FIELD ||
                   region == Region.SPINNER ||
-                  region == Region.TEXT_FIELD ||
-                  region == Region.TEXT_PANE) {
+                  region == Region.TEXT_FIELD) {
                 return true;
             }
         }
@@ -767,6 +767,14 @@
         if (classKey != null) {
             Object value = getClassSpecificValue(classKey);
             if (value != null) {
+                //This is a workaround as the "slider-length" property has been
+                //deprecated for GtkScale from gtk 3.20, so default value of 31
+                //is used and makes redering of slider wrong. Value 14 is being
+                //used as default value for Slider.thumbHeight is 14 and making
+                //width 14 as well makes slider thumb render in proper shape
+                if ("Slider.thumbWidth".equals(key) && value.equals(31)) {
+                    return 14;
+                }
                 return value;
             }
         }
@@ -779,8 +787,15 @@
             return getColorForState(context, ColorType.FOREGROUND);
         }
         else if (key == "ScrollBar.minimumThumbSize") {
+            //This is a workaround as the "min-slider-length" property has been
+            //deprecated for GtkScrollBar from gtk 3.20, so default value of 21
+            //is used and makes ScrollBar thumb very small. Value 40 is being
+            //used as this is the value mentioned in css files
             int len =
                 getClassSpecificIntValue(context, "min-slider-length", 21);
+            if (len == 21) {
+                len = 40;
+            }
             JScrollBar sb = (JScrollBar)context.getComponent();
             if (sb.getOrientation() == JScrollBar.HORIZONTAL) {
                 return new DimensionUIResource(len, 0);
--- a/src/java.desktop/share/classes/java/awt/Font.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.desktop/share/classes/java/awt/Font.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -495,13 +495,7 @@
 
     private Font2D getFont2D() {
         FontManager fm = FontManagerFactory.getInstance();
-        if (fm.usingPerAppContextComposites() &&
-            font2DHandle != null &&
-            font2DHandle.font2D instanceof CompositeFont &&
-            ((CompositeFont)(font2DHandle.font2D)).isStdComposite()) {
-            return fm.findFont2D(name, style,
-                                          FontManager.LOGICAL_FALLBACK);
-        } else if (font2DHandle == null) {
+        if (font2DHandle == null) {
             font2DHandle =
                 fm.findFont2D(name, style,
                               FontManager.LOGICAL_FALLBACK).handle;
--- a/src/java.desktop/share/classes/sun/awt/AWTSecurityManager.java	Wed Feb 20 21:44:31 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.awt;
-
-/**
-  * The AWTSecurityManager class provides the ability to secondarily
-  * index AppContext objects through SecurityManager extensions.
-  * As noted in AppContext.java, AppContexts are primarily indexed by
-  * ThreadGroup.  In the case where the ThreadGroup doesn't provide
-  * enough information to determine AppContext (e.g. system threads),
-  * if a SecurityManager is installed which derives from
-  * AWTSecurityManager, the AWTSecurityManager's getAppContext()
-  * method is called to determine the AppContext.
-  *
-  * A typical example of the use of this class is where an applet
-  * is called by a system thread, yet the system AppContext is
-  * inappropriate, because applet code is currently executing.
-  * In this case, the getAppContext() method can walk the call stack
-  * to determine the applet code being executed and return the applet's
-  * AppContext object.
-  *
-  * @author  Fred Ecks
-  */
-public class AWTSecurityManager extends SecurityManager {
-
-    /**
-      * Get the AppContext corresponding to the current context.
-      * The default implementation returns null, but this method
-      * may be overridden by various SecurityManagers
-      * (e.g. AppletSecurity) to index AppContext objects by the
-      * calling context.
-      *
-      * @return  the AppContext corresponding to the current context.
-      * @see     sun.awt.AppContext
-      * @see     java.lang.SecurityManager
-      * @since   1.2.1
-      */
-    public AppContext getAppContext() {
-        return null; // Default implementation returns null
-    }
-
-} /* class AWTSecurityManager */
--- a/src/java.desktop/share/classes/sun/awt/AppContext.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.desktop/share/classes/sun/awt/AppContext.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -123,17 +123,6 @@
  * therefore safely invoke any of its methods without worry of being
  * blocked.
  *
- * Note: If a SecurityManager is installed which derives from
- * sun.awt.AWTSecurityManager, it may override the
- * AWTSecurityManager.getAppContext() method to return the proper
- * AppContext based on the execution context, in the case where
- * the default ThreadGroup-based AppContext indexing would return
- * the main "system" AppContext.  For example, in an applet situation,
- * if a system thread calls into an applet, rather than returning the
- * main "system" AppContext (the one corresponding to the system thread),
- * an installed AWTSecurityManager may return the applet's AppContext
- * based on the execution context.
- *
  * @author  Thomas Ball
  * @author  Fred Ecks
  */
@@ -287,10 +276,7 @@
 
     /**
      * Returns the appropriate AppContext for the caller,
-     * as determined by its ThreadGroup.  If the main "system" AppContext
-     * would be returned and there's an AWTSecurityManager installed, it
-     * is called to get the proper AppContext based on the execution
-     * context.
+     * as determined by its ThreadGroup.
      *
      * @return  the AppContext for the caller.
      * @see     java.lang.ThreadGroup
@@ -384,18 +370,6 @@
         return (ctx != null && ctx == mainAppContext);
     }
 
-    private static AppContext getExecutionAppContext() {
-        SecurityManager securityManager = System.getSecurityManager();
-        if ((securityManager != null) &&
-            (securityManager instanceof AWTSecurityManager))
-        {
-            AWTSecurityManager awtSecMgr = (AWTSecurityManager) securityManager;
-            AppContext secAppContext = awtSecMgr.getAppContext();
-            return secAppContext; // Return what we're told
-        }
-        return null;
-    }
-
     private long DISPOSAL_TIMEOUT = 5000;  // Default to 5-second timeout
                                            // for disposal of all Frames
                                            // (we wait for this time twice,
@@ -872,8 +846,7 @@
                 // context since we don't need it.
                 if (numAppContexts.get() == 0) return null;
 
-                // Get the context from the security manager
-                AppContext ecx = getExecutionAppContext();
+                AppContext ecx = null;
 
                 // Not sure we really need to re-check numAppContexts here.
                 // If all applets have gone away then we could have a
--- a/src/java.desktop/share/classes/sun/font/FontDesignMetrics.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.desktop/share/classes/sun/font/FontDesignMetrics.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,22 +25,18 @@
 
 package sun.font;
 
-import java.lang.ref.ReferenceQueue;
-import java.lang.ref.SoftReference;
-
+import java.awt.Font;
 import java.awt.FontMetrics;
-import java.awt.Font;
 import java.awt.GraphicsEnvironment;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.NoninvertibleTransformException;
-import java.awt.geom.Rectangle2D;
 import java.awt.font.FontRenderContext;
 import java.awt.font.TextLayout;
-
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Rectangle2D;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
-
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.SoftReference;
 import java.util.concurrent.ConcurrentHashMap;
 
 import sun.java2d.Disposer;
@@ -263,7 +259,7 @@
          * by this code as they use the metrics of the physical anyway.
          */
         SunFontManager fm = SunFontManager.getInstance();
-        if (fm.maybeUsingAlternateCompositeFonts() &&
+        if (fm.usingAlternateCompositeFonts() &&
             FontUtilities.getFont2D(font) instanceof CompositeFont) {
             return new FontDesignMetrics(font, frc);
         }
--- a/src/java.desktop/share/classes/sun/font/FontManager.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.desktop/share/classes/sun/font/FontManager.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,16 +22,12 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package sun.font;
 
 import java.awt.Font;
 import java.awt.FontFormatException;
 import java.io.File;
-import java.util.Locale;
-import java.util.TreeMap;
-
-import javax.swing.plaf.FontUIResource;
-
 
 /**
  * Interface between Java Fonts (java.awt.Font) and the underlying
@@ -93,13 +89,6 @@
         throws FontFormatException;
 
     /**
-     * If usingPerAppContextComposites is true, we are in "applet"
-     * (eg browser) environment and at least one context has selected
-     * an alternate composite font behaviour.
-     */
-    public boolean usingPerAppContextComposites();
-
-    /**
      * Creates a derived composite font from the specified font (handle).
      *
      * @param family the font family of the derived font
--- a/src/java.desktop/share/classes/sun/font/SunFontManager.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.desktop/share/classes/sun/font/SunFontManager.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
 import java.util.concurrent.ConcurrentHashMap;
 
 import javax.swing.plaf.FontUIResource;
-import sun.awt.AppContext;
+
 import sun.awt.FontConfiguration;
 import sun.awt.SunToolkit;
 import sun.awt.util.ThreadGroupUtils;
@@ -256,11 +256,6 @@
         return t1Filter;
     }
 
-    @Override
-    public boolean usingPerAppContextComposites() {
-        return _usingPerAppContextComposites;
-    }
-
     static {
 
         java.security.AccessController.doPrivileged(
@@ -1936,7 +1931,6 @@
     public Font2D findFont2D(String name, int style, int fallback) {
         String lowerCaseName = name.toLowerCase(Locale.ENGLISH);
         String mapName = lowerCaseName + dotStyleStr(style);
-        Font2D font;
 
         /* If preferLocaleFonts() or preferProportionalFonts() has been
          * called we may be using an alternate set of composite fonts in this
@@ -1944,19 +1938,7 @@
          * this is so, and gives access to the alternate composite for the
          * name.
          */
-        if (_usingPerAppContextComposites) {
-            @SuppressWarnings("unchecked")
-            ConcurrentHashMap<String, Font2D> altNameCache =
-                (ConcurrentHashMap<String, Font2D>)
-                AppContext.getAppContext().get(CompositeFont.class);
-            if (altNameCache != null) {
-                font = altNameCache.get(mapName);
-            } else {
-                font = null;
-            }
-        } else {
-            font = fontNameCache.get(mapName);
-        }
+        Font2D font = fontNameCache.get(mapName);
         if (font != null) {
             return font;
         }
@@ -2161,25 +2143,9 @@
          * cache for these.
          */
 
-        if (fontsAreRegistered || fontsAreRegisteredPerAppContext) {
-            Hashtable<String, FontFamily> familyTable = null;
-            Hashtable<String, Font2D> nameTable;
-
-            if (fontsAreRegistered) {
-                familyTable = createdByFamilyName;
-                nameTable = createdByFullName;
-            } else {
-                AppContext appContext = AppContext.getAppContext();
-                @SuppressWarnings("unchecked")
-                Hashtable<String,FontFamily> tmp1 =
-                    (Hashtable<String,FontFamily>)appContext.get(regFamilyKey);
-                familyTable = tmp1;
-
-                @SuppressWarnings("unchecked")
-                Hashtable<String, Font2D> tmp2 =
-                    (Hashtable<String,Font2D>)appContext.get(regFullNameKey);
-                nameTable = tmp2;
-            }
+        if (fontsAreRegistered) {
+            Hashtable<String, FontFamily> familyTable = createdByFamilyName;
+            Hashtable<String, Font2D> nameTable = createdByFullName;
 
             family = familyTable.get(lowerCaseName);
             if (family != null) {
@@ -2684,9 +2650,6 @@
      * Calling the methods below is "heavyweight" but it is expected that
      * these methods will be called very rarely.
      *
-     * If _usingPerAppContextComposites is true, we are in "applet"
-     * (eg browser) environment and at least one context has selected
-     * an alternate composite font behaviour.
      * If _usingAlternateComposites is true, we are not in an "applet"
      * environment and the (single) application has selected
      * an alternate composite font behaviour.
@@ -2698,21 +2661,13 @@
      * but that may have to wait. The results should be correct, just not
      * optimal.
      */
-    private static final Object altJAFontKey       = new Object();
-    private static final Object localeFontKey       = new Object();
-    private static final Object proportionalFontKey = new Object();
-    private boolean _usingPerAppContextComposites = false;
     private boolean _usingAlternateComposites = false;
 
-    /* These values are used only if we are running as a standalone
-     * application, as determined by maybeMultiAppContext();
-     */
     private static boolean gAltJAFont = false;
     private boolean gLocalePref = false;
     private boolean gPropPref = false;
 
-    /* This method doesn't check if alternates are selected in this app
-     * context. Its used by the FontMetrics caching code which in such
+    /* Its used by the FontMetrics caching code which in such
      * a case cannot retrieve a cached metrics solely on the basis of
      * the Font.equals() method since it needs to also check if the Font2D
      * is the same.
@@ -2724,26 +2679,8 @@
      * logical font definitions we may need to revisit this if GTK reports
      * combined metrics instead. For now though this test can be simple.
      */
-    public boolean maybeUsingAlternateCompositeFonts() {
-       return _usingAlternateComposites || _usingPerAppContextComposites;
-    }
-
     public boolean usingAlternateCompositeFonts() {
-        return (_usingAlternateComposites ||
-                (_usingPerAppContextComposites &&
-                AppContext.getAppContext().get(CompositeFont.class) != null));
-    }
-
-    private static boolean maybeMultiAppContext() {
-        Boolean appletSM = (Boolean)
-            java.security.AccessController.doPrivileged(
-                new java.security.PrivilegedAction<Object>() {
-                        public Object run() {
-                            SecurityManager sm = System.getSecurityManager();
-                            return sm instanceof sun.awt.AWTSecurityManager;
-                        }
-                    });
-        return appletSM.booleanValue();
+        return _usingAlternateComposites;
     }
 
     /* Modifies the behaviour of a subsequent call to preferLocaleFonts()
@@ -2758,22 +2695,11 @@
         if (!FontUtilities.isWindows) {
             return;
         }
-
-        if (!maybeMultiAppContext()) {
-            gAltJAFont = true;
-        } else {
-            AppContext appContext = AppContext.getAppContext();
-            appContext.put(altJAFontKey, altJAFontKey);
-        }
+        gAltJAFont = true;
     }
 
     public boolean usingAlternateFontforJALocales() {
-        if (!maybeMultiAppContext()) {
-            return gAltJAFont;
-        } else {
-            AppContext appContext = AppContext.getAppContext();
-            return appContext.get(altJAFontKey) == altJAFontKey;
-        }
+        return gAltJAFont;
     }
 
     public synchronized void preferLocaleFonts() {
@@ -2784,29 +2710,12 @@
         if (!FontConfiguration.willReorderForStartupLocale()) {
             return;
         }
-
-        if (!maybeMultiAppContext()) {
-            if (gLocalePref == true) {
-                return;
-            }
-            gLocalePref = true;
-            createCompositeFonts(fontNameCache, gLocalePref, gPropPref);
-            _usingAlternateComposites = true;
-        } else {
-            AppContext appContext = AppContext.getAppContext();
-            if (appContext.get(localeFontKey) == localeFontKey) {
-                return;
-            }
-            appContext.put(localeFontKey, localeFontKey);
-            boolean acPropPref =
-                appContext.get(proportionalFontKey) == proportionalFontKey;
-            ConcurrentHashMap<String, Font2D>
-                altNameCache = new ConcurrentHashMap<String, Font2D> ();
-            /* If there is an existing hashtable, we can drop it. */
-            appContext.put(CompositeFont.class, altNameCache);
-            _usingPerAppContextComposites = true;
-            createCompositeFonts(altNameCache, true, acPropPref);
+        if (gLocalePref == true) {
+            return;
         }
+        gLocalePref = true;
+        createCompositeFonts(fontNameCache, gLocalePref, gPropPref);
+        _usingAlternateComposites = true;
     }
 
     public synchronized void preferProportionalFonts() {
@@ -2820,29 +2729,12 @@
         if (!FontConfiguration.hasMonoToPropMap()) {
             return;
         }
-
-        if (!maybeMultiAppContext()) {
-            if (gPropPref == true) {
-                return;
-            }
-            gPropPref = true;
-            createCompositeFonts(fontNameCache, gLocalePref, gPropPref);
-            _usingAlternateComposites = true;
-        } else {
-            AppContext appContext = AppContext.getAppContext();
-            if (appContext.get(proportionalFontKey) == proportionalFontKey) {
-                return;
-            }
-            appContext.put(proportionalFontKey, proportionalFontKey);
-            boolean acLocalePref =
-                appContext.get(localeFontKey) == localeFontKey;
-            ConcurrentHashMap<String, Font2D>
-                altNameCache = new ConcurrentHashMap<String, Font2D> ();
-            /* If there is an existing hashtable, we can drop it. */
-            appContext.put(CompositeFont.class, altNameCache);
-            _usingPerAppContextComposites = true;
-            createCompositeFonts(altNameCache, acLocalePref, true);
+        if (gPropPref == true) {
+            return;
         }
+        gPropPref = true;
+        createCompositeFonts(fontNameCache, gLocalePref, gPropPref);
+        _usingAlternateComposites = true;
     }
 
     private static HashSet<String> installedNames = null;
@@ -2865,13 +2757,10 @@
         return installedNames;
     }
 
-    /* Keys are used to lookup per-AppContext Hashtables */
-    private static final Object regFamilyKey  = new Object();
-    private static final Object regFullNameKey = new Object();
+    private static final Object regFamilyLock  = new Object();
     private Hashtable<String,FontFamily> createdByFamilyName;
     private Hashtable<String,Font2D>     createdByFullName;
     private boolean fontsAreRegistered = false;
-    private boolean fontsAreRegisteredPerAppContext = false;
 
     public boolean registerFont(Font font) {
         /* This method should not be called with "null".
@@ -2882,7 +2771,7 @@
         }
 
         /* Initialise these objects only once we start to use this API */
-        synchronized (regFamilyKey) {
+        synchronized (regFamilyLock) {
             if (createdByFamilyName == null) {
                 createdByFamilyName = new Hashtable<String,FontFamily>();
                 createdByFullName = new Hashtable<String,Font2D>();
@@ -2919,31 +2808,10 @@
         }
 
         /* Checks passed, now register the font */
-        Hashtable<String,FontFamily> familyTable;
-        Hashtable<String,Font2D> fullNameTable;
-        if (!maybeMultiAppContext()) {
-            familyTable = createdByFamilyName;
-            fullNameTable = createdByFullName;
-            fontsAreRegistered = true;
-        } else {
-            AppContext appContext = AppContext.getAppContext();
-            @SuppressWarnings("unchecked")
-            Hashtable<String,FontFamily> tmp1 =
-                (Hashtable<String,FontFamily>)appContext.get(regFamilyKey);
-            familyTable = tmp1;
-            @SuppressWarnings("unchecked")
-            Hashtable<String,Font2D> tmp2 =
-                (Hashtable<String,Font2D>)appContext.get(regFullNameKey);
-            fullNameTable = tmp2;
-
-            if (familyTable == null) {
-                familyTable = new Hashtable<String,FontFamily>();
-                fullNameTable = new Hashtable<String,Font2D>();
-                appContext.put(regFamilyKey, familyTable);
-                appContext.put(regFullNameKey, fullNameTable);
-            }
-            fontsAreRegisteredPerAppContext = true;
-        }
+        Hashtable<String, FontFamily> familyTable = createdByFamilyName;
+        Hashtable<String, Font2D> fullNameTable = createdByFullName;
+        fontsAreRegistered = true;
+
         /* Create the FontFamily and add font to the tables */
         Font2D font2D = FontUtilities.getFont2D(font);
         int style = font2D.getStyle();
@@ -2989,12 +2857,6 @@
         Hashtable<String,FontFamily> familyTable;
         if (fontsAreRegistered) {
             familyTable = createdByFamilyName;
-        } else if (fontsAreRegisteredPerAppContext) {
-            AppContext appContext = AppContext.getAppContext();
-            @SuppressWarnings("unchecked")
-            Hashtable<String,FontFamily> tmp =
-                (Hashtable<String,FontFamily>)appContext.get(regFamilyKey);
-            familyTable = tmp;
         } else {
             return null;
         }
@@ -3019,12 +2881,6 @@
         Hashtable<String,Font2D> nameTable;
         if (fontsAreRegistered) {
             nameTable = createdByFullName;
-        } else if (fontsAreRegisteredPerAppContext) {
-            AppContext appContext = AppContext.getAppContext();
-            @SuppressWarnings("unchecked")
-            Hashtable<String,Font2D> tmp =
-                (Hashtable<String,Font2D>)appContext.get(regFullNameKey);
-            nameTable = tmp;
         } else {
             return null;
         }
--- a/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-atomic-private.hh	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-atomic-private.hh	Thu Feb 21 22:08:53 2019 +0100
@@ -115,7 +115,7 @@
 #endif
 
 
-#elif !defined(HB_NO_MT) && defined(_AIX) && defined(__IBMCPP__)
+#elif !defined(HB_NO_MT) && defined(_AIX) && (defined(__IBMCPP__) || defined(__ibmxl__))
 
 #include <builtins.h>
 
--- a/src/java.desktop/share/native/liblcms/cmsxform.c	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.desktop/share/native/liblcms/cmsxform.c	Thu Feb 21 22:08:53 2019 +0100
@@ -836,7 +836,7 @@
 
                             // Save the day? (Ignore the warning)
                             if (Plugin->OldXform) {
-                                   p->OldXform = (_cmsTransformFn) p->xform;
+                                   p->OldXform = (_cmsTransformFn)(void*) p->xform;
                                    p->xform = _cmsTransform2toTransformAdaptor;
                             }
 
--- a/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c	Thu Feb 21 22:08:53 2019 +0100
@@ -258,6 +258,7 @@
 
 static gboolean gtk3_version_3_10 = TRUE;
 static gboolean gtk3_version_3_14 = FALSE;
+static gboolean gtk3_version_3_20 = FALSE;
 
 GtkApi* gtk3_load(JNIEnv *env, const char* lib_name)
 {
@@ -400,6 +401,18 @@
         }
         gtk3_version_3_14 = !fp_gtk_check_version(3, 14, 0);
 
+        if (!fp_gtk_check_version(3, 20, 0)) {
+            gtk3_version_3_20 = TRUE;
+            fp_gtk_widget_path_copy = dl_symbol("gtk_widget_path_copy");
+            fp_gtk_widget_path_new = dl_symbol("gtk_widget_path_new");
+            fp_gtk_widget_path_append_type = dl_symbol("gtk_widget_path_append_type");
+            fp_gtk_widget_path_iter_set_object_name = dl_symbol("gtk_widget_path_iter_set_object_name");
+            fp_gtk_style_context_set_path = dl_symbol("gtk_style_context_set_path");
+            fp_gtk_widget_path_unref = dl_symbol("gtk_widget_path_unref");
+            fp_gtk_style_context_get_path = dl_symbol("gtk_style_context_get_path");
+            fp_gtk_style_context_new = dl_symbol("gtk_style_context_new");
+        }
+
         fp_gdk_window_create_similar_surface =
                       dl_symbol("gdk_window_create_similar_surface");
         fp_gtk_settings_get_for_screen =
@@ -561,7 +574,6 @@
                                                 "gtk_combo_box_new_with_entry");
         fp_gtk_separator_tool_item_new = dlsym(gtk3_libhandle,
                                                  "gtk_separator_tool_item_new");
-
         fp_g_list_append = dl_symbol("g_list_append");
         fp_g_list_free = dl_symbol("g_list_free");
         fp_g_list_free_full = dl_symbol("g_list_free_full");
@@ -1362,6 +1374,90 @@
     return result;
 }
 
+static void append_element (GtkWidgetPath *path, const gchar *selector)
+{
+    fp_gtk_widget_path_append_type (path, G_TYPE_NONE);
+    fp_gtk_widget_path_iter_set_object_name (path, -1, selector);
+}
+
+static GtkWidgetPath* createWidgetPath(const GtkWidgetPath* path) {
+    if (path == NULL) {
+        return fp_gtk_widget_path_new();
+    } else {
+        return fp_gtk_widget_path_copy(path);
+    }
+}
+
+static GtkStyleContext* get_style(WidgetType widget_type, const gchar *detail)
+{
+    if (!gtk3_version_3_20) {
+        gtk3_widget = gtk3_get_widget(widget_type);
+        GtkStyleContext* context = fp_gtk_widget_get_style_context (gtk3_widget);
+        fp_gtk_style_context_save (context);
+        if (detail != 0) {
+             transform_detail_string(detail, context);
+        }
+        return context;
+    } else {
+        gtk3_widget = gtk3_get_widget(widget_type);
+        GtkStyleContext* widget_context = fp_gtk_widget_get_style_context (gtk3_widget);
+        GtkWidgetPath *path = NULL;
+        if (detail != 0) {
+            if (strcmp(detail, "checkbutton") == 0) {
+                path = createWidgetPath (fp_gtk_style_context_get_path (widget_context));
+                append_element(path, "check");
+            } else if (strcmp(detail, "radiobutton") == 0) {
+                path = createWidgetPath (fp_gtk_style_context_get_path (widget_context));
+                append_element(path, "radio");
+            } else if (strcmp(detail, "vscale") == 0 || strcmp(detail, "hscale") == 0) {
+                path = createWidgetPath (fp_gtk_style_context_get_path (widget_context));
+                append_element(path, "slider");
+            } else if (strcmp(detail, "trough") == 0) {
+                //This is a fast solution to the scrollbar trough not being rendered properly
+                if (widget_type == HSCROLL_BAR || widget_type == HSCROLL_BAR_TRACK ||
+                    widget_type == VSCROLL_BAR || widget_type == VSCROLL_BAR_TRACK) {
+                    path = createWidgetPath (NULL);
+                } else {
+                    path = createWidgetPath (fp_gtk_style_context_get_path (widget_context));
+                }
+                append_element(path, detail);
+            } else if (strcmp(detail, "bar") == 0) {
+                path = createWidgetPath (fp_gtk_style_context_get_path (widget_context));
+                append_element(path, "trough");
+                append_element(path, "progress");
+            } else if (strcmp(detail, "vscrollbar") == 0 || strcmp(detail, "hscrollbar") == 0) {
+                path = createWidgetPath (fp_gtk_style_context_get_path (widget_context));
+                append_element(path, "button");
+            } else if (strcmp(detail, "check") == 0) {
+                path = createWidgetPath (NULL);
+                append_element(path, detail);
+            } else if (strcmp(detail, "option") == 0) {
+                path = createWidgetPath (NULL);
+                append_element(path, "radio");
+            } else {
+                path = createWidgetPath (fp_gtk_style_context_get_path (widget_context));
+                append_element(path, detail);
+            }
+        } else {
+            path = createWidgetPath (fp_gtk_style_context_get_path (widget_context));
+        }
+
+        GtkStyleContext *context = fp_gtk_style_context_new ();
+        fp_gtk_style_context_set_path (context, path);
+        fp_gtk_widget_path_unref (path);
+        return context;
+    }
+}
+
+static void disposeOrRestoreContext(GtkStyleContext *context)
+{
+    if (!gtk3_version_3_20) {
+        fp_gtk_style_context_restore (context);
+    } else {
+        fp_g_object_unref (context);
+    }
+}
+
 static void gtk3_paint_arrow(WidgetType widget_type, GtkStateType state_type,
         GtkShadowType shadow_type, const gchar *detail,
         gint x, gint y, gint width, gint height,
@@ -1509,13 +1605,9 @@
      */
     gtk3_set_direction(gtk3_widget, dir);
 
-    GtkStyleContext* context = fp_gtk_widget_get_style_context (gtk3_widget);
-    fp_gtk_style_context_save (context);
-
-    transform_detail_string(detail, context);
+    GtkStyleContext* context = get_style(widget_type, detail);
 
     GtkStateFlags flags = get_gtk_flags(state_type);
-
     if (shadow_type == GTK_SHADOW_IN && widget_type != COMBO_BOX_ARROW_BUTTON) {
         flags |= GTK_STATE_FLAG_ACTIVE;
     }
@@ -1532,23 +1624,31 @@
         fp_gtk_style_context_add_class (context, "default");
     }
 
+    if (fp_gtk_style_context_has_class(context, "trough")) {
+        flags |= GTK_STATE_FLAG_BACKDROP;
+    }
+
     fp_gtk_style_context_set_state (context, flags);
 
-    if (fp_gtk_style_context_has_class(context, "progressbar")) {
-        fp_gtk_render_activity (context, cr, x, y, width, height);
-    } else {
-        fp_gtk_render_background (context, cr, x, y, width, height);
-        if (shadow_type != GTK_SHADOW_NONE) {
-            fp_gtk_render_frame(context, cr, x, y, width, height);
-        }
+    fp_gtk_render_background (context, cr, x, y, width, height);
+    if (shadow_type != GTK_SHADOW_NONE) {
+        fp_gtk_render_frame(context, cr, x, y, width, height);
     }
 
-    fp_gtk_style_context_restore (context);
+    disposeOrRestoreContext(context);
+
     /*
      * Reset the text direction to the default value so that we don't
      * accidentally affect other operations and widgets.
      */
     gtk3_set_direction(gtk3_widget, GTK_TEXT_DIR_LTR);
+
+    //This is a fast solution to the scrollbar trough not being rendered properly
+    if ((widget_type == HSCROLL_BAR || widget_type == HSCROLL_BAR_TRACK ||
+        widget_type == VSCROLL_BAR || widget_type == VSCROLL_BAR_TRACK) && detail != 0) {
+        gtk3_paint_box(widget_type, state_type, shadow_type, NULL,
+                    x, y, width, height, synth_state, dir);
+    }
 }
 
 static void gtk3_paint_box_gap(WidgetType widget_type, GtkStateType state_type,
@@ -1580,23 +1680,19 @@
 static void gtk3_paint_check(WidgetType widget_type, gint synth_state,
         const gchar *detail, gint x, gint y, gint width, gint height)
 {
-    gtk3_widget = gtk3_get_widget(widget_type);
-
-    GtkStyleContext* context = fp_gtk_widget_get_style_context (gtk3_widget);
-
-    fp_gtk_style_context_save (context);
+    GtkStyleContext* context = get_style(widget_type, detail);
 
     GtkStateFlags flags = get_gtk_state_flags(synth_state);
     if (gtk3_version_3_14 && (synth_state & SELECTED)) {
-        flags = GTK_STATE_FLAG_CHECKED;
+        flags &= ~GTK_STATE_FLAG_SELECTED;
+        flags |= GTK_STATE_FLAG_CHECKED;
     }
     fp_gtk_style_context_set_state(context, flags);
 
-    fp_gtk_style_context_add_class (context, "check");
-
-    fp_gtk_render_check (context, cr, x, y, width, height);
-
-    fp_gtk_style_context_restore (context);
+    fp_gtk_render_background(context, cr, x, y, width, height);
+    fp_gtk_render_frame(context, cr, x, y, width, height);
+    fp_gtk_render_check(context, cr, x, y, width, height);
+    disposeOrRestoreContext(context);
 }
 
 
@@ -1684,7 +1780,6 @@
     gtk3_widget = gtk3_get_widget(widget_type);
 
     GtkStyleContext* context = fp_gtk_widget_get_style_context (gtk3_widget);
-
     fp_gtk_style_context_save (context);
 
     if (detail != 0) {
@@ -1787,25 +1882,19 @@
 static void gtk3_paint_option(WidgetType widget_type, gint synth_state,
         const gchar *detail, gint x, gint y, gint width, gint height)
 {
-     gtk3_widget = gtk3_get_widget(widget_type);
-
-     GtkStyleContext* context = fp_gtk_widget_get_style_context (gtk3_widget);
-
-     fp_gtk_style_context_save (context);
+     GtkStyleContext* context = get_style(widget_type, detail);
 
      GtkStateFlags flags = get_gtk_state_flags(synth_state);
      if (gtk3_version_3_14 && (synth_state & SELECTED)) {
-         flags = GTK_STATE_FLAG_CHECKED;
+         flags &= ~GTK_STATE_FLAG_SELECTED;
+         flags |= GTK_STATE_FLAG_CHECKED;
      }
      fp_gtk_style_context_set_state(context, flags);
 
-     if (detail != 0) {
-         transform_detail_string(detail, context);
-     }
-
+     fp_gtk_render_background(context, cr, x, y, width, height);
+     fp_gtk_render_frame(context, cr, x, y, width, height);
      fp_gtk_render_option(context, cr, x, y, width, height);
-
-     fp_gtk_style_context_restore (context);
+     disposeOrRestoreContext(context);
 }
 
 static void gtk3_paint_shadow(WidgetType widget_type, GtkStateType state_type,
@@ -1864,15 +1953,7 @@
         gint x, gint y, gint width, gint height, GtkOrientation orientation,
         gboolean has_focus)
 {
-    gtk3_widget = gtk3_get_widget(widget_type);
-
-    GtkStyleContext* context = fp_gtk_widget_get_style_context (gtk3_widget);
-
-    fp_gtk_style_context_save (context);
-
-    if (detail) {
-       transform_detail_string(detail, context);
-    }
+    GtkStyleContext *context = get_style(widget_type, detail);
 
     GtkStateFlags flags = get_gtk_flags(state_type);
 
@@ -1886,9 +1967,10 @@
 
     fp_gtk_style_context_set_state (context, flags);
 
+    fp_gtk_render_background (context, cr, x, y, width, height);
+    fp_gtk_render_frame(context, cr, x, y, width, height);
     (*fp_gtk_render_slider)(context, cr, x, y, width, height, orientation);
-
-    fp_gtk_style_context_restore (context);
+    disposeOrRestoreContext(context);
 }
 
 static void gtk3_paint_background(WidgetType widget_type,
@@ -2278,6 +2360,11 @@
 
     init_containers();
 
+    if (widget_type == TEXT_FIELD && state_type == GTK_STATE_SELECTED &&
+        color_type == TEXT_BACKGROUND) {
+        widget_type = TEXT_AREA;
+    }
+
     gtk3_widget = gtk3_get_widget(widget_type);
 
     GtkStyleContext* context = fp_gtk_widget_get_style_context(gtk3_widget);
--- a/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.h	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.h	Thu Feb 21 22:08:53 2019 +0100
@@ -162,6 +162,7 @@
 typedef void GtkRange;
 typedef void GtkProgressBar;
 typedef void GtkProgress;
+typedef void GtkWidgetPath;
 
 /* Some real structures */
 typedef struct
@@ -238,7 +239,6 @@
   GType    owner_type;
 } GParamSpec;
 
-
 static gchar* (*fp_glib_check_version)(guint required_major,
                            guint required_minor, guint required_micro);
 
@@ -573,5 +573,18 @@
 static void (*fp_gtk_widget_size_request)(GtkWidget *widget,
                                           GtkRequisition *requisition);
 static GtkAdjustment* (*fp_gtk_range_get_adjustment)(GtkRange* range);
+static GtkWidgetPath* (*fp_gtk_widget_path_copy)
+        (const GtkWidgetPath *path);
+static const GtkWidgetPath* (*fp_gtk_style_context_get_path)
+        (GtkStyleContext *context);
+static GtkWidgetPath* (*fp_gtk_widget_path_new) (void);
+static gint (*fp_gtk_widget_path_append_type)
+        (GtkWidgetPath *path, GType type);
+static void (*fp_gtk_widget_path_iter_set_object_name)
+        (GtkWidgetPath *path, gint pos, const char *name);
+static void (*fp_gtk_style_context_set_path)
+        (GtkStyleContext *context, GtkWidgetPath *path);
+static void (*fp_gtk_widget_path_unref) (GtkWidgetPath *path);
+static GtkStyleContext* (*fp_gtk_style_context_new) (void);
 
 #endif /* !_GTK3_INTERFACE_H */
--- a/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,6 +65,7 @@
     private Locale currentLocale;
     // indicate whether status window is hidden or not.
     private boolean statusWindowHidden = false;
+    private boolean hasCompositionString = false;
 
     // attribute definition in Win32 (in IMM.H)
     public static final byte ATTR_INPUT                 = 0x00;
@@ -246,6 +247,7 @@
         } else if (locale.getLanguage().equals(Locale.KOREAN.getLanguage())) {
             if (subset1 == UnicodeBlock.BASIC_LATIN || subset1 == InputSubset.LATIN_DIGITS) {
                 setOpenStatus(context, false);
+                setConversionStatus(context, IME_CMODE_ALPHANUMERIC);
             } else {
                 if (subset1 == UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS
                     || subset1 == InputSubset.HANJA
@@ -263,11 +265,14 @@
         } else if (locale.getLanguage().equals(Locale.CHINESE.getLanguage())) {
             if (subset1 == UnicodeBlock.BASIC_LATIN || subset1 == InputSubset.LATIN_DIGITS) {
                 setOpenStatus(context, false);
+                newmode = getConversionStatus(context);
+                newmode &= ~IME_CMODE_FULLSHAPE;
+                setConversionStatus(context, newmode);
             } else {
                 if (subset1 == UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS
                     || subset1 == InputSubset.TRADITIONAL_HANZI
                     || subset1 == InputSubset.SIMPLIFIED_HANZI)
-                    newmode = IME_CMODE_NATIVE;
+                    newmode = IME_CMODE_NATIVE | IME_CMODE_FULLSHAPE;
                 else if (subset1 == InputSubset.FULLWIDTH_LATIN)
                     newmode = IME_CMODE_FULLSHAPE;
                 else
@@ -318,6 +323,15 @@
             setLocale(currentLocale, true);
         }
 
+        // Compare IM's composition string with Java's composition string
+        if (hasCompositionString && !isCompositionStringAvailable(context)) {
+            endCompositionNative(context, DISCARD_INPUT);
+            sendInputMethodEvent(InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
+                EventQueue.getMostRecentEventTime(),
+                null, null, null, null, null, 0, 0, 0);
+            hasCompositionString = false;
+        }
+
         /* If the status window or Windows language bar is turned off due to
            native input method was switched to java input method, we
            have to turn it on otherwise it is gone for good until next time
@@ -345,6 +359,7 @@
             isLastFocussedActiveClient = haveActiveClient();
         }
         isActive = false;
+        hasCompositionString = isCompositionStringAvailable(context);
     }
 
     /**
@@ -649,4 +664,5 @@
     static native Locale getNativeLocale();
     static native boolean setNativeLocale(String localeName, boolean onActivate);
     private native void openCandidateWindow(WComponentPeer peer, int x, int y);
+    private native boolean isCompositionStringAvailable(int context);
 }
--- a/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -3869,6 +3869,11 @@
         return;
     }
     COMPOSITIONFORM cf = {CFS_DEFAULT, {0, 0}, {0, 0, 0, 0}};
+    LOGFONT lf;
+    HFONT hFont = (HFONT) GetStockObject(DEFAULT_GUI_FONT);
+    if (GetObject(hFont, sizeof(lf), (LPVOID)&lf) == sizeof(lf)) {
+        ImmSetCompositionFont(hIMC, &lf);
+    }
     ImmSetCompositionWindow(hIMC, &cf);
     ImmReleaseContext(hwnd, hIMC);
 }
--- a/src/java.desktop/windows/native/libawt/windows/awt_InputMethod.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.desktop/windows/native/libawt/windows/awt_InputMethod.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -528,6 +528,23 @@
     CATCH_BAD_ALLOC_RET(NULL);
 }
 
+/*
+ * Class:     sun_awt_windows_WInputMethod
+ * Method:    isCompositionStringAvailable
+ * Signature: (I)Z
+ */
+JNIEXPORT jboolean JNICALL Java_sun_awt_windows_WInputMethod_isCompositionStringAvailable
+  (JNIEnv *env, jobject self, jint context)
+{
+    LONG length;
+    length = ImmGetCompositionString((HIMC)IntToPtr(context), GCS_COMPSTR, NULL, 0);
+    if (length > 0) {
+        return JNI_TRUE;
+    } else {
+        return JNI_FALSE;
+    }
+}
+
 /**
  * Class:     sun_awt_windows_WInputMethod
  * Method:    getNativeIMMDescription
--- a/src/java.logging/share/classes/java/util/logging/Handler.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.logging/share/classes/java/util/logging/Handler.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -329,12 +329,13 @@
      * handler from logging the {@code LogRecord}. It will return false if
      * the {@code LogRecord} is null.
      *
-     * @param record  a {@code LogRecord}
+     * @param record  a {@code LogRecord} (may be null).
      * @return true if the {@code LogRecord} would be logged.
      *
      */
     public boolean isLoggable(LogRecord record) {
         final int levelValue = getLevel().intValue();
+        if (record == null) return false;
         if (record.getLevel().intValue() < levelValue || levelValue == offValue) {
             return false;
         }
--- a/src/java.logging/share/classes/java/util/logging/MemoryHandler.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.logging/share/classes/java/util/logging/MemoryHandler.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -270,7 +270,7 @@
      * check whether the {@code LogRecord} would result in a "push" of the
      * buffer contents. It will return false if the {@code LogRecord} is null.
      *
-     * @param record  a {@code LogRecord}
+     * @param record  a {@code LogRecord} (may be null).
      * @return true if the {@code LogRecord} would be logged.
      *
      */
--- a/src/java.logging/share/classes/java/util/logging/StreamHandler.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.logging/share/classes/java/util/logging/StreamHandler.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -225,7 +225,7 @@
      * whether it satisfies any {@code Filter}.  It will also return false if
      * no output stream has been assigned yet or the LogRecord is null.
      *
-     * @param record  a {@code LogRecord}
+     * @param record  a {@code LogRecord} (may be null).
      * @return true if the {@code LogRecord} would be logged.
      *
      */
--- a/src/java.rmi/share/classes/java/rmi/server/RMIFailureHandler.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/java.rmi/share/classes/java/rmi/server/RMIFailureHandler.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,13 +26,13 @@
 package java.rmi.server;
 
 /**
- * An <code>RMIFailureHandler</code> can be registered via the
- * <code>RMISocketFactory.setFailureHandler</code> call. The
- * <code>failure</code> method of the handler is invoked when the RMI
- * runtime is unable to create a <code>ServerSocket</code> to listen
- * for incoming calls. The <code>failure</code> method returns a boolean
+ * An {@code RMIFailureHandler} can be registered via the
+ * {@code RMISocketFactory.setFailureHandler} call. The
+ * {@code failure} method of the handler is invoked when the RMI
+ * runtime is unable to create a {@code ServerSocket} to listen
+ * for incoming calls. The {@code failure} method returns a boolean
  * indicating whether the runtime should attempt to re-create the
- * <code>ServerSocket</code>.
+ * {@code ServerSocket}.
  *
  * @author      Ann Wollrath
  * @since       1.1
@@ -40,18 +40,18 @@
 public interface RMIFailureHandler {
 
     /**
-     * The <code>failure</code> callback is invoked when the RMI
-     * runtime is unable to create a <code>ServerSocket</code> via the
-     * <code>RMISocketFactory</code>. An <code>RMIFailureHandler</code>
+     * The {@code failure} callback is invoked when the RMI
+     * runtime is unable to create a {@code ServerSocket} via the
+     * {@code RMISocketFactory}. An {@code RMIFailureHandler}
      * is registered via a call to
-     * <code>RMISocketFacotry.setFailureHandler</code>.  If no failure
+     * {@code RMISocketFactory.setFailureHandler}.  If no failure
      * handler is installed, the default behavior is to attempt to
      * re-create the ServerSocket.
      *
-     * @param ex the exception that occurred during <code>ServerSocket</code>
+     * @param ex the exception that occurred during {@code ServerSocket}
      *           creation
      * @return if true, the RMI runtime attempts to retry
-     * <code>ServerSocket</code> creation
+     * {@code ServerSocket} creation
      * @see java.rmi.server.RMISocketFactory#setFailureHandler(RMIFailureHandler)
      * @since 1.1
      */
--- a/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2015, 2018, SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -138,7 +138,7 @@
      * Execute the given command in the target VM.
      */
     InputStream execute(String cmd, Object ... args) throws AgentLoadException, IOException {
-        assert args.length <= 3;                // includes null
+        assert args.length <= 4;                // includes null
 
         // did we detach?
         synchronized (this) {
@@ -166,7 +166,7 @@
             writeString(s, PROTOCOL_VERSION);
             writeString(s, cmd);
 
-            for (int i=0; i<3; i++) {
+            for (int i = 0; i < 4; i++) {
                 if (i < args.length && args[i] != null) {
                     writeString(s, (String)args[i]);
                 } else {
--- a/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -143,7 +143,7 @@
      * Execute the given command in the target VM.
      */
     InputStream execute(String cmd, Object ... args) throws AgentLoadException, IOException {
-        assert args.length <= 3;                // includes null
+        assert args.length <= 4;                // includes null
 
         // did we detach?
         synchronized (this) {
@@ -171,7 +171,7 @@
             writeString(s, PROTOCOL_VERSION);
             writeString(s, cmd);
 
-            for (int i=0; i<3; i++) {
+            for (int i = 0; i < 4; i++) {
                 if (i < args.length && args[i] != null) {
                     writeString(s, (String)args[i]);
                 } else {
--- a/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -139,7 +139,7 @@
      * Execute the given command in the target VM.
      */
     InputStream execute(String cmd, Object ... args) throws AgentLoadException, IOException {
-        assert args.length <= 3;                // includes null
+        assert args.length <= 4;                // includes null
 
         // did we detach?
         synchronized (this) {
@@ -167,7 +167,7 @@
             writeString(s, PROTOCOL_VERSION);
             writeString(s, cmd);
 
-            for (int i=0; i<3; i++) {
+            for (int i = 0; i < 4; i++) {
                 if (i < args.length && args[i] != null) {
                     writeString(s, (String)args[i]);
                 } else {
--- a/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -126,7 +126,7 @@
      * Execute the given command in the target VM.
      */
     InputStream execute(String cmd, Object ... args) throws AgentLoadException, IOException {
-        assert args.length <= 3;                // includes null
+        assert args.length <= 4;                // includes null
 
         // first check that we are still attached
         int door;
--- a/src/jdk.attach/windows/classes/sun/tools/attach/VirtualMachineImpl.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.attach/windows/classes/sun/tools/attach/VirtualMachineImpl.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -77,7 +77,7 @@
     InputStream execute(String cmd, Object ... args)
         throws AgentLoadException, IOException
     {
-        assert args.length <= 3;        // includes null
+        assert args.length <= 4;        // includes null
 
         // create a pipe using a random name
         Random rnd = new Random();
--- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -106,7 +106,7 @@
     static {
         PrivilegedAction<String> getKeyExtractionProp =
                 () -> System.getProperty(
-                        "sun.security.pkcs11.disableKeyExtraction", "true");
+                        "sun.security.pkcs11.disableKeyExtraction", "false");
         String disableKeyExtraction =
                 AccessController.doPrivileged(getKeyExtractionProp);
         DISABLE_NATIVE_KEYS_EXTRACTION =
--- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_keymgmt.c	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_keymgmt.c	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 
 /* Copyright  (c) 2002 Graz University of Technology. All rights reserved.
@@ -151,14 +151,14 @@
     unsigned int i = 0U;
     unsigned long totalDataSize = 0UL, attributesCount = 0UL;
     unsigned long totalCkAttributesSize = 0UL, totalNativeKeyInfoArraySize = 0UL;
-    unsigned long* wrappedKeySizePtr = NULL;
+    jbyte* wrappedKeySizePtr = NULL;
     jbyte* nativeKeyInfoArrayRawCkAttributes = NULL;
     jbyte* nativeKeyInfoArrayRawCkAttributesPtr = NULL;
     jbyte* nativeKeyInfoArrayRawDataPtr = NULL;
     CK_MECHANISM ckMechanism;
     char iv[16] = {0x0};
     CK_ULONG ckWrappedKeyLength = 0U;
-    unsigned long* wrappedKeySizeWrappedKeyArrayPtr = NULL;
+    jbyte* wrappedKeySizeWrappedKeyArrayPtr = NULL;
     CK_BYTE_PTR wrappedKeyBufferPtr = NULL;
     CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj);
     CK_OBJECT_CLASS class;
@@ -234,7 +234,7 @@
     //     * sizes are expressed in bytes and data type is unsigned long
     totalCkAttributesSize = attributesCount * sizeof(CK_ATTRIBUTE);
     TRACE1("DEBUG: GetNativeKeyInfo attributesCount = %lu\n", attributesCount);
-    TRACE1("DEBUG: GetNativeKeyInfo sizeof CK_ATTRIBUTE = %lu\n", sizeof(CK_ATTRIBUTE));
+    TRACE1("DEBUG: GetNativeKeyInfo sizeof CK_ATTRIBUTE = %zu\n", sizeof(CK_ATTRIBUTE));
     TRACE1("DEBUG: GetNativeKeyInfo totalCkAttributesSize = %lu\n", totalCkAttributesSize);
     TRACE1("DEBUG: GetNativeKeyInfo totalDataSize = %lu\n", totalDataSize);
 
@@ -254,8 +254,8 @@
         goto cleanup;
     }
 
-    wrappedKeySizePtr = (unsigned long*)(nativeKeyInfoArrayRaw +
-            sizeof(unsigned long)*2 + totalCkAttributesSize + totalDataSize);
+    wrappedKeySizePtr = nativeKeyInfoArrayRaw +
+            sizeof(unsigned long)*2 + totalCkAttributesSize + totalDataSize;
     memcpy(nativeKeyInfoArrayRaw, &totalCkAttributesSize, sizeof(unsigned long));
 
     memcpy(nativeKeyInfoArrayRaw + sizeof(unsigned long) + totalCkAttributesSize,
@@ -330,15 +330,15 @@
                 memcpy(nativeKeyInfoWrappedKeyArrayRaw, nativeKeyInfoArrayRaw,
                         totalNativeKeyInfoArraySize);
                 wrappedKeySizeWrappedKeyArrayPtr =
-                        (unsigned long*)(nativeKeyInfoWrappedKeyArrayRaw +
+                        nativeKeyInfoWrappedKeyArrayRaw +
                         sizeof(unsigned long)*2 + totalCkAttributesSize +
-                        totalDataSize);
+                        totalDataSize;
                 memcpy(wrappedKeySizeWrappedKeyArrayPtr, &ckWrappedKeyLength, sizeof(unsigned long));
                 TRACE1("DEBUG: GetNativeKeyInfo 1st C_WrapKey wrappedKeyLength = %lu\n", ckWrappedKeyLength);
 
                 wrappedKeyBufferPtr =
-                        (unsigned char*)wrappedKeySizeWrappedKeyArrayPtr +
-                        sizeof(unsigned long);
+                        (CK_BYTE_PTR) (wrappedKeySizeWrappedKeyArrayPtr +
+                        sizeof(unsigned long));
                 rv = (*ckpFunctions->C_WrapKey)(ckSessionHandle, &ckMechanism,
                         jLongToCKULong(jWrappingKeyHandle),ckObjectHandle,
                         wrappedKeyBufferPtr, &ckWrappedKeyLength);
@@ -414,7 +414,7 @@
     jbyte* nativeKeyInfoArrayRawCkAttributesPtr = NULL;
     jbyte* nativeKeyInfoArrayRawDataPtr = NULL;
     unsigned long totalDataSize = 0UL;
-    unsigned long* wrappedKeySizePtr = NULL;
+    jbyte* wrappedKeySizePtr = NULL;
     unsigned int i = 0U;
     CK_MECHANISM ckMechanism;
     char iv[16] = {0x0};
@@ -443,8 +443,8 @@
             sizeof(unsigned long));
     TRACE1("DEBUG: createNativeKey totalDataSize = %lu\n", totalDataSize);
 
-    wrappedKeySizePtr = (unsigned long*)(nativeKeyInfoArrayRaw +
-            sizeof(unsigned long)*2 + totalCkAttributesSize + totalDataSize);
+    wrappedKeySizePtr = nativeKeyInfoArrayRaw +
+            sizeof(unsigned long)*2 + totalCkAttributesSize + totalDataSize;
 
     memcpy(&ckWrappedKeyLength, wrappedKeySizePtr, sizeof(unsigned long));
     TRACE1("DEBUG: createNativeKey wrappedKeyLength = %lu\n", ckWrappedKeyLength);
@@ -470,7 +470,8 @@
         jMechanismToCKMechanism(env, jWrappingMech, &ckMechanism);
         rv = (*ckpFunctions->C_UnwrapKey)(ckSessionHandle, &ckMechanism,
                 jLongToCKULong(jWrappingKeyHandle),
-                (CK_BYTE_PTR)(wrappedKeySizePtr + 1), ckWrappedKeyLength,
+                (CK_BYTE_PTR)(wrappedKeySizePtr + sizeof(unsigned long)),
+                ckWrappedKeyLength,
                 (CK_ATTRIBUTE_PTR)nativeKeyInfoArrayRawCkAttributes,
                 jLongToCKULong(nativeKeyInfoCkAttributesCount),
                 &ckObjectHandle);
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/classfile/ClassLoaderData.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/classfile/ClassLoaderData.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,6 @@
 
 package sun.jvm.hotspot.classfile;
 
-import java.io.PrintStream;
 import sun.jvm.hotspot.debugger.*;
 import sun.jvm.hotspot.memory.*;
 import sun.jvm.hotspot.runtime.*;
@@ -42,14 +41,14 @@
 
   private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
     Type type      = db.lookupType("ClassLoaderData");
-    classLoaderField = type.getAddressField("_class_loader");
+    classLoaderFieldOffset = type.getAddressField("_class_loader").getOffset();
     nextField = type.getAddressField("_next");
     klassesField = new MetadataField(type.getAddressField("_klasses"), 0);
     isUnsafeAnonymousField = new CIntField(type.getCIntegerField("_is_unsafe_anonymous"), 0);
     dictionaryField = type.getAddressField("_dictionary");
   }
 
-  private static AddressField   classLoaderField;
+  private static long classLoaderFieldOffset;
   private static AddressField nextField;
   private static MetadataField  klassesField;
   private static CIntField isUnsafeAnonymousField;
@@ -72,13 +71,9 @@
   }
 
   public Oop getClassLoader() {
-    Address handle = classLoaderField.getValue(getAddress());
-    if (handle != null) {
-      // Load through the handle
-      OopHandle refs = handle.getOopHandleAt(0);
-      return (Instance)VM.getVM().getObjectHeap().newOop(refs);
-    }
-    return null;
+    Address addr = getAddress().addOffsetTo(classLoaderFieldOffset);
+    VMOopHandle vmOopHandle = VMObjectFactory.newObject(VMOopHandle.class, addr);
+    return vmOopHandle.resolve();
   }
 
   public boolean getisUnsafeAnonymous() {
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/cms/CompactibleFreeListSpace.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/cms/CompactibleFreeListSpace.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,7 @@
 import sun.jvm.hotspot.types.*;
 import sun.jvm.hotspot.utilities.*;
 
-public class CompactibleFreeListSpace extends CompactibleSpace {
+public class CompactibleFreeListSpace extends CompactibleSpace implements LiveRegionsProvider {
    private static AddressField collectorField;
    private static AddressField indexedFreeListField;
    private static AddressField dictionaryField;
@@ -93,10 +93,10 @@
    }
 
    public long used0() {
-      List regions = getLiveRegions();
+      List<MemRegion> regions = getLiveRegions();
       long usedSize = 0L;
-      for (Iterator itr = regions.iterator(); itr.hasNext();) {
-         MemRegion mr = (MemRegion) itr.next();
+      for (Iterator<MemRegion> itr = regions.iterator(); itr.hasNext();) {
+         MemRegion mr = itr.next();
          usedSize += mr.byteSize();
       }
       return usedSize;
@@ -154,8 +154,9 @@
        return addr;
    }
 
-   public List/*<MemRegion>*/ getLiveRegions() {
-      List res = new ArrayList(); // List<MemRegion>
+  @Override
+   public List<MemRegion> getLiveRegions() {
+      List<MemRegion> res = new ArrayList<>();
       VM vm = VM.getVM();
       Debugger dbg = vm.getDebugger();
       ObjectHeap heap = vm.getObjectHeap();
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/cms/ConcurrentMarkSweepGeneration.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/cms/ConcurrentMarkSweepGeneration.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,6 +66,9 @@
   public void spaceIterate(SpaceClosure blk, boolean usedOnly) {
      blk.doSpace(cmsSpace());
   }
+  public void liveRegionsIterate(LiveRegionsClosure closure) {
+      closure.doLiveRegions(cmsSpace());
+  }
 
   public Generation.Name kind() {
     return Generation.Name.CONCURRENT_MARK_SWEEP;
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/epsilon/EpsilonHeap.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/epsilon/EpsilonHeap.java	Thu Feb 21 22:08:53 2019 +0100
@@ -66,11 +66,26 @@
     return CollectedHeapName.EPSILON;
   }
 
+  @Override
+  public long capacity() {
+    return space.capacity();
+  }
+
+  @Override
+  public long used() {
+    return space.used();
+  }
+
   public ContiguousSpace space() {
     return space;
   }
 
   @Override
+  public void liveRegionsIterate(LiveRegionsClosure closure) {
+    closure.doLiveRegions(space());
+  }
+
+  @Override
   public void printOn(PrintStream tty) {
      MemRegion mr = reservedRegion();
      tty.println("Epsilon heap");
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/G1CollectedHeap.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/G1CollectedHeap.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,8 +32,9 @@
 import sun.jvm.hotspot.debugger.Address;
 import sun.jvm.hotspot.gc.shared.CollectedHeap;
 import sun.jvm.hotspot.gc.shared.CollectedHeapName;
+import sun.jvm.hotspot.gc.shared.LiveRegionsClosure;
+import sun.jvm.hotspot.gc.shared.PrintRegionClosure;
 import sun.jvm.hotspot.gc.shared.SpaceClosure;
-import sun.jvm.hotspot.gc.shared.PrintRegionClosure;
 import sun.jvm.hotspot.memory.MemRegion;
 import sun.jvm.hotspot.runtime.VM;
 import sun.jvm.hotspot.runtime.VMObjectFactory;
@@ -138,6 +139,15 @@
     }
 
     @Override
+    public void liveRegionsIterate(LiveRegionsClosure closure) {
+        Iterator<HeapRegion> iter = heapRegionIterator();
+        while (iter.hasNext()) {
+            HeapRegion hr = iter.next();
+            closure.doLiveRegions(hr);
+        }
+    }
+
+    @Override
     public void printOn(PrintStream tty) {
         MemRegion mr = reservedRegion();
 
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/HeapRegion.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/HeapRegion.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@
 import sun.jvm.hotspot.debugger.Address;
 import sun.jvm.hotspot.debugger.OopHandle;
 import sun.jvm.hotspot.gc.shared.CompactibleSpace;
+import sun.jvm.hotspot.gc.shared.LiveRegionsProvider;
 import sun.jvm.hotspot.memory.MemRegion;
 import sun.jvm.hotspot.runtime.VM;
 import sun.jvm.hotspot.runtime.VMObjectFactory;
@@ -43,7 +44,7 @@
 // Mirror class for HeapRegion. Currently we don't actually include
 // any of its fields but only iterate over it.
 
-public class HeapRegion extends CompactibleSpace {
+public class HeapRegion extends CompactibleSpace implements LiveRegionsProvider {
     // static int GrainBytes;
     static private CIntegerField grainBytesField;
     static private AddressField topField;
@@ -86,8 +87,8 @@
     }
 
     @Override
-    public List getLiveRegions() {
-        List res = new ArrayList();
+    public List<MemRegion> getLiveRegions() {
+        List<MemRegion> res = new ArrayList<>();
         res.add(new MemRegion(bottom(), top()));
         return res;
     }
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/ImmutableSpace.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/ImmutableSpace.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -73,7 +73,7 @@
    }
 
    /** returns all MemRegions where live objects are */
-   public abstract List/*<MemRegion>*/ getLiveRegions();
+   public abstract List<MemRegion> getLiveRegions();
 
    /** Returned value is in bytes */
    public long capacity() { return end().minus(bottom()); }
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/MutableSpace.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/MutableSpace.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -62,8 +62,8 @@
    }
 
    /** returns all MemRegions where live objects are */
-   public List/*<MemRegion>*/ getLiveRegions() {
-      List res = new ArrayList();
+   public List<MemRegion> getLiveRegions() {
+      List<MemRegion> res = new ArrayList<>();
       res.add(new MemRegion(bottom(), top()));
       return res;
    }
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/ParallelScavengeHeap.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/ParallelScavengeHeap.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
 
 import sun.jvm.hotspot.debugger.*;
 import sun.jvm.hotspot.gc.shared.*;
+import sun.jvm.hotspot.memory.MemRegion;
 import sun.jvm.hotspot.runtime.*;
 import sun.jvm.hotspot.types.*;
 
@@ -88,6 +89,35 @@
       return CollectedHeapName.PARALLEL;
    }
 
+   // Simple wrapper to provide toString() usable for debugging.
+   private class LiveRegionProviderImpl implements LiveRegionsProvider {
+      private String name;
+      private MutableSpace space;
+
+      public LiveRegionProviderImpl(String name, MutableSpace space) {
+         this.name = name;
+         this.space = space;
+      }
+
+      @Override
+      public List<MemRegion> getLiveRegions() {
+         return space.getLiveRegions();
+      }
+      @Override
+      public String toString() {
+         return name;
+      }
+   }
+
+   public void liveRegionsIterate(LiveRegionsClosure closure) {
+      // Add eden space
+      closure.doLiveRegions(new LiveRegionProviderImpl("eden", youngGen().edenSpace()));
+      // Add from-space but not to-space
+      closure.doLiveRegions(new LiveRegionProviderImpl("from", youngGen().fromSpace()));
+
+      closure.doLiveRegions(new LiveRegionProviderImpl("old ", oldGen().objectSpace()));
+   }
+
    public void printOn(PrintStream tty) {
       tty.print("ParallelScavengeHeap [ ");
       youngGen().printOn(tty);
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/DefNewGeneration.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/DefNewGeneration.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -94,6 +94,11 @@
     }
   }
 
+  public void liveRegionsIterate(LiveRegionsClosure closure) {
+    closure.doLiveRegions(eden());
+    closure.doLiveRegions(from());
+  }
+
   public void printOn(PrintStream tty) {
     tty.print("  eden");
     eden().printOn(tty);
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/TenuredGeneration.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/TenuredGeneration.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,6 +76,10 @@
     blk.doSpace(theSpace());
   }
 
+  public void liveRegionsIterate(LiveRegionsClosure closure) {
+    closure.doLiveRegions(theSpace());
+  }
+
   public void printOn(PrintStream tty) {
     tty.print("  old ");
     theSpace().printOn(tty);
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeap.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeap.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,9 +28,12 @@
 import java.util.*;
 
 import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.gc.shared.*;
 import sun.jvm.hotspot.memory.*;
 import sun.jvm.hotspot.runtime.*;
 import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.BitMapInterface;
+import sun.jvm.hotspot.utilities.BitMapSegmented;
 
 public abstract class CollectedHeap extends VMObject {
   private static long         reservedFieldOffset;
@@ -58,8 +61,8 @@
     return reservedRegion().start();
   }
 
-  public long capacity() { return 0; }
-  public long used()     { return 0; }
+  public abstract long capacity();
+  public abstract long used();
 
   public MemRegion reservedRegion() {
     return new MemRegion(addr.addOffsetTo(reservedFieldOffset));
@@ -75,6 +78,8 @@
 
   public abstract CollectedHeapName kind();
 
+  public abstract void liveRegionsIterate(LiveRegionsClosure closure);
+
   public String oopAddressDescription(OopHandle handle) {
       return handle.toString();
   }
@@ -83,10 +88,18 @@
       return handle.getOopHandleAt(offset);
   }
 
+  public OopHandle oop_load_in_native(Address addr) {
+      return addr.getOopHandleAt(0);
+  }
+
   public void print() { printOn(System.out); }
   public void printOn(PrintStream tty) {
     MemRegion mr = reservedRegion();
     tty.println("unknown subtype of CollectedHeap @ " + getAddress() + " (" +
                 mr.start() + "," + mr.end() + ")");
   }
+
+  public BitMapInterface createBitMap(long bits) {
+    return new BitMapSegmented(bits);
+  }
 }
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/ContiguousSpace.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/ContiguousSpace.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
 import sun.jvm.hotspot.runtime.*;
 import sun.jvm.hotspot.types.*;
 
-public class ContiguousSpace extends CompactibleSpace {
+public class ContiguousSpace extends CompactibleSpace implements LiveRegionsProvider {
   private static AddressField topField;
 
   static {
@@ -79,8 +79,8 @@
   }
 
   /** Returns regions of Space where live objects live */
-  public List/*<MemRegion>*/ getLiveRegions() {
-    List res = new ArrayList();
+  public List<MemRegion> getLiveRegions() {
+    List<MemRegion> res = new ArrayList<>();
     res.add(new MemRegion(bottom(), top()));
     return res;
   }
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GenCollectedHeap.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GenCollectedHeap.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 import java.util.*;
 
 import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.gc.shared.*;
 import sun.jvm.hotspot.runtime.*;
 import sun.jvm.hotspot.types.*;
 import sun.jvm.hotspot.utilities.*;
@@ -134,6 +135,14 @@
     }
   }
 
+  public void liveRegionsIterate(LiveRegionsClosure closure) {
+    // Run through all generations, obtaining bottom-top pairs.
+    for (int i = 0; i < nGens(); i++) {
+      Generation gen = getGen(i);
+      gen.liveRegionsIterate(closure);
+    }
+  }
+
   public void printOn(PrintStream tty) {
     for (int i = 0; i < nGens(); i++) {
       tty.print("Gen " + i + ": ");
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Generation.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Generation.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -184,6 +184,7 @@
 
   /** Iteration - do not use for time critical operations */
   public abstract void spaceIterate(SpaceClosure blk, boolean usedOnly);
+  public abstract void liveRegionsIterate(LiveRegionsClosure closure);
 
   public void print() { printOn(System.out); }
   public abstract void printOn(PrintStream tty);
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GenerationFactory.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GenerationFactory.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,6 +65,8 @@
                   }
                   public void spaceIterate(SpaceClosure blk, boolean usedOnly) {
                   }
+                  public void liveRegionsIterate(LiveRegionsClosure closure) {
+                  }
                   public void printOn(java.io.PrintStream tty) {
                       tty.println("unknown subtype of Generation @ " + getAddress() + " (" +
                                   virtualSpace().low() + "," + virtualSpace().high() + ")");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/LiveRegionsClosure.java	Thu Feb 21 22:08:53 2019 +0100
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.gc.shared;
+
+public interface LiveRegionsClosure {
+  public void doLiveRegions(LiveRegionsProvider lrp);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/LiveRegionsProvider.java	Thu Feb 21 22:08:53 2019 +0100
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.gc.shared;
+
+import java.util.List;
+
+import sun.jvm.hotspot.memory.MemRegion;
+
+public interface LiveRegionsProvider {
+  public List<MemRegion> getLiveRegions();
+}
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Space.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Space.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -89,9 +89,6 @@
     return handle.addOffsetToAsOopHandle(size);
   }
 
-  /** returns all MemRegions where live objects are */
-  public abstract List/*<MemRegion>*/ getLiveRegions();
-
   /** Returned value is in bytes */
   public long capacity() { return end().minus(bottom()); }
   /** Returned value is in bytes */
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shenandoah/ShenandoahHeap.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shenandoah/ShenandoahHeap.java	Thu Feb 21 22:08:53 2019 +0100
@@ -25,6 +25,7 @@
 
 import sun.jvm.hotspot.gc.shared.CollectedHeap;
 import sun.jvm.hotspot.gc.shared.CollectedHeapName;
+import sun.jvm.hotspot.gc.shared.LiveRegionsClosure;
 import sun.jvm.hotspot.debugger.Address;
 import sun.jvm.hotspot.runtime.VM;
 import sun.jvm.hotspot.types.Type;
@@ -64,6 +65,11 @@
     }
 
     @Override
+    public long capacity() {
+        return numOfRegions() * ShenandoahHeapRegion.regionSizeBytes();
+    }
+
+    @Override
     public long used() {
         return used.getValue(addr);
     }
@@ -73,6 +79,12 @@
     }
 
     @Override
+    public void liveRegionsIterate(LiveRegionsClosure closure) {
+        // Operation (currently) not supported with Shenandoah GC.
+        System.err.println("Warning: Operation not supported with Shenandoah GC");
+    }
+
+    @Override
     public void printOn(PrintStream tty) {
         MemRegion mr = reservedRegion();
         tty.print("Shenandoah heap");
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZAddress.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZAddress.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,7 +61,7 @@
             value |= ZGlobals.ZAddressSpaceStart;
         }
 
-        return ZOop.to_address(value);
+        return ZUtils.longToAddress(value);
     }
 
     static Address good(Address value) {
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZAddressRangeMapForPageTable.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZAddressRangeMapForPageTable.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,15 +54,38 @@
         return mapField.getValue(addr);
     }
 
+    public long size() {
+        return ZGlobals.ZAddressOffsetMax >> AddressRangeShift;
+    }
+
     private long index_for_addr(Address addr) {
         long index = ZAddress.offset(addr) >> AddressRangeShift;
 
         return index;
     }
 
+    Address at(long index) {
+        return map().getAddressAt(index * VM.getVM().getBytesPerLong());
+    }
+
     Address get(Address addr) {
         long index = index_for_addr(addr);
+        return at(index);
+    }
 
-        return map().getAddressAt(index * VM.getVM().getBytesPerLong());
+    public class Iterator {
+        private long next = 0;
+
+        boolean hasNext() {
+            return next < size();
+        }
+
+        Address next() {
+            if (next >= size()) {
+                throw new RuntimeException("OOIBE");
+            }
+
+            return at(next++);
+        }
     }
 }
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,20 +25,22 @@
 package sun.jvm.hotspot.gc.z;
 
 import java.io.PrintStream;
+import java.util.Iterator;
 
 import sun.jvm.hotspot.debugger.Address;
 import sun.jvm.hotspot.debugger.OopHandle;
 import sun.jvm.hotspot.gc.shared.CollectedHeap;
 import sun.jvm.hotspot.gc.shared.CollectedHeapName;
+import sun.jvm.hotspot.gc.shared.LiveRegionsClosure;
 import sun.jvm.hotspot.runtime.VM;
 import sun.jvm.hotspot.runtime.VMObjectFactory;
 import sun.jvm.hotspot.types.Type;
 import sun.jvm.hotspot.types.TypeDataBase;
+import sun.jvm.hotspot.utilities.BitMapInterface;
 
 // Mirror class for ZCollectedHeap.
 
 public class ZCollectedHeap extends CollectedHeap {
-
     private static long zHeapFieldOffset;
 
     static {
@@ -70,11 +72,19 @@
         super(addr);
     }
 
-    public OopHandle oop_load_at(OopHandle handle, long offset) {
-        assert(!VM.getVM().isCompressedOopsEnabled());
+    @Override
+    public long capacity() {
+        return heap().capacity();
+    }
 
-        Address oopAddress = handle.getAddressAt(offset);
+    @Override
+    public long used() {
+        return heap().used();
+    }
 
+
+
+    private OopHandle oop_load_barrier(Address oopAddress) {
         oopAddress = ZBarrier.weak_barrier(oopAddress);
         if (oopAddress == null) {
             return null;
@@ -83,6 +93,23 @@
         return oopAddress.addOffsetToAsOopHandle(0);
     }
 
+    @Override
+    public OopHandle oop_load_at(OopHandle handle, long offset) {
+        assert(!VM.getVM().isCompressedOopsEnabled());
+
+        Address oopAddress = handle.getAddressAt(offset);
+
+        return oop_load_barrier(oopAddress);
+    }
+
+    // addr can be either in heap or in native
+    @Override
+    public OopHandle oop_load_in_native(Address addr) {
+        Address oopAddress = addr.getAddressAt(0);
+
+        return oop_load_barrier(oopAddress);
+    }
+
     public String oopAddressDescription(OopHandle handle) {
         Address origOop = ZOop.to_address(handle);
         Address loadBarrieredOop = ZBarrier.weak_barrier(origOop);
@@ -92,4 +119,19 @@
             return handle.toString();
         }
     }
+
+    @Override
+    public void liveRegionsIterate(LiveRegionsClosure closure) {
+        Iterator<ZPage> iter = heap().pageTable().activePagesIterator();
+        while (iter.hasNext()) {
+            ZPage page = iter.next();
+            closure.doLiveRegions(page);
+        }
+    }
+
+    @Override
+    public BitMapInterface createBitMap(long size) {
+        // Ignores the size
+        return new ZExternalBitMap(this);
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZExternalBitMap.java	Thu Feb 21 22:08:53 2019 +0100
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.gc.z;
+
+import java.util.HashMap;
+
+import sun.jvm.hotspot.runtime.VM;
+import sun.jvm.hotspot.utilities.BitMap;
+import sun.jvm.hotspot.utilities.BitMapInterface;
+
+/** Discontiguous bitmap for ZGC. */
+public class ZExternalBitMap implements BitMapInterface {
+    private ZPageTable pageTable;
+    private final long oopSize;
+
+    private HashMap<ZPage, BitMap> pageToBitMap = new HashMap<ZPage, BitMap>();
+
+    public ZExternalBitMap(ZCollectedHeap collectedHeap) {
+        pageTable = collectedHeap.heap().pageTable();
+        oopSize = VM.getVM().getOopSize();
+    }
+
+    private ZPage getPage(long zOffset) {
+        if (zOffset > ZGlobals.ZAddressOffsetMask) {
+            throw new RuntimeException("Not a Z offset: " + zOffset);
+        }
+
+        ZPage page = pageTable.get(ZUtils.longToAddress(zOffset));
+        if (page == null) {
+            throw new RuntimeException("Address not in pageTable: " + zOffset);
+        }
+        return page;
+    }
+
+    private BitMap getOrAddBitMap(ZPage page) {
+        BitMap bitMap = pageToBitMap.get(page);
+        if (bitMap == null) {
+            long size = page.size();
+
+            long maxNumObjects = size >>> page.object_alignment_shift();
+            if (maxNumObjects > Integer.MAX_VALUE) {
+                throw new RuntimeException("int overflow");
+            }
+            int intMaxNumObjects = (int)maxNumObjects;
+
+            bitMap = new BitMap(intMaxNumObjects);
+            pageToBitMap.put(page,  bitMap);
+        }
+
+        return bitMap;
+    }
+
+    private int pageLocalBitMapIndex(ZPage page, long zOffset) {
+        long pageLocalZOffset = zOffset - page.start();
+        return (int)(pageLocalZOffset >>> page.object_alignment_shift());
+    }
+
+    private long convertToZOffset(long offset) {
+        long addr = ZGlobals.ZAddressSpaceStart + oopSize * offset;
+        return addr & ZGlobals.ZAddressOffsetMask;
+    }
+
+    @Override
+    public boolean at(long offset) {
+        long zOffset = convertToZOffset(offset);
+        ZPage page = getPage(zOffset);
+        BitMap bitMap = getOrAddBitMap(page);
+        int index = pageLocalBitMapIndex(page, zOffset);
+
+        return bitMap.at(index);
+    }
+
+    @Override
+    public void atPut(long offset, boolean value) {
+        long zOffset = convertToZOffset(offset);
+        ZPage page = getPage(zOffset);
+        BitMap bitMap = getOrAddBitMap(page);
+        int index = pageLocalBitMapIndex(page, zOffset);
+
+        bitMap.atPut(index, value);
+    }
+
+    @Override
+    public void clear() {
+        for (BitMap bitMap : pageToBitMap.values()) {
+            bitMap.clear();
+        }
+    }
+}
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZGlobals.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZGlobals.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,6 +54,7 @@
     // Pointer part of address
     public static long ZAddressOffsetBits;
     public static long ZAddressOffsetMask;
+    public static long ZAddressOffsetMax;
 
     // Address space start/end/size
     public static long ZAddressSpaceStart;
@@ -84,6 +85,7 @@
 
         ZAddressOffsetBits = db.lookupLongConstant("ZAddressOffsetBits").longValue();
         ZAddressOffsetMask = db.lookupLongConstant("ZAddressOffsetMask").longValue();
+        ZAddressOffsetMax  = db.lookupLongConstant("ZAddressOffsetMax").longValue();
 
         ZAddressSpaceStart = db.lookupLongConstant("ZAddressSpaceStart").longValue();
     }
@@ -96,6 +98,10 @@
         return instance().ZGlobalPhase();
     }
 
+    public static int ZGlobalSeqNum() {
+        return instance().ZGlobalSeqNum();
+    }
+
     public static long ZAddressGoodMask() {
         return instance().ZAddressGoodMask();
     }
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZGlobalsForVMStructs.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZGlobalsForVMStructs.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
 
 class ZGlobalsForVMStructs extends VMObject {
     private static AddressField ZGlobalPhaseField;
+    private static AddressField ZGlobalSeqNumField;
     private static AddressField ZAddressGoodMaskField;
     private static AddressField ZAddressBadMaskField;
     private static AddressField ZAddressWeakBadMaskField;
@@ -47,6 +48,7 @@
         Type type = db.lookupType("ZGlobalsForVMStructs");
 
         ZGlobalPhaseField = type.getAddressField("_ZGlobalPhase");
+        ZGlobalSeqNumField = type.getAddressField("_ZGlobalSeqNum");
         ZAddressGoodMaskField = type.getAddressField("_ZAddressGoodMask");
         ZAddressBadMaskField = type.getAddressField("_ZAddressBadMask");
         ZAddressWeakBadMaskField = type.getAddressField("_ZAddressWeakBadMask");
@@ -62,6 +64,10 @@
         return ZGlobalPhaseField.getValue(addr).getJIntAt(0);
     }
 
+    int ZGlobalSeqNum() {
+        return ZGlobalSeqNumField.getValue(addr).getJIntAt(0);
+    }
+
     long ZAddressGoodMask() {
         return ZAddressGoodMaskField.getValue(addr).getJLongAt(0);
     }
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZOop.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZOop.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,23 +26,9 @@
 
 import sun.jvm.hotspot.debugger.Address;
 import sun.jvm.hotspot.debugger.OopHandle;
-import sun.jvm.hotspot.runtime.VM;
 
 class ZOop {
-    private static final long MSB = ~0L ^ (~0L >>> 1);
-
-    private static Address msbAddress() {
-        return VM.getVM().getUniverse().heap().start().orWithMask(MSB).andWithMask(MSB);
-    }
-
-    static Address to_address(long value) {
-        // If the value of an Address becomes 0, null is returned instead of an Address.
-        // Start with a one-bit address and as a last step, remove that bit.
-        Address oneAddress = msbAddress();
-        return oneAddress.orWithMask(value).xorWithMask(ZAddress.as_long(oneAddress));
-    }
-
     static Address to_address(OopHandle oop) {
-        return to_address(ZAddress.as_long(oop));
+        return ZUtils.longToAddress(ZAddress.as_long(oop));
     }
 }
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPage.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPage.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,17 +24,29 @@
 
 package sun.jvm.hotspot.gc.z;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import sun.jvm.hotspot.debugger.Address;
+import sun.jvm.hotspot.debugger.OopHandle;
+import sun.jvm.hotspot.gc.shared.LiveRegionsProvider;
+import sun.jvm.hotspot.memory.MemRegion;
+import sun.jvm.hotspot.oops.Oop;
+import sun.jvm.hotspot.oops.UnknownOopException;
 import sun.jvm.hotspot.runtime.VM;
 import sun.jvm.hotspot.runtime.VMObject;
 import sun.jvm.hotspot.runtime.VMObjectFactory;
+import sun.jvm.hotspot.types.AddressField;
 import sun.jvm.hotspot.types.CIntegerField;
 import sun.jvm.hotspot.types.Type;
 import sun.jvm.hotspot.types.TypeDataBase;
 
-public class ZPage extends VMObject {
+public class ZPage extends VMObject implements LiveRegionsProvider {
     private static CIntegerField typeField;
+    private static CIntegerField seqnumField;
     private static long virtualFieldOffset;
+    private static AddressField topField;
+    private static CIntegerField refcountField;
     private static long forwardingFieldOffset;
 
     static {
@@ -45,7 +57,10 @@
         Type type = db.lookupType("ZPage");
 
         typeField = type.getCIntegerField("_type");
+        seqnumField = type.getCIntegerField("_seqnum");
         virtualFieldOffset = type.getField("_virtual").getOffset();
+        topField = type.getAddressField("_top");
+        refcountField = type.getCIntegerField("_refcount");
         forwardingFieldOffset = type.getField("_forwarding").getOffset();
     }
 
@@ -57,18 +72,50 @@
         return typeField.getJByte(addr);
     }
 
+    private int seqnum() {
+        return seqnumField.getJInt(addr);
+    }
+
     private ZVirtualMemory virtual() {
-        return (ZVirtualMemory)VMObjectFactory.newObject(ZVirtualMemory.class, addr.addOffsetTo(virtualFieldOffset));
+        return VMObjectFactory.newObject(ZVirtualMemory.class, addr.addOffsetTo(virtualFieldOffset));
+    }
+
+    private Address top() {
+        return topField.getValue(addr);
+    }
+
+    private int refcount() {
+        // refcount is uint32_t so need to be cautious when using this field.
+        return refcountField.getJInt(addr);
     }
 
     private ZForwardingTable forwarding() {
-        return (ZForwardingTable)VMObjectFactory.newObject(ZForwardingTable.class, addr.addOffsetTo(forwardingFieldOffset));
+        return VMObjectFactory.newObject(ZForwardingTable.class, addr.addOffsetTo(forwardingFieldOffset));
     }
 
-    private long start() {
+    private boolean is_forwarding() {
+        return forwarding().table() != null;
+    }
+
+    private boolean is_relocatable() {
+        return is_active() && seqnum() < ZGlobals.ZGlobalSeqNum();
+    }
+
+    private boolean isPageRelocating() {
+        assert(is_active());
+        // is_forwarding():  Has a (relocation) forwarding table
+        // is_relocatable(): Has not been freed yet
+        return is_forwarding() && is_relocatable();
+    }
+
+    long start() {
         return virtual().start();
     }
 
+    long size() {
+        return virtual().end() - virtual().start();
+    }
+
     Address forward_object(Address from) {
         // Lookup address in forwarding table
         long from_offset = ZAddress.offset(from);
@@ -94,7 +141,6 @@
         return ZAddress.good(from);
     }
 
-
     long object_alignment_shift() {
         if (type() == ZGlobals.ZPageTypeSmall) {
             return ZGlobals.ZObjectAlignmentSmallShift();
@@ -105,4 +151,94 @@
             return ZGlobals.ZObjectAlignmentLargeShift;
         }
     }
+
+    long objectAlignmentSize() {
+        return 1 << object_alignment_shift();
+    }
+
+    public boolean is_active() {
+        return refcount() != 0;
+    }
+
+    private long getObjectSize(Address good) {
+        OopHandle handle = good.addOffsetToAsOopHandle(0);
+        Oop obj = null;
+
+        try {
+           obj = VM.getVM().getObjectHeap().newOop(handle);
+        } catch (UnknownOopException exp) {
+          throw new RuntimeException(" UnknownOopException  " + exp);
+        }
+
+        return VM.getVM().alignUp(obj.getObjectSize(), objectAlignmentSize());
+    }
+
+    private void addNotRelocatedRegions(List<MemRegion> regions) {
+        MemRegion mr = null;
+
+        // Some objects have already been forwarded to new locations.
+        long topValue = top().asLongValue();
+        for (long offsetValue = start(); offsetValue < topValue;) {
+            Address from = ZAddress.good(ZUtils.longToAddress(offsetValue));
+
+            Address to = relocate_object(from);
+
+            long byteSize;
+            try {
+                byteSize = getObjectSize(to);
+            } catch (Exception e) {
+                // Parsing the ZHeap is inherently unsafe
+                // when classes have been unloaded. Dead objects
+                // might have stale Klass pointers, and there's
+                // no way to get the size of the dead object.
+                //
+                // If possible, run with -XX:-ClassUnloading
+                // to ensure that all Klasses are kept alive.
+                System.err.println("Unparsable regions found. Skipping: "
+                        + from
+                        + " "
+                        + from.addOffsetTo(topValue - offsetValue));
+
+                // Can't proceed further. Just return the collected regions.
+                return;
+            }
+
+            if (from.equals(to)) {
+                // Not relocated - add region
+                if (mr == null) {
+                    mr = new MemRegion(from, 0 /* wordSize */);
+                    regions.add(mr);
+                }
+
+                long wordSize = byteSize / VM.getVM().getBytesPerWord();
+                mr.setWordSize(mr.wordSize() + wordSize);
+            } else {
+                // Forwarded somewhere else, split region.
+                mr = null;
+            }
+
+            offsetValue += byteSize;
+        }
+    }
+
+    public List<MemRegion> getLiveRegions() {
+        List<MemRegion> res = new ArrayList<>();
+
+        if (isPageRelocating()) {
+            addNotRelocatedRegions(res);
+        } else {
+            Address start = ZAddress.good(ZUtils.longToAddress(start()));
+
+            // Can't convert top() to a "good" address because it might
+            // be at the top of the "offset" range, and therefore also
+            // looks like one of the color bits. Instead use the "good"
+            // address and add the size.
+            long size = top().asLongValue() - start();
+            Address end = start.addOffsetTo(size);
+
+            res.add(new MemRegion(start, end));
+        }
+
+        return res;
+    }
 }
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageAllocator.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageAllocator.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,7 @@
 
 public class ZPageAllocator extends VMObject {
 
-    private static AddressField physicalField;
+    private static long physicalFieldOffset;
     private static CIntegerField usedField;
 
     static {
@@ -47,12 +47,12 @@
     static private synchronized void initialize(TypeDataBase db) {
         Type type = db.lookupType("ZPageAllocator");
 
-        physicalField = type.getAddressField("_physical");
+        physicalFieldOffset = type.getAddressField("_physical").getOffset();
         usedField = type.getCIntegerField("_used");
     }
 
     private ZPhysicalMemoryManager physical() {
-      Address physicalAddr = physicalField.getValue(addr);
+      Address physicalAddr = addr.addOffsetTo(physicalFieldOffset);
       return (ZPhysicalMemoryManager)VMObjectFactory.newObject(ZPhysicalMemoryManager.class, physicalAddr);
     }
 
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageTable.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageTable.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,8 @@
 
 package sun.jvm.hotspot.gc.z;
 
+import java.util.Iterator;
+
 import sun.jvm.hotspot.debugger.Address;
 import sun.jvm.hotspot.runtime.VM;
 import sun.jvm.hotspot.runtime.VMObject;
@@ -63,4 +65,112 @@
     boolean is_relocating(Address o) {
         return getEntry(o).relocating();
     }
+
+    private class ZPagesIterator implements Iterator<ZPage> {
+        private ZAddressRangeMapForPageTable.Iterator mapIter;
+        private ZPage next;
+
+        ZPagesIterator() {
+            mapIter = map().new Iterator();
+            positionToNext();
+        }
+
+        private ZPage positionToNext() {
+            ZPage current = next;
+
+            // Find next
+            ZPage found = null;
+            while (mapIter.hasNext()) {
+                ZPageTableEntry entry = new ZPageTableEntry(mapIter.next());
+                if (!entry.isEmpty()) {
+                    ZPage page = entry.page();
+                    // Medium pages have repeated entries for all covered slots,
+                    // therefore we need to compare against the current page.
+                    if (page != null && !page.equals(current)) {
+                        found = page;
+                        break;
+                    }
+                }
+            }
+
+            next = found;
+
+            return current;
+        }
+
+        @Override
+        public boolean hasNext() {
+            return next != null;
+        }
+
+        @Override
+        public ZPage next() {
+            return positionToNext();
+        }
+
+        @Override
+        public void remove() {
+            /* not supported */
+        }
+    }
+
+    abstract class ZPageFilter {
+        public abstract boolean accept(ZPage page);
+    }
+
+    class ZPagesFilteredIterator implements Iterator<ZPage> {
+        private ZPage next;
+        private ZPagesIterator iter = new ZPagesIterator();
+        private ZPageFilter filter;
+
+        ZPagesFilteredIterator(ZPageFilter filter) {
+            this.filter = filter;
+            positionToNext();
+        }
+
+        public ZPage positionToNext() {
+            ZPage current = next;
+
+            // Find next
+            ZPage found = null;
+            while (iter.hasNext()) {
+                ZPage page = iter.next();
+                if (filter.accept(page)) {
+                    found = page;
+                    break;
+                }
+            }
+
+            next = found;
+
+            return current;
+        }
+
+        @Override
+        public boolean hasNext() {
+            return next != null;
+        }
+
+        @Override
+        public ZPage next() {
+            return positionToNext();
+        }
+
+        @Override
+        public void remove() {
+            /* not supported */
+        }
+    }
+
+    public Iterator<ZPage> iterator() {
+        return new ZPagesIterator();
+    }
+
+    public Iterator<ZPage> activePagesIterator() {
+        return new ZPagesFilteredIterator(new ZPageFilter() {
+            public boolean accept(ZPage page) {
+                return page.is_active();
+            }
+        });
+    }
 }
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageTableEntry.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageTableEntry.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,10 +35,18 @@
     }
 
     ZPage page() {
-        return (ZPage)VMObjectFactory.newObject(ZPage.class, entry.andWithMask(~1L));
+        return (ZPage)VMObjectFactory.newObject(ZPage.class, zPageBits());
+    }
+
+    private Address zPageBits() {
+        return entry.andWithMask(~1L);
     }
 
     boolean relocating() {
         return (entry.asLongValue() & 1) == 1;
     }
+
+    boolean isEmpty() {
+        return entry == null || zPageBits() == null;
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZUtils.java	Thu Feb 21 22:08:53 2019 +0100
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ *
+ */
+
+package sun.jvm.hotspot.gc.z;
+
+import sun.jvm.hotspot.debugger.Address;
+import sun.jvm.hotspot.runtime.VM;
+
+class ZUtils {
+    private static final long MSB = ~0L ^ (~0L >>> 1);
+
+    private static Address msbAddress() {
+        return VM.getVM().getUniverse().heap().start().orWithMask(MSB).andWithMask(MSB);
+    }
+
+    static Address longToAddress(long value) {
+        // If the value of an Address becomes 0, null is returned instead of an Address.
+        // Start with a one-bit address and as a last step, remove that bit.
+        Address oneAddress = msbAddress();
+        return oneAddress.orWithMask(value).xorWithMask(ZAddress.as_long(oneAddress));
+    }
+}
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Klass.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Klass.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,7 @@
 
   private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
     Type type    = db.lookupType("Klass");
-    javaMirror   = type.getAddressField("_java_mirror");
+    javaMirrorFieldOffset = type.getField("_java_mirror").getOffset();
     superField   = new MetadataField(type.getAddressField("_super"), 0);
     layoutHelper = new IntField(type.getJIntField("_layout_helper"), 0);
     name         = type.getAddressField("_name");
@@ -89,7 +89,7 @@
   public boolean isArrayKlass()        { return false; }
 
   // Fields
-  private static AddressField   javaMirror;
+  private static long javaMirrorFieldOffset;
   private static MetadataField  superField;
   private static IntField layoutHelper;
   private static AddressField  name;
@@ -101,23 +101,15 @@
   private static CIntField vtableLen;
   private static AddressField classLoaderData;
 
-  private Address getValue(AddressField field) {
-    return addr.getAddressAt(field.getOffset());
-  }
-
   protected Symbol getSymbol(AddressField field) {
     return Symbol.create(addr.getAddressAt(field.getOffset()));
   }
 
   // Accessors for declared fields
   public Instance getJavaMirror() {
-    Address handle = javaMirror.getValue(getAddress());
-    if (handle != null) {
-      // Load through the handle
-      OopHandle refs = handle.getOopHandleAt(0);
-      return (Instance)VM.getVM().getObjectHeap().newOop(refs);
-    }
-    return null;
+    Address addr = getAddress().addOffsetTo(javaMirrorFieldOffset);
+    VMOopHandle vmOopHandle = VMObjectFactory.newObject(VMOopHandle.class, addr);
+    return vmOopHandle.resolve();
   }
   public Klass    getSuper()            { return (Klass)    superField.getValue(this);   }
   public Klass    getJavaSuper()        { return null;  }
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -304,87 +304,48 @@
     visitor.epilogue();
   }
 
-  private void addLiveRegions(String name, List input, List output) {
-     for (Iterator itr = input.iterator(); itr.hasNext();) {
-        MemRegion reg = (MemRegion) itr.next();
+  private static class LiveRegionsCollector implements LiveRegionsClosure {
+    LiveRegionsCollector(List<Address> l) {
+      liveRegions = l;
+    }
+
+    @Override
+    public void doLiveRegions(LiveRegionsProvider lrp) {
+      for (MemRegion reg : lrp.getLiveRegions()) {
         Address top = reg.end();
         Address bottom = reg.start();
         if (Assert.ASSERTS_ENABLED) {
-           Assert.that(top != null, "top address in a live region should not be null");
+          Assert.that(top != null, "top address in a live region should not be null");
         }
         if (Assert.ASSERTS_ENABLED) {
-           Assert.that(bottom != null, "bottom address in a live region should not be null");
+          Assert.that(bottom != null, "bottom address in a live region should not be null");
         }
-        output.add(top);
-        output.add(bottom);
+        liveRegions.add(top);
+        liveRegions.add(bottom);
         if (DEBUG) {
-          System.err.println("Live region: " + name + ": " + bottom + ", " + top);
-        }
-     }
+          System.err.println("Live region: " + lrp + ": " + bottom + ", " + top);
+      }
+    }
   }
 
-  private class LiveRegionsCollector implements SpaceClosure {
-     LiveRegionsCollector(List l) {
-        liveRegions = l;
-     }
-
-     public void doSpace(Space s) {
-        addLiveRegions(s.toString(), s.getLiveRegions(), liveRegions);
-     }
-     private List liveRegions;
+     private List<Address> liveRegions;
   }
 
   // Returns a List<Address> where the addresses come in pairs. These
   // designate the live regions of the heap.
-  private List collectLiveRegions() {
+  private List<Address> collectLiveRegions() {
     // We want to iterate through all live portions of the heap, but
     // do not want to abort the heap traversal prematurely if we find
     // a problem (like an allocated but uninitialized object at the
     // top of a generation). To do this we enumerate all generations'
     // bottom and top regions, and factor in TLABs if necessary.
 
-    // List<Address>. Addresses come in pairs.
-    List liveRegions = new ArrayList();
+    // Addresses come in pairs.
+    List<Address> liveRegions = new ArrayList<>();
     LiveRegionsCollector lrc = new LiveRegionsCollector(liveRegions);
 
     CollectedHeap heap = VM.getVM().getUniverse().heap();
-
-    if (heap instanceof GenCollectedHeap) {
-       GenCollectedHeap genHeap = (GenCollectedHeap) heap;
-       // Run through all generations, obtaining bottom-top pairs.
-       for (int i = 0; i < genHeap.nGens(); i++) {
-         Generation gen = genHeap.getGen(i);
-         gen.spaceIterate(lrc, true);
-       }
-    } else if (heap instanceof ParallelScavengeHeap) {
-       ParallelScavengeHeap psh = (ParallelScavengeHeap) heap;
-       PSYoungGen youngGen = psh.youngGen();
-       // Add eden space
-       addLiveRegions("eden", youngGen.edenSpace().getLiveRegions(), liveRegions);
-       // Add from-space but not to-space
-       addLiveRegions("from", youngGen.fromSpace().getLiveRegions(), liveRegions);
-       PSOldGen oldGen = psh.oldGen();
-       addLiveRegions("old ", oldGen.objectSpace().getLiveRegions(), liveRegions);
-    } else if (heap instanceof G1CollectedHeap) {
-        G1CollectedHeap g1h = (G1CollectedHeap) heap;
-        g1h.heapRegionIterate(lrc);
-    } else if (heap instanceof ShenandoahHeap) {
-       // Operation (currently) not supported with Shenandoah GC. Print
-       // a warning and leave the list of live regions empty.
-       System.err.println("Warning: Operation not supported with Shenandoah GC");
-    } else if (heap instanceof ZCollectedHeap) {
-       // Operation (currently) not supported with ZGC. Print
-       // a warning and leave the list of live regions empty.
-       System.err.println("Warning: Operation not supported with ZGC");
-    } else if (heap instanceof EpsilonHeap) {
-       EpsilonHeap eh = (EpsilonHeap) heap;
-       liveRegions.add(eh.space().top());
-       liveRegions.add(eh.space().bottom());
-    } else {
-       if (Assert.ASSERTS_ENABLED) {
-          Assert.that(false, "Unexpected CollectedHeap type: " + heap.getClass().getName());
-       }
-    }
+    heap.liveRegionsIterate(lrc);
 
     // If UseTLAB is enabled, snip out regions associated with TLABs'
     // dead regions. Note that TLABs can be present in any generation.
@@ -440,11 +401,9 @@
     return liveRegions;
   }
 
-  private void sortLiveRegions(List liveRegions) {
-    Collections.sort(liveRegions, new Comparator() {
-        public int compare(Object o1, Object o2) {
-          Address a1 = (Address) o1;
-          Address a2 = (Address) o2;
+  private void sortLiveRegions(List<Address> liveRegions) {
+    Collections.sort(liveRegions, new Comparator<Address>() {
+        public int compare(Address a1, Address a2) {
           if (AddressOps.lt(a1, a2)) {
             return -1;
           } else if (AddressOps.gt(a1, a2)) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/VMOopHandle.java	Thu Feb 21 22:08:53 2019 +0100
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.oops;
+
+import sun.jvm.hotspot.debugger.Address;
+import sun.jvm.hotspot.debugger.OopHandle;
+import sun.jvm.hotspot.runtime.VM;
+import sun.jvm.hotspot.runtime.VMObject;
+import sun.jvm.hotspot.types.AddressField;
+import sun.jvm.hotspot.types.Type;
+import sun.jvm.hotspot.types.TypeDataBase;
+
+public class VMOopHandle extends VMObject {
+    private static AddressField objField;
+
+    static {
+        VM.registerVMInitializedObserver((o, d) -> initialize(VM.getVM().getTypeDataBase()));
+    }
+
+    private static synchronized void initialize(TypeDataBase db) {
+        Type type = db.lookupType("OopHandle");
+
+        objField = type.getAddressField("_obj");
+    }
+
+    public VMOopHandle(Address addr) {
+        super(addr);
+    }
+
+    public Address getObj() {
+        return objField.getValue(addr);
+    }
+
+    public Instance resolve() {
+        Address handle = getObj();
+        if (handle != null) {
+          // Load through the handle
+          OopHandle refs = VM.getVM().getUniverse().heap().oop_load_in_native(handle);
+          return (Instance)VM.getVM().getObjectHeap().newOop(refs);
+        }
+        return null;
+    }
+}
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VMObjectFactory.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VMObjectFactory.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,14 +45,14 @@
 */
 
 public class VMObjectFactory {
-  public static Object newObject(Class clazz, Address addr)
+  public static <T> T newObject(Class<T> clazz, Address addr)
     throws ConstructionException {
     try {
       if (addr == null) {
         return null;
       }
 
-      Constructor c = clazz.getConstructor(new Class[] {
+      Constructor<T> c = clazz.getConstructor(new Class[] {
         Address.class
       });
       return c.newInstance(new Object[] { addr });
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/BitMapInterface.java	Thu Feb 21 22:08:53 2019 +0100
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.utilities;
+
+/** Minimal bitmap interface to support bitmaps spanning more than Integer.MAX_VALUE bits. */
+public interface BitMapInterface {
+  public boolean at(long offset);
+  public void atPut(long offset, boolean value);
+  public void clear();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/BitMapSegmented.java	Thu Feb 21 22:08:53 2019 +0100
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.utilities;
+
+/** A BitMap implementing the BitMapInterface. */
+public class BitMapSegmented implements BitMapInterface {
+  private static final int SegmentSizeBits = 30;
+  private static final int SegmentSize = 1 << (SegmentSizeBits - 1);
+
+  public BitMapSegmented(long sizeInBits) {
+    this.size = sizeInBits;
+
+    if (sizeInBits == 0) {
+      segmentBitMaps = new BitMap[0];
+      return;
+    }
+
+    int lastSegmentSize = (int)(sizeInBits % SegmentSize);
+
+    int segments = segmentIndex(sizeInBits - 1) + 1;
+    int completeSegments = segments - ((lastSegmentSize != 0) ? 1 : 0);
+
+    segmentBitMaps = new BitMap[segments];
+
+    for (int i = 0; i < completeSegments; i++) {
+      segmentBitMaps[i] = new BitMap(SegmentSize);
+    }
+
+    if (lastSegmentSize != 0) {
+      segmentBitMaps[completeSegments] = new BitMap(lastSegmentSize);
+    }
+  }
+
+  public long size() {
+    return size;
+  }
+
+  // Accessors
+  public boolean at(long offset) {
+    assert offset < size;
+
+    int segmentIndex = segmentIndex(offset);
+    int segmentOffset = segmentOffset(offset);
+    return segmentBitMaps[segmentIndex].at(segmentOffset);
+  }
+
+  public void atPut(long offset, boolean value) {
+    assert offset < size;
+
+    int segmentIndex = segmentIndex(offset);
+    int segmentOffset = segmentOffset(offset);
+    segmentBitMaps[segmentIndex].atPut(segmentOffset, value);
+  }
+
+  public void clear() {
+    for (BitMap map : segmentBitMaps) {
+      map.clear();
+    }
+  }
+
+  //----------------------------------------------------------------------
+  // Internals only below this point
+  //
+  private final long     size; // in bits
+  private final BitMap[] segmentBitMaps;
+
+  private int segmentIndex(long offset) {
+    long longIndex = offset / SegmentSize;
+
+    assert longIndex < Integer.MAX_VALUE;
+    return (int)longIndex;
+  }
+
+  private int segmentOffset(long offset) {
+    return (int)(offset % SegmentSize);
+  }
+}
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java	Thu Feb 21 22:08:53 2019 +0100
@@ -390,9 +390,6 @@
 
     public synchronized void write(String fileName) throws IOException {
         VM vm = VM.getVM();
-        if (vm.getUniverse().heap() instanceof ZCollectedHeap) {
-            throw new RuntimeException("This operation is not supported with ZGC.");
-        }
 
         // open file stream and create buffered data output stream
         fos = new FileOutputStream(fileName);
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/MarkBits.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/MarkBits.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,8 +41,7 @@
     start = reserved.start();
     end   = reserved.end();
     long numOopHandles = end.minus(start) / VM.getVM().getOopSize();
-    // FIXME: will have trouble with larger heap sizes
-    bits = new BitMap((int) numOopHandles);
+    bits = heap.createBitMap(numOopHandles);
   }
 
   public void clear() {
@@ -60,34 +59,22 @@
     }
 
     OopHandle handle = obj.getHandle();
-    // FIXME: will have trouble with larger heap sizes
     long idx = handle.minus(start) / VM.getVM().getOopSize();
-    if ((idx < 0) || (idx >= bits.size())) {
-      System.err.println("MarkBits: WARNING: object " + handle + " outside of heap, ignoring");
-      return false;
-    }
-    int intIdx = (int) idx;
-    if (bits.at(intIdx)) {
+    if (bits.at(idx)) {
       return false; // already marked
     }
-    bits.atPut(intIdx, true);
+    bits.atPut(idx, true);
     return true;
   }
 
   /** Forces clearing of a given mark bit. */
   public void clear(Oop obj) {
     OopHandle handle = obj.getHandle();
-    // FIXME: will have trouble with larger heap sizes
     long idx = handle.minus(start) / VM.getVM().getOopSize();
-    if ((idx < 0) || (idx >= bits.size())) {
-      System.err.println("MarkBits: WARNING: object " + handle + " outside of heap, ignoring");
-      return;
-    }
-    int intIdx = (int) idx;
-    bits.atPut(intIdx, false);
+    bits.atPut(idx, false);
   }
 
-  private BitMap  bits;
+  private BitMapInterface bits;
   private Address start;
   private Address end;
 }
--- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/AbstractWindowsTerminal.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/AbstractWindowsTerminal.java	Thu Feb 21 22:08:53 2019 +0100
@@ -86,8 +86,8 @@
         super(name, type, selectCharset(encoding, codepage), signalHandler);
         NonBlockingPumpReader reader = NonBlocking.nonBlockingPumpReader();
         this.slaveInputPipe = reader.getWriter();
-        this.reader = reader;
         this.input = inputStreamWrapper.apply(NonBlocking.nonBlockingStream(reader, encoding()));
+        this.reader = NonBlocking.nonBlocking(name, input, encoding());
         this.writer = new PrintWriter(writer);
         this.output = new WriterOutputStream(writer, encoding());
         parseInfoCmp();
--- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/NonBlocking.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/NonBlocking.java	Thu Feb 21 22:08:53 2019 +0100
@@ -123,9 +123,9 @@
             }
             if (bytes.hasRemaining()) {
                 if (isPeek) {
-                    return bytes.get(bytes.position());
+                    return Byte.toUnsignedInt(bytes.get(bytes.position()));
                 } else {
-                    return bytes.get();
+                    return Byte.toUnsignedInt(bytes.get());
                 }
             } else {
                 return READ_EXPIRED;
--- a/src/jdk.internal.le/windows/native/lible/Kernel32.cpp	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.internal.le/windows/native/lible/Kernel32.cpp	Thu Feb 21 22:08:53 2019 +0100
@@ -460,7 +460,7 @@
     HANDLE h = GetStdHandle((jint) env->GetLongField(in_hConsoleOutput, pointerValue));
     INPUT_RECORD *buffer = new INPUT_RECORD[in_nLength];
     DWORD numberOfEventsRead;
-    if (!ReadConsoleInput(h, buffer, in_nLength, &numberOfEventsRead)) {
+    if (!ReadConsoleInputW(h, buffer, in_nLength, &numberOfEventsRead)) {
         delete buffer;
         DWORD error = GetLastError();
         jobject exc = env->NewObject(lastErrorExceptionClass,
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java	Wed Feb 20 21:44:31 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java	Thu Feb 21 22:08:53 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,6 @@
 import javax.lang.model.element.ModuleElement;
 import javax.lang.model.element.PackageElement;
 
-import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
@@ -124,11 +123,13 @@
      * methods from the sub-class in order to generate Frame or Non
      * Frame format.
      *
-     * @param title the title of the window.
+     * @param title the title of the window
+     * @param descriptio