Merge JDK-8200758-branch
authorherrick
Wed, 20 Feb 2019 14:01:37 -0500
branchJDK-8200758-branch
changeset 57198 fac5bd3a361d
parent 57197 7fc5a57945d2 (current diff)
parent 53854 792c8a5fbb29 (diff)
child 57213 8ff0a29bf9bc
Merge
src/hotspot/share/gc/z/zStatTLAB.cpp
src/hotspot/share/gc/z/zStatTLAB.hpp
src/hotspot/share/oops/array.inline.hpp
src/java.desktop/share/classes/sun/awt/AWTSecurityManager.java
--- a/.hgtags	Wed Feb 20 12:52:43 2019 -0500
+++ b/.hgtags	Wed Feb 20 14:01:37 2019 -0500
@@ -543,3 +543,4 @@
 021917019cda1c0c5853255322274f37693a2431 jdk-13+7
 b5f7bb57de2f797be34f6c75d45c3245ad37ab97 jdk-12+31
 a535ba736cabc6886acdff36de3a096c46e5ddc5 jdk-13+8
+4ce47bc1fb92cf94c6e3d1f49d582f02dcb851ab jdk-12+32
--- a/make/RunTests.gmk	Wed Feb 20 12:52:43 2019 -0500
+++ b/make/RunTests.gmk	Wed Feb 20 14:01:37 2019 -0500
@@ -658,6 +658,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 +692,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) \
--- a/make/autoconf/basics.m4	Wed Feb 20 12:52:43 2019 -0500
+++ b/make/autoconf/basics.m4	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/make/autoconf/flags-cflags.m4	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/make/autoconf/jdk-options.m4	Wed Feb 20 14:01:37 2019 -0500
@@ -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
@@ -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 12:52:43 2019 -0500
+++ b/make/autoconf/spec.gmk.in	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/make/autoconf/toolchain.m4	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/make/common/MakeBase.gmk	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/make/common/ProcessMarkdown.gmk	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/make/common/ZipArchive.gmk	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/make/conf/jib-profiles.js	Wed Feb 20 14:01:37 2019 -0500
@@ -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
@@ -626,6 +648,12 @@
         },
        "linux-arm32": {
             platform: "linux-arm32",
+        },
+       "linux-ppc64le": {
+            platform: "linux-ppc64le",
+        },
+       "linux-s390x": {
+            platform: "linux-s390x",
         }
     }
     // Generate common artifacts for all main profiles
@@ -870,7 +898,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 +960,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 12:52:43 2019 -0500
+++ b/make/copy/CopyCommon.gmk	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/make/test/BuildMicrobenchmark.gmk	Wed Feb 20 14:01:37 2019 -0500
@@ -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/s390/frame_s390.cpp	Wed Feb 20 12:52:43 2019 -0500
+++ b/src/hotspot/cpu/s390/frame_s390.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/cpu/s390/stubGenerator_s390.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/cpu/s390/vm_version_s390.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/cpu/x86/c2_init_x86.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -29,6 +29,8 @@
 
 // processor dependent initialization for i486
 
+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);
     }
   }
+  reg_mask_init();
 }
--- a/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp	Wed Feb 20 12:52:43 2019 -0500
+++ b/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/cpu/x86/gc/z/z_x86_64.ad	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/cpu/x86/vm_version_x86.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/cpu/x86/x86_64.ad	Wed Feb 20 14:01:37 2019 -0500
@@ -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/posix/os_posix.hpp	Wed Feb 20 12:52:43 2019 -0500
+++ b/src/hotspot/os/posix/os_posix.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/os/solaris/os_solaris.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/os/windows/os_windows.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/adlc/formsopt.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/c1/c1_Optimizer.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/ci/ciReplay.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/classfile/classLoader.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/classfile/stackMapTable.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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/verifier.hpp	Wed Feb 20 12:52:43 2019 -0500
+++ b/src/hotspot/share/classfile/verifier.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1Allocator.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1Allocator.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1FullGCOopClosures.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1ParScanThreadState.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1RemSet.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/g1/heapRegion.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/shared/genOopClosures.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/shared/spaceDecorator.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/shared/vmStructs_gc.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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.hpp	Wed Feb 20 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -676,6 +676,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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/shenandoah/shenandoahMarkingContext.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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/shenandoahRuntime.hpp	Wed Feb 20 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/shenandoah/shenandoahRuntime.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/z/vmStructs_z.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/z/vmStructs_z.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/z/zCollectedHeap.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/z/zCollectedHeap.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/z/zInitialize.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/z/zMark.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/z/zRelocate.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/z/zRootsIterator.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/gc/z/zRootsIterator.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 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 12:52:43 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	Wed Feb 20 14:01:37 2019 -0500
@@ -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	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/interpreter/linkResolver.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/interpreter/rewriter.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/logging/logFileOutput.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/logging/logFileOutput.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/memory/allocation.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/memory/memRegion.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/memory/metaspace.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -57,7 +57,6 @@
 
 class ClassLoaderData;
 class MetaspaceTracer;
-class MetaWord;
 class Mutex;
 class outputStream;
 
--- a/src/hotspot/share/oops/array.hpp	Wed Feb 20 12:52:43 2019 -0500
+++ b/src/hotspot/share/oops/array.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 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 12:52:43 2019 -0500
+++ b/src/hotspot/share/oops/constantPool.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/oops/constantPool.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/oops/generateOopMap.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/oops/instanceKlass.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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"
--- a/src/hotspot/share/oops/method.cpp	Wed Feb 20 12:52:43 2019 -0500
+++ b/src/hotspot/share/oops/method.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/oops/oopHandle.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/oops/reflectionAccessorImplKlassHelper.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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/prims/jvm.cpp	Wed Feb 20 12:52:43 2019 -0500
+++ b/src/hotspot/share/prims/jvm.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/runtime/arguments.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -555,13 +555,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 +2749,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 12:52:43 2019 -0500
+++ b/src/hotspot/share/runtime/deoptimization.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/runtime/fieldDescriptor.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/runtime/monitorChunk.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/runtime/monitorChunk.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/runtime/mutex.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/runtime/safepoint.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/runtime/semaphore.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/hotspot/share/runtime/vmStructs.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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/utilities/globalDefinitions.hpp	Wed Feb 20 12:52:43 2019 -0500
+++ b/src/hotspot/share/utilities/globalDefinitions.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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/X-Buffer.java.template	Wed Feb 20 12:52:43 2019 -0500
+++ b/src/java.base/share/classes/java/nio/X-Buffer.java.template	Wed Feb 20 14:01:37 2019 -0500
@@ -209,6 +209,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]
--- a/src/java.base/share/classes/sun/security/ssl/ClientHello.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/ClientHello.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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/native/libjimage/imageFile.cpp	Wed Feb 20 12:52:43 2019 -0500
+++ b/src/java.base/share/native/libjimage/imageFile.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/java.base/share/native/libjimage/imageFile.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/java.base/share/native/libjimage/jimage.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/java.base/share/native/libjimage/jimage.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CTrayIcon.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/java.desktop/share/classes/java/awt/Font.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 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 12:52:43 2019 -0500
+++ b/src/java.desktop/share/classes/sun/awt/AppContext.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/java.desktop/share/classes/sun/font/FontDesignMetrics.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/java.desktop/share/classes/sun/font/FontManager.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/java.desktop/share/classes/sun/font/SunFontManager.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-atomic-private.hh	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/java.desktop/share/native/liblcms/cmsxform.c	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.h	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/java.desktop/windows/native/libawt/windows/awt_InputMethod.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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.rmi/share/classes/java/rmi/server/RMIFailureHandler.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/src/java.rmi/share/classes/java/rmi/server/RMIFailureHandler.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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.hotspot.agent/share/classes/sun/jvm/hotspot/classfile/ClassLoaderData.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/classfile/ClassLoaderData.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/cms/CompactibleFreeListSpace.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/cms/ConcurrentMarkSweepGeneration.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/epsilon/EpsilonHeap.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/G1CollectedHeap.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/HeapRegion.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/ImmutableSpace.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/MutableSpace.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/ParallelScavengeHeap.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/DefNewGeneration.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/TenuredGeneration.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeap.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/ContiguousSpace.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GenCollectedHeap.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Generation.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GenerationFactory.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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	Wed Feb 20 14:01:37 2019 -0500
@@ -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	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Space.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shenandoah/ShenandoahHeap.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZAddress.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZAddressRangeMapForPageTable.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZGlobals.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZGlobalsForVMStructs.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZOop.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPage.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 boolean is_forwarding() {
+        return forwarding().table() != null;
+    }
+
+    private boolean is_relocatable() {
+        return is_active() && seqnum() < ZGlobals.ZGlobalSeqNum();
     }
 
-    private long start() {
+    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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageAllocator.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageTable.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageTableEntry.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Klass.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VMObjectFactory.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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	Wed Feb 20 14:01:37 2019 -0500
@@ -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	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/MarkBits.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/AbstractWindowsTerminal.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/NonBlocking.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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 12:52:43 2019 -0500
+++ b/src/jdk.internal.le/windows/native/lible/Kernel32.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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.jdi/share/classes/com/sun/tools/example/debug/tty/Env.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/Env.java	Wed Feb 20 14:01:37 2019 -0500
@@ -211,58 +211,14 @@
         ReferenceType clazz = ref.referenceType();
         long id = ref.uniqueID();
         if (clazz == null) {
-            return toHex(id);
+            return Long.toString(id);
         } else {
-            return MessageOutput.format("object description and hex id",
+            return MessageOutput.format("object description and id",
                                         new Object [] {clazz.name(),
-                                                       toHex(id)});
+                                                       Long.toString(id)});
         }
     }
 
-    /** Convert a long to a hexadecimal string. */
-    static String toHex(long n) {
-        char s1[] = new char[16];
-        char s2[] = new char[18];
-
-        /* Store digits in reverse order. */
-        int i = 0;
-        do {
-            long d = n & 0xf;
-            s1[i++] = (char)((d < 10) ? ('0' + d) : ('a' + d - 10));
-        } while ((n >>>= 4) > 0);
-
-        /* Now reverse the array. */
-        s2[0] = '0';
-        s2[1] = 'x';
-        int j = 2;
-        while (--i >= 0) {
-            s2[j++] = s1[i];
-        }
-        return new String(s2, 0, j);
-    }
-
-    /** Convert hexadecimal strings to longs. */
-    static long fromHex(String hexStr) {
-        String str = hexStr.startsWith("0x") ?
-            hexStr.substring(2).toLowerCase() : hexStr.toLowerCase();
-        if (hexStr.length() == 0) {
-            throw new NumberFormatException();
-        }
-
-        long ret = 0;
-        for (int i = 0; i < str.length(); i++) {
-            int c = str.charAt(i);
-            if (c >= '0' && c <= '9') {
-                ret = (ret * 16) + (c - '0');
-            } else if (c >= 'a' && c <= 'f') {
-                ret = (ret * 16) + (c - 'a' + 10);
-            } else {
-                throw new NumberFormatException();
-            }
-        }
-        return ret;
-    }
-
     static ReferenceType getReferenceTypeFromToken(String idToken) {
         ReferenceType cls = null;
         if (Character.isDigit(idToken.charAt(0))) {
--- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java	Wed Feb 20 14:01:37 2019 -0500
@@ -931,7 +931,7 @@
                    // Old-style options (These should remain in place as long as
                    //  the standard VM accepts them)
                    token.equals("-noasyncgc") || token.equals("-prof") ||
-                   token.equals("-verify") || token.equals("-noverify") ||
+                   token.equals("-verify") ||
                    token.equals("-verifyremote") ||
                    token.equals("-verbosegc") ||
                    token.startsWith("-ms") || token.startsWith("-mx") ||
--- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java	Wed Feb 20 14:01:37 2019 -0500
@@ -235,7 +235,7 @@
         {"Not owned", "  Not owned"},
         {"Not waiting for a monitor", "  Not waiting for a monitor"},
         {"Nothing suspended.", "Nothing suspended."},
-        {"object description and hex id", "({0}){1}"},
+        {"object description and id", "({0}){1}"},
         {"Operation is not supported on the target VM", "Operation is not supported on the target VM"},
         {"operation not yet supported", "operation not yet supported"},
         {"Owned by:", "  Owned by: {0}, entry count: {1,number,integer}"},
--- a/test/hotspot/gtest/logging/logTestFixture.cpp	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/gtest/logging/logTestFixture.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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
@@ -33,11 +33,12 @@
 #include "utilities/ostream.hpp"
 
 LogTestFixture::LogTestFixture() : _n_snapshots(0), _configuration_snapshot(NULL) {
-  // Set up TestLogFileName to include PID, testcase name and test name
-  int ret = jio_snprintf(_filename, sizeof(_filename), "testlog.pid%d.%s.%s.log",
-                         os::current_process_id(),
-                         ::testing::UnitTest::GetInstance()->current_test_info()->test_case_name(),
-                         ::testing::UnitTest::GetInstance()->current_test_info()->name());
+
+  // Set up TestLogFileName to include temp_dir, PID, testcase name and test name.
+  const testing::TestInfo* test_info = ::testing::UnitTest::GetInstance()->current_test_info();
+  int ret = jio_snprintf(_filename, sizeof(_filename), "%s%stestlog.pid%d.%s.%s.log",
+                         os::get_temp_directory(), os::file_separator(), os::current_process_id(),
+                         test_info->test_case_name(), test_info->name());
   EXPECT_GT(ret, 0) << "_filename buffer issue";
   TestLogFileName = _filename;
 
--- a/test/hotspot/gtest/logging/logTestUtils.inline.hpp	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/gtest/logging/logTestUtils.inline.hpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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
@@ -88,6 +88,30 @@
   guarantee(success, "Failed to disable logging to file '%s'", filename);
 }
 
+static const char* tmp_dir = os::get_temp_directory();
+static const char* file_sep = os::file_separator();
+
+// Prepend filename with the temp directory and pid and return the result as a
+// resource allocated string.
+static inline char* prepend_temp_dir(const char* filename) {
+  size_t temp_file_len = strlen(tmp_dir) + strlen(file_sep) + strlen(filename) + 28;
+  char* temp_file = NEW_RESOURCE_ARRAY(char, temp_file_len);
+  int ret = jio_snprintf(temp_file, temp_file_len, "%s%spid%d.%s",
+                         tmp_dir, file_sep,
+                         os::current_process_id(), filename);
+  return temp_file;
+}
+
+// Prepend filename with specified prefix and the temp directory and return the
+// result as a malloc allocated string.  This is used by test_logFileOutput.cpp.
+static inline char* prepend_prefix_temp_dir(const char* prefix, const char* filename) {
+  size_t temp_file_len = strlen(prefix) + strlen(tmp_dir) + strlen(file_sep) + strlen(filename) + 1;
+  char* temp_file = (char*)os::malloc(temp_file_len, mtLogging);
+  int ret = jio_snprintf(temp_file, temp_file_len, "%s%s%s%s",
+                         prefix, tmp_dir, file_sep, filename);
+  return temp_file;
+}
+
 // Read a complete line from fp and return it as a resource allocated string.
 // Returns NULL on EOF.
 static inline char* read_line(FILE* fp) {
--- a/test/hotspot/gtest/logging/test_logConfiguration.cpp	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/gtest/logging/test_logConfiguration.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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
@@ -403,16 +403,15 @@
 
   // Make sure prefixes are ignored when used within quotes
   // (this should create a log with "file=" in its filename)
-  int ret = jio_snprintf(buf, sizeof(buf), "\"file=%s\"", TestLogFileName);
-  ASSERT_NE(-1, ret);
-  set_log_config(buf, "logging=trace");
+  // Note that the filename cannot contain directories because
+  // it is being prefixed with "file=".
+  const char* leafFileName = "\"file=leaf_file_name\"";
+  set_log_config(leafFileName, "logging=trace");
   EXPECT_TRUE(is_described("#3: ")) << "prefix within quotes not ignored as it should be";
-  set_log_config(buf, "all=off");
+  set_log_config(leafFileName, "all=off");
 
   // Remove the extra log file created
-  ret = jio_snprintf(buf, sizeof(buf), "file=%s", TestLogFileName);
-  ASSERT_NE(-1, ret);
-  delete_file(buf);
+  delete_file("file=leaf_file_name");
 }
 
 static size_t count_occurrences(const char* haystack, const char* needle) {
--- a/test/hotspot/gtest/logging/test_logFileOutput.cpp	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/gtest/logging/test_logFileOutput.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, 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
@@ -31,7 +31,7 @@
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/ostream.hpp"
 
-static const char* name = "file=testlog.pid%p.%t.log";
+static const char* name = prepend_prefix_temp_dir("file=", "testlog.pid%p.%t.log");
 
 // Test parsing a bunch of valid file output options
 TEST_VM(LogFileOutput, parse_valid) {
@@ -46,11 +46,6 @@
 
   // Override LogOutput's vm_start time to get predictable file name
   LogFileOutput::set_file_name_parameters(0);
-  char expected_filename[1 * K];
-  int ret = jio_snprintf(expected_filename, sizeof(expected_filename),
-                         "testlog.pid%d.1970-01-01_01-00-00.log",
-                         os::current_process_id());
-  ASSERT_GT(ret, 0) << "Buffer too small";
 
   for (size_t i = 0; i < ARRAY_SIZE(valid_options); i++) {
     ResourceMark rm;
@@ -60,8 +55,8 @@
       EXPECT_STREQ(name, fo.name());
       EXPECT_TRUE(fo.initialize(valid_options[i], &ss))
         << "Did not accept valid option(s) '" << valid_options[i] << "': " << ss.as_string();
+      remove(fo.cur_log_file_name());
     }
-    remove(expected_filename);
   }
 }
 
@@ -105,11 +100,11 @@
 }
 
 TEST_VM(LogFileOutput, startup_rotation) {
+  ResourceMark rm;
   const size_t rotations = 5;
-  const char* filename = "start-rotate-test";
+  const char* filename = prepend_temp_dir("start-rotate-test");
   char* rotated_file[rotations];
 
-  ResourceMark rm;
   for (size_t i = 0; i < rotations; i++) {
     size_t len = strlen(filename) + 3;
     rotated_file[i] = NEW_RESOURCE_ARRAY(char, len);
@@ -142,8 +137,9 @@
 }
 
 TEST_VM(LogFileOutput, startup_truncation) {
-  const char* filename = "start-truncate-test";
-  const char* archived_filename = "start-truncate-test.0";
+  ResourceMark rm;
+  const char* filename = prepend_temp_dir("start-truncate-test");
+  const char* archived_filename = prepend_temp_dir("start-truncate-test.0");
 
   delete_file(filename);
   delete_file(archived_filename);
--- a/test/hotspot/gtest/logging/test_logMessageTest.cpp	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/gtest/logging/test_logMessageTest.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -39,6 +39,8 @@
   ~LogMessageTest();
 };
 
+Log(logging) LogMessageTest::_log;
+
 const char* LogMessageTest::_level_filename[] = {
   NULL, // LogLevel::Off
 #define LOG_LEVEL(name, printname) "multiline-" #printname ".log",
--- a/test/hotspot/gtest/logging/test_logTagSetDescriptions.cpp	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/gtest/logging/test_logTagSetDescriptions.cpp	Wed Feb 20 14:01:37 2019 -0500
@@ -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
@@ -48,7 +48,8 @@
 }
 
 TEST_VM(LogTagSetDescriptions, command_line_help) {
-  const char* filename = "logtagset_descriptions";
+  ResourceMark rm;
+  const char* filename = prepend_temp_dir("logtagset_descriptions");
   FILE* fp = fopen(filename, "w+");
   ASSERT_NE((void*)NULL, fp);
   fileStream stream(fp);
--- a/test/hotspot/jtreg/ProblemList.txt	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/ProblemList.txt	Wed Feb 20 14:01:37 2019 -0500
@@ -81,6 +81,7 @@
 # :hotspot_runtime
 
 runtime/handshake/HandshakeWalkSuspendExitTest.java 8214174 generic-all
+runtime/NMT/CheckForProperDetailStackTrace.java 8218458 generic-all
 runtime/SharedArchiveFile/SASymbolTableTest.java 8193639 solaris-all
 
 #############################################################################
@@ -188,7 +189,7 @@
 vmTestbase/vm/mlvm/meth/stress/gc/callSequencesDuringGC/Test.java 8058176 generic-all
 vmTestbase/vm/mlvm/meth/stress/java/sequences/Test.java 8058176 generic-all
 vmTestbase/vm/mlvm/meth/stress/jdi/breakpointInCompiledCode/Test.java 8058176 generic-all
-vmTestbase/vm/mlvm/mixed/stress/java/findDeadlock/TestDescription.java 8208278 generic-all
+vmTestbase/vm/mlvm/mixed/stress/java/findDeadlock/TestDescription.java 8208278 macosx-all
 vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2none_a/TestDescription.java 8013267 generic-all
 vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2manyDiff_b/TestDescription.java 8013267 generic-all
 vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2manySame_b/TestDescription.java 8013267 generic-all
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/c1/TestGotoIf.jasm	Wed Feb 20 14:01:37 2019 -0500
@@ -0,0 +1,171 @@
+/*
+ * 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.
+ *
+ */
+
+public class compiler/c1/TestGotoIf version 52:0 {
+    public Field f1:"I";
+    public Field f2:"I";
+    public static Field i:"I";
+
+    Method "<init>":"()V" stack 1 locals 1 {
+        aload_0;
+        invokespecial Method java/lang/Object."<init>":"()V";
+        return;
+    }
+
+    public Method test1:"()I" stack 3 locals 1 {
+        aload_0;
+        getfield Field f1:"I";
+        aload_0;
+        getfield Field f2:"I";
+        iconst_1;
+        isub;
+        // Without the fix, if got eliminated by CEE
+        if_icmpgt Null;
+        iconst_1;
+      Return: stack_frame_type stack1;
+      stack_map int;
+        ireturn;
+      Null: stack_frame_type same;
+        iconst_0;
+        goto Return; // Backbranch (t_goto) with safepoint
+    }
+
+    public Method test2:"()I" stack 3 locals 1 {
+        aload_0;
+        getfield Field f1:"I";
+        aload_0;
+        getfield Field f2:"I";
+        iconst_1;
+        isub;
+        goto Skip;
+      Return: stack_frame_type full;
+      stack_map int;
+        ireturn;
+      Skip: stack_frame_type full;
+      stack_map int, int;
+        // Without the fix, if got eliminated by CEE
+        if_icmpgt Null;
+        iconst_1;
+        goto Return; // Backbranch (f_goto) with safepoint
+      Null: stack_frame_type full;
+      stack_map;
+        iconst_0;
+        goto Return; // Backbranch (t_goto) with safepoint
+    }
+
+    public Method test3:"()I" stack 3 locals 1 {
+        aload_0;
+        getfield Field f1:"I";
+        aload_0;
+        getfield Field f2:"I";
+        iconst_1;
+        isub;
+        goto Skip;
+      Return: stack_frame_type full;
+      stack_map int;
+        ireturn;
+      Null: stack_frame_type full;
+      stack_map;
+        iconst_0;
+        goto Return; // Backbranch (t_goto) with safepoint
+      Skip: stack_frame_type full;
+      stack_map int, int;
+        // If will be eliminated by CEE
+        if_icmpgt Null; // Backbranch (if) with safepoint
+        iconst_1;
+        goto Return; // Backbranch (f_goto) with safepoint
+    }
+
+    public Method test4:"()I" stack 3 locals 1 {
+        aload_0;
+        getfield Field f1:"I";
+        aload_0;
+        getfield Field f2:"I";
+        iconst_1;
+        isub;
+        goto Skip;
+      Null: stack_frame_type full;
+      stack_map;
+        iconst_0;
+      Return: stack_frame_type full;
+      stack_map int;
+        ireturn; 
+      Skip: stack_frame_type full;
+      stack_map int, int;
+        // If will be eliminated by CEE
+        if_icmpgt Null; // Backbranch (if) with safepoint
+        iconst_1;
+        goto Return; // Backbranch (f_goto) with safepoint
+    }
+
+    public Method test5:"()I" stack 3 locals 2 {
+        aload_0;
+        getfield Field f1:"I";
+        aload_0;
+        getfield Field f2:"I";
+        iconst_1;
+        isub;
+        goto Skip;
+      Null: stack_frame_type full;
+      stack_map;
+        iconst_0;
+        goto Return;
+      Skip: stack_frame_type full;
+      stack_map int, int;
+        // If will be eliminated by CEE
+        if_icmpgt Null; // Backbranch (if) with safepoint
+        iconst_1;
+      Return: stack_frame_type full;
+      stack_map int;
+        ireturn; 
+    }
+
+    public Method test6:"()I" stack 4 locals 1 {
+        getstatic Field i:"I";
+      Loop: stack_frame_type full;
+      stack_map int;
+        // Decrement i and exit loop if < 0
+        iconst_0;
+        getstatic Field i:"I";
+        iconst_1;
+        isub;
+        dup;
+        putstatic Field i:"I";
+        if_icmpgt Exit;
+
+        iconst_1;
+        // Without the fix, if got eliminated by CEE
+        if_icmpgt Null;
+        iconst_1;
+        goto Loop; // Backbranch (f_goto) with safepoint
+      Null: stack_frame_type same;
+        iconst_0;
+        goto Loop; // Backbranch (t_goto) with safepoint
+
+      Exit: stack_frame_type full;
+      stack_map int;
+        iconst_0;
+        ireturn; 
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/c1/TestGotoIfMain.java	Wed Feb 20 14:01:37 2019 -0500
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8218721
+ * @compile TestGotoIf.jasm
+ * @run main/othervm -XX:TieredStopAtLevel=1 -Xcomp
+ *                   -XX:CompileCommand=compileonly,compiler.c1.TestGotoIf::test*
+ *                   compiler.c1.TestGotoIfMain
+ */
+
+package compiler.c1;
+
+public class TestGotoIfMain {
+    public static void main(String[] args) {
+        TestGotoIf test = new TestGotoIf();
+        test.i = 5;
+        test.test1();
+        test.test2();
+        test.test3();
+        test.test4();
+        test.test5();
+        test.test6();
+    }
+}
--- a/test/hotspot/jtreg/compiler/linkage/TestLinkageErrorInGenerateOopMap.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/compiler/linkage/TestLinkageErrorInGenerateOopMap.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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
@@ -42,7 +42,9 @@
     public static void main(String args[]) throws Exception {
         if (args.length == 0) {
             // Spawn new VM instance to execute test
-            String[] flags = {"-noverify", "-XX:-TieredCompilation",
+            String[] flags = {"-XX:-BytecodeVerificationRemote",
+                              "-XX:-BytecodeVerificationLocal",
+                              "-XX:-TieredCompilation",
                               "-XX:CompileCommand=dontinline,compiler/linkage/OSRWithBadOperandStack.m*",
                               "compiler.linkage.TestLinkageErrorInGenerateOopMap", "run"};
             ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(flags);
--- a/test/hotspot/jtreg/gc/arguments/TestMaxNewSize.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/gc/arguments/TestMaxNewSize.java	Wed Feb 20 14:01:37 2019 -0500
@@ -120,19 +120,16 @@
 
   public static void main(String args[]) throws Exception {
     String gcName = args[0];
-    final int M32 = 32 * 1024 * 1024;
-    final int M64 = 64 * 1024 * 1024;
-    final int M96 = 96 * 1024 * 1024;
-    final int M128 = 128 * 1024 * 1024;
-    checkMaxNewSize(new String[] { gcName, "-Xmx128M" }, M128);
-    checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewRatio=5" }, M128);
-    checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewSize=32M" }, M128);
-    checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:OldSize=96M" }, M128);
-    checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:MaxNewSize=32M" }, M32);
-    checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewSize=32M", "-XX:MaxNewSize=32M" }, M32);
-    checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewRatio=6", "-XX:MaxNewSize=32M" }, M32);
-    checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-Xms96M" }, M128);
-    checkMaxNewSize(new String[] { gcName, "-Xmx96M", "-Xms96M" }, M96);
-    checkMaxNewSize(new String[] { gcName, "-XX:NewSize=128M", "-XX:MaxNewSize=50M"}, M128);
+    final int M = 1024 * 1024;
+    checkMaxNewSize(new String[] { gcName, "-Xmx128M" }, 128 * M);
+    checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewRatio=5" }, 128 * M);
+    checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewSize=32M" }, 128 * M);
+    checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:OldSize=96M" }, 128 * M);
+    checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:MaxNewSize=32M" }, 32 * M);
+    checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewSize=32M", "-XX:MaxNewSize=32M" }, 32 * M);
+    checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewRatio=6", "-XX:MaxNewSize=32M" }, 32 * M);
+    checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-Xms96M" }, 128 * M);
+    checkMaxNewSize(new String[] { gcName, "-Xmx96M", "-Xms96M" }, 96 * M);
+    checkMaxNewSize(new String[] { gcName, "-XX:NewSize=128M", "-XX:MaxNewSize=50M"}, 128 * M);
   }
 }
--- a/test/hotspot/jtreg/gc/arguments/TestTargetSurvivorRatioFlag.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/gc/arguments/TestTargetSurvivorRatioFlag.java	Wed Feb 20 14:01:37 2019 -0500
@@ -23,6 +23,8 @@
 
 package gc.arguments;
 
+import static java.lang.ref.Reference.reachabilityFence;
+
 /*
  * @test TestTargetSurvivorRatioFlag
  * @key gc
@@ -297,7 +299,7 @@
 
             // force minor GC
             while (youngGCBean.getCollectionCount() <= initialGcId + MAX_TENURING_THRESHOLD * 2) {
-                byte b[] = new byte[ARRAY_LENGTH];
+                reachabilityFence(new byte[ARRAY_LENGTH]);
             }
 
             allocator.release();
--- a/test/hotspot/jtreg/gc/cms/DisableResizePLAB.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/gc/cms/DisableResizePLAB.java	Wed Feb 20 14:01:37 2019 -0500
@@ -23,6 +23,8 @@
 
 package gc.cms;
 
+import static java.lang.ref.Reference.reachabilityFence;
+
 /*
  * @test DisableResizePLAB
  * @key gc
@@ -41,7 +43,7 @@
         }
         long startTime = System.currentTimeMillis();
         while (System.currentTimeMillis() - startTime < 10_000) {
-            Object o = new byte[1024];
+            reachabilityFence(new byte[1024]);
         }
     }
 }
--- a/test/hotspot/jtreg/gc/cslocker/TestCSLocker.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/gc/cslocker/TestCSLocker.java	Wed Feb 20 14:01:37 2019 -0500
@@ -23,6 +23,8 @@
 
 package gc.cslocker;
 
+import static java.lang.ref.Reference.reachabilityFence;
+
 /*
  * @test TestCSLocker
  * @key gc
@@ -73,8 +75,7 @@
 
         while (isRunning) {
             try {
-                int[] arr = null;
-                arr = new int[size];
+                reachabilityFence(new int[size]);
                 sleep(sleepTime);
             } catch (InterruptedException e) {
                 isRunning = false;
--- a/test/hotspot/jtreg/gc/epsilon/TestMemoryMXBeans.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/gc/epsilon/TestMemoryMXBeans.java	Wed Feb 20 14:01:37 2019 -0500
@@ -57,8 +57,8 @@
         MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();
         long heapInit = memoryMXBean.getHeapMemoryUsage().getInit();
         long heapMax = memoryMXBean.getHeapMemoryUsage().getMax();
-        long nonHeapInit = memoryMXBean.getNonHeapMemoryUsage().getInit();
-        long nonHeapMax = memoryMXBean.getNonHeapMemoryUsage().getMax();
+        memoryMXBean.getNonHeapMemoryUsage().getInit(); // value not used
+        memoryMXBean.getNonHeapMemoryUsage().getMax();  // value not used
 
         if (initSize > 0 && heapInit != initSize) {
             throw new IllegalStateException("Init heap size is wrong: " + heapInit + " vs " + initSize);
--- a/test/hotspot/jtreg/gc/g1/TestFromCardCacheIndex.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/gc/g1/TestFromCardCacheIndex.java	Wed Feb 20 14:01:37 2019 -0500
@@ -130,7 +130,7 @@
             if (target == null) {
                 continue;
             }
-            final long startAddress = WB.getObjectAddress(target);
+            WB.getObjectAddress(target); // startAddress not used
             final long lastAddress = getObjectLastAddress(target);
             final int card = getCardIndex32bit(lastAddress);
             if (card == -1) {
--- a/test/hotspot/jtreg/gc/g1/TestGCLogMessages.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/gc/g1/TestGCLogMessages.java	Wed Feb 20 14:01:37 2019 -0500
@@ -100,12 +100,16 @@
         new LogMessageWithLevel("Processed Buffers", Level.DEBUG),
         new LogMessageWithLevel("Scanned Cards", Level.DEBUG),
         new LogMessageWithLevel("Skipped Cards", Level.DEBUG),
-        new LogMessageWithLevel("Scan HCC", Level.TRACE),
+        new LogMessageWithLevel("Scan HCC", Level.DEBUG),
         // Scan RS
         new LogMessageWithLevel("Scan RS", Level.DEBUG),
         new LogMessageWithLevel("Scanned Cards", Level.DEBUG),
         new LogMessageWithLevel("Claimed Cards", Level.DEBUG),
         new LogMessageWithLevel("Skipped Cards", Level.DEBUG),
+        // Object Copy
+        new LogMessageWithLevel("Object Copy", Level.DEBUG),
+        new LogMessageWithLevel("Scanned Cards", Level.DEBUG),
+        new LogMessageWithLevel("Claimed Cards", Level.DEBUG),
         // Ext Root Scan
         new LogMessageWithLevel("Thread Roots", Level.TRACE),
         new LogMessageWithLevel("Universe Roots", Level.TRACE),
--- a/test/hotspot/jtreg/gc/g1/TestHumongousAllocNearlyFullRegion.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/gc/g1/TestHumongousAllocNearlyFullRegion.java	Wed Feb 20 14:01:37 2019 -0500
@@ -23,6 +23,8 @@
 
 package gc.g1;
 
+import static java.lang.ref.Reference.reachabilityFence;
+
 /*
  * @test TestHumongousAllocNearlyFullRegion
  * @bug 8143587
@@ -62,7 +64,7 @@
             for (int i = 0; i < heapSize; i++) {
                 // 131069 is the number of longs it takes to fill a heapRegion except
                 // for 8 bytes on 64 bit.
-                long[] largeObect = new long[131069];
+                reachabilityFence(new long[131069]);
             }
         }
     }
--- a/test/hotspot/jtreg/gc/g1/TestRemsetLoggingThreads.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/gc/g1/TestRemsetLoggingThreads.java	Wed Feb 20 14:01:37 2019 -0500
@@ -54,10 +54,6 @@
 
     OutputAnalyzer output = new OutputAnalyzer(pb.start());
 
-    // a zero in refinement thread numbers indicates that the value in ParallelGCThreads should be used.
-    // Additionally use at least one thread.
-    int expectedNumRefinementThreads = refinementThreads;
-
     String pattern = "Concurrent RS threads times \\(s\\)$";
     Matcher m = Pattern.compile(pattern, Pattern.MULTILINE).matcher(output.getStdout());
 
--- a/test/hotspot/jtreg/gc/g1/humongousObjects/TestHumongousClassLoader.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/gc/g1/humongousObjects/TestHumongousClassLoader.java	Wed Feb 20 14:01:37 2019 -0500
@@ -156,6 +156,7 @@
         URLClassLoader urlLoader = new URLClassLoader(url);
 
         Class<?> simpleClassLoaderClass = urlLoader.loadClass(SIMPLE_CLASSLOADER_NAME);
+        urlLoader.close();
 
         ClassLoader simpleClassLoader = (ClassLoader) simpleClassLoaderClass
                 .getConstructor(java.lang.ClassLoader.class)
--- a/test/hotspot/jtreg/gc/g1/humongousObjects/TestNoAllocationsInHRegions.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/gc/g1/humongousObjects/TestNoAllocationsInHRegions.java	Wed Feb 20 14:01:37 2019 -0500
@@ -26,6 +26,8 @@
 import jdk.test.lib.Utils;
 import sun.hotspot.WhiteBox;
 
+import static java.lang.ref.Reference.reachabilityFence;
+
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Random;
@@ -139,7 +141,7 @@
                     // Dead object allocation
                     () -> {
                         int size = RND.nextInt(DEAD_OBJECT_MAX_SIZE);
-                        byte[] deadObject = new byte[size];
+                        reachabilityFence(new byte[size]);
                     },
 
                     // Check
--- a/test/hotspot/jtreg/gc/g1/plab/lib/LogParser.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/gc/g1/plab/lib/LogParser.java	Wed Feb 20 14:01:37 2019 -0500
@@ -95,36 +95,37 @@
     }
 
     private PlabReport parseLines() throws NumberFormatException {
-        Scanner lineScanner = new Scanner(log);
-        PlabReport plabReport = new PlabReport();
-        Optional<Long> gc_id;
-        while (lineScanner.hasNextLine()) {
-            String line = lineScanner.nextLine();
-            gc_id = getGcId(line, GC_ID_PATTERN);
-            if (gc_id.isPresent()) {
-                Matcher matcher = PAIRS_PATTERN.matcher(line);
-                if (matcher.find()) {
-                    if (!plabReport.containsKey(gc_id.get())) {
-                        plabReport.put(gc_id.get(), new PlabGCStatistics());
+        try (Scanner lineScanner = new Scanner(log)) {
+            PlabReport plabReport = new PlabReport();
+            Optional<Long> gc_id;
+            while (lineScanner.hasNextLine()) {
+                String line = lineScanner.nextLine();
+                gc_id = getGcId(line, GC_ID_PATTERN);
+                if (gc_id.isPresent()) {
+                    Matcher matcher = PAIRS_PATTERN.matcher(line);
+                    if (matcher.find()) {
+                        if (!plabReport.containsKey(gc_id.get())) {
+                            plabReport.put(gc_id.get(), new PlabGCStatistics());
+                        }
+                        ReportType reportType = line.contains("Young") ? ReportType.SURVIVOR_STATS : ReportType.OLD_STATS;
+
+                        PlabGCStatistics gcStat = plabReport.get(gc_id.get());
+                        if (!gcStat.containsKey(reportType)) {
+                            gcStat.put(reportType, new PlabInfo());
+                        }
+
+                        // Extract all pairs from log.
+                        PlabInfo plabInfo = gcStat.get(reportType);
+                        do {
+                            String pair = matcher.group();
+                            String[] nameValue = pair.replaceAll(": ", ":").split(":");
+                            plabInfo.put(nameValue[0].trim(), Long.parseLong(nameValue[1]));
+                        } while (matcher.find());
                     }
-                    ReportType reportType = line.contains("Young") ? ReportType.SURVIVOR_STATS : ReportType.OLD_STATS;
-
-                    PlabGCStatistics gcStat = plabReport.get(gc_id.get());
-                    if (!gcStat.containsKey(reportType)) {
-                        gcStat.put(reportType, new PlabInfo());
-                    }
-
-                    // Extract all pairs from log.
-                    PlabInfo plabInfo = gcStat.get(reportType);
-                    do {
-                        String pair = matcher.group();
-                        String[] nameValue = pair.replaceAll(": ", ":").split(":");
-                        plabInfo.put(nameValue[0].trim(), Long.parseLong(nameValue[1]));
-                    } while (matcher.find());
                 }
             }
+            return plabReport;
         }
-        return plabReport;
     }
 
     private static Optional<Long> getGcId(String line, Pattern pattern) {
--- a/test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java	Wed Feb 20 14:01:37 2019 -0500
@@ -27,7 +27,6 @@
 import java.io.File;
 import java.net.URL;
 import java.net.URLClassLoader;
-import java.util.function.Predicate;
 import java.util.regex.Pattern;
 import java.util.regex.Matcher;
 
@@ -67,8 +66,6 @@
   }
 
   private static void verifyContainsMetaSpaceUpdate(OutputAnalyzer output) {
-    Predicate<String> collectedMetaSpace = line -> check(line);
-
     // At least one metaspace line from GC should show GC being collected.
     boolean foundCollectedMetaSpace = output.asLines().stream()
         .filter(s -> s.contains("[gc,metaspace"))
--- a/test/hotspot/jtreg/gc/logging/TestPrintReferences.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/gc/logging/TestPrintReferences.java	Wed Feb 20 14:01:37 2019 -0500
@@ -131,7 +131,6 @@
 
     // Find the first Reference Processing log and check its format.
     private static void checkLogFormat(OutputAnalyzer output, boolean parallelRefProcEnabled) {
-        String countRegex = "[0-9]+";
         String timeRegex = doubleRegex + "ms";
 
         /* Total Reference processing time */
--- a/test/hotspot/jtreg/gc/logging/TestUnifiedLoggingSwitchStress.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/gc/logging/TestUnifiedLoggingSwitchStress.java	Wed Feb 20 14:01:37 2019 -0500
@@ -31,6 +31,9 @@
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 import javax.management.ReflectionException;
+
+import static java.lang.ref.Reference.reachabilityFence;
+
 import java.lang.management.ManagementFactory;
 import java.util.LinkedList;
 import java.util.List;
@@ -128,7 +131,7 @@
             // Dead object allocation
             () -> {
                 int size = RND.nextInt(DEAD_OBJECT_MAX_SIZE);
-                byte[] deadObject = new byte[size];
+                reachabilityFence(new byte[size]);
             }
     };
 
--- a/test/hotspot/jtreg/gc/metaspace/G1AddMetaspaceDependency.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/gc/metaspace/G1AddMetaspaceDependency.java	Wed Feb 20 14:01:37 2019 -0500
@@ -111,13 +111,12 @@
     Loader f_loader = new Loader(b_name, b_bytes, a_name, a_loader);
     Loader g_loader = new Loader(b_name, b_bytes, a_name, a_loader);
 
-    Class<?> c;
-    c = b_loader.loadClass(b_name);
-    c = c_loader.loadClass(b_name);
-    c = d_loader.loadClass(b_name);
-    c = e_loader.loadClass(b_name);
-    c = f_loader.loadClass(b_name);
-    c = g_loader.loadClass(b_name);
+    b_loader.loadClass(b_name);
+    c_loader.loadClass(b_name);
+    d_loader.loadClass(b_name);
+    e_loader.loadClass(b_name);
+    f_loader.loadClass(b_name);
+    g_loader.loadClass(b_name);
   }
   public class A {
   }
--- a/test/hotspot/jtreg/gc/metaspace/TestMetaspaceInitialization.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/gc/metaspace/TestMetaspaceInitialization.java	Wed Feb 20 14:01:37 2019 -0500
@@ -33,6 +33,7 @@
  */
 public class TestMetaspaceInitialization {
     private class Internal {
+        @SuppressWarnings("unused")
         public int x;
         public Internal(int x) {
             this.x = x;
--- a/test/hotspot/jtreg/gc/stress/gcbasher/Decompiler.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/gc/stress/gcbasher/Decompiler.java	Wed Feb 20 14:01:37 2019 -0500
@@ -132,7 +132,7 @@
                             byteCodeIndex++;
                         }
 
-                        int def = cursor.readIntAt(byteCodeIndex);
+                        cursor.readIntAt(byteCodeIndex); // def
                         byteCodeIndex +=4;
 
                         int npairs = cursor.readIntAt(byteCodeIndex);
@@ -149,7 +149,7 @@
                             byteCodeIndex++;
                         }
 
-                        int def = cursor.readIntAt(byteCodeIndex);
+                        cursor.readIntAt(byteCodeIndex); // def
                         byteCodeIndex +=4;
 
                         int low = cursor.readIntAt(byteCodeIndex);
@@ -245,7 +245,7 @@
 
     private ConstantPoolEntry[] decodeConstantPool() {
         final int CONSTANT_Utf8 = 1;
-        final int CONSTANT_Unicode = 2;
+        // final int CONSTANT_Unicode = 2;
         final int CONSTANT_Integer = 3;
         final int CONSTANT_Float = 4;
         final int CONSTANT_Long = 5;
--- a/test/hotspot/jtreg/gc/stress/gcbasher/TestGCBasher.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/gc/stress/gcbasher/TestGCBasher.java	Wed Feb 20 14:01:37 2019 -0500
@@ -38,14 +38,15 @@
         HashMap<String, ClassInfo> deps = new HashMap<>();
 
         FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
-        Stream<Path> s = Files.walk(fs.getPath("/"));
-        for (Path p : (Iterable<Path>)s::iterator) {
-            if (p.toString().endsWith(".class") &&
-                !p.getFileName().toString().equals("module-info.class")) {
-                byte[] data = Files.readAllBytes(p);
-                Decompiler d = new Decompiler(data);
-                ClassInfo ci = d.getClassInfo();
-                deps.put(ci.getName(), ci);
+        try (Stream<Path> s = Files.walk(fs.getPath("/"))) {
+            for (Path p : (Iterable<Path>)s::iterator) {
+                if (p.toString().endsWith(".class") &&
+                    !p.getFileName().toString().equals("module-info.class")) {
+                    byte[] data = Files.readAllBytes(p);
+                    Decompiler d = new Decompiler(data);
+                    ClassInfo ci = d.getClassInfo();
+                    deps.put(ci.getName(), ci);
+                }
             }
         }
     }
--- a/test/hotspot/jtreg/runtime/Nestmates/privateMethods/TestInvokeErrors.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/runtime/Nestmates/privateMethods/TestInvokeErrors.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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
@@ -32,7 +32,7 @@
  *          MissingMethodWithSuper.jcod
  *          MissingNestHost.jcod
  * @run main TestInvokeErrors true
- * @run main/othervm -Xverify:none TestInvokeErrors false
+ * @run main/othervm -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal TestInvokeErrors false
  */
 
 public class TestInvokeErrors {
--- a/test/hotspot/jtreg/runtime/appcds/VerifierTest.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/runtime/appcds/VerifierTest.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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
@@ -38,7 +38,7 @@
     // Test verification settings for dumping & runtime
     static final String VFY_ALL = "-Xverify:all";
     static final String VFY_REMOTE = "-Xverify:remote"; // default
-    static final String VFY_NONE = "-Xverify:none";
+    static final String VFY_NONE = "-XX:-BytecodeVerificationRemote, -XX:-BytecodeVerificationLocal";
 
     static final String ERR =
         "ERROR: class VerifierTestC was loaded unexpectedly";
@@ -140,7 +140,7 @@
             {"app",   VFY_ALL,    VFY_REMOTE, VFY_ERR },
             {"app",   VFY_ALL,    VFY_ALL,    VFY_ERR },
             {"app",   VFY_ALL,    VFY_NONE,   ERR },
-            // Dump app/ext with -Xverify:none
+            // Dump app/ext with verifier turned off
             {"app",   VFY_NONE,   VFY_REMOTE, VFY_ERR},
             {"app",   VFY_NONE,   VFY_ALL,    MAP_FAIL},
             {"app",   VFY_NONE,   VFY_NONE,   ERR },
@@ -152,7 +152,7 @@
             {"noApp", VFY_ALL, VFY_REMOTE,    VFY_ERR},
             {"noApp", VFY_ALL, VFY_ALL,       VFY_ERR},
             {"noApp", VFY_ALL, VFY_NONE,      ERR},
-            // Dump sys only with -Xverify:none
+            // Dump sys only with verifier turned off
             {"noApp", VFY_NONE, VFY_REMOTE,   VFY_ERR},
             {"noApp", VFY_NONE, VFY_ALL,      VFY_ERR},
             {"noApp", VFY_NONE, VFY_NONE,     ERR},
@@ -186,8 +186,19 @@
                                " with " + dump_setting +
                                ", run with " + runtime_setting);
             if (!dump_setting.equals(prev_dump_setting)) {
+                String dump_arg1;
+                String dump_arg2;
+                // Need to break this into two separate arguments.
+                if (dump_setting.equals(VFY_NONE)) {
+                    dump_arg1 = "-XX:-BytecodeVerificationRemote";
+                    dump_arg2 = "-XX:-BytecodeVerificationLocal";
+                } else {
+                    // Redundant args should be harmless.
+                    dump_arg1 = dump_arg2 = dump_setting;
+                }
+
                 OutputAnalyzer dumpOutput = TestCommon.dump(
-                                                            jar, dump_list, dump_setting,
+                                                            jar, dump_list, dump_arg1, dump_arg2,
                                                             CDS_LOGGING,
                                                             // FIXME: the following options are for working around a GC
                                                             // issue - assert failure when dumping archive with the -Xverify:all
@@ -198,8 +209,17 @@
                     dumpOutput.shouldContain(VFY_INFO_MESSAGE);
                 }
             }
+            String runtime_arg1;
+            String runtime_arg2;
+            if (runtime_setting.equals(VFY_NONE)) {
+                runtime_arg1 = "-XX:-BytecodeVerificationRemote";
+                runtime_arg2 = "-XX:-BytecodeVerificationLocal";
+            } else {
+                // Redundant args should be harmless.
+                runtime_arg1 = runtime_arg2 = runtime_setting;
+            }
             TestCommon.run("-cp", jar,
-                           runtime_setting,
+                           runtime_arg1, runtime_arg2,
                            "VerifierTest0")
                 .ifNoMappingFailure(output -> checkRuntimeOutput(output, expected_output_str));
             prev_dump_setting = dump_setting;
@@ -229,7 +249,7 @@
             {"app",   VFY_ALL,    VFY_REMOTE, PASS_RESULT },
             {"app",   VFY_ALL,    VFY_ALL,    PASS_RESULT },
             {"app",   VFY_ALL,    VFY_NONE,   PASS_RESULT },
-            // Dump app/ext with -Xverify:none
+            // Dump app/ext with verifier turned off
             {"app",   VFY_NONE,   VFY_REMOTE, PASS_RESULT},
             {"app",   VFY_NONE,   VFY_ALL,    MAP_FAIL},
             {"app",   VFY_NONE,   VFY_NONE,   PASS_RESULT },
@@ -244,8 +264,17 @@
                                " with " + dump_setting +
                                ", run with " + runtime_setting);
             if (!dump_setting.equals(prev_dump_setting)) {
+                String dump_arg1;
+                String dump_arg2;
+                if (dump_setting.equals(VFY_NONE)) {
+                    dump_arg1 = "-XX:-BytecodeVerificationRemote";
+                    dump_arg2 = "-XX:-BytecodeVerificationLocal";
+                } else {
+                    // Redundant args should be harmless.
+                    dump_arg1 = dump_arg2 = dump_setting;
+                }
                 OutputAnalyzer dumpOutput = TestCommon.dump(
-                                                            jar, appClasses, dump_setting,
+                                                            jar, appClasses, dump_arg1, dump_arg2,
                                                             CDS_LOGGING,
                                                             // FIXME: the following options are for working around a GC
                                                             // issue - assert failure when dumping archive with the -Xverify:all
@@ -256,8 +285,17 @@
                     dumpOutput.shouldContain(VFY_INFO_MESSAGE);
                 }
             }
+            String runtime_arg1;
+            String runtime_arg2;
+            if (runtime_setting.equals(VFY_NONE)) {
+                runtime_arg1 = "-XX:-BytecodeVerificationRemote";
+                runtime_arg2 = "-XX:-BytecodeVerificationLocal";
+            } else {
+                // Redundant args should be harmless.
+                runtime_arg1 = runtime_arg2 = runtime_setting;
+            }
             TestCommon.run("-cp", jar,
-                           runtime_setting,
+                           runtime_arg1, runtime_arg2,
                            "Hi")
                 .ifNoMappingFailure(output -> checkRuntimeOutput(output, expected_output_str));
            prev_dump_setting = dump_setting;
--- a/test/hotspot/jtreg/runtime/clone/invokevirtual/HasLocalClone.jasm	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/HasLocalClone.jasm	Wed Feb 20 14:01:37 2019 -0500
@@ -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
@@ -28,7 +28,7 @@
  * @summary Check that invokevirtual of clone() finds the clone() method that
  *          is local to the calling class.
  * @compile DefMethClone.jasm SuperClass.jasm I1.java HasLocalClone.jasm
- * @run main/othervm -noverify HasLocalClone
+ * @run main/othervm -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal HasLocalClone
  */
 
 // The below .jasm code implements the following java code:
--- a/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalClone.jasm	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalClone.jasm	Wed Feb 20 14:01:37 2019 -0500
@@ -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
@@ -28,7 +28,7 @@
  * @summary Check that invokevirtual of clone() calls java.lang.Object.clone()
  *          even if a superinterface has a default method named clone().
  * @compile DefMethClone.jasm SuperClass.jasm I1.java NoLocalClone.jasm
- * @run main/othervm -noverify NoLocalClone
+ * @run main/othervm -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal NoLocalClone
  */
 
 // The below .jasm code implements the following java code:
--- a/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalCloneAbstr.jasm	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalCloneAbstr.jasm	Wed Feb 20 14:01:37 2019 -0500
@@ -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
@@ -28,7 +28,7 @@
  * @summary Check that invokevirtual of clone() calls java.lang.Object.clone()
  *          even if a superinterface has an abstract method named clone().
  * @compile DefMethClone.jasm SuperClass.jasm I1Abstr.java NoLocalCloneAbstr.jasm
- * @run main/othervm -noverify NoLocalCloneAbstr
+ * @run main/othervm -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal NoLocalCloneAbstr
  */
 
 // The below .jasm code implements the following java code:
--- a/test/hotspot/jtreg/runtime/lambda-features/TestStaticandInstance.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/runtime/lambda-features/TestStaticandInstance.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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.
  * 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,7 +26,7 @@
  * @bug 8087342
  * @summary Test linkresolver search static, instance and overpass duplicates
  * @modules java.base/jdk.internal.org.objectweb.asm
- * @run main/othervm -Xverify:none TestStaticandInstance
+ * @run main/othervm -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal TestStaticandInstance
  */
 
 
@@ -94,7 +94,7 @@
   default int q() { return 3; } // trigger defmeth processing: C gets AME overpass
 }
 
-// C gets static, private and AME overpass m()I with -Xverify:none
+// C gets static, private and AME overpass m()I with the verifier turned off
 class C implements I {
   static int m() { return 1;}  // javac with "n()" and patch to "m()"
   private int m() { return 2;} // javac with public and patch to private
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbJhisto.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbJhisto.java	Wed Feb 20 14:01:37 2019 -0500
@@ -36,7 +36,6 @@
  * @summary Test clhsdb jhisto command
  * @requires vm.hasSA
  * @requires vm.gc != "Shenandoah"
- * @requires vm.gc != "Z"
  * @library /test/lib
  * @run main/othervm ClhsdbJhisto
  */
--- a/test/hotspot/jtreg/serviceability/sa/TestHeapDumpForInvokeDynamic.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/serviceability/sa/TestHeapDumpForInvokeDynamic.java	Wed Feb 20 14:01:37 2019 -0500
@@ -50,7 +50,6 @@
  * @test
  * @library /test/lib
  * @requires vm.hasSAandCanAttach & os.family != "mac"
- * @requires vm.gc != "Z"
  * @modules java.base/jdk.internal.misc
  *          jdk.hotspot.agent/sun.jvm.hotspot
  *          jdk.hotspot.agent/sun.jvm.hotspot.utilities
--- a/test/hotspot/jtreg/serviceability/sa/TestHeapDumpForLargeArray.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/serviceability/sa/TestHeapDumpForLargeArray.java	Wed Feb 20 14:01:37 2019 -0500
@@ -48,7 +48,6 @@
  * @bug 8171084
  * @requires vm.hasSAandCanAttach & (vm.bits == "64" & os.maxMemory > 8g)
  * @requires vm.gc != "Shenandoah"
- * @requires vm.gc != "Z"
  * @modules java.base/jdk.internal.misc
  *          jdk.hotspot.agent/sun.jvm.hotspot
  *          jdk.hotspot.agent/sun.jvm.hotspot.utilities
--- a/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java	Wed Feb 20 14:01:37 2019 -0500
@@ -138,19 +138,8 @@
         if (dumpFile.exists() && dumpFile.isFile()) {
             HprofParser.parse(dumpFile);
         } else {
-            boolean ZGCUsed = false;
-
-            for (String opt: Utils.getFilteredTestJavaOpts()) {
-                if (opt.contains("+UseZGC")) {
-                    ZGCUsed = true;
-                    break;
-                }
-            }
-
-            if (!ZGCUsed) {
-                throw new RuntimeException(
-                    "Could not find dump file " + dumpFile.getAbsolutePath());
-            }
+          throw new RuntimeException(
+            "Could not find dump file " + dumpFile.getAbsolutePath());
         }
 
         System.out.println("PASSED");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdb/interrupt/interrupt001/interrupt001.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/interrupt/interrupt001/interrupt001.java	Wed Feb 20 14:01:37 2019 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2018, 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
@@ -94,7 +94,13 @@
 
     static int numThreads = nsk.jdb.interrupt.interrupt001.interrupt001a.numThreads;
 
-    private static Pattern tidPattern = Pattern.compile("(0x[0-9a-f]+)");
+    /*
+     * Pattern for finding the thread ID in a line like the following:
+     *   (nsk.jdb.interrupt.interrupt001.interrupt001a$MyThread)651 Thread-0          cond. waiting
+     * Note we can't match on DEBUGGEE_THREAD because it includes a $, which Pattern
+     * uses to match the end of a line.
+     */
+    private static Pattern tidPattern = Pattern.compile("\\(.+" + MYTHREAD + "\\)(\\S+)");
 
     protected void runCases() {
         String[] reply;
--- a/test/jdk/ProblemList.txt	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/jdk/ProblemList.txt	Wed Feb 20 14:01:37 2019 -0500
@@ -114,8 +114,6 @@
 
 # jdk_awt
 
-java/awt/BasicStroke/DashScaleMinWidth.java 8198411 windows-all
-java/awt/BasicStroke/DashZeroWidth.java 8198411 windows-all
 java/awt/event/MouseEvent/MouseClickTest/MouseClickTest.html 8168389 windows-all,macosx-all
 java/awt/Focus/ActualFocusedWindowTest/ActualFocusedWindowBlockingTest.java 8168408 windows-all,macosx-all
 java/awt/Focus/FocusOwnerFrameOnClick/FocusOwnerFrameOnClick.java 8081489 generic-all
--- a/test/jdk/TEST.groups	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/jdk/TEST.groups	Wed Feb 20 14:01:37 2019 -0500
@@ -375,7 +375,8 @@
     :jdk_swing \
     :jdk_sound \
     :jdk_imageio \
-    :jfc_demo
+    :jfc_demo \
+    :jdk_client_sanity
 
 # SwingSet3 tests.
 jdk_client_sanity = \
--- a/test/jdk/com/sun/java/swing/plaf/windows/AltFocusIssueTest.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/jdk/com/sun/java/swing/plaf/windows/AltFocusIssueTest.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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
@@ -21,13 +21,15 @@
  * questions.
  */
 
-/* @test
-   @bug 8211987
-   @requires (os.family == "windows")
-   @summary Verify if Menu bar gets input focus even if Alt-released event is consumed.
-   @modules java.desktop/com.sun.java.swing.plaf.windows
-   @run main AltFocusIssueTest
-*/
+/**
+ * @test
+ * @bug 8211987
+ * @key headful
+ * @requires (os.family == "windows")
+ * @summary Verify if Menu bar gets input focus even if Alt-released event is consumed.
+ * @modules java.desktop/com.sun.java.swing.plaf.windows
+ * @run main AltFocusIssueTest
+ */
 
 import java.awt.event.KeyAdapter;
 import java.awt.event.KeyEvent;
@@ -145,7 +147,9 @@
         try {
             testAltEvents();
         } finally {
-            SwingUtilities.invokeAndWait(() -> frame.dispose());
+            if (frame != null) {
+                SwingUtilities.invokeAndWait(() -> frame.dispose());
+            }
         }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/BasicStroke/DashOffset.java	Wed Feb 20 14:01:37 2019 -0500
@@ -0,0 +1,241 @@
+/*
+ * 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
+ * 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.
+ */
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsEnvironment;
+import java.awt.Image;
+import java.awt.image.BufferedImage;
+import java.awt.image.IndexColorModel;
+import java.awt.image.VolatileImage;
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.stream.Collectors;
+import javax.imageio.ImageIO;
+
+import static java.awt.image.BufferedImage.TYPE_INT_RGB;
+
+/*
+ * @test
+ * @bug 4469881 8217263 8218682
+ * @key headful
+ * @summary Verifies that dashed rectangles drawn to the screen line
+ *          up with their undashed counterparts
+ * @author flar
+ * @run main/othervm -Dsun.java2d.uiScale=1 DashOffset
+ */
+public class DashOffset {
+
+    private static final BasicStroke dash =
+            new BasicStroke(1.0f, BasicStroke.CAP_BUTT,
+                            BasicStroke.JOIN_MITER, 10.0f,
+                            new float[] {2.0f, 2.0f}, 0.0f);
+
+    private static final Color COLOR1 = Color.BLUE;
+    private static final Color COLOR2 = Color.GREEN;
+
+    private static final Color BACKGROUND = Color.WHITE;
+
+    private static final int WIDTH = 20;
+    private static final int HEIGHT = 20;
+
+    private static final int OFFSET = 2;
+
+    private static final int MAX_DASH_LENGTH = 3;
+
+    public static void main(String[] argv) throws Exception {
+        final boolean saveImage = argv.length > 0 && "-save".equals(argv[0]);
+
+        final BufferedImage img = new BufferedImage(WIDTH, HEIGHT,
+                                                    TYPE_INT_RGB);
+        try {
+            draw(img);
+            validate(img);
+        } finally {
+            if (saveImage) {
+                save(img, "bufferedImage.png");
+            }
+        }
+
+        BufferedImage snapshot = null;
+        try {
+            final GraphicsConfiguration gc =
+                    GraphicsEnvironment.getLocalGraphicsEnvironment()
+                                       .getDefaultScreenDevice()
+                                       .getDefaultConfiguration();
+            if (gc.getColorModel() instanceof IndexColorModel) {
+                System.err.println("Skipping VolatileImage because of IndexColorModel");
+                return;
+            }
+
+            VolatileImage vi = gc.createCompatibleVolatileImage(WIDTH, HEIGHT);
+            int attempt = 0;
+            do {
+                vi.validate(gc);
+                draw(vi);
+                snapshot = vi.getSnapshot();
+            } while (vi.contentsLost() && ++attempt <= 10);
+            if (attempt > 10) {
+                throw new RuntimeException("Too many attempts: " + attempt);
+            }
+            validate(snapshot);
+        } finally {
+            if (saveImage && snapshot != null) {
+                save(snapshot, "volatileImage.png");
+            }
+        }
+    }
+
+    private static void draw(final Image img) {
+        Graphics g = img.getGraphics();
+        g.setColor(BACKGROUND);
+        g.fillRect(0, 0, WIDTH, HEIGHT);
+        g.setColor(COLOR1);
+        g.drawRect(OFFSET, OFFSET, WIDTH - OFFSET * 2, HEIGHT - OFFSET * 2);
+        g.setColor(COLOR2);
+        g.clipRect(OFFSET, OFFSET, WIDTH - OFFSET * 2 + 1, HEIGHT - OFFSET * 2 + 1);
+        ((Graphics2D) g).setStroke(dash);
+        g.drawRect(OFFSET, OFFSET, WIDTH - OFFSET * 2, HEIGHT - OFFSET * 2);
+        g.dispose();
+    }
+
+    private static void validate(final BufferedImage img) {
+        checkHorizontalLine(img, OFFSET);
+        checkHorizontalLine(img, HEIGHT - OFFSET);
+        checkVerticalLine(img, OFFSET);
+        checkVerticalLine(img, WIDTH - OFFSET);
+        checkCorners(img);
+    }
+
+    private static void checkHorizontalLine(final BufferedImage img,
+                                            final int y) {
+        int prev = img.getRGB(OFFSET, y);
+        int curr;
+        int count = 1;
+        checkColor(OFFSET, y, prev, COLOR1, COLOR2);
+        for (int x = OFFSET + 1; x <= WIDTH - OFFSET; x++) {
+            curr = img.getRGB(x, y);
+            if (curr != prev) {
+                checkColor(x, y, curr, COLOR1, COLOR2);
+                checkCount(x, y, count);
+                prev = curr;
+                count = 1;
+            } else {
+                count++;
+            }
+            if (x < WIDTH - OFFSET) {
+                checkColor(x, y - 1, img.getRGB(x, y - 1), BACKGROUND);
+                checkColor(x, y + 1, img.getRGB(x, y + 1), BACKGROUND);
+            }
+        }
+        checkCount(WIDTH - OFFSET, y, count);
+    }
+
+    private static void checkVerticalLine(final BufferedImage img,
+                                          final int x) {
+        int prev = img.getRGB(x, OFFSET);
+        checkColor(x, OFFSET, prev, COLOR1, COLOR2);
+        int count = 1;
+        for (int y = OFFSET + 1; y <= HEIGHT - OFFSET; y++) {
+            int curr = img.getRGB(x, y);
+            if (curr != prev) {
+                checkColor(x, y, curr, COLOR1, COLOR2);
+                checkCount(x, y, count);
+                prev = curr;
+                count = 1;
+            } else {
+                count++;
+            }
+            if (y < HEIGHT - OFFSET) {
+                checkColor(x - 1, y, img.getRGB(x - 1, y), BACKGROUND);
+                checkColor(x + 1, y, img.getRGB(x + 1, y), BACKGROUND);
+            }
+        }
+        checkCount(x, HEIGHT - OFFSET, count);
+    }
+
+    private static void checkCorners(final BufferedImage img) {
+        int[][] corners = {
+                {OFFSET - 1, OFFSET - 1},
+                {OFFSET,     OFFSET - 1},
+                {OFFSET - 1, OFFSET + 1},
+
+                {OFFSET - 1, HEIGHT - OFFSET},
+                {OFFSET - 1, HEIGHT - OFFSET + 1},
+                {OFFSET,     HEIGHT - OFFSET + 1},
+
+                {WIDTH - OFFSET,     OFFSET - 1},
+                {WIDTH - OFFSET + 1, OFFSET - 1},
+                {WIDTH - OFFSET + 1, OFFSET},
+
+                {WIDTH - OFFSET + 1, HEIGHT - OFFSET},
+                {WIDTH - OFFSET + 1, HEIGHT - OFFSET + 1},
+                {WIDTH - OFFSET,     HEIGHT - OFFSET + 1},
+        };
+
+        for (int[] corner : corners) {
+            int color = img.getRGB(corner[0], corner[1]);
+            checkColor(corner[0], corner[1], color, BACKGROUND);
+        }
+    }
+
+    private static void checkColor(final int x, final int y,
+                                   final int color,
+                                   final Color... validColors) {
+        checkColor(x, y, color, Arrays.stream(validColors)
+                                      .mapToInt(Color::getRGB)
+                                      .toArray());
+    }
+
+    private static void checkColor(final int x, final int y,
+                                   final int color,
+                                   final int... validColors) {
+        for (int valid : validColors) {
+            if (color == valid) {
+                return;
+            }
+        }
+        throw new RuntimeException("Unexpected color at " + x + ", " + y
+                + ": " + Integer.toHexString(color) + "; expected: "
+                + Arrays.stream(validColors)
+                        .mapToObj(Integer::toHexString)
+                        .collect(Collectors.joining(", ")));
+    }
+
+    private static void checkCount(final int x, final int y, final int count) {
+        if (count > MAX_DASH_LENGTH) {
+            throw new RuntimeException("Dash is longer than " + MAX_DASH_LENGTH
+                    + " at " + x + ", " + y);
+        }
+    }
+
+    private static void save(final BufferedImage img,
+                             final String fileName) throws IOException {
+        ImageIO.write(img, "png", new File(fileName));
+    }
+
+}
--- a/test/jdk/java/awt/BasicStroke/DashScaleMinWidth.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/jdk/java/awt/BasicStroke/DashScaleMinWidth.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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
@@ -29,13 +29,15 @@
 import java.awt.Image;
 import java.awt.geom.Line2D;
 import java.awt.image.BufferedImage;
+import java.awt.image.IndexColorModel;
 import java.awt.image.VolatileImage;
 
 import static java.awt.image.BufferedImage.TYPE_INT_ARGB;
 
 /**
  * @test
- * @bug 4917097 8019816
+ * @bug 4917097 8019816 8198411
+ * @key headful
  * @summary 1.4.1 REGRESSION: BasicStroke Dashes don't show when scale * line width = 1.0
  * @run main/othervm -Dsun.java2d.uiScale=1 DashScaleMinWidth
  */
@@ -46,13 +48,13 @@
         draw(img);
         validate(img);
 
-        if (GraphicsEnvironment.isHeadless()) {
-            return;
-        }
-
         GraphicsConfiguration gc =
                 GraphicsEnvironment.getLocalGraphicsEnvironment()
                         .getDefaultScreenDevice().getDefaultConfiguration();
+        if (gc.getColorModel() instanceof IndexColorModel) {
+            System.err.println("Skipping VolatileImage because of IndexColorModel");
+            return;
+        }
 
         VolatileImage vi = gc.createCompatibleVolatileImage(200, 40);
         BufferedImage snapshot;
--- a/test/jdk/java/awt/BasicStroke/DashZeroWidth.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/jdk/java/awt/BasicStroke/DashZeroWidth.java	Wed Feb 20 14:01:37 2019 -0500
@@ -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
@@ -29,13 +29,15 @@
 import java.awt.Image;
 import java.awt.geom.Line2D;
 import java.awt.image.BufferedImage;
+import java.awt.image.IndexColorModel;
 import java.awt.image.VolatileImage;
 
 import static java.awt.image.BufferedImage.TYPE_INT_ARGB;
 
 /**
  * @test
- * @bug 4779211 8019816
+ * @bug 4779211 8019816 8198411
+ * @key headful
  * @summary REGRESSION: 1.4 Dashed lines disappear if BasicStroke width=0.0
  * @run main/othervm -Dsun.java2d.uiScale=1 DashZeroWidth
  */
@@ -46,13 +48,13 @@
         draw(img);
         validate(img);
 
-        if (GraphicsEnvironment.isHeadless()) {
-            return;
-        }
-
         GraphicsConfiguration gc =
                 GraphicsEnvironment.getLocalGraphicsEnvironment()
                         .getDefaultScreenDevice().getDefaultConfiguration();
+        if (gc.getColorModel() instanceof IndexColorModel) {
+            System.err.println("Skipping VolatileImage because of IndexColorModel");
+            return;
+        }
 
         VolatileImage vi = gc.createCompatibleVolatileImage(200, 40);
         BufferedImage snapshot;
--- a/test/jdk/java/lang/instrument/appendToClassLoaderSearch/ClassUnloadTest.sh	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/jdk/java/lang/instrument/appendToClassLoaderSearch/ClassUnloadTest.sh	Wed Feb 20 14:01:37 2019 -0500
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2016, 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
@@ -80,5 +80,5 @@
 
 # Finally we run the test
 (cd "${TESTCLASSES}"; \
-  $JAVA ${TESTVMOPTS} -Xverify:none -Xlog:class+unload \
+  $JAVA ${TESTVMOPTS} -Xlog:class+unload \
     -javaagent:ClassUnloadTest.jar ClassUnloadTest "${OTHERDIR}" Bar.jar)
--- a/test/jdk/java/util/Base64/TestEncodingDecodingLength.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/jdk/java/util/Base64/TestEncodingDecodingLength.java	Wed Feb 20 14:01:37 2019 -0500
@@ -30,7 +30,7 @@
  * @bug 8210583 8217969 8218265
  * @summary Tests Base64.Encoder.encode and Base64.Decoder.decode
  *          with the large size of input array/buffer
- * @requires os.maxMemory >= 8g
+ * @requires os.maxMemory >= 10g
  * @run main/othervm -Xms6g -Xmx8g TestEncodingDecodingLength
  *
  */
--- a/test/jdk/javax/net/ssl/interop/ClientHelloBufferUnderflowException.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/jdk/javax/net/ssl/interop/ClientHelloBufferUnderflowException.java	Wed Feb 20 14:01:37 2019 -0500
@@ -28,7 +28,7 @@
 
 /*
  * @test
- * @bug 8215790
+ * @bug 8215790 8219389
  * @summary Verify exception
  * @modules java.base/sun.security.util
  * @run main/othervm ClientHelloBufferUnderflowException
@@ -45,12 +45,15 @@
         try {
             (new ClientHelloBufferUnderflowException()).run();
         } catch (SSLHandshakeException e) {
-            System.out.println("Correct exception thrown");
+            System.out.println("Correct exception thrown: " + e);
+            return;
         } catch (Exception e) {
             System.out.println("Failed: Exception not SSLHandShakeException");
             System.out.println(e.getMessage());
             throw e;
         }
+
+        throw new Exception("No expected exception");
     }
 
     @Override
@@ -76,6 +79,7 @@
         } catch (Exception e) {
             // ignore
         }
+
         return bytes;
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/jdk/internal/jline/AbstractWindowsTerminalTest.java	Wed Feb 20 14:01:37 2019 -0500
@@ -0,0 +1,93 @@
+/*
+ * 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.
+ */
+
+/**
+ * @test
+ * @bug 8218287
+ * @summary Verify the wrapper input stream is used when using Terminal.reader()
+ * @modules jdk.internal.le/jdk.internal.org.jline.terminal
+ *          jdk.internal.le/jdk.internal.org.jline.terminal.impl
+ *          jdk.internal.le/jdk.internal.org.jline.utils
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.function.Function;
+
+import jdk.internal.org.jline.terminal.Size;
+import jdk.internal.org.jline.terminal.Terminal.SignalHandler;
+import jdk.internal.org.jline.terminal.impl.AbstractWindowsTerminal;
+
+
+public class AbstractWindowsTerminalTest {
+    public static void main(String... args) throws IOException {
+        new AbstractWindowsTerminalTest().run();
+    }
+
+    void run() throws IOException {
+        var out = new StringWriter();
+        AtomicBoolean called = new AtomicBoolean();
+        Function<InputStream, InputStream> isWrapper = is -> new InputStream() {
+            @Override
+            public int read() throws IOException {
+                called.set(true);
+                return is.read();
+            }
+        };
+        var t = new AbstractWindowsTerminal(out, "test", "vt100", null, -1, false, SignalHandler.SIG_DFL, isWrapper) {
+            @Override
+            protected int getConsoleOutputCP() {
+                throw new UnsupportedOperationException("unexpected.");
+            }
+
+            @Override
+            protected int getConsoleMode() {
+                return -1;
+            }
+
+            @Override
+            protected void setConsoleMode(int mode) {
+                throw new UnsupportedOperationException("unexpected.");
+            }
+
+            @Override
+            protected boolean processConsoleInput() throws IOException {
+                throw new UnsupportedOperationException("unexpected.");
+            }
+
+            @Override
+            public Size getSize() {
+                throw new UnsupportedOperationException("unexpected.");
+            }
+        };
+        t.processInputChar(' ');
+        if (t.reader().read() != ' ') {
+            throw new AssertionError("Unexpected input!");
+        }
+        if (!called.get()) {
+            throw new AssertionError("The wrapper was not called!");
+        }
+    }
+}
--- a/test/langtools/tools/javac/lambda/MethodReference66.java	Wed Feb 20 12:52:43 2019 -0500
+++ b/test/langtools/tools/javac/lambda/MethodReference66.java	Wed Feb 20 14:01:37 2019 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 8009299
  * @summary Javac crashes when compiling method reference to static interface method
- * @run main/othervm -Xverify:none MethodReference66
+ * @run main/othervm MethodReference66
  */
 public class MethodReference66 {