changeset 53462:13180cc27a0b patterns-stage-1

Automatic merge with default
author mcimadamore
date Wed, 14 Nov 2018 04:59:57 +0100
parents 7b634a4e510c d4f3e37d1fda
children 4397dbeb4cf4 8927cb6ca12c
files test/jdk/java/lang/System/ClearProperty.java test/jdk/java/lang/System/SetPropertiesNull.java
diffstat 250 files changed, 4282 insertions(+), 1209 deletions(-) [+]
line wrap: on
line diff
--- a/make/Main.gmk	Thu Nov 08 22:05:40 2018 +0100
+++ b/make/Main.gmk	Wed Nov 14 04:59:57 2018 +0100
@@ -690,16 +690,17 @@
   # copied and processed.
   java.desktop-gensrc-src: java.base-gensrc java.base-copy
 
-  # The annotation processing for jdk.internal.vm.ci and jdk.internal.vm.compiler
-  # needs classes from the current JDK.
-  jdk.internal.vm.ci-gensrc-src: $(addsuffix -java, \
-      $(call FindTransitiveDepsForModule, jdk.internal.vm.ci))
+  # The annotation processing for jdk.internal.vm.compiler
+  # and jdk.internal.vm.compiler.management needs classes from the current JDK.
   jdk.internal.vm.compiler-gensrc-src: $(addsuffix -java, \
       $(call FindTransitiveDepsForModule, jdk.internal.vm.compiler))
+  jdk.internal.vm.compiler.management-gensrc-src: $(addsuffix -java, \
+      $(call FindTransitiveDepsForModule, jdk.internal.vm.compiler.management))
 
-  # For jdk.internal.vm.compiler, the gensrc step is generating a module-info.java.extra
+  # For these modules, the gensrc step is generating a module-info.java.extra
   # file to be processed by the gensrc-moduleinfo target.
   jdk.internal.vm.compiler-gensrc-moduleinfo: jdk.internal.vm.compiler-gensrc-src
+  jdk.internal.vm.compiler.management-gensrc-moduleinfo: jdk.internal.vm.compiler.management-gensrc-src
 
   jdk.jdeps-gendata: java rmic
 
--- a/make/autoconf/version-numbers	Thu Nov 08 22:05:40 2018 +0100
+++ b/make/autoconf/version-numbers	Wed Nov 14 04:59:57 2018 +0100
@@ -35,7 +35,7 @@
 DEFAULT_VERSION_DATE=2019-03-19
 DEFAULT_VERSION_CLASSFILE_MAJOR=56  # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
 DEFAULT_VERSION_CLASSFILE_MINOR=0
-DEFAULT_ACCEPTABLE_BOOT_VERSIONS="10 11 12"
+DEFAULT_ACCEPTABLE_BOOT_VERSIONS="11 12"
 
 LAUNCHER_NAME=openjdk
 PRODUCT_NAME=OpenJDK
--- a/make/conf/jib-profiles.js	Thu Nov 08 22:05:40 2018 +0100
+++ b/make/conf/jib-profiles.js	Wed Nov 14 04:59:57 2018 +0100
@@ -361,7 +361,7 @@
         };
     };
 
-    common.boot_jdk_version = "10";
+    common.boot_jdk_version = "11";
     common.boot_jdk_home = input.get("boot_jdk", "home_path") + "/jdk-"
         + common.boot_jdk_version
         + (input.build_os == "macosx" ? ".jdk/Contents/Home" : "");
@@ -851,9 +851,10 @@
             server: "jpg",
             product: "jdk",
             version: common.boot_jdk_version,
-            build_number: "46",
+            build_number: "28",
             file: "bundles/" + boot_jdk_platform + "/jdk-" + common.boot_jdk_version + "_"
-                + boot_jdk_platform + "_bin.tar.gz",
+                + boot_jdk_platform + "_bin"
+		+ (input.build_os == "windows" ? ".zip" : ".tar.gz"),
             configure_args: "--with-boot-jdk=" + common.boot_jdk_home,
             environment_path: common.boot_jdk_home + "/bin"
         },
--- a/make/gensrc/Gensrc-jdk.internal.vm.compiler.gmk	Thu Nov 08 22:05:40 2018 +0100
+++ b/make/gensrc/Gensrc-jdk.internal.vm.compiler.gmk	Wed Nov 14 04:59:57 2018 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2016, 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
@@ -67,7 +67,7 @@
 
 PROC_SRCS := $(filter %.java, $(call CacheFind, $(PROC_SRC_DIRS)))
 
-ALL_SRC_DIRS := $(wildcard $(SRC_DIR)/*/src)
+ALL_SRC_DIRS := $(SRC_DIR) $(wildcard $(SRC_DIR)/*/src)
 SOURCEPATH := $(call PathList, $(ALL_SRC_DIRS))
 
 PROCESSOR_JARS := \
@@ -81,23 +81,23 @@
 
 ADD_EXPORTS := \
     --add-modules jdk.internal.vm.ci \
-    --add-exports jdk.internal.vm.ci/jdk.vm.ci.aarch64=ALL-UNNAMED \
-    --add-exports jdk.internal.vm.ci/jdk.vm.ci.amd64=ALL-UNNAMED \
-    --add-exports jdk.internal.vm.ci/jdk.vm.ci.code=ALL-UNNAMED \
-    --add-exports jdk.internal.vm.ci/jdk.vm.ci.code.site=ALL-UNNAMED \
-    --add-exports jdk.internal.vm.ci/jdk.vm.ci.code.stack=ALL-UNNAMED \
-    --add-exports jdk.internal.vm.ci/jdk.vm.ci.common=ALL-UNNAMED \
-    --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot=ALL-UNNAMED \
-    --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot.aarch64=ALL-UNNAMED \
-    --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot.amd64=ALL-UNNAMED \
-    --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot.events=ALL-UNNAMED \
-    --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot.sparc=ALL-UNNAMED \
-    --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspotvmconfig=ALL-UNNAMED \
-    --add-exports jdk.internal.vm.ci/jdk.vm.ci.inittimer=ALL-UNNAMED \
-    --add-exports jdk.internal.vm.ci/jdk.vm.ci.meta=ALL-UNNAMED \
-    --add-exports jdk.internal.vm.ci/jdk.vm.ci.runtime=ALL-UNNAMED \
-    --add-exports jdk.internal.vm.ci/jdk.vm.ci.services=ALL-UNNAMED \
-    --add-exports jdk.internal.vm.ci/jdk.vm.ci.sparc=ALL-UNNAMED \
+    --add-exports jdk.internal.vm.ci/jdk.vm.ci.aarch64=jdk.internal.vm.compiler \
+    --add-exports jdk.internal.vm.ci/jdk.vm.ci.amd64=jdk.internal.vm.compiler \
+    --add-exports jdk.internal.vm.ci/jdk.vm.ci.code=jdk.internal.vm.compiler \
+    --add-exports jdk.internal.vm.ci/jdk.vm.ci.code.site=jdk.internal.vm.compiler \
+    --add-exports jdk.internal.vm.ci/jdk.vm.ci.code.stack=jdk.internal.vm.compiler \
+    --add-exports jdk.internal.vm.ci/jdk.vm.ci.common=jdk.internal.vm.compiler \
+    --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot=jdk.internal.vm.compiler \
+    --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot.aarch64=jdk.internal.vm.compiler \
+    --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot.amd64=jdk.internal.vm.compiler \
+    --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot.events=jdk.internal.vm.compiler \
+    --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot.sparc=jdk.internal.vm.compiler \
+    --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspotvmconfig=jdk.internal.vm.compiler \
+    --add-exports jdk.internal.vm.ci/jdk.vm.ci.inittimer=jdk.internal.vm.compiler \
+    --add-exports jdk.internal.vm.ci/jdk.vm.ci.meta=jdk.internal.vm.compiler \
+    --add-exports jdk.internal.vm.ci/jdk.vm.ci.runtime=jdk.internal.vm.compiler \
+    --add-exports jdk.internal.vm.ci/jdk.vm.ci.services=jdk.internal.vm.compiler \
+    --add-exports jdk.internal.vm.ci/jdk.vm.ci.sparc=jdk.internal.vm.compiler \
     #
 
 $(GENSRC_DIR)/_gensrc_proc_done: $(PROC_SRCS) $(PROCESSOR_JARS)
@@ -121,6 +121,7 @@
 ################################################################################
 
 $(GENSRC_DIR)/module-info.java.extra: $(GENSRC_DIR)/_gensrc_proc_done
+	$(ECHO) "" > $@;
 	($(CD) $(GENSRC_DIR)/META-INF/providers && \
 	    p=""; \
 	    impl=""; \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/gensrc/Gensrc-jdk.internal.vm.compiler.management.gmk	Wed Nov 14 04:59:57 2018 +0100
@@ -0,0 +1,101 @@
+#
+# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+
+GENSRC_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)
+SRC_DIR := $(TOPDIR)/src/$(MODULE)/share/classes
+
+################################################################################
+
+PROC_SRC_SUBDIRS := \
+    org.graalvm.compiler.hotspot.management \
+    #
+
+PROC_SRC_DIRS := $(patsubst %, $(SRC_DIR)/%/src, $(PROC_SRC_SUBDIRS))
+
+PROC_SRCS := $(filter %.java, $(call CacheFind, $(PROC_SRC_DIRS)))
+
+ALL_SRC_DIRS := $(SRC_DIR) $(wildcard $(SRC_DIR)/*/src)
+SOURCEPATH := $(call PathList, $(ALL_SRC_DIRS))
+
+PROCESSOR_JARS := \
+    $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.serviceprovider.processor.jar \
+    #
+PROCESSOR_PATH := $(call PathList, $(PROCESSOR_JARS))
+
+$(GENSRC_DIR)/_gensrc_proc_done: $(PROC_SRCS) $(PROCESSOR_JARS)
+	$(call MakeDir, $(@D))
+	$(eval $(call ListPathsSafely,PROC_SRCS,$(@D)/_gensrc_proc_files))
+	$(JAVA) $(NEW_JAVAC) \
+	    -XDignore.symbol.file \
+	    --upgrade-module-path $(JDK_OUTPUTDIR)/modules --system none \
+	    -sourcepath $(SOURCEPATH) \
+	    -implicit:none \
+	    -proc:only \
+	    -processorpath $(PROCESSOR_PATH) \
+	    -d $(GENSRC_DIR) \
+	    -s $(GENSRC_DIR) \
+	    @$(@D)/_gensrc_proc_files
+	$(TOUCH) $@
+
+TARGETS += $(GENSRC_DIR)/_gensrc_proc_done
+
+################################################################################
+
+$(GENSRC_DIR)/module-info.java.extra: $(GENSRC_DIR)/_gensrc_proc_done
+	$(ECHO) "" > $@;
+	($(CD) $(GENSRC_DIR)/META-INF/providers && \
+	    p=""; \
+	    impl=""; \
+	    for i in $$($(GREP) '^' * | $(SORT) -t ':' -k 2 | $(SED) 's/:.*//'); do \
+	      c=$$($(CAT) $$i | $(TR) -d '\n\r'); \
+	      if test x$$p != x$$c; then \
+                if test x$$p != x; then \
+	          $(ECHO) "    ;" >> $@; \
+	        fi; \
+	        $(ECHO) "provides $$c with" >> $@; \
+                p=$$c; \
+	        impl=""; \
+	      fi; \
+              if test x$$impl != x; then \
+	        $(ECHO) "  , $$i" >> $@; \
+              else \
+	        $(ECHO) "    $$i" >> $@; \
+              fi; \
+              impl=$$i; \
+	    done); \
+	$(ECHO) "    ;" >> $@;
+
+TARGETS += $(GENSRC_DIR)/module-info.java.extra
+
+################################################################################
+
+all: $(TARGETS)
+
+.PHONY: default all
--- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -582,6 +582,7 @@
 
   virtual void null_check(Register reg, int offset = -1);
   static bool needs_explicit_null_check(intptr_t offset);
+  static bool uses_implicit_null_check(void* address);
 
   static address target_addr_for_insn(address insn_addr, unsigned insn);
   static address target_addr_for_insn(address insn_addr) {
--- a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -1902,8 +1902,8 @@
     Label L_done;
 
     __ ldrb(rscratch1, Address(rbcp, 0));
-    __ cmpw(r1, Bytecodes::_invokestatic);
-    __ br(Assembler::EQ, L_done);
+    __ cmpw(rscratch1, Bytecodes::_invokestatic);
+    __ br(Assembler::NE, L_done);
 
     // The member name argument must be restored if _invokestatic is re-executed after a PopFrame call.
     // Detect such a case in the InterpreterRuntime function and return the member name argument, or NULL.
@@ -1938,7 +1938,6 @@
   // remove the activation (without doing throws on illegalMonitorExceptions)
   __ remove_activation(vtos, false, true, false);
   // restore exception
-  // restore exception
   __ get_vm_result(r0, rthread);
 
   // In between activations - previous activation type unknown yet
@@ -1947,9 +1946,8 @@
   //
   // r0: exception
   // lr: return address/pc that threw exception
-  // rsp: expression stack of caller
+  // esp: expression stack of caller
   // rfp: fp of caller
-  // FIXME: There's no point saving LR here because VM calls don't trash it
   __ stp(r0, lr, Address(__ pre(sp, -2 * wordSize)));  // save exception & return address
   __ super_call_VM_leaf(CAST_FROM_FN_PTR(address,
                           SharedRuntime::exception_handler_for_return_address),
--- a/src/hotspot/cpu/arm/assembler_arm_32.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/cpu/arm/assembler_arm_32.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -498,7 +498,7 @@
   void dmb(DMB_Opt opt, Register reg) {
     if (VM_Version::arm_arch() >= 7) {
       emit_int32(0xF57FF050 | opt);
-    } else {
+    } else if (VM_Version::arm_arch() == 6) {
       bool preserve_tmp = (reg == noreg);
       if(preserve_tmp) {
         reg = Rtemp;
--- a/src/hotspot/cpu/arm/macroAssembler_arm.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/cpu/arm/macroAssembler_arm.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -358,6 +358,7 @@
   void zero_memory(Register start, Register end, Register tmp);
 
   static bool needs_explicit_null_check(intptr_t offset);
+  static bool uses_implicit_null_check(void* address);
 
   void arm_stack_overflow_check(int frame_size_in_bytes, Register tmp);
   void arm_stack_overflow_check(Register Rsize, Register tmp);
@@ -1095,4 +1096,3 @@
 
 
 #endif // CPU_ARM_VM_MACROASSEMBLER_ARM_HPP
-
--- a/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -659,6 +659,7 @@
   void get_vm_result_2(Register metadata_result);
 
   static bool needs_explicit_null_check(intptr_t offset);
+  static bool uses_implicit_null_check(void* address);
 
   // Trap-instruction-based checks.
   // Range checks can be distinguished from zero checks as they check 32 bit,
--- a/src/hotspot/cpu/s390/macroAssembler_s390.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/cpu/s390/macroAssembler_s390.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -772,6 +772,7 @@
 
   void null_check(Register reg, Register tmp = Z_R0, int64_t offset = -1);
   static bool needs_explicit_null_check(intptr_t offset);  // Implemented in shared file ?!
+  static bool uses_implicit_null_check(void* address);
 
   // Klass oop manipulations if compressed.
   void encode_klass_not_null(Register dst, Register src = noreg);
--- a/src/hotspot/cpu/sparc/macroAssembler_sparc.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/cpu/sparc/macroAssembler_sparc.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -575,6 +575,7 @@
 
   void null_check(Register reg, int offset = -1);
   static bool needs_explicit_null_check(intptr_t offset);
+  static bool uses_implicit_null_check(void* address);
 
   // support for delayed instructions
   MacroAssembler* delayed() { Assembler::delayed();  return this; }
--- a/src/hotspot/cpu/x86/macroAssembler_x86.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/cpu/x86/macroAssembler_x86.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -96,6 +96,7 @@
 
   void null_check(Register reg, int offset = -1);
   static bool needs_explicit_null_check(intptr_t offset);
+  static bool uses_implicit_null_check(void* address);
 
   // Required platform-specific helpers for Label::patch_instructions.
   // They _shadow_ the declarations in AbstractAssembler, which are undefined.
--- a/src/hotspot/cpu/x86/x86_64.ad	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/cpu/x86/x86_64.ad	Wed Nov 14 04:59:57 2018 +0100
@@ -11925,9 +11925,9 @@
   ins_pipe(ialu_cr_reg_mem);
 %}
 
-instruct testB_mem_imm(rFlagsReg cr, memory mem, immI8 imm, immI0 zero)
-%{
-  match(Set cr (CmpI (AndI (LoadB mem) imm) zero));
+instruct testUB_mem_imm(rFlagsReg cr, memory mem, immU8 imm, immI0 zero)
+%{
+  match(Set cr (CmpI (AndI (LoadUB mem) imm) zero));
 
   ins_cost(125);
   format %{ "testb   $mem, $imm" %}
--- a/src/hotspot/cpu/zero/assembler_zero.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/cpu/zero/assembler_zero.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -47,6 +47,7 @@
   void align(int modulus);
   void bang_stack_with_offset(int offset);
   bool needs_explicit_null_check(intptr_t offset);
+  bool uses_implicit_null_check(void* address);
   RegisterOrConstant delayed_value_impl(intptr_t* delayed_value_addr,
                                         Register tmp, int offset);
  public:
--- a/src/hotspot/os/aix/os_aix.inline.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/os/aix/os_aix.inline.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -41,10 +41,6 @@
   return strncmp(s1, s2, num);
 }
 
-inline bool os::obsolete_option(const JavaVMOption *option) {
-  return false;
-}
-
 inline bool os::uses_stack_guard_pages() {
   return true;
 }
--- a/src/hotspot/os/bsd/os_bsd.inline.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/os/bsd/os_bsd.inline.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -39,10 +39,6 @@
   return strncmp(s1, s2, num);
 }
 
-inline bool os::obsolete_option(const JavaVMOption *option) {
-  return false;
-}
-
 inline bool os::uses_stack_guard_pages() {
   return true;
 }
--- a/src/hotspot/os/linux/os_linux.inline.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/os/linux/os_linux.inline.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -39,10 +39,6 @@
   return strncmp(s1, s2, num);
 }
 
-inline bool os::obsolete_option(const JavaVMOption *option) {
-  return false;
-}
-
 inline bool os::uses_stack_guard_pages() {
   return true;
 }
--- a/src/hotspot/os/solaris/os_solaris.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/os/solaris/os_solaris.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -700,19 +700,6 @@
   BREAKPOINT;
 }
 
-bool os::obsolete_option(const JavaVMOption *option) {
-  if (!strncmp(option->optionString, "-Xt", 3)) {
-    return true;
-  } else if (!strncmp(option->optionString, "-Xtm", 4)) {
-    return true;
-  } else if (!strncmp(option->optionString, "-Xverifyheap", 12)) {
-    return true;
-  } else if (!strncmp(option->optionString, "-Xmaxjitcodesize", 16)) {
-    return true;
-  }
-  return false;
-}
-
 bool os::Solaris::valid_stack_address(Thread* thread, address sp) {
   address  stackStart  = (address)thread->stack_base();
   address  stackEnd    = (address)(stackStart - (address)thread->stack_size());
--- a/src/hotspot/os/windows/os_windows.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/os/windows/os_windows.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -2492,7 +2492,7 @@
 #endif
           {
             // Null pointer exception.
-            if (!MacroAssembler::needs_explicit_null_check((intptr_t)addr)) {
+            if (MacroAssembler::uses_implicit_null_check((void*)addr)) {
               address stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
               if (stub != NULL) return Handle_Exception(exceptionInfo, stub);
             }
--- a/src/hotspot/os/windows/os_windows.inline.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/os/windows/os_windows.inline.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -45,10 +45,6 @@
   return (void*)::GetProcAddress((HMODULE)lib, name);
 }
 
-inline bool os::obsolete_option(const JavaVMOption *option) {
-  return false;
-}
-
 inline bool os::uses_stack_guard_pages() {
   return true;
 }
--- a/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -409,7 +409,7 @@
       // SIGSEGV-based implicit null check in compiled code.
       else if (sig == SIGSEGV && ImplicitNullChecks &&
                CodeCache::contains((void*) pc) &&
-               !MacroAssembler::needs_explicit_null_check((intptr_t) info->si_addr)) {
+               MacroAssembler::uses_implicit_null_check(info->si_addr)) {
         if (TraceTraps) {
           tty->print_cr("trap: null_check at " INTPTR_FORMAT " (SIGSEGV)", pc);
         }
@@ -612,5 +612,3 @@
   AixNativeCallstack::print_callstack_for_context(st, (const ucontext_t*)context, true, buf, (size_t) buf_size);
   return true;
 }
-
-
--- a/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -580,7 +580,7 @@
       // 64-bit Darwin may also use a SIGBUS (seen with compressed oops).
       // Catching SIGBUS here prevents the implicit SIGBUS NULL check below from
       // being called, so only do so if the implicit NULL check is not necessary.
-      } else if (sig == SIGBUS && MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) {
+      } else if (sig == SIGBUS && !MacroAssembler::uses_implicit_null_check(info->si_addr)) {
 #else
       } else if (sig == SIGBUS /* && info->si_code == BUS_OBJERR */) {
 #endif
@@ -655,7 +655,7 @@
         }
 #endif // AMD64
       } else if ((sig == SIGSEGV || sig == SIGBUS) &&
-               !MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) {
+                 MacroAssembler::uses_implicit_null_check(info->si_addr)) {
           // Determination of interpreter/vtable stub/compiled code null exception
           stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
       }
--- a/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -357,10 +357,15 @@
     }
 #endif
 
+    address addr = (address) info->si_addr;
+
+    // Make sure the high order byte is sign extended, as it may be masked away by the hardware.
+    if ((uintptr_t(addr) & (uintptr_t(1) << 55)) != 0) {
+      addr = address(uintptr_t(addr) | (uintptr_t(0xFF) << 56));
+    }
+
     // Handle ALL stack overflow variations here
     if (sig == SIGSEGV) {
-      address addr = (address) info->si_addr;
-
       // check if fault address is within thread stack
       if (thread->on_local_stack(addr)) {
         // stack overflow
@@ -456,7 +461,7 @@
                                               SharedRuntime::
                                               IMPLICIT_DIVIDE_BY_ZERO);
       } else if (sig == SIGSEGV &&
-               !MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) {
+                 MacroAssembler::uses_implicit_null_check((void*)addr)) {
           // Determination of interpreter/vtable stub/compiled code null exception
           stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
       }
--- a/src/hotspot/os_cpu/linux_arm/orderAccess_linux_arm.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/os_cpu/linux_arm/orderAccess_linux_arm.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -63,7 +63,7 @@
      __asm__ volatile (
      ".word 0xF57FF050 | 0xf" : : : "memory");
 #endif
-   } else {
+   } else if (VM_Version::arm_arch() == 6) {
      intptr_t zero = 0;
      __asm__ volatile (
        "mcr p15, 0, %0, c7, c10, 5"
@@ -80,7 +80,7 @@
      __asm__ volatile (
      ".word 0xF57FF050 | 0xe" : : : "memory");
 #endif
-   } else {
+   } else if (VM_Version::arm_arch() == 6) {
      intptr_t zero = 0;
      __asm__ volatile (
        "mcr p15, 0, %0, c7, c10, 5"
--- a/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -384,7 +384,8 @@
         if (nm != NULL && nm->has_unsafe_access()) {
           unsafe_access = true;
         }
-      } else if (sig == SIGSEGV && !MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) {
+      } else if (sig == SIGSEGV &&
+                 MacroAssembler::uses_implicit_null_check(info->si_addr)) {
           // Determination of interpreter/vtable stub/compiled code null exception
           CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
           if (cb != NULL) {
@@ -682,4 +683,3 @@
   // ARM does not require an additional stack bang.
   return 0;
 }
-
--- a/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -431,7 +431,7 @@
       // SIGSEGV-based implicit null check in compiled code.
       else if (sig == SIGSEGV && ImplicitNullChecks &&
                CodeCache::contains((void*) pc) &&
-               !MacroAssembler::needs_explicit_null_check((intptr_t) info->si_addr)) {
+               MacroAssembler::uses_implicit_null_check(info->si_addr)) {
         if (TraceTraps) {
           tty->print_cr("trap: null_check at " INTPTR_FORMAT " (SIGSEGV)", p2i(pc));
         }
--- a/src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -418,7 +418,7 @@
 
       else if (sig == SIGSEGV && ImplicitNullChecks &&
                CodeCache::contains((void*) pc) &&
-               !MacroAssembler::needs_explicit_null_check((intptr_t) info->si_addr)) {
+               MacroAssembler::uses_implicit_null_check(info->si_addr)) {
         if (TraceTraps) {
           tty->print_cr("trap: null_check at " INTPTR_FORMAT " (SIGSEGV)", p2i(pc));
         }
--- a/src/hotspot/os_cpu/linux_sparc/os_linux_sparc.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/os_cpu/linux_sparc/os_linux_sparc.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -416,9 +416,9 @@
   return false;
 }
 
-inline static bool checkNullPointer(address pc, intptr_t fault,
+inline static bool checkNullPointer(address pc, void* fault,
                                     JavaThread* thread, address* stub) {
-  if (!MacroAssembler::needs_explicit_null_check(fault)) {
+  if (MacroAssembler::uses_implicit_null_check(fault)) {
     // Determination of interpreter/vtable stub/compiled code null
     // exception
     *stub =
@@ -586,7 +586,7 @@
         }
 
         if ((sig == SIGSEGV) &&
-            checkNullPointer(pc, (intptr_t)info->si_addr, thread, &stub)) {
+            checkNullPointer(pc, info->si_addr, thread, &stub)) {
           break;
         }
       } while (0);
--- a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -479,7 +479,7 @@
         }
 #endif // AMD64
       } else if (sig == SIGSEGV &&
-               !MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) {
+                 MacroAssembler::uses_implicit_null_check(info->si_addr)) {
           // Determination of interpreter/vtable stub/compiled code null exception
           stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
       }
--- a/src/hotspot/os_cpu/solaris_sparc/os_solaris_sparc.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/os_cpu/solaris_sparc/os_solaris_sparc.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -505,7 +505,7 @@
       }
 #endif  // COMPILER2
 
-      else if (sig == SIGSEGV && info->si_code > 0 && !MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) {
+      else if (sig == SIGSEGV && info->si_code > 0 && MacroAssembler::uses_implicit_null_check(info->si_addr)) {
         // Determination of interpreter/vtable stub/compiled code null exception
         stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
       }
--- a/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -579,7 +579,8 @@
         // QQQ It doesn't seem that we need to do this on x86 because we should be able
         // to return properly from the handler without this extra stuff on the back side.
 
-      else if (sig == SIGSEGV && info->si_code > 0 && !MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) {
+      else if (sig == SIGSEGV && info->si_code > 0 &&
+               MacroAssembler::uses_implicit_null_check(info->si_addr)) {
         // Determination of interpreter/vtable stub/compiled code null exception
         stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
       }
--- a/src/hotspot/share/asm/assembler.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/asm/assembler.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -26,6 +26,7 @@
 #include "asm/codeBuffer.hpp"
 #include "asm/macroAssembler.hpp"
 #include "asm/macroAssembler.inline.hpp"
+#include "gc/shared/collectedHeap.hpp"
 #include "runtime/atomic.hpp"
 #include "runtime/icache.hpp"
 #include "runtime/os.hpp"
@@ -307,21 +308,32 @@
   return NULL;
 }
 
-bool MacroAssembler::needs_explicit_null_check(intptr_t offset) {
+bool MacroAssembler::uses_implicit_null_check(void* address) {
   // Exception handler checks the nmethod's implicit null checks table
   // only when this method returns false.
+  intptr_t int_address = reinterpret_cast<intptr_t>(address);
+  intptr_t cell_header_size = Universe::heap()->cell_header_size();
+  size_t region_size = os::vm_page_size() + cell_header_size;
 #ifdef _LP64
   if (UseCompressedOops && Universe::narrow_oop_base() != NULL) {
-    assert (Universe::heap() != NULL, "java heap should be initialized");
-    // The first page after heap_base is unmapped and
-    // the 'offset' is equal to [heap_base + offset] for
-    // narrow oop implicit null checks.
-    uintptr_t base = (uintptr_t)Universe::narrow_oop_base();
-    if ((uintptr_t)offset >= base) {
-      // Normalize offset for the next check.
-      offset = (intptr_t)(pointer_delta((void*)offset, (void*)base, 1));
+    // A SEGV can legitimately happen in C2 code at address
+    // (heap_base + offset) if  Matcher::narrow_oop_use_complex_address
+    // is configured to allow narrow oops field loads to be implicitly
+    // null checked
+    intptr_t start = ((intptr_t)Universe::narrow_oop_base()) - cell_header_size;
+    intptr_t end = start + region_size;
+    if (int_address >= start && int_address < end) {
+      return true;
     }
   }
 #endif
-  return offset < 0 || os::vm_page_size() <= offset;
+  intptr_t start = -cell_header_size;
+  intptr_t end = start + region_size;
+  return int_address >= start && int_address < end;
 }
+
+bool MacroAssembler::needs_explicit_null_check(intptr_t offset) {
+  // Check if offset is outside of [-cell_header_size, os::vm_page_size)
+  return offset < -Universe::heap()->cell_header_size() ||
+         offset >= os::vm_page_size();
+}
--- a/src/hotspot/share/classfile/classLoaderDataGraph.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/classfile/classLoaderDataGraph.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -496,11 +496,11 @@
 
 // Move class loader data from main list to the unloaded list for unloading
 // and deallocation later.
-bool ClassLoaderDataGraph::do_unloading(bool do_cleaning) {
+bool ClassLoaderDataGraph::do_unloading() {
   assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
 
   // Indicate whether safepoint cleanup is needed.
-  _safepoint_cleanup_needed |= do_cleaning;
+  _safepoint_cleanup_needed = true;
 
   ClassLoaderData* data = _head;
   ClassLoaderData* prev = NULL;
--- a/src/hotspot/share/classfile/classLoaderDataGraph.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/classfile/classLoaderDataGraph.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -88,7 +88,7 @@
   static void loaded_classes_do(KlassClosure* klass_closure);
   static void unlocked_loaded_classes_do(KlassClosure* klass_closure);
   static void classes_unloading_do(void f(Klass* const));
-  static bool do_unloading(bool do_cleaning);
+  static bool do_unloading();
 
   // Expose state to avoid logging overhead in safepoint cleanup tasks.
   static inline bool should_clean_metaspaces_and_reset();
--- a/src/hotspot/share/classfile/systemDictionary.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/classfile/systemDictionary.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -1845,15 +1845,14 @@
 
 // Assumes classes in the SystemDictionary are only unloaded at a safepoint
 // Note: anonymous classes are not in the SD.
-bool SystemDictionary::do_unloading(GCTimer* gc_timer,
-                                    bool do_cleaning) {
+bool SystemDictionary::do_unloading(GCTimer* gc_timer) {
 
   bool unloading_occurred;
   {
     GCTraceTime(Debug, gc, phases) t("ClassLoaderData", gc_timer);
 
     // First, mark for unload all ClassLoaderData referencing a dead class loader.
-    unloading_occurred = ClassLoaderDataGraph::do_unloading(do_cleaning);
+    unloading_occurred = ClassLoaderDataGraph::do_unloading();
     if (unloading_occurred) {
       JFR_ONLY(Jfr::on_unloading_classes();)
       ClassLoaderDataGraph::clean_module_and_package_info();
@@ -1883,7 +1882,7 @@
     _pd_cache_table->trigger_cleanup();
   }
 
-  if (do_cleaning) {
+  {
     GCTraceTime(Debug, gc, phases) t("ResolvedMethodTable", gc_timer);
     ResolvedMethodTable::trigger_cleanup();
   }
--- a/src/hotspot/share/classfile/systemDictionary.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/classfile/systemDictionary.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -347,8 +347,7 @@
 
   // Unload (that is, break root links to) all unmarked classes and
   // loaders.  Returns "true" iff something was unloaded.
-  static bool do_unloading(GCTimer* gc_timer,
-                           bool do_cleaning = true);
+  static bool do_unloading(GCTimer* gc_timer);
 
   // Used by DumpSharedSpaces only to remove classes that failed verification
   static void remove_classes_in_error_state();
--- a/src/hotspot/share/classfile/systemDictionaryShared.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/classfile/systemDictionaryShared.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -27,6 +27,7 @@
 #include "classfile/classListParser.hpp"
 #include "classfile/classLoader.hpp"
 #include "classfile/classLoaderData.inline.hpp"
+#include "classfile/classLoaderDataGraph.hpp"
 #include "classfile/classLoaderExt.hpp"
 #include "classfile/dictionary.hpp"
 #include "classfile/javaClasses.hpp"
@@ -782,8 +783,16 @@
   }
 }
 
+void SystemDictionaryShared::finalize_verification_constraints_for(InstanceKlass* k) {
+  if (!k->is_unsafe_anonymous()) {
+    SharedDictionaryEntry* entry = ((SharedDictionary*)(k->class_loader_data()->dictionary()))->find_entry_for(k);
+    entry->finalize_verification_constraints();
+  }
+}
+
 void SystemDictionaryShared::finalize_verification_constraints() {
-  boot_loader_dictionary()->finalize_verification_constraints();
+  MutexLocker mcld(ClassLoaderDataGraph_lock);
+  ClassLoaderDataGraph::dictionary_classes_do(finalize_verification_constraints_for);
 }
 
 void SystemDictionaryShared::check_verification_constraints(InstanceKlass* klass,
@@ -810,28 +819,6 @@
   return NULL;
 }
 
-void SharedDictionary::finalize_verification_constraints() {
-  int bytes = 0, count = 0;
-  for (int index = 0; index < table_size(); index++) {
-    for (SharedDictionaryEntry *probe = bucket(index);
-                                probe != NULL;
-                               probe = probe->next()) {
-      int n = probe->finalize_verification_constraints();
-      if (n > 0) {
-        bytes += n;
-        count ++;
-      }
-    }
-  }
-  if (log_is_enabled(Info, cds, verification)) {
-    double avg = 0;
-    if (count > 0) {
-      avg = double(bytes) / double(count);
-    }
-    log_info(cds, verification)("Recorded verification constraints for %d classes = %d bytes (avg = %.2f bytes) ", count, bytes, avg);
-  }
-}
-
 void SharedDictionaryEntry::add_verification_constraint(Symbol* name,
          Symbol* from_name, bool from_field_is_protected, bool from_is_array, bool from_is_object) {
   if (_verifier_constraints == NULL) {
--- a/src/hotspot/share/classfile/systemDictionaryShared.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/classfile/systemDictionaryShared.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -172,7 +172,6 @@
 
 public:
   SharedDictionaryEntry* find_entry_for(InstanceKlass* klass);
-  void finalize_verification_constraints();
 
   bool add_non_builtin_klass(const Symbol* class_name,
                              ClassLoaderData* loader_data,
@@ -283,7 +282,7 @@
                                  Handle class_loader,
                                  Handle protection_domain,
                                  TRAPS);
-
+  static void finalize_verification_constraints_for(InstanceKlass* k);
 public:
   // Called by PLATFORM/APP loader only
   static InstanceKlass* find_or_load_shared_class(Symbol* class_name,
--- a/src/hotspot/share/code/codeBlob.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/code/codeBlob.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -393,6 +393,10 @@
   BufferBlob(const char* name, int size);
   BufferBlob(const char* name, int size, CodeBuffer* cb);
 
+  // This ordinary operator delete is needed even though not used, so the
+  // below two-argument operator delete will be treated as a placement
+  // delete rather than an ordinary sized delete; see C++14 3.7.4.2/p2.
+  void operator delete(void* p);
   void* operator new(size_t s, unsigned size) throw();
 
  public:
@@ -476,6 +480,10 @@
     bool        caller_must_gc_arguments
   );
 
+  // This ordinary operator delete is needed even though not used, so the
+  // below two-argument operator delete will be treated as a placement
+  // delete rather than an ordinary sized delete; see C++14 3.7.4.2/p2.
+  void operator delete(void* p);
   void* operator new(size_t s, unsigned size) throw();
 
  public:
@@ -511,6 +519,10 @@
   friend class VMStructs;
 
  protected:
+  // This ordinary operator delete is needed even though not used, so the
+  // below two-argument operator delete will be treated as a placement
+  // delete rather than an ordinary sized delete; see C++14 3.7.4.2/p2.
+  void operator delete(void* p);
   void* operator new(size_t s, unsigned size) throw();
 
  public:
--- a/src/hotspot/share/gc/cms/parNewGeneration.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/gc/cms/parNewGeneration.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -888,11 +888,6 @@
 
   init_assuming_no_promotion_failure();
 
-  if (UseAdaptiveSizePolicy) {
-    set_survivor_overflow(false);
-    size_policy->minor_collection_begin();
-  }
-
   GCTraceTime(Trace, gc, phases) t1("ParNew", NULL, gch->gc_cause());
 
   age_table()->clear();
@@ -1017,11 +1012,6 @@
   TASKQUEUE_STATS_ONLY(thread_state_set.print_termination_stats());
   TASKQUEUE_STATS_ONLY(thread_state_set.print_taskqueue_stats());
 
-  if (UseAdaptiveSizePolicy) {
-    size_policy->minor_collection_end(gch->gc_cause());
-    size_policy->avg_survived()->sample(from()->used());
-  }
-
   // We need to use a monotonically non-decreasing time in ms
   // or we will see time-warp warnings and os::javaTimeMillis()
   // does not guarantee monotonicity.
@@ -1108,9 +1098,6 @@
   // Try allocating obj in to-space (unless too old)
   if (dummyOld.age() < tenuring_threshold()) {
     new_obj = (oop)par_scan_state->alloc_in_to_space(sz);
-    if (new_obj == NULL) {
-      set_survivor_overflow(true);
-    }
   }
 
   if (new_obj == NULL) {
--- a/src/hotspot/share/gc/cms/parNewGeneration.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/gc/cms/parNewGeneration.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -346,11 +346,6 @@
 
  protected:
 
-  bool _survivor_overflow;
-
-  bool survivor_overflow() { return _survivor_overflow; }
-  void set_survivor_overflow(bool v) { _survivor_overflow = v; }
-
   void restore_preserved_marks();
 
  public:
--- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -1655,7 +1655,7 @@
   // Unload Klasses, String, Code Cache, etc.
   if (ClassUnloadingWithConcurrentMark) {
     GCTraceTime(Debug, gc, phases) debug("Class Unloading", _gc_timer_cm);
-    bool purged_classes = SystemDictionary::do_unloading(_gc_timer_cm, false /* Defer cleaning */);
+    bool purged_classes = SystemDictionary::do_unloading(_gc_timer_cm);
     _g1h->complete_cleaning(&g1_is_alive, purged_classes);
   } else {
     GCTraceTime(Debug, gc, phases) debug("Cleanup", _gc_timer_cm);
--- a/src/hotspot/share/gc/shared/c2/barrierSetC2.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/gc/shared/c2/barrierSetC2.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -288,6 +288,9 @@
 #ifdef ASSERT
   virtual bool verify_gc_alias_type(const TypePtr* adr_type, int offset) const { return false; }
 #endif
+
+  virtual bool final_graph_reshaping(Compile* compile, Node* n, uint opcode) const { return false; }
+
 };
 
 #endif // SHARE_GC_SHARED_C2_BARRIERSETC2_HPP
--- a/src/hotspot/share/gc/shared/collectedHeap.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/gc/shared/collectedHeap.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -580,6 +580,11 @@
 
   virtual size_t obj_size(oop obj) const;
 
+  // Cells are memory slices allocated by the allocator. Objects are initialized
+  // in cells. The cell itself may have a header, found at a negative offset of
+  // oops. Usually, the size of the cell header is 0, but it may be larger.
+  virtual ptrdiff_t cell_header_size() const { return 0; }
+
   // Non product verification and debugging.
 #ifndef PRODUCT
   // Support for PromotionFailureALot.  Return true if it's time to cause a
--- a/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -1435,6 +1435,29 @@
   return type == T_OBJECT || type == T_ARRAY;
 }
 
+bool ZBarrierSetC2::final_graph_reshaping(Compile* compile, Node* n, uint opcode) const {
+  bool handled;
+  switch (opcode) {
+    case Op_LoadBarrierSlowReg:
+    case Op_LoadBarrierWeakSlowReg:
+#ifdef ASSERT
+      if (VerifyOptoOopOffsets) {
+        MemNode* mem  = n->as_Mem();
+        // Check to see if address types have grounded out somehow.
+        const TypeInstPtr* tp = mem->in(MemNode::Address)->bottom_type()->isa_instptr();
+        ciInstanceKlass* k = tp->klass()->as_instance_klass();
+        bool oop_offset_is_sane = k->contains_field_offset(tp->offset());
+        assert(!tp || oop_offset_is_sane, "");
+      }
+#endif
+      handled = true;
+      break;
+    default:
+      handled = false;
+  }
+  return handled;
+}
+
 // == Verification ==
 
 #ifdef ASSERT
--- a/src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -207,6 +207,8 @@
   static void find_dominating_barriers(PhaseIterGVN& igvn);
   static void loop_optimize_gc_barrier(PhaseIdealLoop* phase, Node* node, bool last_round);
 
+  virtual bool final_graph_reshaping(Compile* compile, Node* n, uint opcode) const;
+
 #ifdef ASSERT
   virtual void verify_gc_barriers(Compile* compile, CompilePhase phase) const;
 #endif
--- a/src/hotspot/share/memory/heapShared.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/memory/heapShared.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -886,6 +886,10 @@
     Klass* k = SystemDictionary::resolve_or_null(klass_name, THREAD);
     assert(k != NULL && !HAS_PENDING_EXCEPTION, "class must exist");
     InstanceKlass* ik = InstanceKlass::cast(k);
+    assert(InstanceKlass::cast(ik)->is_shared_boot_class(),
+           "Only support boot classes");
+    ik->initialize(THREAD);
+    guarantee(!HAS_PENDING_EXCEPTION, "exception in initialize");
 
     ArchivableStaticFieldFinder finder(ik, field_name);
     ik->do_local_static_fields(&finder);
--- a/src/hotspot/share/memory/metaspace.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/memory/metaspace.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -1260,6 +1260,8 @@
 MetaWord* Metaspace::allocate(ClassLoaderData* loader_data, size_t word_size,
                               MetaspaceObj::Type type, TRAPS) {
   assert(!_frozen, "sanity");
+  assert(!(DumpSharedSpaces && THREAD->is_VM_thread()), "sanity");
+
   if (HAS_PENDING_EXCEPTION) {
     assert(false, "Should not allocate with exception pending");
     return NULL;  // caller does a CHECK_NULL too
@@ -1277,12 +1279,10 @@
     tracer()->report_metaspace_allocation_failure(loader_data, word_size, type, mdtype);
 
     // Allocation failed.
-    if (is_init_completed() && !(DumpSharedSpaces && THREAD->is_VM_thread())) {
+    if (is_init_completed()) {
       // Only start a GC if the bootstrapping has completed.
-      // Also, we cannot GC if we are at the end of the CDS dumping stage which runs inside
-      // the VM thread.
-
-      // Try to clean out some memory and retry.
+      // Try to clean out some heap memory and retry. This can prevent premature
+      // expansion of the metaspace.
       result = Universe::heap()->satisfy_failed_metadata_allocation(loader_data, word_size, mdtype);
     }
   }
@@ -1408,6 +1408,7 @@
 }
 
 ClassLoaderMetaspace::~ClassLoaderMetaspace() {
+  Metaspace::assert_not_frozen();
   DEBUG_ONLY(Atomic::inc(&g_internal_statistics.num_metaspace_deaths));
   delete _vsm;
   if (Metaspace::using_class_space()) {
--- a/src/hotspot/share/memory/metaspaceShared.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/memory/metaspaceShared.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -338,12 +338,6 @@
       ClassLoaderExt::init_app_module_paths_start_index(header->_app_module_paths_start_index);
     }
   }
-
-  if (DumpSharedSpaces) {
-    if (SharedArchiveConfigFile) {
-      read_extra_data(SharedArchiveConfigFile, THREAD);
-    }
-  }
 }
 
 void MetaspaceShared::read_extra_data(const char* filename, TRAPS) {
@@ -1207,10 +1201,6 @@
 
 public:
   static void copy_and_compact() {
-    // We should no longer allocate anything from the metaspace, so that
-    // we can have a stable set of MetaspaceObjs to work with.
-    Metaspace::freeze();
-
     ResourceMark rm;
     SortedSymbolClosure the_ssc; // StackObj
     _ssc = &the_ssc;
@@ -1356,6 +1346,14 @@
 }
 
 void VM_PopulateDumpSharedSpace::doit() {
+  // We should no longer allocate anything from the metaspace, so that:
+  //
+  // (1) Metaspace::allocate might trigger GC if we have run out of
+  //     committed metaspace, but we can't GC because we're running
+  //     in the VM thread.
+  // (2) ArchiveCompactor needs to work with a stable set of MetaspaceObjs.
+  Metaspace::freeze();
+
   Thread* THREAD = VMThread::vm_thread();
 
   FileMapInfo::check_nonempty_dir_in_shared_path_table();
@@ -1420,8 +1418,6 @@
   // any dictionaries.
   NOT_PRODUCT(assert_no_unsafe_anonymous_classes_in_dictionaries());
 
-  SystemDictionaryShared::finalize_verification_constraints();
-
   ArchiveCompactor::initialize();
   ArchiveCompactor::copy_and_compact();
 
@@ -1703,6 +1699,14 @@
 
     log_info(cds)("Shared spaces: preloaded %d classes", class_count);
 
+    if (SharedArchiveConfigFile) {
+      tty->print_cr("Reading extra data from %s ...", SharedArchiveConfigFile);
+      read_extra_data(SharedArchiveConfigFile, THREAD);
+    }
+    tty->print_cr("Reading extra data: done.");
+
+    HeapShared::init_subgraph_entry_fields(THREAD);
+
     // Rewrite and link classes
     tty->print_cr("Rewriting and linking classes ...");
 
@@ -1714,7 +1718,8 @@
     tty->print_cr("Rewriting and linking classes: done");
 
     SystemDictionary::clear_invoke_method_table();
-    HeapShared::init_subgraph_entry_fields(THREAD);
+
+    SystemDictionaryShared::finalize_verification_constraints();
 
     VM_PopulateDumpSharedSpace op;
     VMThread::execute(&op);
--- a/src/hotspot/share/opto/callnode.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/opto/callnode.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -26,6 +26,8 @@
 #include "compiler/compileLog.hpp"
 #include "ci/bcEscapeAnalyzer.hpp"
 #include "compiler/oopMap.hpp"
+#include "gc/shared/barrierSet.hpp"
+#include "gc/shared/c2/barrierSetC2.hpp"
 #include "interpreter/interpreter.hpp"
 #include "opto/callGenerator.hpp"
 #include "opto/callnode.hpp"
--- a/src/hotspot/share/opto/compile.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/opto/compile.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -2792,6 +2792,18 @@
   }
 #endif
   // Count FPU ops and common calls, implements item (3)
+  bool gc_handled = BarrierSet::barrier_set()->barrier_set_c2()->final_graph_reshaping(this, n, nop);
+  if (!gc_handled) {
+    final_graph_reshaping_main_switch(n, frc, nop);
+  }
+
+  // Collect CFG split points
+  if (n->is_MultiBranch() && !n->is_RangeCheck()) {
+    frc._tests.push(n);
+  }
+}
+
+void Compile::final_graph_reshaping_main_switch(Node* n, Final_Reshape_Counts& frc, uint nop) {
   switch( nop ) {
   // Count all float operations that may use FPU
   case Op_AddF:
@@ -2938,18 +2950,13 @@
   case Op_LoadL_unaligned:
   case Op_LoadPLocked:
   case Op_LoadP:
-#if INCLUDE_ZGC
-  case Op_LoadBarrierSlowReg:
-  case Op_LoadBarrierWeakSlowReg:
-#endif
   case Op_LoadN:
   case Op_LoadRange:
   case Op_LoadS: {
   handle_mem:
 #ifdef ASSERT
     if( VerifyOptoOopOffsets ) {
-      assert( n->is_Mem(), "" );
-      MemNode *mem  = (MemNode*)n;
+      MemNode* mem  = n->as_Mem();
       // Check to see if address types have grounded out somehow.
       const TypeInstPtr *tp = mem->in(MemNode::Address)->bottom_type()->isa_instptr();
       assert( !tp || oop_offset_is_sane(tp), "" );
@@ -3467,16 +3474,11 @@
     break;
   }
   default:
-    assert( !n->is_Call(), "" );
-    assert( !n->is_Mem(), "" );
-    assert( nop != Op_ProfileBoolean, "should be eliminated during IGVN");
+    assert(!n->is_Call(), "");
+    assert(!n->is_Mem(), "");
+    assert(nop != Op_ProfileBoolean, "should be eliminated during IGVN");
     break;
   }
-
-  // Collect CFG split points
-  if (n->is_MultiBranch() && !n->is_RangeCheck()) {
-    frc._tests.push(n);
-  }
 }
 
 //------------------------------final_graph_reshaping_walk---------------------
--- a/src/hotspot/share/opto/compile.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/opto/compile.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -1304,6 +1304,7 @@
   // Function calls made by the public function final_graph_reshaping.
   // No need to be made public as they are not called elsewhere.
   void final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc);
+  void final_graph_reshaping_main_switch(Node* n, Final_Reshape_Counts& frc, uint nop);
   void final_graph_reshaping_walk( Node_Stack &nstack, Node *root, Final_Reshape_Counts &frc );
   void eliminate_redundant_card_marks(Node* n);
 
--- a/src/hotspot/share/opto/loopPredicate.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/opto/loopPredicate.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -942,6 +942,15 @@
   GrowableArray<float> _freqs; // cache frequencies
   PhaseIdealLoop* _phase;
 
+  void set_rounding(int mode) {
+    // fesetround is broken on windows
+    NOT_WINDOWS(fesetround(mode);)
+  }
+
+  void check_frequency(float f) {
+    NOT_WINDOWS(assert(f <= 1 && f >= 0, "Incorrect frequency");)
+  }
+
 public:
   PathFrequency(Node* dom, PhaseIdealLoop* phase)
     : _dom(dom), _stack(0), _phase(phase) {
@@ -949,7 +958,7 @@
 
   float to(Node* n) {
     // post order walk on the CFG graph from n to _dom
-    fesetround(FE_TOWARDZERO); // make sure rounding doesn't push frequency above 1
+    set_rounding(FE_TOWARDZERO); // make sure rounding doesn't push frequency above 1
     IdealLoopTree* loop = _phase->get_loop(_dom);
     Node* c = n;
     for (;;) {
@@ -976,14 +985,14 @@
                 inner_head = inner_loop->_head->as_Loop();
                 inner_head->verify_strip_mined(1);
               }
-              fesetround(FE_UPWARD);  // make sure rounding doesn't push frequency above 1
+              set_rounding(FE_UPWARD);  // make sure rounding doesn't push frequency above 1
               float loop_exit_cnt = 0.0f;
               for (uint i = 0; i < inner_loop->_body.size(); i++) {
                 Node *n = inner_loop->_body[i];
                 float c = inner_loop->compute_profile_trip_cnt_helper(n);
                 loop_exit_cnt += c;
               }
-              fesetround(FE_TOWARDZERO);
+              set_rounding(FE_TOWARDZERO);
               float cnt = -1;
               if (n->in(0)->is_If()) {
                 IfNode* iff = n->in(0)->as_If();
@@ -1003,9 +1012,9 @@
                 cnt = p * jmp->_fcnt;
               }
               float this_exit_f = cnt > 0 ? cnt / loop_exit_cnt : 0;
-              assert(this_exit_f <= 1 && this_exit_f >= 0, "Incorrect frequency");
+              check_frequency(this_exit_f);
               f = f * this_exit_f;
-              assert(f <= 1 && f >= 0, "Incorrect frequency");
+              check_frequency(f);
             } else {
               float p = -1;
               if (n->in(0)->is_If()) {
@@ -1018,7 +1027,7 @@
                 p = n->in(0)->as_Jump()->_probs[n->as_JumpProj()->_con];
               }
               f = f * p;
-              assert(f <= 1 && f >= 0, "Incorrect frequency");
+              check_frequency(f);
             }
             _freqs.at_put_grow(n->_idx, (float)f, -1);
             _stack.pop();
@@ -1026,7 +1035,7 @@
             float prev_f = _freqs_stack.pop();
             float new_f = f;
             f = new_f + prev_f;
-            assert(f <= 1 && f >= 0, "Incorrect frequency");
+            check_frequency(f);
             uint i = _stack.index();
             if (i < n->req()) {
               c = n->in(i);
@@ -1039,8 +1048,8 @@
           }
         }
         if (_stack.size() == 0) {
-          fesetround(FE_TONEAREST);
-          assert(f >= 0 && f <= 1, "should have been computed");
+          set_rounding(FE_TONEAREST);
+          check_frequency(f);
           return f;
         }
       } else if (c->is_Loop()) {
--- a/src/hotspot/share/opto/matcher.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/opto/matcher.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -1209,7 +1209,9 @@
   // Allocate a private array of RegMasks.  These RegMasks are not shared.
   msfpt->_in_rms = NEW_RESOURCE_ARRAY( RegMask, cnt );
   // Empty them all.
-  memset( msfpt->_in_rms, 0, sizeof(RegMask)*cnt );
+  for (uint i = 0; i < cnt; i++) {
+    msfpt->_in_rms[i] = RegMask();
+  }
 
   // Do all the pre-defined non-Empty register masks
   msfpt->_in_rms[TypeFunc::ReturnAdr] = _return_addr_mask;
--- a/src/hotspot/share/prims/jvm.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/prims/jvm.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -364,6 +364,8 @@
   // System property list includes both user set via -D option and
   // jvm system specific properties.
   for (SystemProperty* p = Arguments::system_properties(); p != NULL; p = p->next()) {
+    if (strcmp(p->key(), "sun.nio.MaxDirectMemorySize") == 0)  // Can not be defined with -D
+      continue;
     PUTPROP(props, p->key(), p->value());
   }
 
@@ -371,14 +373,11 @@
   // to the sun.nio.MaxDirectMemorySize property.
   // Do this after setting user properties to prevent people
   // from setting the value with a -D option, as requested.
-  {
-    if (FLAG_IS_DEFAULT(MaxDirectMemorySize)) {
-      PUTPROP(props, "sun.nio.MaxDirectMemorySize", "-1");
-    } else {
-      char as_chars[256];
-      jio_snprintf(as_chars, sizeof(as_chars), JULONG_FORMAT, MaxDirectMemorySize);
-      PUTPROP(props, "sun.nio.MaxDirectMemorySize", as_chars);
-    }
+  // Leave empty if not supplied
+  if (!FLAG_IS_DEFAULT(MaxDirectMemorySize)) {
+    char as_chars[256];
+    jio_snprintf(as_chars, sizeof(as_chars), JULONG_FORMAT, MaxDirectMemorySize);
+    PUTPROP(props, "sun.nio.MaxDirectMemorySize", as_chars);
   }
 
   // JVM monitoring and management support
--- a/src/hotspot/share/runtime/arguments.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/runtime/arguments.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -2074,17 +2074,10 @@
     option_type = ++spacer; // Set both to the empty string.
   }
 
-  if (os::obsolete_option(option)) {
-    jio_fprintf(defaultStream::error_stream(),
-                "Obsolete %s%soption: %s\n", option_type, spacer,
-      option->optionString);
-    return false;
-  } else {
-    jio_fprintf(defaultStream::error_stream(),
-                "Unrecognized %s%soption: %s\n", option_type, spacer,
-      option->optionString);
-    return true;
-  }
+  jio_fprintf(defaultStream::error_stream(),
+              "Unrecognized %s%soption: %s\n", option_type, spacer,
+              option->optionString);
+  return true;
 }
 
 static const char* user_assertion_options[] = {
--- a/src/hotspot/share/runtime/globals.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/runtime/globals.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -1259,8 +1259,8 @@
           "[default: ./hs_err_pid%p.log] (%p replaced with pid)")           \
                                                                             \
   product(bool, ExtensiveErrorReports,                                      \
-                 PRODUCT_ONLY(false) NOT_PRODUCT(true),                     \
-                 "Error reports are more extensive.")                       \
+          PRODUCT_ONLY(false) NOT_PRODUCT(true),                            \
+          "Error reports are more extensive.")                              \
                                                                             \
   product(bool, DisplayVMOutputToStderr, false,                             \
           "If DisplayVMOutput is true, display all VM output to stderr")    \
--- a/src/hotspot/share/runtime/os.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/runtime/os.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -802,9 +802,6 @@
   // System loadavg support.  Returns -1 if load average cannot be obtained.
   static int loadavg(double loadavg[], int nelem);
 
-  // Hook for os specific jvm options that we don't want to abort on seeing
-  static bool obsolete_option(const JavaVMOption *option);
-
   // Amount beyond the callee frame size that we bang the stack.
   static int extra_bang_size_in_bytes();
 
--- a/src/hotspot/share/utilities/bitMap.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/utilities/bitMap.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -263,14 +263,24 @@
   }
 }
 
+bool BitMap::is_small_range_of_words(idx_t beg_full_word, idx_t end_full_word) {
+  // There is little point to call large version on small ranges.
+  // Need to check carefully, keeping potential idx_t underflow in mind.
+  // The threshold should be at least one word.
+  STATIC_ASSERT(small_range_words >= 1);
+  return (beg_full_word + small_range_words >= end_full_word);
+}
+
 void BitMap::set_large_range(idx_t beg, idx_t end) {
   verify_range(beg, end);
 
   idx_t beg_full_word = word_index_round_up(beg);
   idx_t end_full_word = word_index(end);
 
-  assert(end_full_word - beg_full_word >= 32,
-         "the range must include at least 32 bytes");
+  if (is_small_range_of_words(beg_full_word, end_full_word)) {
+    set_range(beg, end);
+    return;
+  }
 
   // The range includes at least one full word.
   set_range_within_word(beg, bit_index(beg_full_word));
@@ -284,7 +294,7 @@
   idx_t beg_full_word = word_index_round_up(beg);
   idx_t end_full_word = word_index(end);
 
-  if (end_full_word - beg_full_word < 32) {
+  if (is_small_range_of_words(beg_full_word, end_full_word)) {
     clear_range(beg, end);
     return;
   }
@@ -368,8 +378,10 @@
   idx_t beg_full_word = word_index_round_up(beg);
   idx_t end_full_word = word_index(end);
 
-  assert(end_full_word - beg_full_word >= 32,
-         "the range must include at least 32 bytes");
+  if (is_small_range_of_words(beg_full_word, end_full_word)) {
+    par_at_put_range(beg, end, value);
+    return;
+  }
 
   // The range includes at least one full word.
   par_put_range_within_word(beg, bit_index(beg_full_word), value);
--- a/src/hotspot/share/utilities/bitMap.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/utilities/bitMap.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -72,6 +72,10 @@
   static const bm_word_t find_ones_flip = 0;
   static const bm_word_t find_zeros_flip = ~(bm_word_t)0;
 
+  // Threshold for performing small range operation, even when large range
+  // operation was requested. Measured in words.
+  static const size_t small_range_words = 32;
+
  protected:
   // Return the position of bit within the word that contains it (e.g., if
   // bitmap words are 32 bits, return a number 0 <= n <= 31).
@@ -117,6 +121,8 @@
 
   static void clear_range_of_words(bm_word_t* map, idx_t beg, idx_t end);
 
+  static bool is_small_range_of_words(idx_t beg_full_word, idx_t end_full_word);
+
   // The index of the first full word in a range.
   idx_t word_index_round_up(idx_t bit) const;
 
--- a/src/hotspot/share/utilities/bitMap.inline.hpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/hotspot/share/utilities/bitMap.inline.hpp	Wed Nov 14 04:59:57 2018 +0100
@@ -237,10 +237,12 @@
 }
 
 inline void BitMap::set_large_range_of_words(idx_t beg, idx_t end) {
+  assert(beg <= end, "underflow");
   memset(_map + beg, ~(unsigned char)0, (end - beg) * sizeof(bm_word_t));
 }
 
 inline void BitMap::clear_large_range_of_words(idx_t beg, idx_t end) {
+  assert(beg <= end, "underflow");
   memset(_map + beg, 0, (end - beg) * sizeof(bm_word_t));
 }
 
--- a/src/java.base/share/classes/java/lang/System.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/lang/System.java	Wed Nov 14 04:59:57 2018 +0100
@@ -802,6 +802,7 @@
         if (props == null) {
             props = new Properties();
             initProperties(props);
+            VersionProps.init(props);
         }
         System.props = props;
     }
@@ -1973,6 +1974,7 @@
         // be put into it directly.
         props = new Properties(84);
         initProperties(props);  // initialized by the VM
+        VersionProps.init(props);
 
         // There are certain system configurations that may be controlled by
         // VM options such as the maximum amount of direct memory and
@@ -1992,7 +1994,6 @@
 
         lineSeparator = props.getProperty("line.separator");
         StaticProperty.javaHome();          // Load StaticProperty to cache the property values
-        VersionProps.init();
 
         FileInputStream fdIn = new FileInputStream(FileDescriptor.in);
         FileOutputStream fdOut = new FileOutputStream(FileDescriptor.out);
--- a/src/java.base/share/classes/java/lang/VersionProps.java.template	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/lang/VersionProps.java.template	Wed Nov 14 04:59:57 2018 +0100
@@ -29,6 +29,7 @@
 import java.util.Arrays;
 import java.util.List;
 import java.util.Optional;
+import java.util.Properties;
 
 class VersionProps {
 
@@ -69,17 +70,13 @@
         (VENDOR_VERSION_STRING.length() > 0
          ? " " + VENDOR_VERSION_STRING : "");
 
-    static {
-        init();
-    }
-
-    public static void init() {
-        System.setProperty("java.version", java_version);
-        System.setProperty("java.version.date", java_version_date);
-        System.setProperty("java.runtime.version", java_runtime_version);
-        System.setProperty("java.runtime.name", java_runtime_name);
+    public static void init(Properties props) {
+        props.setProperty("java.version", java_version);
+        props.setProperty("java.version.date", java_version_date);
+        props.setProperty("java.runtime.version", java_runtime_version);
+        props.setProperty("java.runtime.name", java_runtime_name);
         if (VENDOR_VERSION_STRING.length() > 0)
-            System.setProperty("java.vendor.version", VENDOR_VERSION_STRING);
+            props.setProperty("java.vendor.version", VENDOR_VERSION_STRING);
     }
 
     private static int parseVersionNumber(String version, int prevIndex, int index) {
--- a/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java	Wed Nov 14 04:59:57 2018 +0100
@@ -30,6 +30,8 @@
 import java.lang.ref.SoftReference;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.Comparator;
+import java.util.TreeMap;
 import java.util.concurrent.ConcurrentHashMap;
 
 import static java.lang.invoke.LambdaForm.*;
@@ -86,7 +88,8 @@
                 LOCAL_TYPES = 14,
                 FOLD_SELECT_ARGS = 15,
                 FOLD_SELECT_ARGS_TO_VOID = 16,
-                FILTER_SELECT_ARGS = 17;
+                FILTER_SELECT_ARGS = 17,
+                REPEAT_FILTER_ARGS = 18;
 
         private static final boolean STRESS_TEST = false; // turn on to disable most packing
         private static final int
@@ -641,6 +644,104 @@
         return putInCache(key, form);
     }
 
+    /**
+     * This creates a LF that will repeatedly invoke some unary filter function
+     * at each of the given positions. This allows fewer LFs and BMH species
+     * classes to be generated in typical cases compared to building up the form
+     * by reapplying of {@code filterArgumentForm(int,BasicType)}, and should do
+     * no worse in the worst case.
+     */
+    LambdaForm filterRepeatedArgumentForm(BasicType newType, int... argPositions) {
+        assert (argPositions.length > 1);
+        byte[] keyArgs = new byte[argPositions.length + 2];
+        keyArgs[0] = Transform.REPEAT_FILTER_ARGS;
+        keyArgs[argPositions.length + 1] = (byte)newType.ordinal();
+        for (int i = 0; i < argPositions.length; i++) {
+            keyArgs[i + 1] = (byte)argPositions[i];
+        }
+        Transform key = new Transform(keyArgs);
+        LambdaForm form = getInCache(key);
+        if (form != null) {
+            assert(form.arity == lambdaForm.arity &&
+                    formParametersMatch(form, newType, argPositions));
+            return form;
+        }
+        BasicType oldType = lambdaForm.parameterType(argPositions[0]);
+        MethodType filterType = MethodType.methodType(oldType.basicTypeClass(),
+                newType.basicTypeClass());
+        form = makeRepeatedFilterForm(filterType, argPositions);
+        assert (formParametersMatch(form, newType, argPositions));
+        return putInCache(key, form);
+    }
+
+    private boolean formParametersMatch(LambdaForm form, BasicType newType, int... argPositions) {
+        for (int i : argPositions) {
+            if (form.parameterType(i) != newType) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    private LambdaForm makeRepeatedFilterForm(MethodType combinerType, int... positions) {
+        assert (combinerType.parameterCount() == 1 &&
+                combinerType == combinerType.basicType() &&
+                combinerType.returnType() != void.class);
+        LambdaFormBuffer buf = buffer();
+        buf.startEdit();
+
+        BoundMethodHandle.SpeciesData oldData = oldSpeciesData();
+        BoundMethodHandle.SpeciesData newData = newSpeciesData(L_TYPE);
+
+        // The newly created LF will run with a different BMH.
+        // Switch over any pre-existing BMH field references to the new BMH class.
+        Name oldBaseAddress = lambdaForm.parameter(0);  // BMH holding the values
+        buf.replaceFunctions(oldData.getterFunctions(), newData.getterFunctions(), oldBaseAddress);
+        Name newBaseAddress = oldBaseAddress.withConstraint(newData);
+        buf.renameParameter(0, newBaseAddress);
+
+        // Insert the new expressions at the end
+        int exprPos = lambdaForm.arity();
+        Name getCombiner = new Name(newData.getterFunction(oldData.fieldCount()), newBaseAddress);
+        buf.insertExpression(exprPos++, getCombiner);
+
+        // After inserting expressions, we insert parameters in order
+        // from lowest to highest, simplifying the calculation of where parameters
+        // and expressions are
+        var newParameters = new TreeMap<Name, Integer>(new Comparator<>() {
+            public int compare(Name n1, Name n2) {
+                return n1.index - n2.index;
+            }
+        });
+
+        // Insert combiner expressions in reverse order so that the invocation of
+        // the resulting form will invoke the combiners in left-to-right order
+        for (int i = positions.length - 1; i >= 0; --i) {
+            int pos = positions[i];
+            assert (pos > 0 && pos <= MethodType.MAX_JVM_ARITY && pos < lambdaForm.arity);
+
+            Name newParameter = new Name(pos, basicType(combinerType.parameterType(0)));
+            Object[] combinerArgs = {getCombiner, newParameter};
+
+            Name callCombiner = new Name(combinerType, combinerArgs);
+            buf.insertExpression(exprPos++, callCombiner);
+            newParameters.put(newParameter, exprPos);
+        }
+
+        // Mix in new parameters from left to right in the buffer (this doesn't change
+        // execution order
+        int offset = 0;
+        for (var entry : newParameters.entrySet()) {
+            Name newParameter = entry.getKey();
+            int from = entry.getValue();
+            buf.insertParameter(newParameter.index() + 1 + offset, newParameter);
+            buf.replaceParameterByCopy(newParameter.index() + offset, from + offset);
+            offset++;
+        }
+        return buf.endEdit();
+    }
+
+
     private LambdaForm makeArgumentCombinationForm(int pos,
                                                    MethodType combinerType,
                                                    boolean keepArguments, boolean dropResult) {
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Wed Nov 14 04:59:57 2018 +0100
@@ -42,6 +42,7 @@
 import java.lang.reflect.Array;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -257,14 +258,19 @@
 
     private static int countNonNull(Object[] array) {
         int count = 0;
-        for (Object x : array) {
-            if (x != null)  ++count;
+        if (array != null) {
+            for (Object x : array) {
+                if (x != null) ++count;
+            }
         }
         return count;
     }
 
     static MethodHandle makePairwiseConvertByEditor(MethodHandle target, MethodType srcType,
                                                     boolean strict, boolean monobox) {
+        // In method types arguments start at index 0, while the LF
+        // editor have the MH receiver at position 0 - adjust appropriately.
+        final int MH_RECEIVER_OFFSET = 1;
         Object[] convSpecs = computeValueConversions(srcType, target.type(), strict, monobox);
         int convCount = countNonNull(convSpecs);
         if (convCount == 0)
@@ -272,27 +278,52 @@
         MethodType basicSrcType = srcType.basicType();
         MethodType midType = target.type().basicType();
         BoundMethodHandle mh = target.rebind();
-        // FIXME: Reduce number of bindings when there is more than one Class conversion.
-        // FIXME: Reduce number of bindings when there are repeated conversions.
-        for (int i = 0; i < convSpecs.length-1; i++) {
+
+        // Match each unique conversion to the positions at which it is to be applied
+        var convSpecMap = new HashMap<Object, int[]>(((4 * convCount) / 3) + 1);
+        for (int i = 0; i < convSpecs.length - MH_RECEIVER_OFFSET; i++) {
             Object convSpec = convSpecs[i];
-            if (convSpec == null)  continue;
+            if (convSpec == null) continue;
+            int[] positions = convSpecMap.get(convSpec);
+            if (positions == null) {
+                positions = new int[] { i + MH_RECEIVER_OFFSET };
+            } else {
+                positions = Arrays.copyOf(positions, positions.length + 1);
+                positions[positions.length - 1] = i + MH_RECEIVER_OFFSET;
+            }
+            convSpecMap.put(convSpec, positions);
+        }
+        for (var entry : convSpecMap.entrySet()) {
+            Object convSpec = entry.getKey();
+
             MethodHandle fn;
             if (convSpec instanceof Class) {
                 fn = getConstantHandle(MH_cast).bindTo(convSpec);
             } else {
                 fn = (MethodHandle) convSpec;
             }
-            Class<?> newType = basicSrcType.parameterType(i);
-            if (--convCount == 0)
+            int[] positions = entry.getValue();
+            Class<?> newType = basicSrcType.parameterType(positions[0] - MH_RECEIVER_OFFSET);
+            BasicType newBasicType = BasicType.basicType(newType);
+            convCount -= positions.length;
+            if (convCount == 0) {
                 midType = srcType;
-            else
-                midType = midType.changeParameterType(i, newType);
-            LambdaForm form2 = mh.editor().filterArgumentForm(1+i, BasicType.basicType(newType));
+            } else {
+                Class<?>[] ptypes = midType.ptypes().clone();
+                for (int pos : positions) {
+                    ptypes[pos - 1] = newType;
+                }
+                midType = MethodType.makeImpl(midType.rtype(), ptypes, true);
+            }
+            LambdaForm form2;
+            if (positions.length > 1) {
+                form2 = mh.editor().filterRepeatedArgumentForm(newBasicType, positions);
+            } else {
+                form2 = mh.editor().filterArgumentForm(positions[0], newBasicType);
+            }
             mh = mh.copyWithExtendL(midType, form2, fn);
-            mh = mh.rebind();
         }
-        Object convSpec = convSpecs[convSpecs.length-1];
+        Object convSpec = convSpecs[convSpecs.length - 1];
         if (convSpec != null) {
             MethodHandle fn;
             if (convSpec instanceof Class) {
@@ -320,98 +351,18 @@
         return mh;
     }
 
-    static MethodHandle makePairwiseConvertIndirect(MethodHandle target, MethodType srcType,
-                                                    boolean strict, boolean monobox) {
-        assert(target.type().parameterCount() == srcType.parameterCount());
-        // Calculate extra arguments (temporaries) required in the names array.
-        Object[] convSpecs = computeValueConversions(srcType, target.type(), strict, monobox);
-        final int INARG_COUNT = srcType.parameterCount();
-        int convCount = countNonNull(convSpecs);
-        boolean retConv = (convSpecs[INARG_COUNT] != null);
-        boolean retVoid = srcType.returnType() == void.class;
-        if (retConv && retVoid) {
-            convCount -= 1;
-            retConv = false;
-        }
-
-        final int IN_MH         = 0;
-        final int INARG_BASE    = 1;
-        final int INARG_LIMIT   = INARG_BASE + INARG_COUNT;
-        final int NAME_LIMIT    = INARG_LIMIT + convCount + 1;
-        final int RETURN_CONV   = (!retConv ? -1         : NAME_LIMIT - 1);
-        final int OUT_CALL      = (!retConv ? NAME_LIMIT : RETURN_CONV) - 1;
-        final int RESULT        = (retVoid ? -1 : NAME_LIMIT - 1);
-
-        // Now build a LambdaForm.
-        MethodType lambdaType = srcType.basicType().invokerType();
-        Name[] names = arguments(NAME_LIMIT - INARG_LIMIT, lambdaType);
-
-        // Collect the arguments to the outgoing call, maybe with conversions:
-        final int OUTARG_BASE = 0;  // target MH is Name.function, name Name.arguments[0]
-        Object[] outArgs = new Object[OUTARG_BASE + INARG_COUNT];
-
-        int nameCursor = INARG_LIMIT;
-        for (int i = 0; i < INARG_COUNT; i++) {
-            Object convSpec = convSpecs[i];
-            if (convSpec == null) {
-                // do nothing: difference is trivial
-                outArgs[OUTARG_BASE + i] = names[INARG_BASE + i];
-                continue;
-            }
-
-            Name conv;
-            if (convSpec instanceof Class) {
-                Class<?> convClass = (Class<?>) convSpec;
-                conv = new Name(getConstantHandle(MH_cast), convClass, names[INARG_BASE + i]);
-            } else {
-                MethodHandle fn = (MethodHandle) convSpec;
-                conv = new Name(fn, names[INARG_BASE + i]);
-            }
-            assert(names[nameCursor] == null);
-            names[nameCursor++] = conv;
-            assert(outArgs[OUTARG_BASE + i] == null);
-            outArgs[OUTARG_BASE + i] = conv;
-        }
-
-        // Build argument array for the call.
-        assert(nameCursor == OUT_CALL);
-        names[OUT_CALL] = new Name(target, outArgs);
-
-        Object convSpec = convSpecs[INARG_COUNT];
-        if (!retConv) {
-            assert(OUT_CALL == names.length-1);
-        } else {
-            Name conv;
-            if (convSpec == void.class) {
-                conv = new Name(LambdaForm.constantZero(BasicType.basicType(srcType.returnType())));
-            } else if (convSpec instanceof Class) {
-                Class<?> convClass = (Class<?>) convSpec;
-                conv = new Name(getConstantHandle(MH_cast), convClass, names[OUT_CALL]);
-            } else {
-                MethodHandle fn = (MethodHandle) convSpec;
-                if (fn.type().parameterCount() == 0)
-                    conv = new Name(fn);  // don't pass retval to void conversion
-                else
-                    conv = new Name(fn, names[OUT_CALL]);
-            }
-            assert(names[RETURN_CONV] == null);
-            names[RETURN_CONV] = conv;
-            assert(RETURN_CONV == names.length-1);
-        }
-
-        LambdaForm form = new LambdaForm(lambdaType.parameterCount(), names, RESULT, Kind.CONVERT);
-        return SimpleMethodHandle.make(srcType, form);
-    }
-
     static Object[] computeValueConversions(MethodType srcType, MethodType dstType,
                                             boolean strict, boolean monobox) {
         final int INARG_COUNT = srcType.parameterCount();
-        Object[] convSpecs = new Object[INARG_COUNT+1];
+        Object[] convSpecs = null;
         for (int i = 0; i <= INARG_COUNT; i++) {
             boolean isRet = (i == INARG_COUNT);
             Class<?> src = isRet ? dstType.returnType() : srcType.parameterType(i);
             Class<?> dst = isRet ? srcType.returnType() : dstType.parameterType(i);
             if (!VerifyType.isNullConversion(src, dst, /*keepInterfaces=*/ strict)) {
+                if (convSpecs == null) {
+                    convSpecs = new Object[INARG_COUNT + 1];
+                }
                 convSpecs[i] = valueConversion(src, dst, strict, monobox);
             }
         }
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Wed Nov 14 04:59:57 2018 +0100
@@ -3864,18 +3864,63 @@
      */
     public static
     MethodHandle filterArguments(MethodHandle target, int pos, MethodHandle... filters) {
+        // In method types arguments start at index 0, while the LF
+        // editor have the MH receiver at position 0 - adjust appropriately.
+        final int MH_RECEIVER_OFFSET = 1;
         filterArgumentsCheckArity(target, pos, filters);
         MethodHandle adapter = target;
+
+        // keep track of currently matched filters, as to optimize repeated filters
+        int index = 0;
+        int[] positions = new int[filters.length];
+        MethodHandle filter = null;
+
         // process filters in reverse order so that the invocation of
         // the resulting adapter will invoke the filters in left-to-right order
         for (int i = filters.length - 1; i >= 0; --i) {
-            MethodHandle filter = filters[i];
-            if (filter == null)  continue;  // ignore null elements of filters
-            adapter = filterArgument(adapter, pos + i, filter);
+            MethodHandle newFilter = filters[i];
+            if (newFilter == null) continue;  // ignore null elements of filters
+
+            // flush changes on update
+            if (filter != newFilter) {
+                if (filter != null) {
+                    if (index > 1) {
+                        adapter = filterRepeatedArgument(adapter, filter, Arrays.copyOf(positions, index));
+                    } else {
+                        adapter = filterArgument(adapter, positions[0] - 1, filter);
+                    }
+                }
+                filter = newFilter;
+                index = 0;
+            }
+
+            filterArgumentChecks(target, pos + i, newFilter);
+            positions[index++] = pos + i + MH_RECEIVER_OFFSET;
+        }
+        if (index > 1) {
+            adapter = filterRepeatedArgument(adapter, filter, Arrays.copyOf(positions, index));
+        } else if (index == 1) {
+            adapter = filterArgument(adapter, positions[0] - 1, filter);
         }
         return adapter;
     }
 
+    private static MethodHandle filterRepeatedArgument(MethodHandle adapter, MethodHandle filter, int[] positions) {
+        MethodType targetType = adapter.type();
+        MethodType filterType = filter.type();
+        BoundMethodHandle result = adapter.rebind();
+        Class<?> newParamType = filterType.parameterType(0);
+
+        Class<?>[] ptypes = targetType.ptypes().clone();
+        for (int pos : positions) {
+            ptypes[pos - 1] = newParamType;
+        }
+        MethodType newType = MethodType.makeImpl(targetType.rtype(), ptypes, true);
+
+        LambdaForm lform = result.editor().filterRepeatedArgumentForm(BasicType.basicType(newParamType), positions);
+        return result.copyWithExtendL(newType, lform, filter);
+    }
+
     /*non-public*/ static
     MethodHandle filterArgument(MethodHandle target, int pos, MethodHandle filter) {
         filterArgumentChecks(target, pos, filter);
--- a/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java	Wed Nov 14 04:59:57 2018 +0100
@@ -1629,7 +1629,7 @@
         @ForceInline
         private static byte[] newArray(long indexCoder) {
             byte coder = (byte)(indexCoder >> 32);
-            int index = ((int)indexCoder & 0x7FFFFFFF);
+            int index = (int)indexCoder;
             return (byte[]) UNSAFE.allocateUninitializedArray(byte.class, index << coder);
         }
 
@@ -1692,30 +1692,35 @@
             // no instantiation
         }
 
-        private static class StringifierMost extends ClassValue<MethodHandle> {
-            @Override
-            protected MethodHandle computeValue(Class<?> cl) {
-                if (cl == String.class) {
-                    return lookupStatic(MethodHandles.publicLookup(), String.class, "valueOf", String.class, Object.class);
-                } else if (cl == float.class) {
-                    return lookupStatic(MethodHandles.publicLookup(), String.class, "valueOf", String.class, float.class);
-                } else if (cl == double.class) {
-                    return lookupStatic(MethodHandles.publicLookup(), String.class, "valueOf", String.class, double.class);
-                } else if (!cl.isPrimitive()) {
-                    MethodHandle mhObject = lookupStatic(MethodHandles.publicLookup(), String.class, "valueOf", String.class, Object.class);
+        private static class ObjectStringifier {
 
-                    // We need the additional conversion here, because String.valueOf(Object) may return null.
-                    // String conversion rules in Java state we need to produce "null" String in this case.
-                    // It can be easily done with applying valueOf the second time.
-                    return MethodHandles.filterReturnValue(mhObject,
-                            mhObject.asType(MethodType.methodType(String.class, String.class)));
-                }
+            // We need some additional conversion for Objects in general, because String.valueOf(Object)
+            // may return null. String conversion rules in Java state we need to produce "null" String
+            // in this case, so we provide a customized version that deals with this problematic corner case.
+            private static String valueOf(Object value) {
+                String s;
+                return (value == null || (s = value.toString()) == null) ? "null" : s;
+            }
 
-                return null;
-            }
+            // Could have used MethodHandles.lookup() instead of Lookup.IMPL_LOOKUP, if not for the fact
+            // java.lang.invoke Lookups are explicitly forbidden to be retrieved using that API.
+            private static final MethodHandle INSTANCE =
+                    lookupStatic(Lookup.IMPL_LOOKUP, ObjectStringifier.class, "valueOf", String.class, Object.class);
+
+        }
+
+        private static class FloatStringifiers {
+            private static final MethodHandle FLOAT_INSTANCE =
+                    lookupStatic(MethodHandles.publicLookup(), String.class, "valueOf", String.class, float.class);
+
+            private static final MethodHandle DOUBLE_INSTANCE =
+                    lookupStatic(MethodHandles.publicLookup(), String.class, "valueOf", String.class, double.class);
         }
 
         private static class StringifierAny extends ClassValue<MethodHandle> {
+
+            private static final ClassValue<MethodHandle> INSTANCE = new StringifierAny();
+
             @Override
             protected MethodHandle computeValue(Class<?> cl) {
                 if (cl == byte.class || cl == short.class || cl == int.class) {
@@ -1727,7 +1732,7 @@
                 } else if (cl == long.class) {
                     return lookupStatic(MethodHandles.publicLookup(), String.class, "valueOf", String.class, long.class);
                 } else {
-                    MethodHandle mh = STRINGIFIERS_MOST.get(cl);
+                    MethodHandle mh = forMost(cl);
                     if (mh != null) {
                         return mh;
                     } else {
@@ -1737,9 +1742,6 @@
             }
         }
 
-        private static final ClassValue<MethodHandle> STRINGIFIERS_MOST = new StringifierMost();
-        private static final ClassValue<MethodHandle> STRINGIFIERS_ANY = new StringifierAny();
-
         /**
          * Returns a stringifier for references and floats/doubles only.
          * Always returns null for other primitives.
@@ -1748,7 +1750,14 @@
          * @return stringifier; null, if not available
          */
         static MethodHandle forMost(Class<?> t) {
-            return STRINGIFIERS_MOST.get(t);
+            if (!t.isPrimitive()) {
+                return ObjectStringifier.INSTANCE;
+            } else if (t == float.class) {
+                return FloatStringifiers.FLOAT_INSTANCE;
+            } else if (t == double.class) {
+                return FloatStringifiers.DOUBLE_INSTANCE;
+            }
+            return null;
         }
 
         /**
@@ -1758,7 +1767,7 @@
          * @return stringifier
          */
         static MethodHandle forAny(Class<?> t) {
-            return STRINGIFIERS_ANY.get(t);
+            return StringifierAny.INSTANCE.get(t);
         }
     }
 
--- a/src/java.base/share/classes/java/lang/ref/Reference.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/lang/ref/Reference.java	Wed Nov 14 04:59:57 2018 +0100
@@ -379,7 +379,7 @@
      * Throws {@link CloneNotSupportedException}. A {@code Reference} cannot be
      * meaningfully cloned. Construct a new {@code Reference} instead.
      *
-     * @returns never returns normally
+     * @return never returns normally
      * @throws  CloneNotSupportedException always
      *
      * @since 11
--- a/src/java.base/share/classes/java/net/CookieManager.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/net/CookieManager.java	Wed Nov 14 04:59:57 2018 +0100
@@ -62,7 +62,7 @@
  * <ul>
  *   <li>
  *     CookieHandler is at the core of cookie management. User can call
- *     CookieHandler.setDefault to set a concrete CookieHanlder implementation
+ *     CookieHandler.setDefault to set a concrete CookieHandler implementation
  *     to be used.
  *   </li>
  *   <li>
@@ -354,7 +354,7 @@
     private boolean shouldAcceptInternal(URI uri, HttpCookie cookie) {
         try {
             return policyCallback.shouldAccept(uri, cookie);
-        } catch (Exception ignored) { // pretect against malicious callback
+        } catch (Exception ignored) { // protect against malicious callback
             return false;
         }
     }
--- a/src/java.base/share/classes/java/net/DatagramSocket.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/net/DatagramSocket.java	Wed Nov 14 04:59:57 2018 +0100
@@ -304,7 +304,7 @@
     private void checkOldImpl() {
         if (impl == null)
             return;
-        // DatagramSocketImpl.peekdata() is a protected method, therefore we need to use
+        // DatagramSocketImpl.peekData() is a protected method, therefore we need to use
         // getDeclaredMethod, therefore we need permission to access the member
         try {
             AccessController.doPrivileged(
@@ -660,7 +660,7 @@
                 throw new SocketException("Socket is closed");
             checkAddress (p.getAddress(), "send");
             if (connectState == ST_NOT_CONNECTED) {
-                // check the address is ok wiht the security manager on every send.
+                // check the address is ok with the security manager on every send.
                 SecurityManager security = System.getSecurityManager();
 
                 // The reason you want to synchronize on datagram packet
@@ -1070,7 +1070,7 @@
      *
      * @param on  whether to enable or disable the
      * @exception SocketException if an error occurs enabling or
-     *            disabling the {@code SO_RESUEADDR} socket option,
+     *            disabling the {@code SO_REUSEADDR} socket option,
      *            or the socket is closed.
      * @since 1.4
      * @see #getReuseAddress()
--- a/src/java.base/share/classes/java/net/HttpCookie.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/net/HttpCookie.java	Wed Nov 14 04:59:57 2018 +0100
@@ -666,7 +666,7 @@
         int domainLength = domain.length();
         int lengthDiff = host.length() - domainLength;
         if (lengthDiff == 0) {
-            // if the host name and the domain name are just string-compare euqal
+            // if the host name and the domain name are just string-compare equal
             return host.equalsIgnoreCase(domain);
         }
         else if (lengthDiff > 0) {
@@ -1131,7 +1131,7 @@
      * Split cookie header string according to rfc 2965:
      *   1) split where it is a comma;
      *   2) but not the comma surrounding by double-quotes, which is the comma
-     *      inside port list or embeded URIs.
+     *      inside port list or embedded URIs.
      *
      * @param  header
      *         the cookie header string to split
--- a/src/java.base/share/classes/java/net/IDN.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/net/IDN.java	Wed Nov 14 04:59:57 2018 +0100
@@ -407,7 +407,7 @@
     // 26-letter Latin alphabet <A-Z a-z>, the digits <0-9>, and the hyphen
     // <->.
     // Non LDH refers to characters in the ASCII range, but which are not
-    // letters, digits or the hypen.
+    // letters, digits or the hyphen.
     //
     // non-LDH = 0..0x2C, 0x2E..0x2F, 0x3A..0x40, 0x5B..0x60, 0x7B..0x7F
     //
--- a/src/java.base/share/classes/java/net/InMemoryCookieStore.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/net/InMemoryCookieStore.java	Wed Nov 14 04:59:57 2018 +0100
@@ -54,7 +54,7 @@
     private Map<String, List<HttpCookie>> domainIndex = null;
     private Map<URI, List<HttpCookie>> uriIndex = null;
 
-    // use ReentrantLock instead of syncronized for scalability
+    // use ReentrantLock instead of synchronized for scalability
     private ReentrantLock lock = null;
 
 
@@ -260,7 +260,7 @@
         int domainLength = domain.length();
         int lengthDiff = host.length() - domainLength;
         if (lengthDiff == 0) {
-            // if the host name and the domain name are just string-compare euqal
+            // if the host name and the domain name are just string-compare equal
             return host.equalsIgnoreCase(domain);
         } else if (lengthDiff > 0) {
             // need to check H & D component
@@ -301,7 +301,7 @@
                             toRemove.add(c);
                         }
                     } else {
-                        // the cookie has beed removed from main store,
+                        // the cookie has been removed from main store,
                         // so also remove it from domain indexed store
                         toRemove.add(c);
                     }
@@ -345,7 +345,7 @@
                                 cookieJar.remove(ck);
                             }
                         } else {
-                            // the cookie has beed removed from main store,
+                            // the cookie has been removed from main store,
                             // so also remove it from domain indexed store
                             it.remove();
                         }
--- a/src/java.base/share/classes/java/net/Inet4Address.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/net/Inet4Address.java	Wed Nov 14 04:59:57 2018 +0100
@@ -164,7 +164,7 @@
 
     /**
      * Utility routine to check if the InetAddress is a wildcard address.
-     * @return a {@code boolean} indicating if the Inetaddress is
+     * @return a {@code boolean} indicating if the InetAddress is
      *         a wildcard address.
      */
     public boolean isAnyLocalAddress() {
--- a/src/java.base/share/classes/java/net/Inet6Address.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/net/Inet6Address.java	Wed Nov 14 04:59:57 2018 +0100
@@ -415,7 +415,7 @@
      * set to the value corresponding to the given interface for the address
      * type specified in {@code addr}. The call will fail with an
      * UnknownHostException if the given interface does not have a numeric
-     * scope_id assigned for the given address type (eg. link-local or site-local).
+     * scope_id assigned for the given address type (e.g. link-local or site-local).
      * See <a href="Inet6Address.html#scoped">here</a> for a description of IPv6
      * scoped addresses.
      *
@@ -507,7 +507,7 @@
 
     /* check the two Ipv6 addresses and return false if they are both
      * non global address types, but not the same.
-     * (ie. one is sitelocal and the other linklocal)
+     * (i.e. one is site-local and the other link-local)
      * return true otherwise.
      */
 
@@ -683,7 +683,7 @@
     /**
      * Utility routine to check if the InetAddress is a wildcard address.
      *
-     * @return a {@code boolean} indicating if the Inetaddress is
+     * @return a {@code boolean} indicating if the InetAddress is
      *         a wildcard address.
      */
     @Override
@@ -821,7 +821,7 @@
 
     /**
      * Returns the scoped interface, if this instance was created with
-     * with a scoped interface.
+     * a scoped interface.
      *
      * @return the scoped interface, or null if not set.
      * @since 1.5
--- a/src/java.base/share/classes/java/net/InetAddress.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/net/InetAddress.java	Wed Nov 14 04:59:57 2018 +0100
@@ -377,7 +377,7 @@
 
     /**
      * Utility routine to check if the InetAddress is a wildcard address.
-     * @return a {@code boolean} indicating if the Inetaddress is
+     * @return a {@code boolean} indicating if the InetAddress is
      *         a wildcard address.
      * @since 1.4
      */
@@ -1022,7 +1022,7 @@
          * <p>Lookup a host mapping by name. Retrieve the IP addresses
          * associated with a host.
          *
-         * <p>Search the configured hosts file for the addresses assocaited with
+         * <p>Search the configured hosts file for the addresses associated
          * with the specified host name.
          *
          * @param host the specified hostname
@@ -1038,7 +1038,7 @@
             byte addr[] = new byte[4];
             ArrayList<InetAddress> inetAddresses = null;
 
-            // lookup the file and create a list InetAddress for the specfied host
+            // lookup the file and create a list InetAddress for the specified host
             try (Scanner hostsFileScanner = new Scanner(new File(hostsFile), "UTF-8")) {
                 while (hostsFileScanner.hasNextLine()) {
                     hostEntry = hostsFileScanner.nextLine();
@@ -1341,7 +1341,7 @@
                     throw new UnknownHostException(host + ": invalid IPv6 address");
                 }
             } else if (ipv6Expected) {
-                // Means an IPv4 litteral between brackets!
+                // Means an IPv4 literal between brackets!
                 throw new UnknownHostException("["+host+"]");
             }
             InetAddress[] ret = new InetAddress[1];
@@ -1358,7 +1358,7 @@
                 return ret;
             }
         } else if (ipv6Expected) {
-            // We were expecting an IPv6 Litteral, but got something else
+            // We were expecting an IPv6 Literal, but got something else
             throw new UnknownHostException("["+host+"]");
         }
         return getAllByName0(host, reqAddr, true, true);
--- a/src/java.base/share/classes/java/net/NetworkInterface.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/net/NetworkInterface.java	Wed Nov 14 04:59:57 2018 +0100
@@ -170,7 +170,7 @@
      * a SecurityException will be returned in the List.
      *
      * @return a {@code List} object with all or a subset of the
-     *         InterfaceAddresss of this network interface
+     *         InterfaceAddress of this network interface
      * @since 1.6
      */
     public java.util.List<InterfaceAddress> getInterfaceAddresses() {
--- a/src/java.base/share/classes/java/net/ProxySelector.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/net/ProxySelector.java	Wed Nov 14 04:59:57 2018 +0100
@@ -136,7 +136,7 @@
      * @param   uri
      *          The URI that a connection is required to
      *
-     * @return  a List of Proxies. Each element in the
+     * @return  a List of Proxies. Each element in
      *          the List is of type
      *          {@link java.net.Proxy Proxy};
      *          when no proxy is available, the list will
--- a/src/java.base/share/classes/java/net/ResponseCache.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/net/ResponseCache.java	Wed Nov 14 04:59:57 2018 +0100
@@ -91,7 +91,7 @@
     /**
      * Sets (or unsets) the system-wide cache.
      *
-     * Note: non-standard procotol handlers may ignore this setting.
+     * Note: non-standard protocol handlers may ignore this setting.
      *
      * @param responseCache The response cache, or
      *          {@code null} to unset the cache.
--- a/src/java.base/share/classes/java/net/SecureCacheResponse.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/net/SecureCacheResponse.java	Wed Nov 14 04:59:57 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -26,9 +26,11 @@
 package java.net;
 
 import java.security.cert.Certificate;
+import javax.net.ssl.SSLSession;
 import javax.net.ssl.SSLPeerUnverifiedException;
 import java.security.Principal;
 import java.util.List;
+import java.util.Optional;
 
 /**
  * Represents a cache response originally retrieved through secure
@@ -80,7 +82,7 @@
      * retrieved the network resource.
      *
      * @return the server's principal. Returns an X500Principal of the
-     * end-entity certiticate for X509-based cipher suites, and
+     * end-entity certificate for X509-based cipher suites, and
      * KerberosPrincipal for Kerberos cipher suites.
      *
      * @throws SSLPeerUnverifiedException if the peer was not verified.
@@ -105,4 +107,27 @@
       * @see #getPeerPrincipal()
       */
      public abstract Principal getLocalPrincipal();
+
+    /**
+     * Returns an {@link Optional} containing the {@code SSLSession} in
+     * use on the original connection that retrieved the network resource.
+     * Returns an empty {@code Optional} if the underlying implementation
+     * does not support this method.
+     *
+     * @implSpec For compatibility, the default implementation of this
+     *           method returns an empty {@code Optional}.  Subclasses
+     *           should override this method with an appropriate
+     *           implementation since an application may need to access
+     *           additional parameters associated with the SSL session.
+     *
+     * @return   an {@link Optional} containing the {@code SSLSession} in
+     *           use on the original connection
+     *
+     * @see SSLSession
+     *
+     * @since 12
+     */
+    public Optional<SSLSession> getSSLSession() {
+        return Optional.empty();
+    }
 }
--- a/src/java.base/share/classes/java/net/ServerSocket.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/net/ServerSocket.java	Wed Nov 14 04:59:57 2018 +0100
@@ -166,7 +166,7 @@
      * The {@code backlog} argument is the requested maximum number of
      * pending connections on the socket. Its exact semantics are implementation
      * specific. In particular, an implementation may impose a maximum length
-     * or may choose to ignore the parameter altogther. The value provided
+     * or may choose to ignore the parameter altogether. The value provided
      * should be greater than {@code 0}. If it is less than or equal to
      * {@code 0}, then an implementation specific default will be used.
      *
@@ -214,7 +214,7 @@
      * The {@code backlog} argument is the requested maximum number of
      * pending connections on the socket. Its exact semantics are implementation
      * specific. In particular, an implementation may impose a maximum length
-     * or may choose to ignore the parameter altogther. The value provided
+     * or may choose to ignore the parameter altogether. The value provided
      * should be greater than {@code 0}. If it is less than or equal to
      * {@code 0}, then an implementation specific default will be used.
      *
@@ -351,7 +351,7 @@
      * The {@code backlog} argument is the requested maximum number of
      * pending connections on the socket. Its exact semantics are implementation
      * specific. In particular, an implementation may impose a maximum length
-     * or may choose to ignore the parameter altogther. The value provided
+     * or may choose to ignore the parameter altogether. The value provided
      * should be greater than {@code 0}. If it is less than or equal to
      * {@code 0}, then an implementation specific default will be used.
      * @param   endpoint        The IP address and port number to bind to.
@@ -826,7 +826,7 @@
      * <p>
      * The value of {@link SocketOptions#SO_RCVBUF SO_RCVBUF} is used both to
      * set the size of the internal socket receive buffer, and to set the size
-     * of the TCP receive window that is advertized to the remote peer.
+     * of the TCP receive window that is advertised to the remote peer.
      * <p>
      * It is possible to change the value subsequently, by calling
      * {@link Socket#setReceiveBufferSize(int)}. However, if the application
--- a/src/java.base/share/classes/java/net/Socket.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/net/Socket.java	Wed Nov 14 04:59:57 2018 +0100
@@ -1237,7 +1237,7 @@
      * should call {@link #getReceiveBufferSize()}.
      *
      * <p>The value of {@link SocketOptions#SO_RCVBUF SO_RCVBUF} is also used
-     * to set the TCP receive window that is advertized to the remote peer.
+     * to set the TCP receive window that is advertised to the remote peer.
      * Generally, the window size can be modified at any time when a socket is
      * connected. However, if a receive window larger than 64K is required then
      * this must be requested <B>before</B> the socket is connected to the
@@ -1578,10 +1578,10 @@
      * <p>
      * Note: Closing a socket doesn't clear its connection state, which means
      * this method will return {@code true} for a closed socket
-     * (see {@link #isClosed()}) if it was successfuly connected prior
+     * (see {@link #isClosed()}) if it was successfully connected prior
      * to being closed.
      *
-     * @return true if the socket was successfuly connected to a server
+     * @return true if the socket was successfully connected to a server
      * @since 1.4
      */
     public boolean isConnected() {
@@ -1594,10 +1594,10 @@
      * <p>
      * Note: Closing a socket doesn't clear its binding state, which means
      * this method will return {@code true} for a closed socket
-     * (see {@link #isClosed()}) if it was successfuly bound prior
+     * (see {@link #isClosed()}) if it was successfully bound prior
      * to being closed.
      *
-     * @return true if the socket was successfuly bound to an address
+     * @return true if the socket was successfully bound to an address
      * @since 1.4
      * @see #bind
      */
--- a/src/java.base/share/classes/java/net/SocketOutputStream.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/net/SocketOutputStream.java	Wed Nov 14 04:59:57 2018 +0100
@@ -51,7 +51,7 @@
      * Creates a new SocketOutputStream. Can only be called
      * by a Socket. This method needs to hang on to the owner Socket so
      * that the fd will not be closed.
-     * @param impl the socket output stream inplemented
+     * @param impl the socket output stream implemented
      */
     SocketOutputStream(AbstractPlainSocketImpl impl) throws IOException {
         super(impl.getFileDescriptor());
--- a/src/java.base/share/classes/java/net/SocketPermission.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/net/SocketPermission.java	Wed Nov 14 04:59:57 2018 +0100
@@ -283,7 +283,7 @@
      *    nr = new SocketPermission("204.160.241.0:1024-65535", "connect");
      * </pre>
      *
-     * @param host the hostname or IPaddress of the computer, optionally
+     * @param host the hostname or IP address of the computer, optionally
      * including a colon followed by a port or port range.
      * @param action the action string.
      */
@@ -317,7 +317,7 @@
                 if ((ind = host.indexOf(':')) != host.lastIndexOf(':')) {
                     /* More than one ":", meaning IPv6 address is not
                      * in RFC 2732 format;
-                     * We will rectify user errors for all unambiguious cases
+                     * We will rectify user errors for all unambiguous cases
                      */
                     StringTokenizer st = new StringTokenizer(host, ":");
                     int tokens = st.countTokens();
@@ -961,7 +961,7 @@
                 return (that.cname.endsWith(this.cname));
             }
 
-            // comapare IP addresses
+            // compare IP addresses
             if (this.addresses == null) {
                 this.getIP();
             }
--- a/src/java.base/share/classes/java/net/SocksSocketImpl.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/net/SocksSocketImpl.java	Wed Nov 14 04:59:57 2018 +0100
@@ -51,7 +51,7 @@
     private Socket cmdsock = null;
     private InputStream cmdIn = null;
     private OutputStream cmdOut = null;
-    /* true if the Proxy has been set programatically */
+    /* true if the Proxy has been set programmatically */
     private boolean applicationSetProxy;  /* false */
 
 
@@ -145,7 +145,7 @@
     }
 
     /**
-     * Provides the authentication machanism required by the proxy.
+     * Provides the authentication mechanism required by the proxy.
      */
     private boolean authenticate(byte method, InputStream in,
                                  BufferedOutputStream out) throws IOException {
@@ -158,7 +158,7 @@
         // No Authentication required. We're done then!
         if (method == NO_AUTH)
             return true;
-        /**
+        /*
          * User/Password authentication. Try, in that order :
          * - The application provided Authenticator, if any
          * - the user.name & no password (backward compatibility behavior).
@@ -377,7 +377,7 @@
             URI uri;
             // Use getHostString() to avoid reverse lookups
             String host = epoint.getHostString();
-            // IPv6 litteral?
+            // IPv6 literal?
             if (epoint.getAddress() instanceof Inet6Address &&
                 (!host.startsWith("[")) && (host.indexOf(':') >= 0)) {
                 host = "[" + host + "]";
@@ -692,7 +692,7 @@
             URI uri;
             // Use getHostString() to avoid reverse lookups
             String host = saddr.getHostString();
-            // IPv6 litteral?
+            // IPv6 literal?
             if (saddr.getAddress() instanceof Inet6Address &&
                 (!host.startsWith("[")) && (host.indexOf(':') >= 0)) {
                 host = "[" + host + "]";
--- a/src/java.base/share/classes/java/net/URI.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/net/URI.java	Wed Nov 14 04:59:57 2018 +0100
@@ -861,9 +861,9 @@
      *
      * <p> This method is provided for use in situations where it is known that
      * the given string is a legal URI, for example for URI constants declared
-     * within in a program, and so it would be considered a programming error
+     * within a program, and so it would be considered a programming error
      * for the string not to parse as such.  The constructors, which throw
-     * {@link URISyntaxException} directly, should be used situations where a
+     * {@link URISyntaxException} directly, should be used in situations where a
      * URI is being constructed from user input or from some other source that
      * may be prone to errors.  </p>
      *
--- a/src/java.base/share/classes/java/net/URL.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/net/URL.java	Wed Nov 14 04:59:57 2018 +0100
@@ -1009,7 +1009,7 @@
      * can not be converted to a URI.
      *
      * @exception URISyntaxException if this URL is not formatted strictly according to
-     *            to RFC2396 and cannot be converted to a URI.
+     *            RFC2396 and cannot be converted to a URI.
      *
      * @return    a URI instance equivalent to this URL.
      * @since 1.5
@@ -1054,7 +1054,7 @@
     /**
      * Same as {@link #openConnection()}, except that the connection will be
      * made through the specified proxy; Protocol handlers that do not
-     * support proxing will ignore the proxy parameter and make a
+     * support proxying will ignore the proxy parameter and make a
      * normal connection.
      *
      * Invoking this method preempts the system's default
--- a/src/java.base/share/classes/java/net/URLEncoder.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/net/URLEncoder.java	Wed Nov 14 04:59:57 2018 +0100
@@ -109,7 +109,7 @@
          * list. It is also noteworthy that this is consistent with
          * O'Reilly's "HTML: The Definitive Guide" (page 164).
          *
-         * As a last note, Intenet Explorer does not encode the "@"
+         * As a last note, Internet Explorer does not encode the "@"
          * character which is clearly not unreserved according to the
          * RFC. We are being consistent with the RFC in this matter,
          * as is Netscape.
--- a/src/java.base/share/classes/java/net/URLPermission.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/net/URLPermission.java	Wed Nov 14 04:59:57 2018 +0100
@@ -51,7 +51,7 @@
  *     portrange = portnumber | -portnumber | portnumber-[portnumber] | *
  *     hostrange = ([*.] dnsname) | IPv4address | IPv6address
  * </pre>
- * <i>dnsname</i> is a standard DNS host or domain name, ie. one or more labels
+ * <i>dnsname</i> is a standard DNS host or domain name, i.e. one or more labels
  * separated by ".". <i>IPv4address</i> is a standard literal IPv4 address and
  * <i>IPv6address</i> is as defined in <a href="http://www.ietf.org/rfc/rfc2732.txt">
  * RFC 2732</a>. Literal IPv6 addresses must however, be enclosed in '[]' characters.
@@ -89,7 +89,7 @@
  * </tr>
  * <tr><th scope="row">http://www.oracle.com/a/b/-</th>
  *   <td>The '-' character refers to all resources recursively below the
- *       preceding path (eg. http://www.oracle.com/a/b/c/d/e.html matches this
+ *       preceding path (e.g. http://www.oracle.com/a/b/c/d/e.html matches this
  *       example).
  *   </td>
  * </tr>
--- a/src/java.base/share/classes/java/net/URLStreamHandler.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/net/URLStreamHandler.java	Wed Nov 14 04:59:57 2018 +0100
@@ -250,15 +250,15 @@
             } else if (path != null && path.length() > 0) {
                 isRelPath = true;
                 int ind = path.lastIndexOf('/');
-                String seperator = "";
+                String separator = "";
                 if (ind == -1 && authority != null)
-                    seperator = "/";
-                path = path.substring(0, ind + 1) + seperator +
+                    separator = "/";
+                path = path.substring(0, ind + 1) + separator +
                          spec.substring(start, limit);
 
             } else {
-                String seperator = (authority != null) ? "/" : "";
-                path = seperator + spec.substring(start, limit);
+                String separator = (authority != null) ? "/" : "";
+                path = separator + spec.substring(start, limit);
             }
         } else if (queryOnly && path != null) {
             int ind = path.lastIndexOf('/');
@@ -314,7 +314,7 @@
 
     /**
      * Returns the default port for a URL parsed by this handler. This method
-     * is meant to be overidden by handlers with default port numbers.
+     * is meant to be overridden by handlers with default port numbers.
      * @return the default port for a {@code URL} parsed by this handler.
      * @since 1.3
      */
@@ -323,14 +323,14 @@
     }
 
     /**
-     * Provides the default equals calculation. May be overidden by handlers
+     * Provides the default equals calculation. May be overridden by handlers
      * for other protocols that have different requirements for equals().
      * This method requires that none of its arguments is null. This is
      * guaranteed by the fact that it is only called by java.net.URL class.
      * @param u1 a URL object
      * @param u2 a URL object
      * @return {@code true} if the two urls are
-     * considered equal, ie. they refer to the same
+     * considered equal, i.e. they refer to the same
      * fragment in the same file.
      * @since 1.3
      */
@@ -342,7 +342,7 @@
     }
 
     /**
-     * Provides the default hash calculation. May be overidden by handlers for
+     * Provides the default hash calculation. May be overridden by handlers for
      * other protocols that have different requirements for hashCode
      * calculation.
      * @param u a URL object
--- a/src/java.base/share/classes/java/net/spi/URLStreamHandlerProvider.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/net/spi/URLStreamHandlerProvider.java	Wed Nov 14 04:59:57 2018 +0100
@@ -30,7 +30,7 @@
 /**
  * URL stream handler service-provider class.
  *
- *<p> A URL stream handler provider is a concrete subclass of this class that
+ * <p> A URL stream handler provider is a concrete subclass of this class that
  * has a zero-argument constructor. URL stream handler providers may be
  * installed in an instance of the Java platform by adding them to the
  * application class path.
--- a/src/java.base/share/classes/java/nio/channels/MulticastChannel.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/java/nio/channels/MulticastChannel.java	Wed Nov 14 04:59:57 2018 +0100
@@ -177,7 +177,7 @@
      * @throws  SecurityException
      *          If a security manager is set, and its
      *          {@link SecurityManager#checkMulticast(InetAddress) checkMulticast}
-     *          method denies access to the multiast group
+     *          method denies access to the multicast group
      */
     MembershipKey join(InetAddress group, NetworkInterface interf)
         throws IOException;
@@ -226,7 +226,7 @@
      * @throws  SecurityException
      *          If a security manager is set, and its
      *          {@link SecurityManager#checkMulticast(InetAddress) checkMulticast}
-     *          method denies access to the multiast group
+     *          method denies access to the multicast group
      */
     MembershipKey join(InetAddress group, NetworkInterface interf, InetAddress source)
         throws IOException;
--- a/src/java.base/share/classes/javax/net/ssl/HttpsURLConnection.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/javax/net/ssl/HttpsURLConnection.java	Wed Nov 14 04:59:57 2018 +0100
@@ -29,6 +29,7 @@
 import java.net.HttpURLConnection;
 import java.security.Principal;
 import java.security.cert.X509Certificate;
+import java.util.Optional;
 
 /**
  * <code>HttpsURLConnection</code> extends <code>HttpURLConnection</code>
@@ -52,9 +53,7 @@
  *
  * @since 1.4
  */
-public abstract
-class HttpsURLConnection extends HttpURLConnection
-{
+public abstract class HttpsURLConnection extends HttpURLConnection {
     /**
      * Creates an <code>HttpsURLConnection</code> using the
      * URL specified.
@@ -378,4 +377,29 @@
     public SSLSocketFactory getSSLSocketFactory() {
         return sslSocketFactory;
     }
+
+    /**
+     * Returns an {@link Optional} containing the {@code SSLSession} in
+     * use on this connection.  Returns an empty {@code Optional} if the
+     * underlying implementation does not support this method.
+     *
+     * @implSpec For compatibility, the default implementation of this
+     *           method returns an empty {@code Optional}.  Subclasses
+     *           should override this method with an appropriate
+     *           implementation since an application may need to access
+     *           additional parameters associated with the SSL session.
+     *
+     * @return   an {@link Optional} containing the {@code SSLSession} in
+     *           use on this connection.
+     *
+     * @throws   IllegalStateException if this method is called before
+     *           the connection has been established
+     *
+     * @see SSLSession
+     *
+     * @since 12
+     */
+    public Optional<SSLSession> getSSLSession() {
+        return Optional.empty();
+    }
 }
--- a/src/java.base/share/classes/jdk/internal/misc/VM.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/jdk/internal/misc/VM.java	Wed Nov 14 04:59:57 2018 +0100
@@ -199,17 +199,16 @@
         // by the vm option -XX:MaxDirectMemorySize=<size>.
         // The maximum amount of allocatable direct buffer memory (in bytes)
         // from the system property sun.nio.MaxDirectMemorySize set by the VM.
+        // If not set or set to -1, the max memory will be used
         // The system property will be removed.
         String s = (String)props.remove("sun.nio.MaxDirectMemorySize");
-        if (s != null) {
-            if (s.equals("-1")) {
-                // -XX:MaxDirectMemorySize not given, take default
-                directMemory = Runtime.getRuntime().maxMemory();
-            } else {
-                long l = Long.parseLong(s);
-                if (l > -1)
-                    directMemory = l;
-            }
+        if (s == null || s.isEmpty() || s.equals("-1")) {
+            // -XX:MaxDirectMemorySize not given, take default
+            directMemory = Runtime.getRuntime().maxMemory();
+        } else {
+            long l = Long.parseLong(s);
+            if (l > -1)
+                directMemory = l;
         }
 
         // Check if direct buffers should be page aligned
--- a/src/java.base/share/classes/sun/net/NetworkClient.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/sun/net/NetworkClient.java	Wed Nov 14 04:59:57 2018 +0100
@@ -101,7 +101,7 @@
      * the NetworkClients will not work correctly in EBCDIC based systems.
      * However, we cannot just use ASCII or ISO8859_1 universally, because in
      * Asian locales, non-ASCII characters may be embedded in otherwise
-     * ASCII based protocols (eg. HTTP). The specifications (RFC2616, 2398)
+     * ASCII based protocols (e.g. HTTP). The specifications (RFC2616, 2398)
      * are a little ambiguous in this matter. For instance, RFC2398 [part 2.1]
      * says that the HTTP request URI should be escaped using a defined
      * mechanism, but there is no way to specify in the escaped string what
--- a/src/java.base/share/classes/sun/net/ftp/impl/FtpClient.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/sun/net/ftp/impl/FtpClient.java	Wed Nov 14 04:59:57 2018 +0100
@@ -154,7 +154,7 @@
      * the NetworkClients will not work correctly in EBCDIC based systems.
      * However, we cannot just use ASCII or ISO8859_1 universally, because in
      * Asian locales, non-ASCII characters may be embedded in otherwise
-     * ASCII based protocols (eg. HTTP). The specifications (RFC2616, 2398)
+     * ASCII based protocols (e.g. HTTP). The specifications (RFC2616, 2398)
      * are a little ambiguous in this matter. For instance, RFC2398 [part 2.1]
      * says that the HTTP request URI should be escaped using a defined
      * mechanism, but there is no way to specify in the escaped string what
--- a/src/java.base/share/classes/sun/net/util/IPAddressUtil.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/sun/net/util/IPAddressUtil.java	Wed Nov 14 04:59:57 2018 +0100
@@ -184,7 +184,7 @@
             }
             if (ch == '.' && ((j + INADDR4SZ) <= INADDR16SZ)) {
                 String ia4 = src.substring(curtok, srcb_length);
-                /* check this IPv4 address has 3 dots, ie. A.B.C.D */
+                /* check this IPv4 address has 3 dots, i.e. A.B.C.D */
                 int dot_count = 0, index=0;
                 while ((index = ia4.indexOf ('.', index)) != -1) {
                     dot_count ++;
--- a/src/java.base/share/classes/sun/net/www/URLConnection.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/sun/net/www/URLConnection.java	Wed Nov 14 04:59:57 2018 +0100
@@ -183,7 +183,7 @@
      * @param   type    The content type to use.  One of the
      *                  content_* static variables in this
      *                  class should be used.
-     *                  eg. setType(URL.content_html);
+     *                  e.g. setType(URL.content_html);
      */
     public void setContentType(String type) {
         contentType = type;
--- a/src/java.base/share/classes/sun/net/www/protocol/http/AuthCacheValue.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/sun/net/www/protocol/http/AuthCacheValue.java	Wed Nov 14 04:59:57 2018 +0100
@@ -30,7 +30,7 @@
 
 /**
  * AuthCacheValue: interface to minimize exposure to authentication cache
- * for external users (ie. plugin)
+ * for external users (i.e. plugin)
  *
  * @author Michael McMahon
  */
--- a/src/java.base/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java	Wed Nov 14 04:59:57 2018 +0100
@@ -119,7 +119,7 @@
     /**
      * requests is used to ensure that interaction with the
      * Authenticator for a particular realm is single threaded.
-     * ie. if multiple threads need to get credentials from the user
+     * i.e. if multiple threads need to get credentials from the user
      * at the same time, then all but the first will block until
      * the first completes its authentication.
      */
--- a/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Wed Nov 14 04:59:57 2018 +0100
@@ -246,7 +246,7 @@
         userAgent = agent;
 
         // A set of net properties to control the use of authentication schemes
-        // when proxing/tunneling.
+        // when proxying/tunneling.
         String p = getNetProperty("jdk.http.auth.tunneling.disabledSchemes");
         disabledTunnelingSchemes = schemesListToSet(p);
         p = getNetProperty("jdk.http.auth.proxying.disabledSchemes");
@@ -3590,7 +3590,7 @@
         /**
          * expectedLength == -1 if the stream is chunked
          * expectedLength > 0 if the stream is fixed content-length
-         *    In the 2nd case, we make sure the expected number of
+         *    In the 2nd case, we make sure the expected number
          *    of bytes are actually written
          */
         StreamingOutputStream (OutputStream os, long expectedLength) {
--- a/src/java.base/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java	Wed Nov 14 04:59:57 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -31,6 +31,8 @@
 import java.security.Principal;
 import java.io.IOException;
 import java.util.List;
+import java.util.Optional;
+import javax.net.ssl.SSLSession;
 import javax.net.ssl.SSLPeerUnverifiedException;
 import sun.net.www.http.*;
 import sun.net.www.protocol.http.HttpURLConnection;
@@ -296,4 +298,19 @@
         }
     }
 
+    SSLSession getSSLSession() {
+        if (cachedResponse != null) {
+            Optional<SSLSession> option =
+                    ((SecureCacheResponse)cachedResponse).getSSLSession();
+            if (option.isPresent()) {
+                return option.orElseThrow();
+            }
+        }
+
+        if (http == null) {
+            throw new IllegalStateException("connection not yet open");
+        }
+
+        return ((HttpsClient)http).getSSLSession();
+    }
 }
--- a/src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java	Wed Nov 14 04:59:57 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -739,6 +739,13 @@
     }
 
     /**
+     * Returns the {@code SSLSession} in use on this connection.
+     */
+    SSLSession getSSLSession() {
+        return session;
+    }
+
+    /**
      * This method implements the SSL HandshakeCompleted callback,
      * remembering the resulting session so that it may be queried
      * for the current cipher suite and peer certificates.  Servers
--- a/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java	Wed Nov 14 04:59:57 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -46,6 +46,7 @@
 import java.security.Principal;
 import java.util.Map;
 import java.util.List;
+import java.util.Optional;
 import sun.net.www.http.HttpClient;
 
 /**
@@ -533,4 +534,9 @@
     public void setAuthenticator(Authenticator auth) {
         delegate.setAuthenticator(auth);
     }
+
+    @Override
+    public Optional<SSLSession> getSSLSession() {
+        return Optional.ofNullable(delegate.getSSLSession());
+    }
 }
--- a/src/java.base/share/classes/sun/security/ssl/NewSessionTicket.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/sun/security/ssl/NewSessionTicket.java	Wed Nov 14 04:59:57 2018 +0100
@@ -260,9 +260,8 @@
             // create and cache the new session
             // The new session must be a child of the existing session so
             // they will be invalidated together, etc.
-            SSLSessionImpl sessionCopy = new SSLSessionImpl(shc,
-                    shc.handshakeSession.getSuite(), newId,
-                    shc.handshakeSession.getCreationTime());
+            SSLSessionImpl sessionCopy =
+                    new SSLSessionImpl(shc.handshakeSession, newId);
             shc.handshakeSession.addChild(sessionCopy);
             sessionCopy.setPreSharedKey(psk);
             sessionCopy.setPskIdentity(newId.getId());
@@ -375,9 +374,8 @@
             // they will be invalidated together, etc.
             SessionId newId =
                 new SessionId(true, hc.sslContext.getSecureRandom());
-            SSLSessionImpl sessionCopy = new SSLSessionImpl(
-                    hc, sessionToSave.getSuite(), newId,
-                    sessionToSave.getCreationTime());
+            SSLSessionImpl sessionCopy = new SSLSessionImpl(sessionToSave,
+                    newId);
             sessionToSave.addChild(sessionCopy);
             sessionCopy.setPreSharedKey(psk);
             sessionCopy.setTicketAgeAdd(nstm.ticketAgeAdd);
--- a/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java	Wed Nov 14 04:59:57 2018 +0100
@@ -50,9 +50,6 @@
         this.localSupportedSignAlgs = new ArrayList<SignatureScheme>(
             context.conSession.getLocalSupportedSignatureSchemes());
 
-        this.requestedServerNames =
-                context.conSession.getRequestedServerNames();
-
         handshakeConsumers = new LinkedHashMap<>(consumers);
         handshakeFinished = true;
     }
--- a/src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java	Wed Nov 14 04:59:57 2018 +0100
@@ -415,6 +415,16 @@
             result = false;
         }
 
+        // Make sure that the server handshake context's localSupportedSignAlgs
+        // field is populated.  This is particularly important when
+        // client authentication was used in an initial session and it is
+        // now being resumed.
+        if (shc.localSupportedSignAlgs == null) {
+            shc.localSupportedSignAlgs =
+                    SignatureScheme.getSupportedAlgorithms(
+                            shc.algorithmConstraints, shc.activeProtocols);
+        }
+
         // Validate the required client authentication.
         if (result &&
             (shc.sslConfig.clientAuthType == CLIENT_AUTH_REQUIRED)) {
@@ -763,7 +773,7 @@
             SecretKey earlySecret = hkdf.extract(zeros, psk, "TlsEarlySecret");
 
             byte[] label = ("tls13 res binder").getBytes();
-            MessageDigest md = MessageDigest.getInstance(hashAlg.toString());;
+            MessageDigest md = MessageDigest.getInstance(hashAlg.name);
             byte[] hkdfInfo = SSLSecretDerivation.createHkdfInfo(
                     label, md.digest(new byte[0]), hashAlg.hashLength);
             return hkdf.expand(earlySecret,
--- a/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java	Wed Nov 14 04:59:57 2018 +0100
@@ -154,6 +154,7 @@
         this.useExtendedMasterSecret = false;
         this.creationTime = System.currentTimeMillis();
         this.identificationProtocol = null;
+        this.boundValues = new ConcurrentHashMap<>();
     }
 
     /*
@@ -204,6 +205,41 @@
         }
         this.creationTime = creationTime;
         this.identificationProtocol = hc.sslConfig.identificationProtocol;
+        this.boundValues = new ConcurrentHashMap<>();
+
+        if (SSLLogger.isOn && SSLLogger.isOn("session")) {
+             SSLLogger.finest("Session initialized:  " + this);
+        }
+    }
+
+    SSLSessionImpl(SSLSessionImpl baseSession, SessionId newId) {
+        this.protocolVersion = baseSession.getProtocolVersion();
+        this.cipherSuite = baseSession.cipherSuite;
+        this.sessionId = newId;
+        this.host = baseSession.getPeerHost();
+        this.port = baseSession.getPeerPort();
+        this.localSupportedSignAlgs =
+            baseSession.localSupportedSignAlgs == null ?
+                Collections.emptySet() :
+                Collections.unmodifiableCollection(
+                        baseSession.localSupportedSignAlgs);
+        this.peerSupportedSignAlgs =
+                baseSession.getPeerSupportedSignatureAlgorithms();
+        this.serverNameIndication = baseSession.serverNameIndication;
+        this.requestedServerNames = baseSession.getRequestedServerNames();
+        this.masterSecret = baseSession.getMasterSecret();
+        this.useExtendedMasterSecret = baseSession.useExtendedMasterSecret;
+        this.creationTime = baseSession.getCreationTime();
+        this.lastUsedTime = System.currentTimeMillis();
+        this.identificationProtocol = baseSession.getIdentificationProtocol();
+        this.localCerts = baseSession.localCerts;
+        this.peerCerts = baseSession.peerCerts;
+        this.statusResponses = baseSession.statusResponses;
+        this.resumptionMasterSecret = baseSession.resumptionMasterSecret;
+        this.context = baseSession.context;
+        this.negotiatedMaxFragLen = baseSession.negotiatedMaxFragLen;
+        this.maximumPacketSize = baseSession.maximumPacketSize;
+        this.boundValues = baseSession.boundValues;
 
         if (SSLLogger.isOn && SSLLogger.isOn("session")) {
              SSLLogger.finest("Session initialized:  " + this);
@@ -772,8 +808,7 @@
      * key and the calling security context. This is important since
      * sessions can be shared across different protection domains.
      */
-    private final ConcurrentHashMap<SecureKey, Object> boundValues =
-            new ConcurrentHashMap<>();
+    private final ConcurrentHashMap<SecureKey, Object> boundValues;
 
     /**
      * Assigns a session value.  Session change events are given if
--- a/src/java.base/share/classes/sun/security/tools/keytool/CertAndKeyGen.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/sun/security/tools/keytool/CertAndKeyGen.java	Wed Nov 14 04:59:57 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -30,6 +30,8 @@
 import java.security.cert.CertificateException;
 import java.security.cert.CertificateEncodingException;
 import java.security.*;
+import java.security.spec.ECGenParameterSpec;
+import java.security.spec.NamedParameterSpec;
 import java.util.Date;
 
 import sun.security.pkcs10.PKCS10;
@@ -48,8 +50,7 @@
  * parameters, such as DSS/DSA.  Some sites' Certificate Authorities
  * adopt fixed algorithm parameters, which speeds up some operations
  * including key generation and signing.  <em>At this time, this interface
- * does not provide a way to provide such algorithm parameters, e.g.
- * by providing the CA certificate which includes those parameters.</em>
+ * supports initializing with a named group.</em>
  *
  * <P>Also, note that at this time only signature-capable keys may be
  * acquired through this interface.  Diffie-Hellman keys, used for secure
@@ -77,6 +78,7 @@
     {
         keyGen = KeyPairGenerator.getInstance(keyType);
         this.sigAlg = sigAlg;
+        this.keyType = keyType;
     }
 
     /**
@@ -106,6 +108,7 @@
             }
         }
         this.sigAlg = sigAlg;
+        this.keyType = keyType;
     }
 
     /**
@@ -121,41 +124,58 @@
         prng = generator;
     }
 
+    public void generate(String name) {
+        try {
+            if (prng == null) {
+                prng = new SecureRandom();
+            }
+            try {
+                keyGen.initialize(new NamedParameterSpec(name), prng);
+            } catch (InvalidAlgorithmParameterException e) {
+                if (keyType.equalsIgnoreCase("EC")) {
+                    // EC has another NamedParameterSpec
+                    keyGen.initialize(new ECGenParameterSpec(name), prng);
+                } else {
+                    throw e;
+                }
+            }
+
+        } catch (Exception e) {
+            throw new IllegalArgumentException(e.getMessage());
+        }
+        generateInternal();
+    }
+
     // want "public void generate (X509Certificate)" ... inherit DSA/D-H param
 
+    public void generate(int keyBits) {
+        if (keyBits != -1) {
+            try {
+                if (prng == null) {
+                    prng = new SecureRandom();
+                }
+                keyGen.initialize(keyBits, prng);
+
+            } catch (Exception e) {
+                throw new IllegalArgumentException(e.getMessage());
+            }
+        }
+        generateInternal();
+    }
+
     /**
-     * Generates a random public/private key pair, with a given key
-     * size.  Different algorithms provide different degrees of security
-     * for the same key size, because of the "work factor" involved in
-     * brute force attacks.  As computers become faster, it becomes
-     * easier to perform such attacks.  Small keys are to be avoided.
+     * Generates a random public/private key pair.
      *
-     * <P>Note that not all values of "keyBits" are valid for all
-     * algorithms, and not all public key algorithms are currently
+     * <P>Note that not all public key algorithms are currently
      * supported for use in X.509 certificates.  If the algorithm
      * you specified does not produce X.509 compatible keys, an
      * invalid key exception is thrown.
      *
-     * @param keyBits the number of bits in the keys.
-     * @exception InvalidKeyException if the environment does not
+     * @exception IllegalArgumentException if the environment does not
      *  provide X.509 public keys for this signature algorithm.
      */
-    public void generate (int keyBits)
-    throws InvalidKeyException
-    {
-        KeyPair pair;
-
-        try {
-            if (prng == null) {
-                prng = new SecureRandom();
-            }
-            keyGen.initialize(keyBits, prng);
-            pair = keyGen.generateKeyPair();
-
-        } catch (Exception e) {
-            throw new IllegalArgumentException(e.getMessage());
-        }
-
+    private void generateInternal() {
+        KeyPair pair = keyGen.generateKeyPair();
         publicKey = pair.getPublic();
         privateKey = pair.getPrivate();
 
@@ -333,6 +353,7 @@
     }
 
     private SecureRandom        prng;
+    private String              keyType;
     private String              sigAlg;
     private KeyPairGenerator    keyGen;
     private PublicKey           publicKey;
--- a/src/java.base/share/classes/sun/security/tools/keytool/Main.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/sun/security/tools/keytool/Main.java	Wed Nov 14 04:59:57 2018 +0100
@@ -28,13 +28,13 @@
 import java.io.*;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.security.AlgorithmParameters;
 import java.security.CodeSigner;
 import java.security.CryptoPrimitive;
 import java.security.KeyStore;
 import java.security.KeyStoreException;
 import java.security.MessageDigest;
 import java.security.Key;
-import java.security.NoSuchProviderException;
 import java.security.PublicKey;
 import java.security.PrivateKey;
 import java.security.Signature;
@@ -68,6 +68,7 @@
 import javax.security.auth.x500.X500Principal;
 import java.util.Base64;
 
+import sun.security.util.ECKeySizeParameterSpec;
 import sun.security.util.KeyUtil;
 import sun.security.util.ObjectIdentifier;
 import sun.security.pkcs10.PKCS10;
@@ -116,6 +117,7 @@
     private String keyAlgName = null;
     private boolean verbose = false;
     private int keysize = -1;
+    private String groupName = null;
     private boolean rfc = false;
     private long validity = (long)90;
     private String alias = null;
@@ -202,7 +204,7 @@
             STORETYPE, PROVIDERNAME, ADDPROVIDER, PROVIDERCLASS,
             PROVIDERPATH, V, PROTECTED),
         GENKEYPAIR("Generates.a.key.pair",
-            ALIAS, KEYALG, KEYSIZE, SIGALG, DESTALIAS, DNAME,
+            ALIAS, KEYALG, KEYSIZE, CURVENAME, SIGALG, DESTALIAS, DNAME,
             STARTDATE, EXT, VALIDITY, KEYPASS, KEYSTORE,
             STOREPASS, STORETYPE, PROVIDERNAME, ADDPROVIDER,
             PROVIDERCLASS, PROVIDERPATH, V, PROTECTED),
@@ -314,6 +316,7 @@
     // in the optionsSet.contains() block in parseArgs().
     enum Option {
         ALIAS("alias", "<alias>", "alias.name.of.the.entry.to.process"),
+        CURVENAME("groupname", "<name>", "groupname.option.help"),
         DESTALIAS("destalias", "<alias>", "destination.alias"),
         DESTKEYPASS("destkeypass", "<arg>", "destination.key.password"),
         DESTKEYSTORE("destkeystore", "<keystore>", "destination.keystore.name"),
@@ -586,6 +589,8 @@
                 dname = args[++i];
             } else if (collator.compare(flags, "-keysize") == 0) {
                 keysize = Integer.parseInt(args[++i]);
+            } else if (collator.compare(flags, "-groupname") == 0) {
+                groupName = args[++i];
             } else if (collator.compare(flags, "-keyalg") == 0) {
                 keyAlgName = args[++i];
             } else if (collator.compare(flags, "-sigalg") == 0) {
@@ -1119,7 +1124,7 @@
             if (keyAlgName == null) {
                 keyAlgName = "DSA";
             }
-            doGenKeyPair(alias, dname, keyAlgName, keysize, sigAlgName);
+            doGenKeyPair(alias, dname, keyAlgName, keysize, groupName, sigAlgName);
             kssave = true;
         } else if (command == GENSECKEY) {
             if (keyAlgName == null) {
@@ -1793,16 +1798,28 @@
      * Creates a new key pair and self-signed certificate.
      */
     private void doGenKeyPair(String alias, String dname, String keyAlgName,
-                              int keysize, String sigAlgName)
+                              int keysize, String groupName, String sigAlgName)
         throws Exception
     {
-        if (keysize == -1) {
-            if ("EC".equalsIgnoreCase(keyAlgName)) {
-                keysize = SecurityProviderConstants.DEF_EC_KEY_SIZE;
-            } else if ("RSA".equalsIgnoreCase(keyAlgName)) {
-                keysize = SecurityProviderConstants.DEF_RSA_KEY_SIZE;
-            } else if ("DSA".equalsIgnoreCase(keyAlgName)) {
-                keysize = SecurityProviderConstants.DEF_DSA_KEY_SIZE;
+        if (groupName != null) {
+            if (keysize != -1) {
+                throw new Exception(rb.getString("groupname.keysize.coexist"));
+            }
+        } else {
+            if (keysize == -1) {
+                if ("EC".equalsIgnoreCase(keyAlgName)) {
+                    keysize = SecurityProviderConstants.DEF_EC_KEY_SIZE;
+                } else if ("RSA".equalsIgnoreCase(keyAlgName)) {
+                    keysize = SecurityProviderConstants.DEF_RSA_KEY_SIZE;
+                } else if ("DSA".equalsIgnoreCase(keyAlgName)) {
+                    keysize = SecurityProviderConstants.DEF_DSA_KEY_SIZE;
+                }
+            } else {
+                if ("EC".equalsIgnoreCase(keyAlgName)) {
+                    weakWarnings.add(String.format(
+                            rb.getString("deprecate.keysize.for.ec"),
+                            ecGroupNameForSize(keysize)));
+                }
             }
         }
 
@@ -1829,7 +1846,13 @@
             x500Name = new X500Name(dname);
         }
 
-        keypair.generate(keysize);
+        if (groupName != null) {
+            keypair.generate(groupName);
+        } else {
+            // This covers keysize both specified and unspecified
+            keypair.generate(keysize);
+        }
+
         PrivateKey privKey = keypair.getPrivateKey();
 
         CertificateExtensions ext = createV3Extensions(
@@ -1861,6 +1884,13 @@
         keyStore.setKeyEntry(alias, privKey, keyPass, chain);
     }
 
+    private String ecGroupNameForSize(int size) throws Exception {
+        AlgorithmParameters ap = AlgorithmParameters.getInstance("EC");
+        ap.init(new ECKeySizeParameterSpec(size));
+        // The following line assumes the toString value is "name (oid)"
+        return ap.toString().split(" ")[0];
+    }
+
     /**
      * Clones an entry
      * @param orig original alias
--- a/src/java.base/share/classes/sun/security/tools/keytool/Resources.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/classes/sun/security/tools/keytool/Resources.java	Wed Nov 14 04:59:57 2018 +0100
@@ -99,6 +99,8 @@
         // keytool: help: options
         {"alias.name.of.the.entry.to.process",
                 "alias name of the entry to process"}, //-alias
+        {"groupname.option.help",
+                "Group name. For example, an Elliptic Curve name."}, //-groupname
         {"destination.alias",
                 "destination alias"}, //-destalias
         {"destination.key.password",
@@ -290,6 +292,10 @@
                 "Alias <{0}> does not exist"},
         {"Alias.alias.has.no.certificate",
                 "Alias <{0}> has no certificate"},
+        {"groupname.keysize.coexist",
+                "Cannot specify both -groupname and -keysize"},
+        {"deprecate.keysize.for.ec",
+                "Specifying -keysize for generating EC keys is deprecated, please use \"-groupname %s\" instead."},
         {"Key.pair.not.generated.alias.alias.already.exists",
                 "Key pair not generated, alias <{0}> already exists"},
         {"Generating.keysize.bit.keyAlgName.key.pair.and.self.signed.certificate.sigAlgName.with.a.validity.of.validality.days.for",
--- a/src/java.base/share/native/libjava/System.c	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/native/libjava/System.c	Wed Nov 14 04:59:57 2018 +0100
@@ -211,7 +211,6 @@
     PUTPROP(props, "java.specification.vendor",
             JAVA_SPECIFICATION_VENDOR);
 
-    PUTPROP(props, "java.version", VERSION_SHORT);
     PUTPROP(props, "java.vendor", VENDOR);
     PUTPROP(props, "java.vendor.url", VENDOR_URL);
     PUTPROP(props, "java.vendor.url.bug", VENDOR_URL_BUG);
@@ -255,8 +254,10 @@
 
     /* unicode_encoding specifies the default endianness */
     PUTPROP(props, "sun.io.unicode.encoding", sprops->unicode_encoding);
-    PUTPROP(props, "sun.cpu.isalist",
-            (sprops->cpu_isalist ? sprops->cpu_isalist : ""));
+    if (sprops->cpu_isalist  != NULL) {
+        // leave undefined if none
+        PUTPROP(props, "sun.cpu.isalist", sprops->cpu_isalist);
+    }
     PUTPROP(props, "sun.cpu.endian",  sprops->cpu_endian);
 
 
@@ -330,8 +331,10 @@
                     sprops->data_model);
 
     /* patch level */
-    PUTPROP(props, "sun.os.patch.level",  \
+    if (sprops->patch_level != NULL) {
+        PUTPROP(props, "sun.os.patch.level",  \
                     sprops->patch_level);
+    }
 
     /* Java2D properties */
     /* Note: java.awt.graphicsenv is an implementation private property which
@@ -354,9 +357,6 @@
 
     PUTPROP_ForPlatformNString(props, "user.name", sprops->user_name);
     PUTPROP_ForPlatformNString(props, "user.home", sprops->user_home);
-
-    PUTPROP(props, "user.timezone", sprops->timezone);
-
     PUTPROP_ForPlatformNString(props, "user.dir", sprops->user_dir);
 
     /* This is a sun. property as it is currently only set for Gnome and
--- a/src/java.base/share/native/libjava/java_props.h	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/share/native/libjava/java_props.h	Wed Nov 14 04:59:57 2018 +0100
@@ -56,23 +56,18 @@
     nchar *user_name;
     nchar *user_home;
 
-    char *language;
     char *format_language;
     char *display_language;
-    char *script;
     char *format_script;
     char *display_script;
-    char *country;
     char *format_country;
     char *display_country;
-    char *variant;
     char *format_variant;
     char *display_variant;
     char *encoding;
     char *sun_jnu_encoding;
     char *sun_stdout_encoding;
     char *sun_stderr_encoding;
-    char *timezone;
 
     char *printerJob;
     char *graphics_env;
--- a/src/java.base/unix/native/libjava/java_props_md.c	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/unix/native/libjava/java_props_md.c	Wed Nov 14 04:59:57 2018 +0100
@@ -399,7 +399,7 @@
 #endif
 
     /* patches/service packs installed */
-    sprops.patch_level = "unknown";
+    sprops.patch_level = NULL;      // leave it undefined
 
     /* Java 2D/AWT properties */
 #ifdef MACOSX
@@ -488,19 +488,15 @@
                     &(sprops.format_variant),
                     &(sprops.encoding))) {
         ParseLocale(env, LC_MESSAGES,
-                    &(sprops.language),
-                    &(sprops.script),
-                    &(sprops.country),
-                    &(sprops.variant),
+                    &(sprops.display_language),
+                    &(sprops.display_script),
+                    &(sprops.display_country),
+                    &(sprops.display_variant),
                     NULL);
     } else {
-        sprops.language = "en";
+        sprops.display_language = "en";
         sprops.encoding = "ISO8859-1";
     }
-    sprops.display_language = sprops.language;
-    sprops.display_script = sprops.script;
-    sprops.display_country = sprops.country;
-    sprops.display_variant = sprops.variant;
 
     /* ParseLocale failed with OOME */
     JNU_CHECK_EXCEPTION_RETURN(env, NULL);
@@ -543,18 +539,12 @@
         }
     }
 
-    /* User TIMEZONE */
-    {
-        /*
-         * We defer setting up timezone until it's actually necessary.
-         * Refer to TimeZone.getDefault(). However, the system
-         * property is necessary to be able to be set by the command
-         * line interface -D. Here temporarily set a null string to
-         * timezone.
-         */
-        tzset();        /* for compatibility */
-        sprops.timezone = "";
-    }
+    /* User TIMEZONE
+     * We defer setting up timezone until it's actually necessary.
+     * Refer to TimeZone.getDefault(). The system property
+     * is able to be set by the command line interface -Duser.timezone.
+     */
+    tzset();        /* for compatibility */
 
     /* Current directory */
     {
--- a/src/java.base/unix/native/libjsig/jsig.c	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/unix/native/libjsig/jsig.c	Wed Nov 14 04:59:57 2018 +0100
@@ -77,7 +77,7 @@
 /* Used to synchronize the installation of signal handlers. */
 static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
 static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
-static pthread_t tid = 0;
+static pthread_t tid;
 
 typedef void (*sa_handler_t)(int);
 typedef void (*sa_sigaction_t)(int, siginfo_t *, void *);
@@ -110,8 +110,11 @@
   /* When the jvm is installing its set of signal handlers, threads
    * other than the jvm thread should wait. */
   if (jvm_signal_installing) {
-    if (tid != pthread_self()) {
-      pthread_cond_wait(&cond, &mutex);
+    /* tid is not initialized until jvm_signal_installing is set to true. */
+    if (pthread_equal(tid, pthread_self()) == 0) {
+      do {
+        pthread_cond_wait(&cond, &mutex);
+      } while (jvm_signal_installing);
     }
   }
 }
--- a/src/java.base/unix/native/libnet/ResolverConfigurationImpl.c	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/unix/native/libnet/ResolverConfigurationImpl.c	Wed Nov 14 04:59:57 2018 +0100
@@ -42,7 +42,7 @@
 
 
 /*
- * Class:     sun_net_dns_ResolverConfgurationImpl
+ * Class:     sun_net_dns_ResolverConfigurationImpl
  * Method:    localDomain0
  * Signature: ()Ljava/lang/String;
  */
@@ -66,7 +66,7 @@
 }
 
 /*
- * Class:     sun_net_dns_ResolverConfgurationImpl
+ * Class:     sun_net_dns_ResolverConfigurationImpl
  * Method:    loadConfig0
  * Signature: ()Ljava/lang/String;
  */
--- a/src/java.base/unix/native/libnet/net_util_md.c	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/unix/native/libnet/net_util_md.c	Wed Nov 14 04:59:57 2018 +0100
@@ -803,8 +803,12 @@
 
 #ifdef __linux__
         /*
-         * On Linux if we are connecting to a link-local address
-         * we need to specify the interface in the scope_id (2.4 kernel only)
+         * On Linux if we are connecting to a
+         *
+         *   - link-local address
+         *   - multicast interface-local or link-local address
+         *
+         * we need to specify the interface in the scope_id.
          *
          * If the scope was cached then we use the cached value. If not cached but
          * specified in the Inet6Address we use that, but we first check if the
@@ -814,7 +818,9 @@
          * we try to determine a value from the routing table. In all these
          * cases the used value is cached for further use.
          */
-        if (IN6_IS_ADDR_LINKLOCAL(&sa->sa6.sin6_addr)) {
+        if (IN6_IS_ADDR_LINKLOCAL(&sa->sa6.sin6_addr)
+            || IN6_IS_ADDR_MC_NODELOCAL(&sa->sa6.sin6_addr)
+            || IN6_IS_ADDR_MC_LINKLOCAL(&sa->sa6.sin6_addr)) {
             unsigned int cached_scope_id = 0, scope_id = 0;
 
             if (ia6_cachedscopeidID) {
@@ -1081,7 +1087,7 @@
              * dest_plen % 8    => number of additional bits to match
              *
              * eg: fe80::/10 => match 1 byte + 2 additional bits in the
-             *                  the next byte.
+             *                  next byte.
              */
             int byte_count = dest_plen >> 3;
             int extra_bits = dest_plen & 0x3;
--- a/src/java.base/windows/classes/sun/net/dns/ResolverConfigurationImpl.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/windows/classes/sun/net/dns/ResolverConfigurationImpl.java	Wed Nov 14 04:59:57 2018 +0100
@@ -36,13 +36,13 @@
 public class ResolverConfigurationImpl
     extends ResolverConfiguration
 {
-    // Lock helds whilst loading configuration or checking
+    // Lock held whilst loading configuration or checking
     private static Object lock = new Object();
 
     // Resolver options
     private final Options opts;
 
-    // Addreses have changed
+    // Addresses have changed
     private static boolean changed = false;
 
     // Time of last refresh.
@@ -65,7 +65,7 @@
     private LinkedList<String> stringToList(String str) {
         LinkedList<String> ll = new LinkedList<>();
 
-        // comma and space are valid delimites
+        // comma and space are valid delimiters
         StringTokenizer st = new StringTokenizer(str, ", ");
         while (st.hasMoreTokens()) {
             String s = st.nextToken();
@@ -81,7 +81,7 @@
     private void loadConfig() {
         assert Thread.holdsLock(lock);
 
-        // if address have changed then DNS probably changed aswell;
+        // if address have changed then DNS probably changed as well;
         // otherwise check if cached settings have expired.
         //
         if (changed) {
--- a/src/java.base/windows/native/libjava/java_props_md.c	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/windows/native/libjava/java_props_md.c	Wed Nov 14 04:59:57 2018 +0100
@@ -661,12 +661,6 @@
                 userDefaultUILang = userDefaultLCID;
             }
 
-            SetupI18nProps(userDefaultUILang,
-                           &sprops.language,
-                           &sprops.script,
-                           &sprops.country,
-                           &sprops.variant,
-                           &display_encoding);
             SetupI18nProps(userDefaultLCID,
                            &sprops.format_language,
                            &sprops.format_script,
@@ -710,17 +704,12 @@
     }
 
     sprops.unicode_encoding = "UnicodeLittle";
-    /* User TIMEZONE */
-    {
-        /*
-         * We defer setting up timezone until it's actually necessary.
-         * Refer to TimeZone.getDefault(). However, the system
-         * property is necessary to be able to be set by the command
-         * line interface -D. Here temporarily set a null string to
-         * timezone.
-         */
-        sprops.timezone = "";
-    }
+
+    /* User TIMEZONE
+     * We defer setting up timezone until it's actually necessary.
+     * Refer to TimeZone.getDefault(). The system property
+     * is able to be set by the command line interface -Duser.timezone.
+     */
 
     /* Current directory */
     {
--- a/src/java.base/windows/native/libnet/net_util_md.c	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.base/windows/native/libnet/net_util_md.c	Wed Nov 14 04:59:57 2018 +0100
@@ -585,7 +585,7 @@
  * The more complicated case is when the requested address is ::0 or 0.0.0.0.
  *
  * Two further cases:
- * 2. If the reqeusted port is 0 (ie. any port) then we try to bind in v4 space
+ * 2. If the requested port is 0 (ie. any port) then we try to bind in v4 space
  *    first with a wild-card port argument. We then try to bind in v6 space
  *    using the returned port number. If this fails, we repeat the process
  *    until a free port common to both spaces becomes available.
--- a/src/java.management/share/classes/java/lang/management/package.html	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.management/share/classes/java/lang/management/package.html	Wed Nov 14 04:59:57 2018 +0100
@@ -1,5 +1,5 @@
 <!--
- Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2003, 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
@@ -69,7 +69,7 @@
 this allows interoperation across versions.
 A data type used by the MXBean interfaces are mapped to an
 open type when being accessed via MBeanServer interface.
-See the <a href="{@docRoot}/javax/management/MXBean.html#MXBean-spec">
+See the <a href="{@docRoot}/java.management/javax/management/MXBean.html#MXBean-spec">
 MXBean</a> specification for details.
 
 <h3><a id="examples">Ways to Access MXBeans</a></h3>
--- a/src/java.management/share/classes/javax/management/Query.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.management/share/classes/javax/management/Query.java	Wed Nov 14 04:59:57 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -128,7 +128,7 @@
       *
       * @return  The conjunction of the two arguments.  The returned object
       * will be serialized as an instance of the non-public class
-      * <a href="../../serialized-form.html#javax.management.AndQueryExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.AndQueryExp">
       * javax.management.AndQueryExp</a>.
       */
      public static QueryExp and(QueryExp q1, QueryExp q2)  {
@@ -144,7 +144,7 @@
       *
       * @return  The disjunction of the two arguments.  The returned object
       * will be serialized as an instance of the non-public class
-      * <a href="../../serialized-form.html#javax.management.OrQueryExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.OrQueryExp">
       * javax.management.OrQueryExp</a>.
       */
      public static QueryExp or(QueryExp q1, QueryExp q2)  {
@@ -161,7 +161,7 @@
       * @return A "greater than" constraint on the arguments.  The
       * returned object will be serialized as an instance of the
       * non-public class
-      * <a href="../../serialized-form.html#javax.management.BinaryRelQueryExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.BinaryRelQueryExp">
       * javax.management.BinaryRelQueryExp</a> with a {@code relOp} equal
       * to {@link #GT}.
       */
@@ -179,7 +179,7 @@
       * @return A "greater than or equal to" constraint on the
       * arguments.  The returned object will be serialized as an
       * instance of the non-public class
-      * <a href="../../serialized-form.html#javax.management.BinaryRelQueryExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.BinaryRelQueryExp">
       * javax.management.BinaryRelQueryExp</a> with a {@code relOp} equal
       * to {@link #GE}.
       */
@@ -197,7 +197,7 @@
       * @return A "less than or equal to" constraint on the arguments.
       * The returned object will be serialized as an instance of the
       * non-public class
-      * <a href="../../serialized-form.html#javax.management.BinaryRelQueryExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.BinaryRelQueryExp">
       * javax.management.BinaryRelQueryExp</a> with a {@code relOp} equal
       * to {@link #LE}.
       */
@@ -215,7 +215,7 @@
       * @return A "less than" constraint on the arguments.  The
       * returned object will be serialized as an instance of the
       * non-public class
-      * <a href="../../serialized-form.html#javax.management.BinaryRelQueryExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.BinaryRelQueryExp">
       * javax.management.BinaryRelQueryExp</a> with a {@code relOp} equal
       * to {@link #LT}.
       */
@@ -233,7 +233,7 @@
       * @return A "equal to" constraint on the arguments.  The
       * returned object will be serialized as an instance of the
       * non-public class
-      * <a href="../../serialized-form.html#javax.management.BinaryRelQueryExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.BinaryRelQueryExp">
       * javax.management.BinaryRelQueryExp</a> with a {@code relOp} equal
       * to {@link #EQ}.
       */
@@ -252,7 +252,7 @@
       * @return The constraint that v1 lies between v2 and v3.  The
       * returned object will be serialized as an instance of the
       * non-public class
-      * <a href="../../serialized-form.html#javax.management.BetweenQueryExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.BetweenQueryExp">
       * javax.management.BetweenQueryExp</a>.
       */
      public static QueryExp between(ValueExp v1, ValueExp v2, ValueExp v3) {
@@ -280,7 +280,7 @@
       * @return A query expression that represents the matching
       * constraint on the string argument.  The returned object will
       * be serialized as an instance of the non-public class
-      * <a href="../../serialized-form.html#javax.management.MatchQueryExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.MatchQueryExp">
       * javax.management.MatchQueryExp</a>.
       */
      public static QueryExp match(AttributeValueExp a, StringValueExp s)  {
@@ -320,7 +320,7 @@
       * @return An attribute expression for the attribute named name.
       * The returned object will be serialized as an instance of the
       * non-public class
-      * <a href="../../serialized-form.html#javax.management.QualifiedAttributeValueExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.QualifiedAttributeValueExp">
       * javax.management.QualifiedAttributeValueExp</a>.
       */
      public static AttributeValueExp attr(String className, String name)  {
@@ -338,7 +338,7 @@
       *
       * @return A class attribute expression.  The returned object
       * will be serialized as an instance of the non-public class
-      * <a href="../../serialized-form.html#javax.management.ClassAttributeValueExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.ClassAttributeValueExp">
       * javax.management.ClassAttributeValueExp</a>.
       */
      public static AttributeValueExp classattr()  {
@@ -352,7 +352,7 @@
       *
       * @return A negated constraint.  The returned object will be
       * serialized as an instance of the non-public class
-      * <a href="../../serialized-form.html#javax.management.NotQueryExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.NotQueryExp">
       * javax.management.NotQueryExp</a>.
       */
      public static QueryExp not(QueryExp queryExp)  {
@@ -368,7 +368,7 @@
       * @return A QueryExp that represents the constraint.  The
       * returned object will be serialized as an instance of the
       * non-public class
-      * <a href="../../serialized-form.html#javax.management.InQueryExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.InQueryExp">
       * javax.management.InQueryExp</a>.
       */
      public static QueryExp in(ValueExp val, ValueExp valueList[])  {
@@ -395,7 +395,7 @@
       * @return A ValueExp object containing the argument.  The
       * returned object will be serialized as an instance of the
       * non-public class
-      * <a href="../../serialized-form.html#javax.management.NumericValueExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.NumericValueExp">
       * javax.management.NumericValueExp</a>.
       */
      public static ValueExp value(Number val)  {
@@ -411,7 +411,7 @@
       * @return A ValueExp object containing the argument.  The
       * returned object will be serialized as an instance of the
       * non-public class
-      * <a href="../../serialized-form.html#javax.management.NumericValueExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.NumericValueExp">
       * javax.management.NumericValueExp</a>.
       */
      public static ValueExp value(int val)  {
@@ -427,7 +427,7 @@
       * @return A ValueExp object containing the argument.  The
       * returned object will be serialized as an instance of the
       * non-public class
-      * <a href="../../serialized-form.html#javax.management.NumericValueExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.NumericValueExp">
       * javax.management.NumericValueExp</a>.
       */
      public static ValueExp value(long val)  {
@@ -443,7 +443,7 @@
       * @return A ValueExp object containing the argument.  The
       * returned object will be serialized as an instance of the
       * non-public class
-      * <a href="../../serialized-form.html#javax.management.NumericValueExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.NumericValueExp">
       * javax.management.NumericValueExp</a>.
       */
      public static ValueExp value(float val)  {
@@ -459,7 +459,7 @@
       * @return  A ValueExp object containing the argument.  The
       * returned object will be serialized as an instance of the
       * non-public class
-      * <a href="../../serialized-form.html#javax.management.NumericValueExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.NumericValueExp">
       * javax.management.NumericValueExp</a>.
       */
      public static ValueExp value(double val)  {
@@ -475,7 +475,7 @@
       * @return A ValueExp object containing the argument.  The
       * returned object will be serialized as an instance of the
       * non-public class
-      * <a href="../../serialized-form.html#javax.management.BooleanValueExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.BooleanValueExp">
       * javax.management.BooleanValueExp</a>.
       */
      public static ValueExp value(boolean val)  {
@@ -492,7 +492,7 @@
       * @return A ValueExp representing the sum or concatenation of
       * the two arguments.  The returned object will be serialized as
       * an instance of the non-public class
-      * <a href="../../serialized-form.html#javax.management.BinaryOpValueExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.BinaryOpValueExp">
       * javax.management.BinaryOpValueExp</a> with an {@code op} equal to
       * {@link #PLUS}.
       */
@@ -510,7 +510,7 @@
       * @return A ValueExp representing the product.  The returned
       * object will be serialized as an instance of the non-public
       * class
-      * <a href="../../serialized-form.html#javax.management.BinaryOpValueExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.BinaryOpValueExp">
       * javax.management.BinaryOpValueExp</a> with an {@code op} equal to
       * {@link #TIMES}.
       */
@@ -528,7 +528,7 @@
       * @return A ValueExp representing the difference between two
       * arguments.  The returned object will be serialized as an
       * instance of the non-public class
-      * <a href="../../serialized-form.html#javax.management.BinaryOpValueExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.BinaryOpValueExp">
       * javax.management.BinaryOpValueExp</a> with an {@code op} equal to
       * {@link #MINUS}.
       */
@@ -546,7 +546,7 @@
       * @return A ValueExp representing the quotient of two arguments.
       * The returned object will be serialized as an instance of the
       * non-public class
-      * <a href="../../serialized-form.html#javax.management.BinaryOpValueExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.BinaryOpValueExp">
       * javax.management.BinaryOpValueExp</a> with an {@code op} equal to
       * {@link #DIV}.
       */
@@ -566,7 +566,7 @@
       * @return The constraint that a matches s.  The returned object
       * will be serialized as an instance of the non-public class
       *
-      * <a href="../../serialized-form.html#javax.management.MatchQueryExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.MatchQueryExp">
       * javax.management.MatchQueryExp</a>.
       */
      public static QueryExp initialSubString(AttributeValueExp a, StringValueExp s)  {
@@ -585,7 +585,7 @@
       * @return The constraint that a matches s.  The returned object
       * will be serialized as an instance of the non-public class
       *
-      * <a href="../../serialized-form.html#javax.management.MatchQueryExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.MatchQueryExp">
       * javax.management.MatchQueryExp</a>.
       */
      public static QueryExp anySubString(AttributeValueExp a, StringValueExp s) {
@@ -605,7 +605,7 @@
       * @return The constraint that a matches s.  The returned object
       * will be serialized as an instance of the non-public class
       *
-      * <a href="../../serialized-form.html#javax.management.MatchQueryExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.MatchQueryExp">
       * javax.management.MatchQueryExp</a>.
       */
      public static QueryExp finalSubString(AttributeValueExp a, StringValueExp s) {
@@ -630,7 +630,7 @@
       * @return a query expression that represents an inheritance
       * constraint on an MBean class.  The returned object will be
       * serialized as an instance of the non-public class
-      * <a href="../../serialized-form.html#javax.management.InstanceOfQueryExp">
+      * <a href="{@docRoot}/serialized-form.html#javax.management.InstanceOfQueryExp">
       * javax.management.InstanceOfQueryExp</a>.
       * @since 1.6
       */
--- a/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java	Wed Nov 14 04:59:57 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -137,7 +137,7 @@
  * <code>MalformedURLException</code> if there is none.  An
  * implementation may choose to find providers by other means.  For
  * example, it may support <a
- * href="{@docRoot}/java/util/ServiceLoader.html#developing-service-providers">service providers</a>,
+ * href="{@docRoot}/java.base/java/util/ServiceLoader.html#developing-service-providers">service providers</a>,
  * where the service interface is <code>JMXConnectorProvider</code>.</p>
  *
  * <p>Every implementation must support the RMI connector protocol with
--- a/src/java.management/share/classes/javax/management/remote/JMXConnectorServerFactory.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.management/share/classes/javax/management/remote/JMXConnectorServerFactory.java	Wed Nov 14 04:59:57 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -128,7 +128,7 @@
  * <code>MalformedURLException</code> if there is none.  An
  * implementation may choose to find providers by other means.  For
  * example, it may support <a
- * href="{@docRoot}/java/util/ServiceLoader.html#developing-service-providers">service providers</a>,
+ * href="{@docRoot}/java.base/java/util/ServiceLoader.html#developing-service-providers">service providers</a>,
  * where the service interface is <code>JMXConnectorServerProvider</code>.</p>
  *
  * <p>Every implementation must support the RMI connector protocol with
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.naming/share/classes/com/sun/jndi/ldap/DefaultLdapDnsProvider.java	Wed Nov 14 04:59:57 2018 +0100
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.jndi.ldap;
+
+import javax.naming.NamingException;
+import javax.naming.ldap.spi.LdapDnsProvider;
+import javax.naming.ldap.spi.LdapDnsProviderResult;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+public class DefaultLdapDnsProvider {
+
+    public Optional<LdapDnsProviderResult> lookupEndpoints(String url,
+                                                           Map<?,?> env)
+            throws NamingException
+    {
+        if (url == null || env == null) {
+            throw new NullPointerException();
+        }
+
+        String domainName;
+        List<String> endpoints = new ArrayList<>();
+        LdapURL ldapUrl = new LdapURL(url);
+        String dn = ldapUrl.getDN();
+        String host = ldapUrl.getHost();
+        int port = ldapUrl.getPort();
+        String[] hostports;
+
+        // handle a URL with no hostport (ldap:/// or ldaps:///)
+        // locate the LDAP service using the URL's distinguished name
+        if (host == null
+                && port == -1
+                && dn != null
+                && (domainName = ServiceLocator.mapDnToDomainName(dn)) != null
+                && (hostports = ServiceLocator.getLdapService(domainName, env)) != null) {
+            // Generate new URLs that include the discovered hostports.
+            // Reuse the original URL scheme.
+            String scheme = ldapUrl.getScheme() + "://";
+            String query = ldapUrl.getQuery();
+            String urlSuffix = ldapUrl.getPath() + (query != null ? query : "");
+            for (String hostPort : hostports) {
+                // the hostports come from the DNS SRV records
+                // we assume the SRV record is scheme aware
+                endpoints.add(scheme + hostPort + urlSuffix);
+            }
+        } else {
+            // we don't have enough information to set the domain name
+            // correctly
+            domainName = "";
+            endpoints.add(url);
+        }
+
+        LdapDnsProviderResult res = new LdapDnsProviderResult(domainName, endpoints);
+        if (res.getEndpoints().size() == 0 && res.getDomainName().isEmpty()) {
+            return Optional.empty();
+        } else {
+            return Optional.of(res);
+        }
+    }
+
+}
--- a/src/java.naming/share/classes/com/sun/jndi/ldap/LdapCtxFactory.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.naming/share/classes/com/sun/jndi/ldap/LdapCtxFactory.java	Wed Nov 14 04:59:57 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@
 
 import javax.naming.*;
 import javax.naming.directory.*;
+import javax.naming.ldap.spi.LdapDnsProviderResult;
 import javax.naming.spi.ObjectFactory;
 import javax.naming.spi.InitialContextFactory;
 import javax.naming.ldap.Control;
@@ -158,41 +159,73 @@
     }
 
     private static DirContext getUsingURL(String url, Hashtable<?,?> env)
-            throws NamingException {
-        DirContext ctx = null;
-        LdapURL ldapUrl = new LdapURL(url);
-        String dn = ldapUrl.getDN();
-        String host = ldapUrl.getHost();
-        int port = ldapUrl.getPort();
-        String[] hostports;
-        String domainName = null;
+            throws NamingException
+    {
+        try {
+            LdapDnsProviderResult r =
+                LdapDnsProviderService.getInstance().lookupEndpoints(url, env);
+            LdapCtx ctx;
+            NamingException lastException = null;
 
-        // handle a URL with no hostport (ldap:/// or ldaps:///)
-        // locate the LDAP service using the URL's distinguished name
-        if (host == null &&
-            port == -1 &&
-            dn != null &&
-            (domainName = ServiceLocator.mapDnToDomainName(dn)) != null &&
-            (hostports = ServiceLocator.getLdapService(domainName, env))
-                != null) {
-            // Generate new URLs that include the discovered hostports.
-            // Reuse the original URL scheme.
-            String scheme = ldapUrl.getScheme() + "://";
-            String[] newUrls = new String[hostports.length];
-            String query = ldapUrl.getQuery();
-            String urlSuffix = ldapUrl.getPath() + (query != null ? query : "");
-            for (int i = 0; i < hostports.length; i++) {
-                newUrls[i] = scheme + hostports[i] + urlSuffix;
+            /*
+             * Prior to this change we had been assuming that the url.getDN()
+             * should be converted to a domain name via
+             * ServiceLocator.mapDnToDomainName(url.getDN())
+             *
+             * However this is incorrect as we can't assume that the supplied
+             * url.getDN() is the same as the dns domain for the directory
+             * server.
+             *
+             * This means that we depend on the dnsProvider to return both
+             * the list of urls of individual hosts from which we attempt to
+             * create an LdapCtx from *AND* the domain name that they serve
+             *
+             * In order to do this the dnsProvider must return an
+             * {@link LdapDnsProviderResult}.
+             *
+             */
+            for (String u : r.getEndpoints()) {
+                try {
+                    ctx = getLdapCtxFromUrl(
+                            r.getDomainName(), url, new LdapURL(u), env);
+                    return ctx;
+                } catch (NamingException e) {
+                    // try the next element
+                    lastException = e;
+                }
             }
-            ctx = getUsingURLs(newUrls, env);
-            // Associate the derived domain name with the context
-            ((LdapCtx)ctx).setDomainName(domainName);
 
-        } else {
-            ctx = new LdapCtx(dn, host, port, env, ldapUrl.useSsl());
-            // Record the URL that created the context
-            ((LdapCtx)ctx).setProviderUrl(url);
+            if (lastException != null) {
+                throw lastException;
+            }
+
+            // lookupEndpoints returned an LdapDnsProviderResult with an empty
+            // list of endpoints
+            throw new NamingException("Could not resolve a valid ldap host");
+        } catch (NamingException e) {
+            // lookupEndpoints(url, env) may throw a NamingException, which
+            // there is no need to wrap.
+            throw e;
+        } catch (Exception e) {
+            NamingException ex = new NamingException();
+            ex.setRootCause(e);
+            throw ex;
         }
+    }
+
+    private static LdapCtx getLdapCtxFromUrl(String domain,
+                                             String url,
+                                             LdapURL u,
+                                             Hashtable<?,?> env)
+            throws NamingException
+    {
+        String dn = u.getDN();
+        String host = u.getHost();
+        int port = u.getPort();
+        LdapCtx ctx = new LdapCtx(dn, host, port, env, u.useSsl());
+        ctx.setDomainName(domain);
+        // Record the URL that created the context
+        ctx.setProviderUrl(url);
         return ctx;
     }
 
@@ -202,19 +235,17 @@
      * Not pretty, but potentially more informative than returning null.
      */
     private static DirContext getUsingURLs(String[] urls, Hashtable<?,?> env)
-            throws NamingException {
-        NamingException ne = null;
-        DirContext ctx = null;
-        for (int i = 0; i < urls.length; i++) {
+            throws NamingException
+    {
+        NamingException ex = null;
+        for (String u : urls) {
             try {
-                return getUsingURL(urls[i], env);
-            } catch (AuthenticationException e) {
-                throw e;
+                return getUsingURL(u, env);
             } catch (NamingException e) {
-                ne = e;
+                ex = e;
             }
         }
-        throw ne;
+        throw ex;
     }
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.naming/share/classes/com/sun/jndi/ldap/LdapDnsProviderService.java	Wed Nov 14 04:59:57 2018 +0100
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.jndi.ldap;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.*;
+import javax.naming.NamingException;
+import javax.naming.ldap.spi.LdapDnsProvider;
+import javax.naming.ldap.spi.LdapDnsProviderResult;
+import sun.security.util.SecurityConstants;
+
+/**
+ * The {@code LdapDnsProviderService} is responsible for creating and providing
+ * access to the registered {@code LdapDnsProvider}s. The {@link ServiceLoader}
+ * is used to find and register any implementations of {@link LdapDnsProvider}.
+ */
+final class LdapDnsProviderService {
+
+    private static volatile LdapDnsProviderService service;
+    private static final Object LOCK = new int[0];
+    private final ServiceLoader<LdapDnsProvider> providers;
+
+    /**
+     * Creates a new instance of LdapDnsProviderService
+     */
+    private LdapDnsProviderService() {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm == null) {
+            providers = ServiceLoader.load(
+                    LdapDnsProvider.class,
+                    ClassLoader.getSystemClassLoader());
+        } else {
+            final PrivilegedAction<ServiceLoader<LdapDnsProvider>> pa =
+                    () -> ServiceLoader.load(
+                            LdapDnsProvider.class,
+                            ClassLoader.getSystemClassLoader());
+
+            providers = AccessController.doPrivileged(
+                pa,
+                null,
+                new RuntimePermission("ldapDnsProvider"),
+                SecurityConstants.GET_CLASSLOADER_PERMISSION);
+        }
+    }
+
+    /**
+     * Retrieve the singleton static instance of LdapDnsProviderService.
+     */
+    static LdapDnsProviderService getInstance() {
+        if (service != null) return service;
+        synchronized(LOCK) {
+            if (service != null) return service;
+            service = new LdapDnsProviderService();
+        }
+        return service;
+    }
+
+    /**
+     * Retrieve result from the first provider that successfully resolves
+     * the endpoints. If no results are found when calling installed
+     * subclasses of {@code LdapDnsProvider} then this method will fall back
+     * to the {@code DefaultLdapDnsProvider}.
+     *
+     * @throws NamingException if the {@code url} in not valid or an error
+     *                         occurred while performing the lookup.
+     */
+    LdapDnsProviderResult lookupEndpoints(String url, Hashtable<?,?> env)
+        throws NamingException
+    {
+        Iterator<LdapDnsProvider> iterator = providers.iterator();
+        Hashtable<?, ?> envCopy = new Hashtable<>(env);
+        LdapDnsProviderResult result = null;
+
+        while (result == null && iterator.hasNext()) {
+            result = iterator.next().lookupEndpoints(url, envCopy)
+                    .filter(r -> r.getEndpoints().size() > 0)
+                    .orElse(null);
+        }
+
+        if (result == null) {
+            return new DefaultLdapDnsProvider().lookupEndpoints(url, env)
+                .orElse(new LdapDnsProviderResult("", List.of()));
+        }
+        return result;
+    }
+
+}
--- a/src/java.naming/share/classes/com/sun/jndi/ldap/ServiceLocator.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.naming/share/classes/com/sun/jndi/ldap/ServiceLocator.java	Wed Nov 14 04:59:57 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -25,11 +25,7 @@
 
 package com.sun.jndi.ldap;
 
-import java.util.Arrays;
-import java.util.Hashtable;
-import java.util.Random;
-import java.util.StringTokenizer;
-import java.util.List;
+import java.util.*;
 
 import javax.naming.*;
 import javax.naming.directory.*;
@@ -113,6 +109,23 @@
      * @return An ordered list of hostports for the LDAP service or null if
      *         the service has not been located.
      */
+    static String[] getLdapService(String domainName, Map<?,?> environment) {
+        if (environment instanceof Hashtable) {
+            return getLdapService(domainName, (Hashtable)environment);
+        }
+        return getLdapService(domainName, new Hashtable<>(environment));
+    }
+
+    /**
+     * Locates the LDAP service for a given domain.
+     * Queries DNS for a list of LDAP Service Location Records (SRV) for a
+     * given domain name.
+     *
+     * @param domainName A string domain name.
+     * @param environment The possibly null environment of the context.
+     * @return An ordered list of hostports for the LDAP service or null if
+     *         the service has not been located.
+     */
     static String[] getLdapService(String domainName, Hashtable<?,?> environment) {
 
         if (domainName == null || domainName.length() == 0) {
--- a/src/java.naming/share/classes/javax/naming/directory/InitialDirContext.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.naming/share/classes/javax/naming/directory/InitialDirContext.java	Wed Nov 14 04:59:57 2018 +0100
@@ -27,7 +27,6 @@
 package javax.naming.directory;
 
 import java.util.Hashtable;
-import javax.naming.spi.NamingManager;
 import javax.naming.*;
 
 /**
@@ -84,6 +83,36 @@
      * Environment properties are discussed in the
      * {@code javax.naming.InitialContext} class description.
      *
+     * <p> If the {@code java.naming.provider.url} property of the supplied
+     * environment consists of a URL (or a list of URLs) using the ldap
+     * protocol the resulting {@link javax.naming.ldap.LdapContext} will use
+     * an LDAP server resolved by the configured {@link
+     * javax.naming.ldap.spi.LdapDnsProvider LdapDnsProviders}:
+     * <ol>
+     * <li>If this is the first {@code InitialDirContext} created with a
+     *     {@code java.naming.provider.url} using the ldap protocol then the
+     *     {@linkplain java.util.ServiceLoader ServiceLoader} mechanism is
+     *     used to locate {@linkplain javax.naming.ldap.spi.LdapDnsProvider
+     *     LdapDnsProvider} implementations using the system class loader.
+     *     The order that providers are located is implementation specific
+     *     and an implementation is free to cache the located providers.
+     * <li>The {@code lookupEndpoints} method of each provider, if instantiated,
+     *     is invoked once with a combination of each of the URLs in the the
+     *     {@code java.naming.provider.url} property and the environment until
+     *     a provider returns non-empty or all providers have been exhausted.
+     *     If none of the
+     *     {@linkplain javax.naming.ldap.spi.LdapDnsProvider LdapDnsProviders}
+     *     return a non-empty
+     *     {@linkplain javax.naming.ldap.spi.LdapDnsProviderResult result} then
+     *     the implementation will make a best-effort attempt to determine an
+     *     endpoint. A
+     *     {@linkplain java.util.ServiceConfigurationError ServiceConfigurationError},
+     *     {@code Error} or {@code RuntimeException} thrown when loading or
+     *     calling an {@linkplain javax.naming.ldap.spi.LdapDnsProvider
+     *     LdapDnsProvider}, if encountered, will be propagated to the calling
+     *     thread.
+     * </ol>
+     *
      * <p> This constructor will not modify {@code environment}
      * or save a reference to it, but may save a clone.
      * Caller should not modify mutable keys and values in
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.naming/share/classes/javax/naming/ldap/spi/LdapDnsProvider.java	Wed Nov 14 04:59:57 2018 +0100
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.naming.ldap.spi;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import java.util.Map;
+import java.util.Optional;
+
+/**
+ * Service-provider class for DNS lookups when performing LDAP operations.
+ *
+ * <p> An LDAP DNS provider is a concrete subclass of this class that
+ * has a zero-argument constructor. LDAP DNS providers are located using the
+ * ServiceLoader facility, as specified by
+ * {@linkplain javax.naming.directory.InitialDirContext InitialDirectContext}.
+ *
+ * The
+ * {@link java.util.ServiceLoader ServiceLoader} is used to create and register
+ * implementations of {@code LdapDnsProvider}.
+ *
+ * <p> An LDAP DNS provider can be used in environments where the default
+ * DNS resolution mechanism is not sufficient to accurately pinpoint the
+ * correct LDAP servers needed to perform LDAP operations. For example, in an
+ * environment containing a mix of {@code ldap} and {@code ldaps} servers
+ * you may want the {@linkplain javax.naming.ldap.LdapContext LdapContext}
+ * to query {@code ldaps} servers only.
+ *
+ * @since 12
+ */
+public abstract class LdapDnsProvider {
+
+    // The {@code RuntimePermission("ldapDnsProvider")} is
+    // necessary to subclass and instantiate the {@code LdapDnsProvider} class.
+    private static final RuntimePermission DNSPROVIDER_PERMISSION =
+            new RuntimePermission("ldapDnsProvider");
+
+    /**
+     * Creates a new instance of {@code LdapDnsProvider}.
+     *
+     * @throws SecurityException if a security manager is present and its
+     *                           {@code checkPermission} method doesn't allow
+     *                           the {@code RuntimePermission("ldapDnsProvider")}.
+     */
+    protected LdapDnsProvider() {
+        this(checkPermission());
+    }
+
+    private LdapDnsProvider(Void unused) {
+        // nothing to do.
+    }
+
+    private static Void checkPermission() {
+        final SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(DNSPROVIDER_PERMISSION);
+        }
+        return null;
+    }
+
+    /**
+     * Lookup the endpoints and domain name for the given {@link Context}
+     * {@link Context#PROVIDER_URL provider URL} and environment. The resolved
+     * endpoints and domain name are returned as an
+     * {@link LdapDnsProviderResult}.
+     *
+     * <p> An endpoint is a {@code String} representation of an LDAP URL which
+     * points to an LDAP server to be used for LDAP operations. The syntax of
+     * an LDAP URL is defined by <a href="http://www.ietf.org/rfc/rfc2255.txt">
+     * <i>RFC&nbsp;2255: The LDAP URL Format</i></a>.
+     *
+     * @param url   The {@link Context} {@link Context#PROVIDER_URL provider URL}
+     * @param env   The {@link Context} environment.
+     *
+     * @return  an {@link LdapDnsProviderResult} or empty {@code Optional}
+     *          if the lookup fails.
+     *
+     * @throws NamingException      if the {@code url} is not valid or an error
+     *                              occurred while performing the lookup.
+     * @throws NullPointerException if either {@code url} or {@code env} are
+     *                              {@code null}.
+     */
+    public abstract Optional<LdapDnsProviderResult> lookupEndpoints(
+            String url, Map<?,?> env) throws NamingException;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.naming/share/classes/javax/naming/ldap/spi/LdapDnsProviderResult.java	Wed Nov 14 04:59:57 2018 +0100
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.naming.ldap.spi;
+
+import java.util.List;
+
+/**
+ * The result of a DNS lookup for an LDAP URL.
+ *
+ * <p> This class is used by an {@link LdapDnsProvider} to return the result
+ * of a DNS lookup for a given LDAP URL. The result consists of a domain name
+ * and its associated ldap server endpoints.
+ *
+ * <p> A {@code null} {@code domainName} is equivalent to and represented
+ * by an empty string.
+ *
+ * @since 12
+ */
+public final class LdapDnsProviderResult {
+
+    private final String domainName;
+    private final List<String> endpoints;
+
+    /**
+     * Construct an LdapDnsProviderResult consisting of a resolved domain name
+     * and the ldap server endpoints that serve the domain.
+     *
+     * @param domainName    the resolved domain name; can be null.
+     * @param endpoints     the possibly empty list of resolved ldap server
+     *                      endpoints
+     *
+     * @throws NullPointerException   if {@code endpoints} contains {@code null}
+     *                                elements.
+     * @throws ClassCastException     if {@code endpoints} contains non-
+     *                                {@code String} elements.
+     */
+    public LdapDnsProviderResult(String domainName, List<String> endpoints) {
+        this.domainName = (domainName == null) ? "" : domainName;
+        this.endpoints = List.copyOf(endpoints);
+    }
+
+    /**
+     * Returns the domain name resolved from the ldap URL. This method returns
+     * the empty string if the {@code LdapDnsProviderResult} is created with a
+     * null domain name.
+     *
+     * @return  the resolved domain name
+     */
+    public String getDomainName() {
+        return domainName;
+    }
+
+    /**
+     * Returns the possibly empty list of individual server endpoints resolved
+     * from the ldap URL.
+     *
+     * @return  a possibly empty unmodifiable {@link List} containing the
+     *          resolved ldap server endpoints
+     */
+    public List<String> getEndpoints() {
+        return endpoints;
+    }
+
+}
--- a/src/java.naming/share/classes/module-info.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.naming/share/classes/module-info.java	Wed Nov 14 04:59:57 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -26,6 +26,10 @@
 /**
  * Defines the Java Naming and Directory Interface (JNDI) API.
  *
+ * @provides javax.naming.ldap.spi.LdapDnsProvider
+ *
+ * @uses javax.naming.ldap.spi.LdapDnsProvider
+ *
  * @moduleGraph
  * @since 9
  */
@@ -37,6 +41,7 @@
     exports javax.naming.event;
     exports javax.naming.ldap;
     exports javax.naming.spi;
+    exports javax.naming.ldap.spi;
 
     exports com.sun.jndi.toolkit.ctx to
         jdk.naming.dns;
@@ -46,6 +51,7 @@
 
     uses javax.naming.ldap.StartTlsResponse;
     uses javax.naming.spi.InitialContextFactory;
+    uses javax.naming.ldap.spi.LdapDnsProvider;
 
     provides java.security.Provider with
         sun.security.provider.certpath.ldap.JdkLDAP;
--- a/src/java.net.http/share/classes/java/net/http/HttpRequest.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.net.http/share/classes/java/net/http/HttpRequest.java	Wed Nov 14 04:59:57 2018 +0100
@@ -191,8 +191,8 @@
          * {@link HttpClient#sendAsync(java.net.http.HttpRequest,
          * java.net.http.HttpResponse.BodyHandler) HttpClient::sendAsync}
          * completes exceptionally with an {@code HttpTimeoutException}. The effect
-         * of not setting a timeout is the same as setting an infinite Duration, ie.
-         * block forever.
+         * of not setting a timeout is the same as setting an infinite Duration,
+         * i.e. block forever.
          *
          * @param duration the timeout duration
          * @return this builder
--- a/src/java.net.http/share/classes/jdk/internal/net/http/AuthenticationFilter.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/AuthenticationFilter.java	Wed Nov 14 04:59:57 2018 +0100
@@ -127,7 +127,7 @@
         }
 
         // our own private scheme for proxy URLs
-        // eg. proxy.http://host:port/
+        // e.g. proxy.http://host:port/
         String scheme = "proxy." + r.uri().getScheme();
         try {
             return new URI(scheme,
--- a/src/java.net.http/share/classes/jdk/internal/net/http/Http1AsyncReceiver.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http1AsyncReceiver.java	Wed Nov 14 04:59:57 2018 +0100
@@ -282,7 +282,7 @@
         // The most recently subscribed delegate will get the error.
         // If the delegate is null, the error will be handled by the next
         // delegate that subscribes.
-        // If the queue is not empty, wait until it it is empty before
+        // If the queue is not empty, wait until it is empty before
         // handling the error.
         Http1AsyncDelegate delegate = pendingDelegateRef.get();
         if (delegate == null) delegate = this.delegate;
--- a/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java	Wed Nov 14 04:59:57 2018 +0100
@@ -414,7 +414,7 @@
 
     // call these before assigning a request/stream to a connection
     // if false returned then a new Http2Connection is required
-    // if true, the the stream may be assigned to this connection
+    // if true, the stream may be assigned to this connection
     // for server push, if false returned, then the stream should be cancelled
     synchronized boolean reserveStream(boolean clientInitiated) throws IOException {
         if (finalStream) {
--- a/src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java	Wed Nov 14 04:59:57 2018 +0100
@@ -211,7 +211,7 @@
     //    from the map. This should also take care of push promises.
     // 2. For WebSocket the count is increased when creating a
     //    DetachedConnectionChannel for the socket, and decreased
-    //    when the the channel is closed.
+    //    when the channel is closed.
     //    In addition, the HttpClient facade is passed to the WebSocket builder,
     //    (instead of the client implementation delegate).
     // 3. For HTTP/1.1 the count is incremented before starting to parse the body
--- a/src/java.net.http/share/classes/jdk/internal/net/http/SocketTube.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/SocketTube.java	Wed Nov 14 04:59:57 2018 +0100
@@ -322,7 +322,7 @@
         // onNext is usually called from within a user / executor thread.
         // Initial writing will be performed in that thread. If for some reason,
         // not all the data can be written, a writeEvent will be registered, and
-        // writing will resume in the the selector manager thread when the
+        // writing will resume in the selector manager thread when the
         // writeEvent is fired.
         //
         // If this method is invoked in the selector manager thread (because of
--- a/src/java.net.http/share/classes/jdk/internal/net/http/Stream.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/Stream.java	Wed Nov 14 04:59:57 2018 +0100
@@ -69,7 +69,7 @@
  * RESPONSES
  *
  * Multiple responses can be received per request. Responses are queued up on
- * a LinkedList of CF<HttpResponse> and the the first one on the list is completed
+ * a LinkedList of CF<HttpResponse> and the first one on the list is completed
  * with the next response
  *
  * getResponseAsync() -- queries list of response CFs and returns first one
--- a/src/jdk.compiler/share/classes/com/sun/source/doctree/DocTree.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/source/doctree/DocTree.java	Wed Nov 14 04:59:57 2018 +0100
@@ -211,6 +211,12 @@
         START_ELEMENT,
 
         /**
+         * Used for instances of {@link SystemPropertyTree}
+         * representing an @systemProperty tag.
+         */
+        SYSTEM_PROPERTY("systemProperty"),
+
+        /**
          * Used for instances of {@link SummaryTree}
          * representing the summary of a comment description.
          */
--- a/src/jdk.compiler/share/classes/com/sun/source/doctree/DocTreeVisitor.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/source/doctree/DocTreeVisitor.java	Wed Nov 14 04:59:57 2018 +0100
@@ -311,6 +311,21 @@
     }
 
     /**
+     * Visits a SystemPropertyTree node.
+     *
+     * @implSpec Visits a {@code SystemPropertyTree} node
+     * by calling {@code visitOther(node, p)}.
+     *
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     * @since 12
+     */
+    default R visitSystemProperty(SystemPropertyTree node, P p) {
+        return visitOther(node, p);
+    }
+
+    /**
      * Visits a TextTree node.
      * @param node the node being visited
      * @param p a parameter value
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.compiler/share/classes/com/sun/source/doctree/SystemPropertyTree.java	Wed Nov 14 04:59:57 2018 +0100
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.source.doctree;
+
+
+import javax.lang.model.element.Name;
+
+/**
+ * A tree node for an {@code @systemProperty} inline tag.
+ *
+ * <p>
+ * {&#064;systemProperty property-name}
+ *
+ * @since 12
+ */
+public interface SystemPropertyTree extends InlineTagTree {
+    /**
+     * Returns the specified system property name.
+     * @return the system property name
+     */
+    Name getPropertyName();
+}
--- a/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeFactory.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeFactory.java	Wed Nov 14 04:59:57 2018 +0100
@@ -60,6 +60,7 @@
 import com.sun.source.doctree.SinceTree;
 import com.sun.source.doctree.StartElementTree;
 import com.sun.source.doctree.SummaryTree;
+import com.sun.source.doctree.SystemPropertyTree;
 import com.sun.source.doctree.TextTree;
 import com.sun.source.doctree.ThrowsTree;
 import com.sun.source.doctree.UnknownBlockTagTree;
@@ -325,6 +326,15 @@
     }
 
     /**
+     * Create a new {@code SystemPropertyTree} object, to represent a {@code {@systemProperty } } tag.
+     *
+     * @param propertyName the system property name
+     * @return a {@code SystemPropertyTree} object
+     * @since 12
+     */
+    SystemPropertyTree newSystemPropertyTree(Name propertyName);
+
+    /**
      * Create a new {@code TextTree} object, to represent some plain text.
      * @param text the text
      * @return a {@code TextTree} object
--- a/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java	Wed Nov 14 04:59:57 2018 +0100
@@ -469,6 +469,19 @@
      * @param node  {@inheritDoc}
      * @param p  {@inheritDoc}
      * @return the result of scanning
+     * @since 12
+     */
+    @Override
+    public R visitSystemProperty(SystemPropertyTree node, P p) {
+        return null;
+    }
+
+    /**
+     * {@inheritDoc} This implementation returns {@code null}.
+     *
+     * @param node  {@inheritDoc}
+     * @param p  {@inheritDoc}
+     * @return the result of scanning
      */
     @Override
     public R visitText(TextTree node, P p) {
--- a/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java	Wed Nov 14 04:59:57 2018 +0100
@@ -431,6 +431,19 @@
      * @param node {@inheritDoc}
      * @param p {@inheritDoc}
      * @return  the result of {@code defaultAction}
+     * @since 12
+     */
+    @Override
+    public R visitSystemProperty(SystemPropertyTree node, P p) {
+        return defaultAction(node, p);
+    }
+
+    /**
+     * {@inheritDoc} This implementation calls {@code defaultAction}.
+     *
+     * @param node {@inheritDoc}
+     * @param p {@inheritDoc}
+     * @return  the result of {@code defaultAction}
      */
     @Override
     public R visitText(TextTree node, P p) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java	Wed Nov 14 04:59:57 2018 +0100
@@ -432,7 +432,10 @@
             try {
                 c.complete();
             } catch (CompletionFailure ex) {
-                if (absent) syms.removeClass(ps.modle, flatname);
+                if (absent) {
+                    syms.removeClass(ps.modle, flatname);
+                    ex.dcfh.classSymbolRemoved(c);
+                }
                 throw ex;
             }
         }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/DeferredCompletionFailureHandler.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/DeferredCompletionFailureHandler.java	Wed Nov 14 04:59:57 2018 +0100
@@ -24,8 +24,8 @@
  */
 package com.sun.tools.javac.code;
 
+import java.util.HashMap;
 import java.util.Map;
-import java.util.WeakHashMap;
 
 import com.sun.tools.javac.code.Kinds.Kind;
 import com.sun.tools.javac.code.Scope.WriteableScope;
@@ -62,7 +62,7 @@
     }
 
     public final Handler userCodeHandler = new Handler() {
-        private final Map<ClassSymbol, FlipSymbolDescription> class2Flip = new WeakHashMap<>();
+        private final Map<ClassSymbol, FlipSymbolDescription> class2Flip = new HashMap<>();
 
         public void install() {
             class2Flip.values().forEach(f -> f.flip());
@@ -78,6 +78,9 @@
                 }
             }));
         }
+        public void classSymbolRemoved(ClassSymbol sym) {
+            class2Flip.remove(sym);
+        }
         public void uninstall() {
             class2Flip.values().forEach(f -> f.flip());
         }
@@ -90,6 +93,7 @@
             throw cf;
         }
         public void classSymbolCompleteFailed(ClassSymbol sym, Completer origCompleter) {}
+        public void classSymbolRemoved(ClassSymbol sym) {}
         public void uninstall() {
         }
     };
@@ -118,6 +122,10 @@
         handler.classSymbolCompleteFailed(sym, origCompleter);
     }
 
+    public void classSymbolRemoved(ClassSymbol sym) {
+        handler.classSymbolRemoved(sym);
+    }
+
     public boolean isDeferredCompleter(Completer c) {
         return c instanceof DeferredCompleter;
     }
@@ -126,6 +134,7 @@
         public void install();
         public void handleAPICompletionFailure(CompletionFailure cf);
         public void classSymbolCompleteFailed(ClassSymbol sym, Completer origCompleter);
+        public void classSymbolRemoved(ClassSymbol sym);
         public void uninstall();
     }
 
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java	Wed Nov 14 04:59:57 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2020,6 +2020,7 @@
             for (IncorporationAction action : incorporationActions) {
                 uv2.incorporationActions.add(action.dup(uv2));
             }
+            uv2.kind = kind;
         }
 
         @Override
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java	Wed Nov 14 04:59:57 2018 +0100
@@ -1032,6 +1032,14 @@
         return names.fromChars(buf, start, bp - start);
     }
 
+    protected Name readSystemPropertyName() {
+        int pos = bp;
+        nextChar();
+        while (bp < buflen && Character.isUnicodeIdentifierPart(ch) || ch == '.')
+            nextChar();
+        return names.fromChars(buf, pos, bp - pos);
+    }
+
     protected boolean isDecimalDigit(char ch) {
         return ('0' <= ch && ch <= '9');
     }
@@ -1360,6 +1368,28 @@
                 }
             },
 
+            // @systemProperty property-name
+            new TagParser(Kind.INLINE, DCTree.Kind.SYSTEM_PROPERTY) {
+                public DCTree parse(int pos) throws ParseException {
+                    skipWhitespace();
+                    if (ch == '}') {
+                        throw new ParseException("dc.no.content");
+                    }
+                    Name propertyName = readSystemPropertyName();
+                    if (propertyName == null) {
+                        throw new ParseException("dc.no.content");
+                    }
+                    skipWhitespace();
+                    if (ch != '}') {
+                        nextChar();
+                        throw new ParseException("dc.unexpected.content");
+                    } else {
+                        nextChar();
+                        return m.at(pos).newSystemPropertyTree(propertyName);
+                    }
+                }
+            },
+
             // @throws class-name description
             new TagParser(Kind.BLOCK, DCTree.Kind.THROWS) {
                 public DCTree parse(int pos) throws ParseException {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DCTree.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DCTree.java	Wed Nov 14 04:59:57 2018 +0100
@@ -887,6 +887,29 @@
         }
     }
 
+    public static class DCSystemProperty extends DCInlineTag implements SystemPropertyTree {
+        public final Name propertyName;
+
+        DCSystemProperty(Name propertyName) {
+            this.propertyName = propertyName;
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public Kind getKind() {
+            return Kind.SYSTEM_PROPERTY;
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
+            return v.visitSystemProperty(this, d);
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public Name getPropertyName() {
+            return propertyName;
+        }
+    }
+
     public static class DCText extends DCTree implements TextTree {
         public final String text;
 
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocPretty.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocPretty.java	Wed Nov 14 04:59:57 2018 +0100
@@ -529,6 +529,20 @@
     }
 
     @Override @DefinedBy(Api.COMPILER_TREE)
+    public Void visitSystemProperty(SystemPropertyTree node, Void p) {
+        try {
+            print("{");
+            printTagName(node);
+            print(" ");
+            print(node.getPropertyName());
+            print("}");
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+        return null;
+    }
+
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitText(TextTree node, Void p) {
         try {
             print(node.getBody());
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java	Wed Nov 14 04:59:57 2018 +0100
@@ -82,6 +82,7 @@
 import com.sun.tools.javac.tree.DCTree.DCSince;
 import com.sun.tools.javac.tree.DCTree.DCStartElement;
 import com.sun.tools.javac.tree.DCTree.DCSummary;
+import com.sun.tools.javac.tree.DCTree.DCSystemProperty;
 import com.sun.tools.javac.tree.DCTree.DCText;
 import com.sun.tools.javac.tree.DCTree.DCThrows;
 import com.sun.tools.javac.tree.DCTree.DCUnknownBlockTag;
@@ -448,6 +449,13 @@
     }
 
     @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCSystemProperty newSystemPropertyTree(Name propertyName) {
+        DCSystemProperty tree = new DCSystemProperty(propertyName);
+        tree.pos = pos;
+        return tree;
+    }
+
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public DCText newTextTree(String text) {
         DCText tree = new DCText(text);
         tree.pos = pos;
--- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_TLS12_KEY_MAT_PARAMS.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_TLS12_KEY_MAT_PARAMS.java	Wed Nov 14 04:59:57 2018 +0100
@@ -1,11 +1,12 @@
 /*
- * Copyright (c) 2018, Red Hat, Inc. and/or its affiliates.
- *
+ * Copyright (c) 2018, Red Hat, Inc.
  * 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.
+ * 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
--- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_TLS12_MASTER_KEY_DERIVE_PARAMS.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_TLS12_MASTER_KEY_DERIVE_PARAMS.java	Wed Nov 14 04:59:57 2018 +0100
@@ -1,11 +1,12 @@
 /*
- * Copyright (c) 2018, Red Hat, Inc. and/or its affiliates.
- *
+ * Copyright (c) 2018, Red Hat, Inc.
  * 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.
+ * 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
--- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_TLS_MAC_PARAMS.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_TLS_MAC_PARAMS.java	Wed Nov 14 04:59:57 2018 +0100
@@ -1,11 +1,12 @@
 /*
- * Copyright (c) 2018, Red Hat, Inc. and/or its affiliates.
- *
+ * Copyright (c) 2018, Red Hat, Inc.
  * 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.
+ * 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
--- a/src/jdk.internal.vm.compiler.management/share/classes/org.graalvm.compiler.hotspot.management/src/org/graalvm/compiler/hotspot/management/HotSpotGraalRuntimeMBean.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/jdk.internal.vm.compiler.management/share/classes/org.graalvm.compiler.hotspot.management/src/org/graalvm/compiler/hotspot/management/HotSpotGraalRuntimeMBean.java	Wed Nov 14 04:59:57 2018 +0100
@@ -80,7 +80,16 @@
         return runtime;
     }
 
-    private static final boolean DEBUG = Boolean.getBoolean(HotSpotGraalRuntimeMBean.class.getSimpleName() + ".debug");
+    private static final boolean DEBUG = initDebug();
+
+    private static boolean initDebug() {
+        try {
+            return Boolean.getBoolean(HotSpotGraalRuntimeMBean.class.getSimpleName() + ".debug");
+        } catch (SecurityException e) {
+            // Swallow the exception
+            return false;
+        }
+    }
 
     @Override
     public Object getAttribute(String name) throws AttributeNotFoundException {
--- a/src/jdk.internal.vm.compiler/share/classes/module-info.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/jdk.internal.vm.compiler/share/classes/module-info.java	Wed Nov 14 04:59:57 2018 +0100
@@ -39,6 +39,7 @@
     uses org.graalvm.compiler.hotspot.HotSpotCodeCacheListener;
     uses org.graalvm.compiler.hotspot.HotSpotGraalManagementRegistration;
     uses org.graalvm.compiler.nodes.graphbuilderconf.NodeIntrinsicPluginFactory;
+    uses org.graalvm.compiler.phases.common.jmx.HotSpotMBeanOperationProvider;
     uses org.graalvm.compiler.serviceprovider.JMXService;
 
     exports jdk.internal.vm.compiler.collections        to jdk.internal.vm.compiler.management;
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Wed Nov 14 04:59:57 2018 +0100
@@ -65,6 +65,7 @@
 import com.sun.source.doctree.SeeTree;
 import com.sun.source.doctree.StartElementTree;
 import com.sun.source.doctree.SummaryTree;
+import com.sun.source.doctree.SystemPropertyTree;
 import com.sun.source.doctree.TextTree;
 import com.sun.source.util.SimpleDocTreeVisitor;
 
@@ -1531,6 +1532,17 @@
                     return false;
                 }
 
+                @Override
+                public Boolean visitSystemProperty(SystemPropertyTree node, Content p) {
+                    Content output = TagletWriter.getInlineTagOutput(element,
+                            configuration.tagletManager, holderTag, tag,
+                            getTagletWriterInstance(isFirstSentence, inSummary));
+                    if (output != null) {
+                        result.addContent(output);
+                    }
+                    return false;
+                }
+
                 private CharSequence textCleanup(String text, boolean isLast) {
                     return textCleanup(text, isLast, false);
                 }
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java	Wed Nov 14 04:59:57 2018 +0100
@@ -37,6 +37,7 @@
 
 import com.sun.source.doctree.DocTree;
 import com.sun.source.doctree.IndexTree;
+import com.sun.source.doctree.SystemPropertyTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
@@ -45,6 +46,7 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Resources;
 import jdk.javadoc.internal.doclets.toolkit.builders.SerializedFormBuilder;
 import jdk.javadoc.internal.doclets.toolkit.taglets.TagletWriter;
 import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
@@ -72,6 +74,7 @@
     private final HtmlConfiguration configuration;
     private final Utils utils;
     private final boolean inSummary;
+    private final Resources resources;
 
     public TagletWriterImpl(HtmlDocletWriter htmlWriter, boolean isFirstSentence) {
         this(htmlWriter, isFirstSentence, false);
@@ -83,6 +86,7 @@
         configuration = htmlWriter.configuration;
         this.utils = configuration.utils;
         this.inSummary = inSummary;
+        resources = configuration.getResources();
     }
 
     /**
@@ -112,61 +116,7 @@
         }
         String desc = ch.getText(itt.getDescription());
 
-        String anchorName = htmlWriter.links.getName(tagText);
-        Content result = null;
-        if (isFirstSentence && inSummary) {
-            result = new StringContent(tagText);
-        } else {
-            result = HtmlTree.A_ID(HtmlStyle.searchTagResult, anchorName, new StringContent(tagText));
-            if (configuration.createindex && !tagText.isEmpty()) {
-                SearchIndexItem si = new SearchIndexItem();
-                si.setLabel(tagText);
-                si.setDescription(desc);
-                DocPaths docPaths = configuration.docPaths;
-                new SimpleElementVisitor9<Void, Void>() {
-                    @Override
-                    public Void visitModule(ModuleElement e, Void p) {
-                        si.setUrl(docPaths.moduleSummary(e).getPath() + "#" + anchorName);
-                        si.setHolder(utils.getFullyQualifiedName(element));
-                        return null;
-                    }
-
-                    @Override
-                    public Void visitPackage(PackageElement e, Void p) {
-                        si.setUrl(docPaths.forPackage(e).getPath()
-                                + "/" + DocPaths.PACKAGE_SUMMARY.getPath() + "#" + anchorName);
-                        si.setHolder(utils.getSimpleName(element));
-                        return null;
-                    }
-
-                    @Override
-                    public Void visitType(TypeElement e, Void p) {
-                        si.setUrl(docPaths.forClass(e).getPath() + "#" + anchorName);
-                        si.setHolder(utils.getFullyQualifiedName(e));
-                        return null;
-                    }
-
-                    @Override
-                    public Void visitVariable(VariableElement e, Void p) {
-                        TypeElement te = utils.getEnclosingTypeElement(e);
-                        si.setUrl(docPaths.forClass(te).getPath() + "#" + anchorName);
-                        si.setHolder(utils.getFullyQualifiedName(e) + "." + utils.getSimpleName(e));
-                        return null;
-                    }
-
-                    @Override
-                    protected Void defaultAction(Element e, Void p) {
-                        TypeElement te = utils.getEnclosingTypeElement(e);
-                        si.setUrl(docPaths.forClass(te).getPath() + "#" + anchorName);
-                        si.setHolder(utils.getFullyQualifiedName(e));
-                        return null;
-                    }
-                }.visit(element);
-                si.setCategory(configuration.getContent("doclet.SearchTags").toString());
-                configuration.tagSearchIndex.add(si);
-            }
-        }
-        return result;
+        return createAnchorAndSearchIndex(element, tagText,desc);
     }
 
     /**
@@ -367,6 +317,16 @@
     /**
      * {@inheritDoc}
      */
+    protected Content systemPropertyTagOutput(Element element, DocTree tag) {
+        SystemPropertyTree itt = (SystemPropertyTree)tag;
+        String tagText = itt.getPropertyName().toString();
+        return HtmlTree.CODE(createAnchorAndSearchIndex(element, tagText,
+                resources.getText("doclet.System_Property")));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     public Content getThrowsHeader() {
         HtmlTree result = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.throwsLabel,
                 new StringContent(configuration.getText("doclet.Throws"))));
@@ -449,4 +409,62 @@
     public BaseConfiguration configuration() {
         return configuration;
     }
+
+    private Content createAnchorAndSearchIndex(Element element, String tagText, String desc){
+        String anchorName = htmlWriter.links.getName(tagText);
+        Content result = null;
+        if (isFirstSentence && inSummary) {
+            result = new StringContent(tagText);
+        } else {
+            result = HtmlTree.A_ID(HtmlStyle.searchTagResult, anchorName, new StringContent(tagText));
+            if (configuration.createindex && !tagText.isEmpty()) {
+                SearchIndexItem si = new SearchIndexItem();
+                si.setLabel(tagText);
+                si.setDescription(desc);
+                DocPaths docPaths = configuration.docPaths;
+                new SimpleElementVisitor9<Void, Void>() {
+                    @Override
+                    public Void visitModule(ModuleElement e, Void p) {
+                        si.setUrl(docPaths.moduleSummary(e).getPath() + "#" + anchorName);
+                        si.setHolder(utils.getFullyQualifiedName(element));
+                        return null;
+                    }
+
+                    @Override
+                    public Void visitPackage(PackageElement e, Void p) {
+                        si.setUrl(docPaths.forPackage(e).getPath()
+                                + "/" + DocPaths.PACKAGE_SUMMARY.getPath() + "#" + anchorName);
+                        si.setHolder(utils.getSimpleName(element));
+                        return null;
+                    }
+
+                    @Override
+                    public Void visitType(TypeElement e, Void p) {
+                        si.setUrl(docPaths.forClass(e).getPath() + "#" + anchorName);
+                        si.setHolder(utils.getFullyQualifiedName(e));
+                        return null;
+                    }
+
+                    @Override
+                    public Void visitVariable(VariableElement e, Void p) {
+                        TypeElement te = utils.getEnclosingTypeElement(e);
+                        si.setUrl(docPaths.forClass(te).getPath() + "#" + anchorName);
+                        si.setHolder(utils.getFullyQualifiedName(e) + "." + utils.getSimpleName(e));
+                        return null;
+                    }
+
+                    @Override
+                    protected Void defaultAction(Element e, Void p) {
+                        TypeElement te = utils.getEnclosingTypeElement(e);
+                        si.setUrl(docPaths.forClass(te).getPath() + "#" + anchorName);
+                        si.setHolder(utils.getFullyQualifiedName(e));
+                        return null;
+                    }
+                }.visit(element);
+                si.setCategory(configuration.getContent("doclet.SearchTags").toString());
+                configuration.tagSearchIndex.add(si);
+            }
+        }
+        return result;
+    }
 }
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties	Wed Nov 14 04:59:57 2018 +0100
@@ -95,6 +95,7 @@
 doclet.Interfaces=Interfaces
 doclet.Enclosing_Class=Enclosing class:
 doclet.Enclosing_Interface=Enclosing interface:
+doclet.System_Property=System Property
 doclet.Window_Source_title=Source code
 doclet.Window_Help_title=API Help
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/SystemPropertyTaglet.java	Wed Nov 14 04:59:57 2018 +0100
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.internal.doclets.toolkit.taglets;
+
+import com.sun.source.doctree.DocTree;
+import jdk.javadoc.internal.doclets.toolkit.Content;
+
+import javax.lang.model.element.Element;
+import java.util.EnumSet;
+
+import static com.sun.source.doctree.DocTree.Kind.SYSTEM_PROPERTY;
+
+/**
+ * A taglet that represents the {@code @systemProperty} tag.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+
+public class SystemPropertyTaglet extends BaseTaglet {
+
+    SystemPropertyTaglet(){
+        super(SYSTEM_PROPERTY.tagName, true, EnumSet.of(Site.CONSTRUCTOR, Site.METHOD, Site.FIELD,
+                Site.PACKAGE, Site.MODULE, Site.TYPE));
+    }
+
+    @Override
+    public Content getTagletOutput(Element element, DocTree tag, TagletWriter writer) {
+        return writer.systemPropertyTagOutput(element, tag);
+    }
+}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java	Wed Nov 14 04:59:57 2018 +0100
@@ -609,6 +609,7 @@
         addStandardTaglet(new CodeTaglet());
         addStandardTaglet(new IndexTaglet());
         addStandardTaglet(new SummaryTaglet());
+        addStandardTaglet(new SystemPropertyTaglet());
 
         // Keep track of the names of standard tags for error checking purposes.
         // The following are not handled above.
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletWriter.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletWriter.java	Wed Nov 14 04:59:57 2018 +0100
@@ -172,6 +172,15 @@
     protected abstract Content simpleTagOutput(Element element, DocTree simpleTag, String header);
 
     /**
+     * Return the system property tag output.
+     *
+     * @param element
+     * @param systemPropertyTag the system property tag
+     * @return the output of system property tag
+     */
+    protected abstract Content systemPropertyTagOutput(Element element, DocTree systemPropertyTag);
+
+    /**
      * Return the header for the throws tag.
      *
      * @return the header for the throws tag.
--- a/src/jdk.management/share/classes/com/sun/management/DiagnosticCommandMBean.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/src/jdk.management/share/classes/com/sun/management/DiagnosticCommandMBean.java	Wed Nov 14 04:59:57 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -213,7 +213,7 @@
  * Virtual Machine is modified, the {@code DiagnosticCommandMBean} emits
  * a {@link javax.management.Notification} with a
  * {@linkplain javax.management.Notification#getType() type} of
- * <a href="{@docRoot}/javax/management/MBeanInfo.html#info-changed">
+ * <a href="{@docRoot}/java.management/javax/management/MBeanInfo.html#info-changed">
  * {@code "jmx.mbean.info.changed"}</a> and a
  * {@linkplain javax.management.Notification#getUserData() userData} that
  * is the new {@code MBeanInfo}.
--- a/test/hotspot/gtest/gc/shared/test_oopStorage_parperf.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/gtest/gc/shared/test_oopStorage_parperf.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -46,9 +46,6 @@
 // object containing a large number of entries, and logs some stats
 // about the distribution and performance of the iteration.
 
-// Parallel iteration not available unless INCLUDE_ALL_GCS
-#if INCLUDE_ALL_GCS
-
 const uint _max_workers = 10;
 static uint _num_workers = 0;
 const size_t _storage_entries = 1000000;
@@ -229,5 +226,3 @@
     LogConfiguration::configure_stdout(old_level, true, LOG_TAGS(TEST_TAGS));
   }
 }
-
-#endif // INCLUDE_ALL_GCS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/gtest/utilities/test_bitMap_large.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2018, Red Hat Inc. 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 "utilities/bitMap.inline.hpp"
+#include "unittest.hpp"
+
+// Bitmap size should be large enough to accept large operations.
+static const BitMap::idx_t BITMAP_SIZE = 8192;
+
+// The test would like to fuzz indexes in this window. Having the fuzz
+// window at bitmap word size makes sure the test would touch every combination
+// of indexes (un)aligned on word boundary.
+static const BitMap::idx_t FUZZ_WINDOW = sizeof(BitMap::bm_word_t) * 8;
+
+static void verify_set(CHeapBitMap& map, BitMap::idx_t l, BitMap::idx_t r) {
+  for (BitMap::idx_t c = l; c < r; c++) {
+    EXPECT_TRUE(map.at(c));
+  }
+}
+
+static void verify_unset(CHeapBitMap& map, BitMap::idx_t l, BitMap::idx_t r) {
+  for (BitMap::idx_t c = l; c < r; c++) {
+    EXPECT_FALSE(map.at(c));
+  }
+}
+
+TEST(BitMap, clear_large_range) {
+  CHeapBitMap map(BITMAP_SIZE);
+
+  map.set_range(0, BITMAP_SIZE);
+  verify_set(map, 0, BITMAP_SIZE);
+
+  for (size_t size_class = 0; size_class <= BITMAP_SIZE; size_class = MAX2<size_t>(1, size_class*2)) {
+    for (BitMap::idx_t l = 0; l < FUZZ_WINDOW; l++) {
+      for (BitMap::idx_t tr = l; tr < FUZZ_WINDOW; tr++) {
+        BitMap::idx_t r = MIN2(BITMAP_SIZE, size_class + tr); // avoid overflow
+
+        map.clear_large_range(l, r);
+        verify_unset(map, l, r);
+        verify_set(map, 0, l);
+        verify_set(map, r, BITMAP_SIZE);
+
+        // Restore cleared
+        map.set_range(l, r);
+        verify_set(map, l, r);
+      }
+    }
+  }
+}
+
+TEST(BitMap, set_large_range) {
+  CHeapBitMap map(BITMAP_SIZE);
+
+  map.clear();
+  verify_unset(map, 0, BITMAP_SIZE);
+
+  for (size_t size_class = 0; size_class <= BITMAP_SIZE; size_class = MAX2<size_t>(1, size_class*2)) {
+    for (BitMap::idx_t l = 0; l < FUZZ_WINDOW; l++) {
+      for (BitMap::idx_t tr = l; tr < FUZZ_WINDOW; tr++) {
+        BitMap::idx_t r = MIN2(BITMAP_SIZE, size_class + tr); // avoid overflow
+
+        map.set_large_range(l, r);
+        verify_set(map, l, r);
+        verify_unset(map, 0, l);
+        verify_unset(map, r, BITMAP_SIZE);
+
+        // Restore set
+        map.clear_range(l, r);
+        verify_unset(map, l, r);
+      }
+    }
+  }
+}
+
+TEST(BitMap, par_at_put_large_range) {
+  CHeapBitMap map(BITMAP_SIZE);
+
+  map.clear();
+  verify_unset(map, 0, BITMAP_SIZE);
+
+  for (size_t size_class = 0; size_class <= BITMAP_SIZE; size_class = MAX2<size_t>(1, size_class*2)) {
+    for (BitMap::idx_t l = 0; l < FUZZ_WINDOW; l++) {
+      for (BitMap::idx_t tr = l; tr < FUZZ_WINDOW; tr++) {
+        BitMap::idx_t r = MIN2(BITMAP_SIZE, size_class + tr); // avoid overflow
+
+        map.par_at_put_large_range(l, r, true);
+        verify_set(map, l, r);
+        verify_unset(map, 0, l);
+        verify_unset(map, r, BITMAP_SIZE);
+
+        // Restore set
+        map.clear_range(l, r);
+        verify_unset(map, l, r);
+      }
+    }
+  }
+}
--- a/test/hotspot/jtreg/ProblemList-graal.txt	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/ProblemList-graal.txt	Wed Nov 14 04:59:57 2018 +0100
@@ -164,18 +164,15 @@
 
 # Graal unit tests
 org.graalvm.compiler.core.test.CheckGraalInvariants                              8205081
-org.graalvm.compiler.core.test.inlining.PolymorphicInliningTest                  8205081
 org.graalvm.compiler.core.test.OptionsVerifierTest                               8205081
-org.graalvm.compiler.core.test.ProfilingInfoTest                                 8205081
 org.graalvm.compiler.hotspot.test.CompilationWrapperTest                         8205081
-org.graalvm.compiler.hotspot.test.HsErrLogTest                                   8205081
-org.graalvm.compiler.hotspot.test.OptionsInFileTest                              8205081
-org.graalvm.compiler.hotspot.test.ReservedStackAccessTest                        8205081
 org.graalvm.compiler.replacements.test.classfile.ClassfileBytecodeProviderTest   8205081
-org.graalvm.compiler.replacements.test.classfile.RedefineIntrinsicTest           8205081
 
 org.graalvm.compiler.core.test.deopt.CompiledMethodTest          8202955
 org.graalvm.compiler.core.test.CountedLoopTest                   8211179
 org.graalvm.compiler.debug.test.DebugContextTest                 8203504
 
 org.graalvm.compiler.hotspot.test.GraalOSRTest                   8206947
+org.graalvm.compiler.hotspot.test.ReservedStackAccessTest        8213567   windows-all
+
+org.graalvm.compiler.debug.test.TimerKeyTest                     8213598
--- a/test/hotspot/jtreg/compiler/graalunit/common/GraalUnitTestLauncher.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/compiler/graalunit/common/GraalUnitTestLauncher.java	Wed Nov 14 04:59:57 2018 +0100
@@ -31,6 +31,7 @@
 
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.JDKToolFinder;
 
 /*
  * This is helper class used to run Graal unit tests.
@@ -262,6 +263,14 @@
 
         ProcessBuilder javaPB = ProcessTools.createJavaProcessBuilder(true,
                 javaFlags.toArray(new String[javaFlags.size()]));
+
+        // Some tests rely on MX_SUBPROCESS_COMMAND_FILE env variable which contains
+        // name of the file with java executable and java args used to launch the current process.
+        Path cmdFile = Files.createTempFile(Path.of(""), "mx_subprocess_", ".cmd");
+        Files.writeString(cmdFile, JDKToolFinder.getJDKTool("java") + System.lineSeparator());
+        Files.write(cmdFile, javaFlags, StandardOpenOption.APPEND);
+        javaPB.environment().put("MX_SUBPROCESS_COMMAND_FILE", cmdFile.toAbsolutePath().toString());
+
         System.out.println("INFO: run command: " + String.join(" ", javaPB.command()));
 
         OutputAnalyzer outputAnalyzer = new OutputAnalyzer(javaPB.start());
--- a/test/hotspot/jtreg/gc/TestAllocateHeapAtMultiple.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/gc/TestAllocateHeapAtMultiple.java	Wed Nov 14 04:59:57 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 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
@@ -27,6 +27,7 @@
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  * @requires vm.bits == "64" & vm.gc != "Z" & os.family != "aix"
+ * @run main/timeout=360 TestAllocateHeapAtMultiple
  */
 
 import jdk.test.lib.JDKToolFinder;
--- a/test/hotspot/jtreg/runtime/MemberName/MemberNameLeak.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/runtime/MemberName/MemberNameLeak.java	Wed Nov 14 04:59:57 2018 +0100
@@ -23,8 +23,9 @@
 
 /*
  * @test
- * @bug 8174749
+ * @bug 8174749 8213307
  * @summary MemberNameTable should reuse entries
+ * @requires vm.gc == "null"
  * @library /test/lib
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
@@ -71,13 +72,16 @@
       }
     }
 
-    public static void test(String gc) throws Throwable {
+    public static void test(String gc, boolean doConcurrent) throws Throwable {
         // Run this Leak class with logging
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
                                       "-Xlog:membername+table=trace",
                                       "-XX:+UnlockDiagnosticVMOptions",
                                       "-XX:+WhiteBoxAPI",
                                       "-Xbootclasspath/a:.",
+                                      doConcurrent ? "-XX:+ExplicitGCInvokesConcurrent" : "-XX:-ExplicitGCInvokesConcurrent",
+                                      "-XX:+ClassUnloading",
+                                      "-XX:+ClassUnloadingWithConcurrentMark",
                                       gc, Leak.class.getName());
         OutputAnalyzer output = new OutputAnalyzer(pb.start());
         output.shouldContain("ResolvedMethod entry added for MemberNameLeak$Leak.callMe()V");
@@ -87,11 +91,14 @@
     }
 
     public static void main(java.lang.String[] unused) throws Throwable {
-        test("-XX:+UseG1GC");
-        test("-XX:+UseParallelGC");
-        test("-XX:+UseSerialGC");
+        test("-XX:+UseG1GC", false);
+        test("-XX:+UseG1GC", true);
+
+        test("-XX:+UseParallelGC", false);
+        test("-XX:+UseSerialGC", false);
         if (!Compiler.isGraalEnabled()) { // Graal does not support CMS
-            test("-XX:+UseConcMarkSweepGC");
+            test("-XX:+UseConcMarkSweepGC", false);
+            test("-XX:+UseConcMarkSweepGC", true);
         }
     }
 }
--- a/test/hotspot/jtreg/runtime/Metaspace/PrintMetaspaceDcmd.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/runtime/Metaspace/PrintMetaspaceDcmd.java	Wed Nov 14 04:59:57 2018 +0100
@@ -30,13 +30,23 @@
  * @test
  * @key metaspace jcmd
  * @summary Test the VM.metaspace command
- * @requires vm.gc != "Z"
+ * @requires vm.gc != "Z" & vm.bits != "32"
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
  * @run main/othervm -XX:MaxMetaspaceSize=201M -Xmx100M -XX:+UseCompressedOops -XX:+UseCompressedClassPointers PrintMetaspaceDcmd with-compressed-class-space
  * @run main/othervm -XX:MaxMetaspaceSize=201M -Xmx100M -XX:-UseCompressedOops -XX:-UseCompressedClassPointers PrintMetaspaceDcmd without-compressed-class-space
  */
+/*
+ * @test
+ * @key metaspace jcmd
+ * @summary Test the VM.metaspace command
+ * @requires vm.gc != "Z" & vm.bits == "32"
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ * @run main/othervm -XX:MaxMetaspaceSize=201M -Xmx100M PrintMetaspaceDcmd without-compressed-class-space
+ */
 
 public class PrintMetaspaceDcmd {
 
--- a/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetLocalVars.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetLocalVars.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -143,9 +143,7 @@
   printf("\n test_local_integer: BEGIN\n\n");
 
   test_int(thr, depth, slot, "int");
-  test_long_inv_slot(thr, depth, slot, "int");
   test_float(thr, depth, slot, "int");
-  test_double_inv_slot(thr, depth, slot, "int");
   test_object_type_mismatch(thr, depth, slot, "double");
 
   printf("\n test_local_integer: END\n\n");
@@ -159,7 +157,6 @@
   test_long_inv_slot(thr, depth, slot, "invalid");
   test_float_inv_slot(thr, depth, slot, "invalid");
   test_double_inv_slot(thr, depth, slot, "invalid");
-  test_object_inv_slot(thr, depth, slot, "invalid");
 
   printf("\n test_local_invalid: END\n\n");
 }
@@ -205,6 +202,18 @@
 
 JNIEXPORT void JNICALL
 Java_GetLocalVars_testLocals(JNIEnv *env, jclass cls, jobject thread) {
+  /*
+   * We test the JVMTI GetLocal<Type> for locals of the method:
+   *
+   *  int staticMeth(byte byteArg, Object objArg, double dblArg, int intArg) {
+   *      testLocals(Thread.currentThread());
+   *      {
+   *          int intLoc = 9999;
+   *          intArg = intLoc;
+   *      }
+   *      return intArg;
+   *  }
+   */
   static const char* METHOD_NAME = "staticMeth";
   static const char* METHOD_SIGN = "(BLjava/lang/Object;DI)I";
   static const int Depth = 1;
--- a/test/hotspot/jtreg/vmTestbase/metaspace/stressDictionary/StressDictionary.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/metaspace/stressDictionary/StressDictionary.java	Wed Nov 14 04:59:57 2018 +0100
@@ -29,7 +29,7 @@
  *
  * @library /vmTestbase /test/lib
  * @run driver jdk.test.lib.FileInstaller . .
- * @run main/othervm/timeout=300 metaspace.stressDictionary.StressDictionary -stressTime 30
+ * @run main/othervm/timeout=420 metaspace.stressDictionary.StressDictionary -stressTime 30
  */
 
 package metaspace.stressDictionary;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn004/libforceEarlyReturn004a.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn004/libforceEarlyReturn004a.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -38,7 +38,7 @@
     env->SetBooleanField(object, field, 1);
 
     // execute infinite loop to be sure that thread in native method
-    while(always_true)
+    while (always_true)
     {
         // Need some dummy code so the optimizer does not remove this loop.
         dummy_counter = dummy_counter < 1000 ? 0 : dummy_counter + 1;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn005/libforceEarlyReturn005a.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn005/libforceEarlyReturn005a.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -32,7 +32,7 @@
 {
         jint success  = env->MonitorEnter(object);
 
-        if(success != 0)
+        if (success != 0)
         {
                 NSK_COMPLAIN1("MonitorEnter return non-zero: %d\n", success);
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn002/libforceEarlyReturn002a.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn002/libforceEarlyReturn002a.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -38,7 +38,7 @@
     env->SetBooleanField(object, field, 1);
 
     // execute infinite loop to be sure that thread in native method
-    while(always_true)
+    while (always_true)
     {
         // Need some dummy code so the optimizer does not remove this loop.
         dummy_counter = dummy_counter < 1000 ? 0 : dummy_counter + 1;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach008/attach008Agent00.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach008/attach008Agent00.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -73,7 +73,7 @@
         jobject object) {
     char threadName[MAX_STRING_LENGTH];
 
-    if(!nsk_jvmti_aod_getThreadName(jvmti, thread, threadName)) {
+    if (!nsk_jvmti_aod_getThreadName(jvmti, thread, threadName)) {
         nsk_jvmti_aod_disableEventsAndFinish(agentName, testEvents, testEventsNumber, 0, jvmti, jni);
         return;
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach041/attach041Agent00.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach041/attach041Agent00.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -52,7 +52,7 @@
     int i;
     char threadGroupName[MAX_STRING_LENGTH];
 
-    if(!NSK_JVMTI_VERIFY(jvmti->GetThreadGroupInfo(group, &groupInfo))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetThreadGroupInfo(group, &groupInfo))) {
         return 0;
     }
 
@@ -61,7 +61,7 @@
 
     NSK_DISPLAY3("%s: trying to find thread '%s' in group '%s'\n", agentName, threadNameToFind, threadGroupName);
 
-    if(!NSK_JVMTI_VERIFY(jvmti->GetThreadGroupChildren(group, &threadsCount, &threads, &groupsCount, &groups))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetThreadGroupChildren(group, &threadsCount, &threads, &groupsCount, &groups))) {
         return 0;
     }
 
@@ -118,7 +118,7 @@
         jthreadGroup *topGroups;
         int i;
 
-        if(!NSK_JVMTI_VERIFY(jvmti->GetTopThreadGroups(&groupsCount, &topGroups))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->GetTopThreadGroups(&groupsCount, &topGroups))) {
             NSK_COMPLAIN1("%s: failed to get top thread groups\n", agentName);
             nsk_jvmti_aod_disableEventAndFinish(agentName, JVMTI_EVENT_THREAD_START, 0, jvmti, jni);
             return;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach042/attach042Agent00.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach042/attach042Agent00.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -48,7 +48,7 @@
         jthread thread) {
     char startedThreadName[MAX_STRING_LENGTH];
 
-    if(!nsk_jvmti_aod_getThreadName(jvmti, thread, startedThreadName)) {
+    if (!nsk_jvmti_aod_getThreadName(jvmti, thread, startedThreadName)) {
         nsk_jvmti_aod_disableEventAndFinish(agentName, JVMTI_EVENT_THREAD_START, 0, jvmti, jni);
         return;
     }
@@ -62,7 +62,7 @@
         int i;
         int startedThreadWasFound = 0;
 
-        if(!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threadsCount, &threads))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threadsCount, &threads))) {
             NSK_COMPLAIN1("%s: failed to get all threads\n", agentName);
             nsk_jvmti_aod_disableEventAndFinish(agentName, JVMTI_EVENT_THREAD_START, 0, jvmti, jni);
             return;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Breakpoint/breakpoint001/breakpoint001.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Breakpoint/breakpoint001/breakpoint001.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -58,7 +58,7 @@
 static void initCounters() {
     int i;
 
-    for(i=0; i<METH_NUM; i++)
+    for (i=0; i<METH_NUM; i++)
         bpEvents[i] = 0;
 }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassLoad/classload001/classload001.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassLoad/classload001/classload001.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -79,10 +79,10 @@
 static void initCounters() {
     size_t i;
 
-    for(i=0; i<EXP_SIG_NUM; i++)
+    for (i=0; i<EXP_SIG_NUM; i++)
         clsEvents[i] = 0;
 
-    for(i=0; i<UNEXP_SIG_NUM; i++)
+    for (i=0; i<UNEXP_SIG_NUM; i++)
         primClsEvents[i] = 0;
 }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/abort/Abort.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/abort/Abort.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -81,10 +81,10 @@
   int invocations = 0;
 
   NSK_DISPLAY0("Waiting debugee.\n");
-  if(!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) {
+  if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) {
     return;
   }
-  if(!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) {
+  if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) {
     return;
   }
 
@@ -95,18 +95,18 @@
   primitive_callbacks.heap_iteration_callback = &heap_callback;
 
   NSK_DISPLAY0("Iterating over reachable objects.\n");
-  if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, NULL, &primitive_callbacks, &invocations))) {
+  if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, NULL, &primitive_callbacks, &invocations))) {
     nsk_jvmti_setFailStatus();
     return;
   }
 
-  if(invocations != 1) {
+  if (invocations != 1) {
     NSK_COMPLAIN1("Primitive callbacks were invoked more than once: "
                   "%d invocations registered.\n",invocations);
     nsk_jvmti_setFailStatus();
   }
 
-  if(!NSK_VERIFY(nsk_jvmti_resumeSync()))
+  if (!NSK_VERIFY(nsk_jvmti_resumeSync()))
     return;
 }
 
@@ -139,12 +139,12 @@
   caps.can_tag_objects = 1;
   caps.can_generate_object_free_events = 1;
 
-  if(!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
+  if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
     return JNI_ERR;
   }
 
   memset(&event_callbacks, 0, sizeof(jvmtiEventCallbacks));
-  if(!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&event_callbacks, sizeof(jvmtiEventCallbacks)))) {
+  if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&event_callbacks, sizeof(jvmtiEventCallbacks)))) {
     return JNI_ERR;
   }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/callbacks/Callbacks.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/callbacks/Callbacks.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -111,25 +111,25 @@
 
 // Check if the signature is signature of primitive type.
 jboolean is_primitive_type(const char *signature) {
-  if(!strcmp(signature,"C")
-     || !strcmp(signature, "B")
-     || !strcmp(signature, "S")
-     || !strcmp(signature, "I")
-     || !strcmp(signature, "J")
-     || !strcmp(signature, "F")
-     || !strcmp(signature, "D")
-     || !strcmp(signature, "Z"))
+  if (!strcmp(signature,"C")
+      || !strcmp(signature, "B")
+      || !strcmp(signature, "S")
+      || !strcmp(signature, "I")
+      || !strcmp(signature, "J")
+      || !strcmp(signature, "F")
+      || !strcmp(signature, "D")
+      || !strcmp(signature, "Z"))
     return JNI_TRUE;
   return JNI_FALSE;
 }
 
 // For given signature find expected tag type
 int get_tag_type(const char *signature) {
-  if(is_primitive_type(signature)) {
+  if (is_primitive_type(signature)) {
     return TAG_TYPE_PRIMITIVE;
-  } else if(signature[0]=='[' && is_primitive_type(signature+1)) {
+  } else if (signature[0]=='[' && is_primitive_type(signature+1)) {
     return TAG_TYPE_ARRAY;
-  } else if(!strcmp(signature, "Ljava/lang/String;")) {
+  } else if (!strcmp(signature, "Ljava/lang/String;")) {
     return TAG_TYPE_STRING;
   } else {
     return TAG_TYPE_OBJECT;
@@ -141,7 +141,7 @@
   * Returns 0 if value matched with expected.
   */
 jboolean verify_value(jvalue value, jvmtiPrimitiveType type) {
-  switch(type) {
+  switch (type) {
   case JVMTI_PRIMITIVE_TYPE_BOOLEAN:
     return value.z==BOOLEAN;
   case JVMTI_PRIMITIVE_TYPE_BYTE:
@@ -167,7 +167,7 @@
 // Check that array values are correct depending on type of elements
 jboolean verify_array(const void *array, jvmtiPrimitiveType type, jint length) {
   void *expected_array;
-  switch(type) {
+  switch (type) {
   case JVMTI_PRIMITIVE_TYPE_BOOLEAN:
     expected_array = (void*)BOOLEAN_ARRAY;
     break;
@@ -210,11 +210,11 @@
   tag = *object_tag_ptr;
 
   // skip all non-tagged fields as well as fields of tagged objects
-  if(tag == 0 ||
-     DECODE_TYPE(tag) == TAG_TYPE_OBJECT ||
-     DECODE_TYPE(tag) == TAG_TYPE_STRING) {
+  if (tag == 0 ||
+      DECODE_TYPE(tag) == TAG_TYPE_OBJECT ||
+      DECODE_TYPE(tag) == TAG_TYPE_STRING) {
     return 0;
-  } else if(DECODE_TYPE(tag) != TAG_TYPE_PRIMITIVE) {
+  } else if (DECODE_TYPE(tag) != TAG_TYPE_PRIMITIVE) {
     NSK_COMPLAIN3("jvmtiPrimitiveFieldCallback was invoked for an object with "
                   "non-primitive field tag (0x%lX) corresponging to %s::%s.\n",
                   DECODE_TYPE(tag),
@@ -226,7 +226,7 @@
 
   objects_info[DECODE_OBJECT(tag)].fields[info->field.index].found++;
 
-  if(!verify_value(value, value_type)) {
+  if (!verify_value(value, value_type)) {
     NSK_COMPLAIN2("Field %s::%s has unexpected value.\n",
                   objects_info[DECODE_OBJECT(tag)].name,
                   objects_info[DECODE_OBJECT(tag)].fields[info->field.index].name);
@@ -245,9 +245,9 @@
   int i;
 
   //skip all untegged strings
-  if(*tag_ptr==0) {
+  if (*tag_ptr==0) {
     return 0;
-  } else if(DECODE_TYPE(*tag_ptr) != TAG_TYPE_STRING) {
+  } else if (DECODE_TYPE(*tag_ptr) != TAG_TYPE_STRING) {
     NSK_COMPLAIN2("jvmtiStringPrimitiveValueCallback was invoked for an object "
                   "with non-string tag corresponding to %s::%s.\n",
                   objects_info[DECODE_OBJECT(*tag_ptr)].name,
@@ -258,7 +258,7 @@
   objects_info[DECODE_OBJECT(*tag_ptr)].fields[DECODE_FIELD(*tag_ptr)].found++;
 
   //check that reported length is the same as expected
-  if(value_length != (jint) wcslen(STRING)) {
+  if (value_length != (jint) wcslen(STRING)) {
     NSK_COMPLAIN4("Length of reported string %s::%s is %d while %d is expected.\n",
                   objects_info[DECODE_OBJECT(*tag_ptr)].name,
                   objects_info[DECODE_OBJECT(*tag_ptr)].fields[DECODE_FIELD(*tag_ptr)].name,
@@ -269,11 +269,11 @@
   }
 
   //compare reported value with expected one
-  for(i = 0; i<value_length && matched; i++) {
+  for (i = 0; i<value_length && matched; i++) {
     matched = value[i] == STRING[i];
   }
 
-  if(!matched) {
+  if (!matched) {
     NSK_COMPLAIN2("Value of field %s::%s has unexpected value.\n",
                   objects_info[DECODE_OBJECT(*tag_ptr)].name,
                   objects_info[DECODE_OBJECT(*tag_ptr)].fields[DECODE_FIELD(*tag_ptr)].name);
@@ -291,9 +291,9 @@
                             const void* elements,
                             void* user_data) {
   //skip untegged arrays
-  if(*tag_ptr == 0) {
+  if (*tag_ptr == 0) {
     return 0;
-  } else if(DECODE_TYPE(*tag_ptr) != TAG_TYPE_ARRAY) {
+  } else if (DECODE_TYPE(*tag_ptr) != TAG_TYPE_ARRAY) {
     NSK_COMPLAIN2("jvmtiArrayPrimitiveValueCallbak was invoked for object "
                   "with non-array tag corresponding to %s::%s.\n",
                   objects_info[DECODE_OBJECT(*tag_ptr)].name,
@@ -305,14 +305,14 @@
   objects_info[DECODE_OBJECT(*tag_ptr)].fields[DECODE_FIELD(*tag_ptr)].found++;
 
   //check if reported length is the same as expected
-  if(element_count != ARRAY_LENGTH) {
+  if (element_count != ARRAY_LENGTH) {
     NSK_COMPLAIN4("Length of array %s::%s is %d while %d is expected.\n",
                   objects_info[DECODE_OBJECT(*tag_ptr)].name,
                   objects_info[DECODE_OBJECT(*tag_ptr)].fields[DECODE_FIELD(*tag_ptr)].name,
                   element_count,
                   ARRAY_LENGTH);
     nsk_jvmti_setFailStatus();
-  } else if(!verify_array(elements, element_type, element_count)) {
+  } else if (!verify_array(elements, element_type, element_count)) {
     //compare array with expected one
     NSK_COMPLAIN2("Value of field %s::%s has unexpected value.\n",
                   objects_info[DECODE_OBJECT(*tag_ptr)].name,
@@ -328,11 +328,11 @@
                            jint length,
                            void* user_data) {
   //skip untagged objects
-  if(*tag_ptr == 0) {
+  if (*tag_ptr == 0) {
     return 0;
   }
 
-  if(DECODE_TYPE(*tag_ptr) != TAG_TYPE_PRIMITIVE) {
+  if (DECODE_TYPE(*tag_ptr) != TAG_TYPE_PRIMITIVE) {
     objects_info[DECODE_OBJECT(*tag_ptr)].fields[DECODE_FIELD(*tag_ptr)].found++;
   }
 
@@ -341,7 +341,7 @@
 
 JNIEXPORT void JNICALL
 object_free_callback(jvmtiEnv* jvmti, jlong tag) {
-  if(DECODE_TYPE(tag)==TAG_TYPE_PRIMITIVE) {
+  if (DECODE_TYPE(tag)==TAG_TYPE_PRIMITIVE) {
     int object = DECODE_OBJECT(tag);
     objects_info[object].collected = 1;
     NSK_DISPLAY1("Object %s collected.\n",
@@ -368,69 +368,69 @@
   jobjectArray testObjects;
   int object;
 
-  if(!NSK_VERIFY(NULL != (debugee = jni->FindClass(className))))
+  if (!NSK_VERIFY(NULL != (debugee = jni->FindClass(className))))
     return JNI_ERR;
 
-  if(!NSK_VERIFY(NULL != (testObjectsField = jni->GetStaticFieldID(debugee, fieldName, fieldSig))))
+  if (!NSK_VERIFY(NULL != (testObjectsField = jni->GetStaticFieldID(debugee, fieldName, fieldSig))))
     return JNI_ERR;
 
-  if(!NSK_VERIFY(NULL != (testObjects = (jobjectArray)(jni->GetStaticObjectField(
+  if (!NSK_VERIFY(NULL != (testObjects = (jobjectArray)(jni->GetStaticObjectField(
           debugee, testObjectsField)))))
     return JNI_ERR;
 
   // For each of test objects tag every field
-  for(object = 0; object<TEST_OBJECTS_COUNT; object++) {
+  for (object = 0; object<TEST_OBJECTS_COUNT; object++) {
     jobject target;
     jclass targetClass;
     jfieldID *targetFields;
     jint field;
 
     memset(&objects_info[object],0,sizeof(object_info_t));
-    if(!NSK_VERIFY(NULL != (target = jni->GetObjectArrayElement(testObjects, object))))
+    if (!NSK_VERIFY(NULL != (target = jni->GetObjectArrayElement(testObjects, object))))
       return JNI_ERR;
 
-    if(!NSK_VERIFY(NULL != (targetClass = jni->GetObjectClass(target))))
+    if (!NSK_VERIFY(NULL != (targetClass = jni->GetObjectClass(target))))
       return JNI_ERR;
 
-    if(!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(targetClass, &(objects_info[object].name), NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(targetClass, &(objects_info[object].name), NULL)))
       return JNI_ERR;
 
-    if(!NSK_JVMTI_VERIFY(jvmti->GetClassFields(
+    if (!NSK_JVMTI_VERIFY(jvmti->GetClassFields(
             targetClass, &(objects_info[object].fields_count), &targetFields)))
       return JNI_ERR;
 
     objects_info[object].fields = (field_info_t*)calloc(objects_info[object].fields_count,sizeof(field_info_t));
 
     // Iterate over fields, collect info about it and tag non primitive fields.
-    for(field = 0; field < objects_info[object].fields_count; field++) {
-      if(!NSK_JVMTI_VERIFY(jvmti->GetFieldName(targetClass,
-                                               targetFields[field],
-                                               &objects_info[object].fields[field].name,
-                                               &objects_info[object].fields[field].signature,
-                                               NULL)))
+    for (field = 0; field < objects_info[object].fields_count; field++) {
+      if (!NSK_JVMTI_VERIFY(jvmti->GetFieldName(targetClass,
+                                                targetFields[field],
+                                                &objects_info[object].fields[field].name,
+                                                &objects_info[object].fields[field].signature,
+                                                NULL)))
         return JNI_ERR;
-      if(is_primitive_type(objects_info[object].fields[field].signature)) {
+      if (is_primitive_type(objects_info[object].fields[field].signature)) {
         objects_info[object].fields[field].primitive = 1;
       } else {
         jint modifiers;
         jobject value;
         int tag_type = get_tag_type(objects_info[object].fields[field].signature);
-        if(!NSK_JVMTI_VERIFY(jvmti->GetFieldModifiers(
+        if (!NSK_JVMTI_VERIFY(jvmti->GetFieldModifiers(
                 targetClass, targetFields[field], &modifiers))) {
           return JNI_ERR;
         }
-        if(modifiers & STATIC_FIELD) {
-          if(!NSK_VERIFY(NULL != (value = jni->GetStaticObjectField(targetClass,
-                                                                    targetFields[field])))) {
+        if (modifiers & STATIC_FIELD) {
+          if (!NSK_VERIFY(NULL != (value = jni->GetStaticObjectField(targetClass,
+                                                                     targetFields[field])))) {
             return JNI_ERR;
           }
         } else {
-          if(!NSK_VERIFY(NULL != (value = jni->GetObjectField(target, targetFields[field])))) {
+          if (!NSK_VERIFY(NULL != (value = jni->GetObjectField(target, targetFields[field])))) {
             return JNI_ERR;
           }
         }
         //tag field's value
-        if(!NSK_JVMTI_VERIFY(jvmti->SetTag(value, ENCODE_TAG(tag_type,object,field)))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SetTag(value, ENCODE_TAG(tag_type,object,field)))) {
           return JNI_ERR;
         }
         //remove local reference so object will have a chance to become unreachable
@@ -439,9 +439,9 @@
     }
 
     // tag class and it's instance to pass this tag into primitive field callback
-    if(!NSK_JVMTI_VERIFY(jvmti->SetTag(target, ENCODE_TAG(TAG_TYPE_PRIMITIVE,object,0))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetTag(target, ENCODE_TAG(TAG_TYPE_PRIMITIVE,object,0))))
       return JNI_ERR;
-    if(!NSK_JVMTI_VERIFY(jvmti->SetTag(targetClass, ENCODE_TAG(TAG_TYPE_PRIMITIVE,object,0))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetTag(targetClass, ENCODE_TAG(TAG_TYPE_PRIMITIVE,object,0))))
       return JNI_ERR;
 
     NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)targetFields));
@@ -459,8 +459,8 @@
 void release_object_info(jvmtiEnv *jvmti, JNIEnv *jni) {
   int object;
   int field;
-  for(object = 0; object < TEST_OBJECTS_COUNT; object++) {
-    for(field = 0; field < objects_info[object].fields_count; field++) {
+  for (object = 0; object < TEST_OBJECTS_COUNT; object++) {
+    for (field = 0; field < objects_info[object].fields_count; field++) {
       jvmti->Deallocate((unsigned char*)objects_info[object].fields[field].name);
       jvmti->Deallocate((unsigned char*)objects_info[object].fields[field].signature);
     }
@@ -473,15 +473,15 @@
 void verify_objects() {
   int object;
   int field;
-  for(object = 0; object < TEST_OBJECTS_COUNT; object++) {
-    for(field = 0; field < objects_info[object].fields_count; field++) {
+  for (object = 0; object < TEST_OBJECTS_COUNT; object++) {
+    for (field = 0; field < objects_info[object].fields_count; field++) {
       // If primitive field of object that was not collected or
       // non primitive field that was not collected was not found
       // expected amount of times, than test failed.
-      if((objects_info[object].fields[field].primitive && !objects_info[object].collected)
-         || !objects_info[object].fields[field].collected) {
+      if ((objects_info[object].fields[field].primitive && !objects_info[object].collected)
+          || !objects_info[object].fields[field].collected) {
         int expected = 0;
-        switch(get_tag_type(objects_info[object].fields[field].signature)) {
+        switch (get_tag_type(objects_info[object].fields[field].signature)) {
         case TAG_TYPE_STRING:
           expected = STRING_OCCURANCE_COUNT;
           break;
@@ -495,7 +495,7 @@
           expected = NONPRIMITIVE_OCCURANCE_COUNT;
           break;
         }
-        if(expected != objects_info[object].fields[field].found) {
+        if (expected != objects_info[object].fields[field].found) {
           NSK_COMPLAIN4("Field %s::%s expected to be found %d times, "
                         "but it was found %d times.\n",
                         objects_info[object].name,
@@ -515,15 +515,15 @@
   jvmtiHeapCallbacks primitive_callbacks;
 
   NSK_DISPLAY0("Waiting debugee.\n");
-  if(!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) {
+  if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) {
     return;
   }
-  if(!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) {
+  if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) {
     return;
   }
 
   NSK_DISPLAY0("Tagging fields.\n");
-  if(!NSK_VERIFY(JNI_OK==tag_objects(jvmti, jni))) {
+  if (!NSK_VERIFY(JNI_OK==tag_objects(jvmti, jni))) {
     return;
   }
 
@@ -534,7 +534,7 @@
   primitive_callbacks.heap_iteration_callback = &heap_callback;
 
   NSK_DISPLAY0("Iterating over reachable objects.\n");
-  if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, NULL, &primitive_callbacks, NULL))) {
+  if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, NULL, &primitive_callbacks, NULL))) {
     nsk_jvmti_setFailStatus();
     return;
   }
@@ -542,16 +542,16 @@
   NSK_DISPLAY0("Verifying that all filds were found.\n");
   verify_objects();
 
-  if(!NSK_VERIFY(nsk_jvmti_resumeSync())) {
+  if (!NSK_VERIFY(nsk_jvmti_resumeSync())) {
     return;
   }
 
-  if(!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) {
+  if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) {
     return;
   }
 
   NSK_DISPLAY0("Iterating over unreachable objects.\n");
-  if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, NULL, &primitive_callbacks, NULL))) {
+  if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, NULL, &primitive_callbacks, NULL))) {
     nsk_jvmti_setFailStatus();
     return;
   }
@@ -559,13 +559,13 @@
   NSK_DISPLAY0("Verifying that all filds were found.\n");
   verify_objects();
 
-  if(!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) {
+  if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) {
     return;
   }
 
   release_object_info(jvmti, jni);
 
-  if(!NSK_VERIFY(nsk_jvmti_resumeSync()))
+  if (!NSK_VERIFY(nsk_jvmti_resumeSync()))
     return;
 }
 
@@ -598,13 +598,13 @@
   caps.can_tag_objects = 1;
   caps.can_generate_object_free_events = 1;
 
-  if(!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
+  if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
     return JNI_ERR;
   }
 
   memset(&event_callbacks, 0, sizeof(jvmtiEventCallbacks));
   event_callbacks.ObjectFree = &object_free_callback;
-  if(!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&event_callbacks, sizeof(jvmtiEventCallbacks)))) {
+  if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&event_callbacks, sizeof(jvmtiEventCallbacks)))) {
     return JNI_ERR;
   }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/concrete-klass-filter/ConcreteKlassFilter.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/concrete-klass-filter/ConcreteKlassFilter.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -56,7 +56,7 @@
                             jvmtiPrimitiveType value_type,
                             void* user_data) {
   //only field of our test object are expected
-  if(*object_tag_ptr != TEST_OBJECT_TAG) {
+  if (*object_tag_ptr != TEST_OBJECT_TAG) {
     NSK_COMPLAIN2("jvmtiPrimitiveFieldCallback was invoked for primitive "
                   "field with unexpected class tag 0x%lX and object tag 0x%lX.\n",
                   object_class_tag, *object_tag_ptr);
@@ -64,13 +64,13 @@
     return 0;
   }
   //expected field is long
-  if(value_type != JVMTI_PRIMITIVE_TYPE_LONG) {
+  if (value_type != JVMTI_PRIMITIVE_TYPE_LONG) {
     NSK_COMPLAIN0("jvmtiPrimitiveFieldCallback was invoked for non-long field.\n");
     nsk_jvmti_setFailStatus();
     return 0;
   }
   //check value
-  if(value.j != EXPECTED_PRIMITIVE_VALUE) {
+  if (value.j != EXPECTED_PRIMITIVE_VALUE) {
     NSK_COMPLAIN0("Unexpected value was passed to jvmtiPrimitiveFieldCallback.\n");
     NSK_COMPLAIN1("Expected value: 0x%lX.\n", EXPECTED_PRIMITIVE_VALUE);
     NSK_COMPLAIN1("Passed value: 0x%lX.\n", value.j);
@@ -114,7 +114,7 @@
                            jint length,
                            void* user_data) {
   //test object have to be reported by this callback
-  if(*tag_ptr != TEST_OBJECT_TAG) {
+  if (*tag_ptr != TEST_OBJECT_TAG) {
     NSK_COMPLAIN2("Object with unexpected class tag 0x%lX and object tag 0x%lX "
                   "was passed to jvmtiHeapIterationCallback.\n", class_tag, *tag_ptr);
     nsk_jvmti_setFailStatus();
@@ -123,7 +123,7 @@
 
   non_primitive_reported++;
 
-  if(non_primitive_reported>EXPECTED_NON_PRIMITIVES_COUNT) {
+  if (non_primitive_reported>EXPECTED_NON_PRIMITIVES_COUNT) {
     NSK_COMPLAIN1("Test object was reported more than %d times.\n",
                   EXPECTED_NON_PRIMITIVES_COUNT);
     nsk_jvmti_setFailStatus();
@@ -134,7 +134,7 @@
 
 JNIEXPORT void JNICALL
 object_free_callback(jvmtiEnv* jvmti, jlong tag) {
-  if(tag != TEST_OBJECT_TAG) {
+  if (tag != TEST_OBJECT_TAG) {
     NSK_COMPLAIN1("object free callback was invoked for an object with "
                   "unexpected tag 0x%lX.\n",tag);
     nsk_jvmti_setFailStatus();
@@ -152,22 +152,22 @@
   jobject testObject;
   jclass testObjectClass;
 
-  if(!NSK_VERIFY(NULL != (debugee = jni->FindClass(className))))
+  if (!NSK_VERIFY(NULL != (debugee = jni->FindClass(className))))
     return JNI_ERR;
 
-  if(!NSK_VERIFY(NULL != (testObjectField = jni->GetStaticFieldID(debugee, fieldName, fieldSig))))
+  if (!NSK_VERIFY(NULL != (testObjectField = jni->GetStaticFieldID(debugee, fieldName, fieldSig))))
     return JNI_ERR;
 
-  if(!NSK_VERIFY(NULL != (testObject = (jni->GetStaticObjectField(debugee, testObjectField)))))
+  if (!NSK_VERIFY(NULL != (testObject = (jni->GetStaticObjectField(debugee, testObjectField)))))
     return JNI_ERR;
 
-  if(!NSK_VERIFY(NULL != (testObjectClass = (jni->GetObjectClass(testObject)))))
+  if (!NSK_VERIFY(NULL != (testObjectClass = (jni->GetObjectClass(testObject)))))
     return JNI_ERR;
 
   // tag class and it's instance to pass this tag into primitive field callback
-  if(!NSK_JVMTI_VERIFY(jvmti->SetTag(testObject, TEST_OBJECT_TAG)))
+  if (!NSK_JVMTI_VERIFY(jvmti->SetTag(testObject, TEST_OBJECT_TAG)))
     return JNI_ERR;
-  if(!NSK_JVMTI_VERIFY(jvmti->SetTag(testObjectClass, TEST_OBJECT_TAG)))
+  if (!NSK_JVMTI_VERIFY(jvmti->SetTag(testObjectClass, TEST_OBJECT_TAG)))
     return JNI_ERR;
 
   jni->DeleteLocalRef(testObjectClass);
@@ -178,8 +178,8 @@
 
 void verify_objects() {
   //if test object was not unloaded then it's field expected to be found once.
-  if(object_unloaded) return;
-  if(field_found == 0) {
+  if (object_unloaded) return;
+  if (field_found == 0) {
     NSK_COMPLAIN0("TestClass instance field was not found.\n");
     nsk_jvmti_setFailStatus();
   } if (field_found > 1) {
@@ -197,22 +197,22 @@
   jvmtiHeapCallbacks primitive_callbacks;
   jclass klass;
 
-  if(!NSK_VERIFY(NULL != (klass = jni->FindClass(testClassName)))) {
+  if (!NSK_VERIFY(NULL != (klass = jni->FindClass(testClassName)))) {
     NSK_COMPLAIN1("Can't find class %s.\n",testClassName);
     nsk_jvmti_setFailStatus();
     return;
   }
 
   NSK_DISPLAY0("Waiting debugee.\n");
-  if(!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) {
+  if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) {
     return;
   }
-  if(!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) {
+  if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) {
     return;
   }
 
   NSK_DISPLAY0("Tagging fields.\n");
-  if(!NSK_VERIFY(JNI_OK==tag_objects(jvmti, jni))) {
+  if (!NSK_VERIFY(JNI_OK==tag_objects(jvmti, jni))) {
     return;
   }
 
@@ -223,7 +223,7 @@
   primitive_callbacks.heap_iteration_callback = &heap_callback;
 
   NSK_DISPLAY0("Iterating over reachable objects.\n");
-  if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, NULL))) {
+  if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, NULL))) {
     nsk_jvmti_setFailStatus();
     return;
   }
@@ -231,16 +231,16 @@
   NSK_DISPLAY0("Verifying that all filds were found.\n");
   verify_objects();
 
-  if(!NSK_VERIFY(nsk_jvmti_resumeSync())) {
+  if (!NSK_VERIFY(nsk_jvmti_resumeSync())) {
     return;
   }
 
-  if(!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) {
+  if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) {
     return;
   }
 
   NSK_DISPLAY0("Iterating over unreachable objects.\n");
-  if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, NULL))) {
+  if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, NULL))) {
     nsk_jvmti_setFailStatus();
     return;
   }
@@ -248,7 +248,7 @@
   NSK_DISPLAY0("Verifying that all filds were found.\n");
   verify_objects();
 
-  if(!NSK_VERIFY(nsk_jvmti_resumeSync()))
+  if (!NSK_VERIFY(nsk_jvmti_resumeSync()))
     return;
 }
 
@@ -281,13 +281,13 @@
   caps.can_tag_objects = 1;
   caps.can_generate_object_free_events = 1;
 
-  if(!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
+  if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
     return JNI_ERR;
   }
 
   memset(&event_callbacks, 0, sizeof(jvmtiEventCallbacks));
   event_callbacks.ObjectFree = &object_free_callback;
-  if(!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&event_callbacks, sizeof(jvmtiEventCallbacks)))) {
+  if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&event_callbacks, sizeof(jvmtiEventCallbacks)))) {
     return JNI_ERR;
   }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -108,21 +108,21 @@
 
 // Check if the signature is signature of primitive type.
 jboolean is_primitive_type(const char *signature) {
-  if(!strcmp(signature,"C")
-     || !strcmp(signature, "B")
-     || !strcmp(signature, "S")
-     || !strcmp(signature, "I")
-     || !strcmp(signature, "J")
-     || !strcmp(signature, "F")
-     || !strcmp(signature, "D")
-     || !strcmp(signature, "Z"))
+  if (!strcmp(signature,"C")
+      || !strcmp(signature, "B")
+      || !strcmp(signature, "S")
+      || !strcmp(signature, "I")
+      || !strcmp(signature, "J")
+      || !strcmp(signature, "F")
+      || !strcmp(signature, "D")
+      || !strcmp(signature, "Z"))
     return JNI_TRUE;
   return JNI_FALSE;
 }
 
 //check tag values accoring to heap filter choosed for test
 jboolean verify_tag(jlong class_tag, jlong object_tag) {
-  switch(filter_type) {
+  switch (filter_type) {
   case JVMTI_HEAP_FILTER_TAGGED:
     return object_tag == 0;
   case JVMTI_HEAP_FILTER_UNTAGGED:
@@ -138,7 +138,7 @@
 
 //check whether or not field expected to be reported
 jboolean occurance_expected(int tagged, int is_static, int is_primitive) {
-  switch(filter_type) {
+  switch (filter_type) {
   case JVMTI_HEAP_FILTER_TAGGED:
     return !tagged;
   case JVMTI_HEAP_FILTER_UNTAGGED:
@@ -167,11 +167,11 @@
 
   //iterate over all fields found during tagging and compare reported value
   //with their values.
-  if(value_type != JVMTI_PRIMITIVE_TYPE_INT)
+  if (value_type != JVMTI_PRIMITIVE_TYPE_INT)
     return 0;
-  for(object = 0; object < TEST_OBJECTS_COUNT; object++) {
-    for(field = 0; field < objects_info[object].fields_count; field++) {
-      if(objects_info[object].fields[field].type == TYPE_FIELD &&
+  for (object = 0; object < TEST_OBJECTS_COUNT; object++) {
+    for (field = 0; field < objects_info[object].fields_count; field++) {
+      if (objects_info[object].fields[field].type == TYPE_FIELD &&
          *(jint*)(objects_info[object].fields[field].value) == value.i) {
         objects_info[object].fields[field].found++;
       }
@@ -191,17 +191,17 @@
   if (!NSK_VERIFY(verify_tag(class_tag, *tag_ptr))) {
     nsk_jvmti_setFailStatus();
   }
-  for(object = 0; object < TEST_OBJECTS_COUNT; object++) {
-    for(field = 0; field < objects_info[object].fields_count; field++) {
-      if(objects_info[object].fields[field].type == TYPE_STRING &&
+  for (object = 0; object < TEST_OBJECTS_COUNT; object++) {
+    for (field = 0; field < objects_info[object].fields_count; field++) {
+      if (objects_info[object].fields[field].type == TYPE_STRING &&
          value_length == objects_info[object].fields[field].size) {
         int matched = 1;
         int i;
         wchar_t *str = (wchar_t*)objects_info[object].fields[field].value;
-        for(i = 0; i < value_length && matched; i++) {
+        for (i = 0; i < value_length && matched; i++) {
           matched = (str[i] == value[i]);
         }
-        if(matched)
+        if (matched)
           objects_info[object].fields[field].found++;
       }
     }
@@ -222,17 +222,17 @@
   if (!NSK_VERIFY(verify_tag(class_tag, *tag_ptr))) {
     nsk_jvmti_setFailStatus();
   }
-  for(object = 0; object < TEST_OBJECTS_COUNT; object++) {
-    for(field = 0; field < objects_info[object].fields_count; field++) {
-      if(objects_info[object].fields[field].type == TYPE_ARRAY &&
+  for (object = 0; object < TEST_OBJECTS_COUNT; object++) {
+    for (field = 0; field < objects_info[object].fields_count; field++) {
+      if (objects_info[object].fields[field].type == TYPE_ARRAY &&
          element_count == objects_info[object].fields[field].size) {
         int matched = 1;
         int i;
-        for(i = 0; i < element_count && matched; i++) {
+        for (i = 0; i < element_count && matched; i++) {
           matched = ((jint*)objects_info[object].fields[field].value)[i]==
             ((jint*)elements)[i];
         }
-        if(matched)
+        if (matched)
           objects_info[object].fields[field].found++;
       }
     }
@@ -257,18 +257,18 @@
 
 JNIEXPORT void JNICALL
 object_free_callback(jvmtiEnv* jvmti, jlong tag) {
-  if(DECODE_TYPE(tag) == OBJECT_TAG) {
+  if (DECODE_TYPE(tag) == OBJECT_TAG) {
     objects_info[DECODE_OBJECT(tag)].collected = 1;
-  } else if(DECODE_TYPE(tag) == FIELD_TAG) {
+  } else if (DECODE_TYPE(tag) == FIELD_TAG) {
     objects_info[DECODE_OBJECT(tag)].fields[DECODE_FIELD(tag)].collected = 1;
   }
 }
 
 //set expected fields value according to it's type
 void set_expected_value(field_info_t *field, int tagged, int is_static) {
-  if(field->primitive) {
+  if (field->primitive) {
     field->size = (int) sizeof(jint);
-    if(is_static) {
+    if (is_static) {
       field->value = (void*)(tagged ? &TAGGED_STATIC_INT_VALUE:
                              &UNTAGGED_STATIC_INT_VALUE);
     } else {
@@ -299,18 +299,18 @@
   jobjectArray testObjects;
   int object;
 
-  if(!NSK_VERIFY(NULL != (debugee = jni->FindClass(className))))
+  if (!NSK_VERIFY(NULL != (debugee = jni->FindClass(className))))
     return JNI_ERR;
 
-  if(!NSK_VERIFY(NULL != (testObjectsField = jni->GetStaticFieldID(debugee, fieldName, fieldSig))))
+  if (!NSK_VERIFY(NULL != (testObjectsField = jni->GetStaticFieldID(debugee, fieldName, fieldSig))))
     return JNI_ERR;
 
-  if(!NSK_VERIFY(NULL != (testObjects = (jobjectArray)(jni->GetStaticObjectField(
+  if (!NSK_VERIFY(NULL != (testObjects = (jobjectArray)(jni->GetStaticObjectField(
           debugee, testObjectsField)))))
     return JNI_ERR;
 
   // For each of test objects tag every field
-  for(object = 0; object<TEST_OBJECTS_COUNT; object++) {
+  for (object = 0; object<TEST_OBJECTS_COUNT; object++) {
     jobject target;
     jclass targetClass;
     jfieldID *targetFields;
@@ -318,58 +318,58 @@
     int tagged = object == 0;
 
     memset(&objects_info[object],0,sizeof(object_info_t));
-    if(!NSK_VERIFY(NULL != (target = jni->GetObjectArrayElement(testObjects, object))))
+    if (!NSK_VERIFY(NULL != (target = jni->GetObjectArrayElement(testObjects, object))))
       return JNI_ERR;
 
-    if(!NSK_VERIFY(NULL != (targetClass = jni->GetObjectClass(target))))
+    if (!NSK_VERIFY(NULL != (targetClass = jni->GetObjectClass(target))))
       return JNI_ERR;
 
-    if(!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(targetClass, &(objects_info[object].name), NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(targetClass, &(objects_info[object].name), NULL)))
       return JNI_ERR;
 
-    if(!NSK_JVMTI_VERIFY(jvmti->GetClassFields(
+    if (!NSK_JVMTI_VERIFY(jvmti->GetClassFields(
             targetClass, &(objects_info[object].fields_count), &targetFields)))
       return JNI_ERR;
 
     objects_info[object].fields = (field_info_t*)calloc(objects_info[object].fields_count,sizeof(field_info_t));
 
     // Iterate over fields, collect info about it and tag non primitive fields.
-    for(field = 0; field < objects_info[object].fields_count; field++) {
+    for (field = 0; field < objects_info[object].fields_count; field++) {
       jint modifiers;
       int is_static = 0;
       int is_primitive = 0;
-      if(!NSK_JVMTI_VERIFY(jvmti->GetFieldName(targetClass,
-                                               targetFields[field],
-                                               &objects_info[object].fields[field].name,
-                                               &objects_info[object].fields[field].signature,
-                                               NULL)))
+      if (!NSK_JVMTI_VERIFY(jvmti->GetFieldName(targetClass,
+                                                targetFields[field],
+                                                &objects_info[object].fields[field].name,
+                                                &objects_info[object].fields[field].signature,
+                                                NULL)))
         return JNI_ERR;
-      if(!NSK_JVMTI_VERIFY(jvmti->GetFieldModifiers(
+      if (!NSK_JVMTI_VERIFY(jvmti->GetFieldModifiers(
               targetClass, targetFields[field], &modifiers))) {
         return JNI_ERR;
       }
       is_static = (modifiers & STATIC_FIELD) == STATIC_FIELD;
-      if(is_primitive_type(objects_info[object].fields[field].signature)) {
+      if (is_primitive_type(objects_info[object].fields[field].signature)) {
         objects_info[object].fields[field].primitive = 1;
         is_primitive = 1;
       } else {
         jobject value;
-        if(!NSK_JVMTI_VERIFY(jvmti->GetFieldModifiers(
+        if (!NSK_JVMTI_VERIFY(jvmti->GetFieldModifiers(
                 targetClass, targetFields[field], &modifiers))) {
           return JNI_ERR;
         }
-        if(is_static) {
-          if(!NSK_VERIFY(NULL != (value = jni->GetStaticObjectField(
+        if (is_static) {
+          if (!NSK_VERIFY(NULL != (value = jni->GetStaticObjectField(
                   targetClass, targetFields[field])))) {
             return JNI_ERR;
           }
         } else {
-          if(!NSK_VERIFY(NULL != (value = jni->GetObjectField(target, targetFields[field])))) {
+          if (!NSK_VERIFY(NULL != (value = jni->GetObjectField(target, targetFields[field])))) {
             return JNI_ERR;
           }
         }
-        if(tagged) {
-          if(!NSK_JVMTI_VERIFY(jvmti->SetTag(value, ENCODE_TAG(FIELD_TAG,object,field)))) {
+        if (tagged) {
+          if (!NSK_JVMTI_VERIFY(jvmti->SetTag(value, ENCODE_TAG(FIELD_TAG,object,field)))) {
             return JNI_ERR;
           }
         }
@@ -384,10 +384,10 @@
     }
 
     // tag class and it's instance to pass this tag into primitive field callback
-    if(tagged) {
-      if(!NSK_JVMTI_VERIFY(jvmti->SetTag(target, ENCODE_TAG(OBJECT_TAG,object,0))))
+    if (tagged) {
+      if (!NSK_JVMTI_VERIFY(jvmti->SetTag(target, ENCODE_TAG(OBJECT_TAG,object,0))))
         return JNI_ERR;
-      if(!NSK_JVMTI_VERIFY(jvmti->SetTag(targetClass, ENCODE_TAG(CLASS_TAG,object,0))))
+      if (!NSK_JVMTI_VERIFY(jvmti->SetTag(targetClass, ENCODE_TAG(CLASS_TAG,object,0))))
         return JNI_ERR;
     }
 
@@ -406,8 +406,8 @@
 void release_object_info(jvmtiEnv *jvmti, JNIEnv *jni) {
   int object;
   int field;
-  for(object = 0; object < TEST_OBJECTS_COUNT; object++) {
-    for(field = 0; field < objects_info[object].fields_count; field++) {
+  for (object = 0; object < TEST_OBJECTS_COUNT; object++) {
+    for (field = 0; field < objects_info[object].fields_count; field++) {
       jvmti->Deallocate((unsigned char*)objects_info[object].fields[field].name);
       jvmti->Deallocate((unsigned char*)objects_info[object].fields[field].signature);
     }
@@ -420,18 +420,18 @@
 void verify_objects(int reachable) {
   int object;
   int field;
-  for(object = 0; object < (reachable?TEST_OBJECTS_COUNT:TAGGED_OBJECTS); object++) {
-    for(field = 0; field < objects_info[object].fields_count; field++) {
+  for (object = 0; object < (reachable?TEST_OBJECTS_COUNT:TAGGED_OBJECTS); object++) {
+    for (field = 0; field < objects_info[object].fields_count; field++) {
       // If primitive field of object that was not collected or
       // non primitive field that was not collected was not found
       // expected amount of times, than test failed.
-      if((objects_info[object].fields[field].primitive &&
-          !objects_info[object].collected)
-         ||
-         (!objects_info[object].fields[field].primitive &&
-          !objects_info[object].fields[field].collected)) {
-        if(objects_info[object].fields[field].expected !=
-           objects_info[object].fields[field].found) {
+      if ((objects_info[object].fields[field].primitive &&
+           !objects_info[object].collected)
+          ||
+          (!objects_info[object].fields[field].primitive &&
+           !objects_info[object].fields[field].collected)) {
+        if (objects_info[object].fields[field].expected !=
+            objects_info[object].fields[field].found) {
           NSK_COMPLAIN4("Field %s::%s expected to be found %d times, "
                         "but it was found %d times.\n",
                         objects_info[object].name,
@@ -453,15 +453,15 @@
   jvmtiEventCallbacks event_callbacks;
 
   NSK_DISPLAY0("Waiting debugee.\n");
-  if(!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) {
+  if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) {
     return;
   }
-  if(!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) {
+  if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) {
     return;
   }
 
   NSK_DISPLAY0("Tagging fields.\n");
-  if(!NSK_VERIFY(JNI_OK==tag_objects(jvmti, jni))) {
+  if (!NSK_VERIFY(JNI_OK==tag_objects(jvmti, jni))) {
     return;
   }
 
@@ -472,7 +472,7 @@
   primitive_callbacks.heap_iteration_callback = &heap_callback;
 
   NSK_DISPLAY0("Iterating over reachable objects.\n");
-  if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(filter_type, NULL, &primitive_callbacks, NULL))) {
+  if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(filter_type, NULL, &primitive_callbacks, NULL))) {
     nsk_jvmti_setFailStatus();
     return;
   }
@@ -480,16 +480,16 @@
   NSK_DISPLAY0("Verifying that all fields were found.\n");
   verify_objects(1);
 
-  if(!NSK_VERIFY(nsk_jvmti_resumeSync())) {
+  if (!NSK_VERIFY(nsk_jvmti_resumeSync())) {
     return;
   }
 
-  if(!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) {
+  if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) {
     return;
   }
 
   NSK_DISPLAY0("Iterating over unreachable objects.\n");
-  if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(filter_type, NULL, &primitive_callbacks, NULL))) {
+  if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(filter_type, NULL, &primitive_callbacks, NULL))) {
     nsk_jvmti_setFailStatus();
     return;
   }
@@ -502,13 +502,13 @@
    * since it will free some memory that the callback will access.
    */
   memset(&event_callbacks, 0, sizeof(jvmtiEventCallbacks));
-  if(!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&event_callbacks, sizeof(jvmtiEventCallbacks)))) {
+  if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&event_callbacks, sizeof(jvmtiEventCallbacks)))) {
     return;
   }
 
   release_object_info(jvmti, jni);
 
-  if(!NSK_VERIFY(nsk_jvmti_resumeSync()))
+  if (!NSK_VERIFY(nsk_jvmti_resumeSync()))
     return;
 }
 
@@ -537,14 +537,14 @@
   nsk_jvmti_parseOptions(options);
 
   type = nsk_jvmti_findOptionValue("filter");
-  if(type != NULL) {
-    if(0 == strcmp(type, "JVMTI_HEAP_FILTER_TAGGED")) {
+  if (type != NULL) {
+    if (0 == strcmp(type, "JVMTI_HEAP_FILTER_TAGGED")) {
       filter_type = JVMTI_HEAP_FILTER_TAGGED;
-    } else if(0 == strcmp(type, "JVMTI_HEAP_FILTER_UNTAGGED")) {
+    } else if (0 == strcmp(type, "JVMTI_HEAP_FILTER_UNTAGGED")) {
       filter_type = JVMTI_HEAP_FILTER_UNTAGGED;
-    } else if(0 == strcmp(type, "JVMTI_HEAP_FILTER_CLASS_TAGGED")) {
+    } else if (0 == strcmp(type, "JVMTI_HEAP_FILTER_CLASS_TAGGED")) {
       filter_type = JVMTI_HEAP_FILTER_CLASS_TAGGED;
-    } else if(0 == strcmp(type, "JVMTI_HEAP_FILTER_CLASS_UNTAGGED")) {
+    } else if (0 == strcmp(type, "JVMTI_HEAP_FILTER_CLASS_UNTAGGED")) {
       filter_type = JVMTI_HEAP_FILTER_CLASS_UNTAGGED;
     } else {
       NSK_COMPLAIN1("unknown filter value '%s'.\n",type);
@@ -561,13 +561,13 @@
   caps.can_tag_objects = 1;
   caps.can_generate_object_free_events = 1;
 
-  if(!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
+  if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
     return JNI_ERR;
   }
 
   memset(&event_callbacks, 0, sizeof(jvmtiEventCallbacks));
   event_callbacks.ObjectFree = &object_free_callback;
-  if(!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&event_callbacks, sizeof(jvmtiEventCallbacks)))) {
+  if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&event_callbacks, sizeof(jvmtiEventCallbacks)))) {
     return JNI_ERR;
   }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/non-concrete-klass-filter/NonConcreteKlassFilter.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/non-concrete-klass-filter/NonConcreteKlassFilter.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -62,7 +62,7 @@
                             jvmtiPrimitiveType value_type,
                             void* user_data) {
   //nothing should be reported in ZERO_INVOCATIONS_PHASE
-  if(phase == ZERO_INVOCATIONS_PHASE) {
+  if (phase == ZERO_INVOCATIONS_PHASE) {
     NSK_COMPLAIN2("jvmtiPrimitiveFieldCallback was invoked for a field with "
                   "class tag 0x%lX and object tag 0x%lX during iteration with "
                   "interface or abstract class as a filter.\n",
@@ -70,10 +70,10 @@
     nsk_jvmti_setFailStatus();
   } else {
     int i;
-    if(value_type != JVMTI_PRIMITIVE_TYPE_LONG)
+    if (value_type != JVMTI_PRIMITIVE_TYPE_LONG)
       return 0;
 
-    if(IS_FIELD_UNEXPECTED(value.j)) {
+    if (IS_FIELD_UNEXPECTED(value.j)) {
       NSK_COMPLAIN3("Unexpected value 0x%lX was repotrted by "
                     "jvmtiPrimitiveFieldCallback for an object with "
                     "class tag 0x%lX and object tag 0x%lX.\n",
@@ -83,8 +83,8 @@
     }
 
     //find reported field in expected values
-    for(i = 0; i < EXPECTED_PRIMITIVES; i++) {
-      if(expected_values[i] == value.j)
+    for (i = 0; i < EXPECTED_PRIMITIVES; i++) {
+      if (expected_values[i] == value.j)
         occurancies[i]++;
     }
 
@@ -123,7 +123,7 @@
                            jint length,
                            void* user_data) {
   //nothing should be reported in ZERO_INVOCATIONS_PHASE
-  if(phase == ZERO_INVOCATIONS_PHASE) {
+  if (phase == ZERO_INVOCATIONS_PHASE) {
     NSK_COMPLAIN2("jvmtiHeapIterationCallback was invoked for an object with "
                   "class tag 0x%lX and object tag 0x%lX during iteration with "
                   "interface or abstract class as a klass-filter.\n",
@@ -141,10 +141,10 @@
   int i;
 
   NSK_DISPLAY0("Waiting debugee.\n");
-  if(!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) {
+  if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) {
     return;
   }
-  if(!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) {
+  if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) {
     return;
   }
 
@@ -155,14 +155,14 @@
   primitive_callbacks.heap_iteration_callback = &heap_callback;
 
   phase = ZERO_INVOCATIONS_PHASE;
-  for(i = 0; i < FILTER_COUNT; i++) {
-    if(!NSK_VERIFY(NULL != (klass = jni->FindClass(types[i])))) {
+  for (i = 0; i < FILTER_COUNT; i++) {
+    if (!NSK_VERIFY(NULL != (klass = jni->FindClass(types[i])))) {
       NSK_COMPLAIN1("Can't find class %s.\n",types[i]);
       nsk_jvmti_setFailStatus();
       return;
     }
     NSK_DISPLAY1("Iterating through heap with klass-filter '%s'.\n",types[i]);
-    if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, NULL))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, NULL))) {
       nsk_jvmti_setFailStatus();
       return;
     }
@@ -170,17 +170,17 @@
 
   phase = STATIC_FIELDS_FINDING_PHASE;
   NSK_DISPLAY0("Iterating through heap with klass-filter 'java/lang/Class'.\n");
-  if(!NSK_VERIFY(NULL != (klass = jni->FindClass("java/lang/Class")))) {
+  if (!NSK_VERIFY(NULL != (klass = jni->FindClass("java/lang/Class")))) {
     NSK_COMPLAIN0("Can't find class java/lang/Class.\n");
     nsk_jvmti_setFailStatus();
     return;
   }
-  if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, NULL))) {
+  if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, NULL))) {
     nsk_jvmti_setFailStatus();
     return;
   }
-  for(i = 0; i < EXPECTED_PRIMITIVES; i++) {
-    if(occurancies[i] != EXPECTED_OCCURANCE_COUNT) {
+  for (i = 0; i < EXPECTED_PRIMITIVES; i++) {
+    if (occurancies[i] != EXPECTED_OCCURANCE_COUNT) {
       NSK_COMPLAIN3("Primitive static field with value 0x%lX was reported "
                     "%d times while expected to be reported %d times.\n",
                     expected_values[i], occurancies[i], EXPECTED_OCCURANCE_COUNT);
@@ -188,7 +188,7 @@
     }
   }
 
-  if(!NSK_VERIFY(nsk_jvmti_resumeSync()))
+  if (!NSK_VERIFY(nsk_jvmti_resumeSync()))
     return;
 }
 
@@ -221,12 +221,12 @@
   caps.can_tag_objects = 1;
   caps.can_generate_object_free_events = 1;
 
-  if(!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
+  if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
     return JNI_ERR;
   }
 
   memset(&event_callbacks, 0, sizeof(jvmtiEventCallbacks));
-  if(!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&event_callbacks, sizeof(jvmtiEventCallbacks)))) {
+  if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&event_callbacks, sizeof(jvmtiEventCallbacks)))) {
     return JNI_ERR;
   }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe002/popframe002.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe002/popframe002.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -101,7 +101,7 @@
         tot_result = STATUS_FAILED;
     }
 
-    switch(t_case) {
+    switch (t_case) {
 /* NULL pointer to the thread in debug mode */
     case 1:
         printf("\nInvoke PopFrame() with NULL pointer to a thread...\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe005/popframe005.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe005/popframe005.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -124,7 +124,7 @@
                     , entry_name
                     , entry_sig
                     );
-        } while(0);
+        } while (0);
 
         if (failure) {
             NSK_COMPLAIN1("#### MethodExit event occurred (tid: %d) ####\n"
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe011/popframe011.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe011/popframe011.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -110,7 +110,7 @@
         return STATUS_FAILED;
     }
 
-    switch(t_case) {
+    switch (t_case) {
 /* NULL pointer to the thread in debug mode */
     case 1:
         printf("\nInvoke PopFrame() with NULL pointer to a thread...\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass006/redefclass006.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass006/redefclass006.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -100,7 +100,7 @@
         return PASSED;
     }
 
-    switch(t_case) {
+    switch (t_case) {
 /* NULL pointer to the jvmtiClassDefinition */
         case 0:
             break;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028/redefclass028.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028/redefclass028.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -179,7 +179,7 @@
             nsk_jvmti_resumeSync();
             exit(95 + PASSED);
         }
-    } while(fire == 0);
+    } while (fire == 0);
 
     NSK_DISPLAY0("agentProc: hotspot method compiled\n\n");
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029/redefclass029.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029/redefclass029.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -178,7 +178,7 @@
             nsk_jvmti_resumeSync();
             exit(95 + PASSED);
         }
-    } while(fire == 0);
+    } while (fire == 0);
 
     NSK_DISPLAY0("agentProc: hotspot method compiled\n\n");
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030/redefclass030.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030/redefclass030.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -179,7 +179,7 @@
             nsk_jvmti_resumeSync();
             exit(95 + PASSED);
         }
-    } while(fire == 0);
+    } while (fire == 0);
 
     NSK_DISPLAY0("agentProc: hotspot method compiled\n\n");
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform003/retransform003.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform003/retransform003.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -157,7 +157,7 @@
     if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
-    if(nsk_jvmti_findOptionIntValue("can_retransform_classes", 1)) {
+    if (nsk_jvmti_findOptionIntValue("can_retransform_classes", 1)) {
         caps.can_retransform_classes = 1;
     } else {
         caps.can_retransform_classes = 0;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -287,7 +287,7 @@
                     i+1);
                 result = STATUS_FAILED;
             }
-        } while(thrStarted[i] != 1);
+        } while (thrStarted[i] != 1);
         if (verbose)
             printf("\nthe waiting thread #%d started\n",
                 i+1);
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP11/ap11t001/ap11t001.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP11/ap11t001/ap11t001.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -121,7 +121,7 @@
             nsk_jvmti_setFailStatus();
             NSK_COMPLAIN1("VMObjectAlloc: event's thread was found in the list of live threads: %s\n\n", threadInfo.name);
         }
-    } while(0);
+    } while (0);
 
 
     /* Check that object_klass is loaded class
@@ -143,7 +143,7 @@
 
         if (classes != NULL)
             jvmti->Deallocate((unsigned char*)classes);
-    } while(0);
+    } while (0);
 
 
     /* Check for object_klass
@@ -172,7 +172,7 @@
             NSK_COMPLAIN2("VMObjectAlloc: inconsistent object size data\n\t"
                " size passed in to callback: %d\n\t size returned by GetObjectSize: %d\n\n", (long)size, (long)objSize);
         }
-    } while(0);
+    } while (0);
 
     if (signature != NULL)
         jvmti->Deallocate((unsigned char*)signature);
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/hs103t002.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/hs103t002.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -71,7 +71,7 @@
   nsk_printf("doRedefineInNativeThread\n");
   cla = jni->FindClass(SEARCH_NAME);
   nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char));
-  for(i = 0; i < 30; i++) {
+  for (i = 0; i < 30; i++) {
     nsk_printf(" Inside the redefine method..\n");
     if (nsk_jvmti_redefineClass(jvmti, cla,fileName) == NSK_TRUE) {
       nsk_printf("\nMyClass :: Successfully redefined..\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/hs104t002.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/hs104t002.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -48,7 +48,7 @@
     return JNI_VERSION_1_8;
 }
 #endif
-jint  Agent_Initialize(JavaVM *vm, char *options, void *reserved){
+jint  Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
     if (!NSK_VERIFY (JNI_OK == vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1))) {
         nsk_printf("#error Agent :: Could not load JVMTI interface.\n");
         return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/hs203t002.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/hs203t002.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -98,7 +98,7 @@
     nsk_printf(" %d..",redefineNumber);
     nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char));
 
-    if(nsk_jvmti_redefineClass(jvmti, threadClass,fileName) == NSK_TRUE) {
+    if (nsk_jvmti_redefineClass(jvmti, threadClass,fileName) == NSK_TRUE) {
         nsk_printf("Agent:: Redefined..\n");
     } else {
         nsk_printf(" Failed to redefine..\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t001/hs204t001.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t001/hs204t001.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -51,7 +51,7 @@
 char *getClassName(jvmtiEnv *jvmti, jclass  klass) {
     char * className;
     char * generic;
-    if(!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(klass, &className, &generic))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(klass, &className, &generic))) {
         nsk_jvmti_setFailStatus();
     }
     return className;
@@ -64,7 +64,7 @@
         jclass klass) {
     char * name;
     name = getClassName(jvmti_env,klass);
-    if((strcmp(name,CLASS_NAME) == 0) && (redefineNumber== 1)) {
+    if ((strcmp(name,CLASS_NAME) == 0) && (redefineNumber== 1)) {
        char fileName[512];
         nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName,
                         sizeof(fileName)/sizeof(char));
@@ -100,7 +100,7 @@
         } else {
             NSK_COMPLAIN0("\nMyClass :: Failed to redefine ..\n");
         }
-        if((myTestClass = (jclass) jni_env->NewGlobalRef(klass)) == NULL) {
+        if ((myTestClass = (jclass) jni_env->NewGlobalRef(klass)) == NULL) {
             NSK_COMPLAIN0("Failed to create global ref...");
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/hs204t002.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/hs204t002.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -54,7 +54,7 @@
     redefineNumber=0;
     jvmti->GetClassSignature(klass, &className, &generic);
     /* printf("Agent::Class Name %s \n",className); */
-    if((strcmp(className, CLASS_NAME) == 0)) {
+    if ((strcmp(className, CLASS_NAME) == 0)) {
         jclass cls;
         cls = jni->FindClass(SEARCH_NAME);
         if (cls == NULL) {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -55,7 +55,7 @@
         NSK_DISPLAY0(" Agent :: Failed get class signature.\n");
         nsk_jvmti_agentFailed();
     } else {
-        if((strcmp(className, CLASS_NAME) == 0)) {
+        if ((strcmp(className, CLASS_NAME) == 0)) {
             jfieldID fieldId;
             if (!NSK_JNI_VERIFY(jni, (fieldId = jni->GetStaticFieldID(klass, FIELDNAME, TYPE)) != NULL)) {
                     NSK_DISPLAY0(" Agent :: Failed to get FieldId.\n");
@@ -114,7 +114,7 @@
         NSK_DISPLAY0(" Agent :: Failed get class signature.\n");
         nsk_jvmti_agentFailed();
     } else {
-        if((strcmp(className, CLASS_NAME) == 0)) {
+        if ((strcmp(className, CLASS_NAME) == 0)) {
             jvmtiThreadInfo info;
             nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName,
                     sizeof(fileName)/sizeof(char));
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t002/ji03t002.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t002/ji03t002.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -145,7 +145,7 @@
             env->FatalError("cannot get field ID");
         }
 
-        switch(i) {
+        switch (i) {
         case 0:
             if (verbose)
                 printf("\ndoRedirect: overwriting the function CallStaticDoubleMethodV ...\n");
@@ -199,7 +199,7 @@
         if (verbose)
             printf("\ndoCall: calling %s JNI method for \"%s %s\"...\n",
                 msg, meth_info[i].m_name, meth_info[i].m_sign);
-        switch(i) {
+        switch (i) {
         case 0:
             dVal = env->CallStaticDoubleMethod(objCls, meth_info[i].mid, 73);
             break;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -186,7 +186,7 @@
     NSK_DISPLAY1("\nagent %s initializer: the JVMTI env obtained\n\tsetting event callbacks ...\n",
         (indx==0)?"A":"B");
     (void) memset(&callbacks, 0, sizeof(callbacks));
-    switch(indx) {
+    switch (indx) {
     case 0:
         callbacks.VMInit = &VMInitA;
         break;
@@ -240,7 +240,7 @@
                 (indx==0)?"A":"B", TRIES);
             exit(STATUS_FAILED);
         }
-    } while(thrstarted[indx] != 1);
+    } while (thrstarted[indx] != 1);
 
     NSK_DISPLAY1("\nstartAgent: the agent %s thread started\n",
         (indx==0)?"A":"B");
@@ -288,7 +288,7 @@
                 TRIES);
             exit(STATUS_FAILED);
         }
-    } while(redir[1] != 1);
+    } while (redir[1] != 1);
 
     /* check the interception set in another JVMTI env */
     NSK_DISPLAY0("\n>>> TEST CASE #4) First JVMTI env: checking the redirection set in second JVMTI env ...\n");
@@ -335,7 +335,7 @@
                 TRIES);
             exit(STATUS_FAILED);
         }
-    } while(redir[0] != 1);
+    } while (redir[0] != 1);
 
     /* check the interception set in another JVMTI env */
     NSK_DISPLAY0("\n>>> TEST CASE #2) Second JVMTI env: checking the redirection set in first JVMTI env ...\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -252,7 +252,7 @@
                 TRIES);
             env->FatalError("ownerThread: time exceed");
         }
-    } while(releaseMon != 1);
+    } while (releaseMon != 1);
 
     if (exitMonitor(env, "ownerThread") == STATUS_FAILED)
         THREAD_return(STATUS_FAILED);
@@ -344,7 +344,7 @@
                 TRIES);
             env->FatalError(" the monitor is still not entered by the owner thread");
         }
-    } while(monEntered != 1);
+    } while (monEntered != 1);
 
     for (i=0; i<MAX_THREADS-1; i++) {
         NSK_DISPLAY1("starting waiting thread #%d ...\n",
@@ -368,7 +368,7 @@
                     i+1);
                 exit(STATUS_FAILED);
             }
-        } while(thrStarted[i] != 1);
+        } while (thrStarted[i] != 1);
         NSK_DISPLAY1("the waiting thread #%d started\n",
             i+1);
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -65,7 +65,7 @@
     if (signature != NULL)
         jvmti_env->Deallocate((unsigned char*)signature);
 
-    switch(BreakpointEventsCount) {
+    switch (BreakpointEventsCount) {
     case 1:
         NSK_DISPLAY0("Testcase #1: FramePop in both agents\n");
         break;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001a.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001a.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -69,7 +69,7 @@
     if (signature != NULL)
         jvmti_env->Deallocate((unsigned char*)signature);
 
-    switch(MethodEntryEventsCount) {
+    switch (MethodEntryEventsCount) {
     case 1:
         NSK_DISPLAY0("Testcase #1: FramePop in both agents\n");
         if (!NSK_JVMTI_VERIFY(jvmti_env->NotifyFramePop(thread, 0)))
@@ -115,7 +115,7 @@
     if (signature != NULL)
         jvmti_env->Deallocate((unsigned char*)signature);
 
-    switch(MethodEntryEventsCount) {
+    switch (MethodEntryEventsCount) {
     case 1:
         /* It's ok */
         break;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/timers/JvmtiTest/JvmtiTest.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/timers/JvmtiTest/JvmtiTest.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -178,7 +178,7 @@
 static void print_timerinfo(jvmtiTimerInfo* timerInfo) {
   char buffer[32];
   const char* timerKind;
-  switch(timerInfo->kind) {
+  switch (timerInfo->kind) {
   case JVMTI_TIMER_USER_CPU:
     timerKind = "JVMTI_TIMER_USER_CPU";
     break;
--- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadController.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadController.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -441,7 +441,7 @@
         // while (!threadsGroupLocks.runnableCanExit.get()) {
         //        Thread.yield();
         //    }
-        while(flag==JNI_FALSE)
+        while (flag==JNI_FALSE)
         {
             GET_BOOL_FIELD(flag, threadsGroupLocks, ThreadsGroupLocks, "runnableCanExit");
             CALL_STATIC_VOID_NOPARAM(Thread, "yield");
@@ -476,7 +476,7 @@
      */
     JNIEXPORT jobject JNICALL
     Java_nsk_monitoring_share_ThreadController_getThreadState(JNIEnv *env,
-            jobject obj, jobject thread){
+            jobject obj, jobject thread) {
 
         JavaVM *vm;
         jvmtiEnv *jvmti;
@@ -486,18 +486,18 @@
         jstring stateName;
         jint state;
 
-        if(!NSK_VERIFY(
+        if (!NSK_VERIFY(
              env->GetJavaVM(&vm) == 0)) {
             return NULL;
         }
 
-        if(!NSK_VERIFY(
+        if (!NSK_VERIFY(
              vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1)
                     == JNI_OK)) {
             return NULL;
         }
 
-        if(!NSK_VERIFY(
+        if (!NSK_VERIFY(
              jvmti->GetThreadState((jthread)thread, &state)
              == JVMTI_ERROR_NONE)) {
             return NULL;
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/JVMTIagent.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/JVMTIagent.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -627,7 +627,7 @@
 
     NSK_TRACE(jni_env->DeleteGlobalRef(rasCls));
 
-    while(clsInfoCurr != NULL) {
+    while (clsInfoCurr != NULL) {
         class_info *_clsInfo = clsInfoCurr;
 
         if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) clsInfoCurr->clazzsig)))
@@ -659,7 +659,7 @@
         lock(jni_env);
         display(0, "#### JVMTIagent: findAndHotSwap: >>>>>>>> entered the raw monitor \"eventLock\" ####\n");
 
-        while(clsInfoCurr != NULL) {
+        while (clsInfoCurr != NULL) {
             if (hotswap == HOTSWAP_EVERY_METHOD_ENTRY_FOR_EVERY_CLASS ||
                     hotswap == HOTSWAP_EVERY_EXCEPTION_FOR_EVERY_CLASS) {
                 display(1, "\n#### JVMTIagent: findAndHotSwap: going to hotswap tested class \"%s\" during execution of class \"%s\" ...\n",
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -148,7 +148,7 @@
         return NULL;
     }
 
-    for(i = 0; i < options->size; i++) {
+    for (i = 0; i < options->size; i++) {
         if (strcmp(option, options->names[i]) == 0) {
             return options->values[i];
         }
@@ -167,7 +167,7 @@
         return NSK_FALSE;
     }
 
-    for(i = 0; i < options->size; i++) {
+    for (i = 0; i < options->size; i++) {
         if (strcmp(option, options->names[i]) == 0) {
             return NSK_TRUE;
         }
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/MonitorEnterExecutor.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/MonitorEnterExecutor.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -33,7 +33,7 @@
 
         success  = env->MonitorEnter(thisObject);
 
-        if(success != 0)
+        if (success != 0)
         {
                 NSK_COMPLAIN1("MonitorEnter return non-zero: %d\n", success);
 
@@ -44,7 +44,7 @@
 
         success  = env->MonitorExit(thisObject);
 
-        if(success != 0)
+        if (success != 0)
         {
                 NSK_COMPLAIN1("MonitorExit return non-zero: %d\n", success);
 
@@ -61,7 +61,7 @@
 
         success  = env->MonitorEnter(thisObject);
 
-        if(success != 0)
+        if (success != 0)
         {
                 NSK_COMPLAIN1("MonitorEnter return non-zero: %d\n", success);
 
@@ -72,7 +72,7 @@
 
         success  = env->MonitorExit(thisObject);
 
-        if(success != 0)
+        if (success != 0)
         {
                 NSK_COMPLAIN1("MonitorExit return non-zero: %d\n", success);
 
@@ -89,7 +89,7 @@
 
         success  = env->MonitorEnter(thisObject);
 
-        if(success != 0)
+        if (success != 0)
         {
                 NSK_COMPLAIN1("MonitorEnter return non-zero: %d\n", success);
 
@@ -100,7 +100,7 @@
 
         success  = env->MonitorExit(thisObject);
 
-        if(success != 0)
+        if (success != 0)
         {
                 NSK_COMPLAIN1("MonitorExit return non-zero: %d\n", success);
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/JNIreferences.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/JNIreferences.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -37,31 +37,31 @@
         jint i;
         jint result = -1;
 
-        if(globalReferences == NULL)
+        if (globalReferences == NULL)
         {
                 globalReferences = (jobject*)malloc(sizeof(jobject) * maxJNIGlobalReferences);
 
-                if(globalReferences == NULL)
+                if (globalReferences == NULL)
                 {
                         NSK_COMPLAIN0("malloc return NULL\n");
                         return -1;
                 }
 
-                for(i = 0; i < maxJNIGlobalReferences; i++)
+                for (i = 0; i < maxJNIGlobalReferences; i++)
                 {
                         globalReferences[i] = NULL;
                 }
         }
 
-        for(i = 0; i < maxJNIGlobalReferences; i++)
+        for (i = 0; i < maxJNIGlobalReferences; i++)
         {
                 jobject reference = globalReferences[i];
 
-                if(reference == NULL)
+                if (reference == NULL)
                 {
                         reference = env->NewGlobalRef(object);
 
-                        if(reference == NULL)
+                        if (reference == NULL)
                         {
                                 NSK_COMPLAIN0("NewGlobalRef return NULL\n");
 
@@ -87,7 +87,7 @@
 {
         jobject reference = globalReferences[index];
 
-        if(reference == NULL)
+        if (reference == NULL)
         {
                 NSK_COMPLAIN1("globalReferences[%d] = NULL, possible wrong index is passed\n", index);
 
@@ -109,7 +109,7 @@
         jobject reference = env->NewLocalRef(object);
         jclass klass;
 
-        if(reference == NULL)
+        if (reference == NULL)
         {
                 NSK_COMPLAIN0("NewLocalRef return NULL\n");
 
@@ -136,32 +136,32 @@
         jint i;
         jint result = -1;
 
-        if(weakReferences == NULL)
+        if (weakReferences == NULL)
         {
                 weakReferences = (jweak*)malloc(sizeof(jweak) * maxJNIWeakReferences);
 
-                if(weakReferences == NULL)
+                if (weakReferences == NULL)
                 {
                         NSK_COMPLAIN0("malloc return NULL\n");
 
                         return -1;
                 }
 
-                for(i = 0; i < maxJNIWeakReferences; i++)
+                for (i = 0; i < maxJNIWeakReferences; i++)
                 {
                         weakReferences[i] = NULL;
                 }
         }
 
-        for(i = 0; i < maxJNIWeakReferences; i++)
+        for (i = 0; i < maxJNIWeakReferences; i++)
         {
                 jobject reference = weakReferences[i];
 
-                if(reference == NULL)
+                if (reference == NULL)
                 {
                         reference = env->NewWeakGlobalRef(object);
 
-                        if(reference == NULL)
+                        if (reference == NULL)
                         {
                                 NSK_COMPLAIN0("NewWeakGlobalRef return NULL\n");
 
@@ -187,7 +187,7 @@
 {
         jweak reference = weakReferences[index];
 
-        if(reference == NULL)
+        if (reference == NULL)
         {
                 NSK_COMPLAIN1("weakReferences[%d] = NULL, possible wrong index is passed\n", index);
 
@@ -196,7 +196,7 @@
                     "Requested weakReferences[] element is NULL, possible wrong index is passed");
         }
 
-        if(env->IsSameObject(reference, NULL) == JNI_TRUE)
+        if (env->IsSameObject(reference, NULL) == JNI_TRUE)
         {
                 NSK_COMPLAIN0("TEST BUG: Weak reference was collected\n");
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/Injector.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/Injector.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -377,7 +377,7 @@
     static u2 calculateOffsetDelta(u2 frameNumber, u2 frameOffsetDelta) {
         u2 oldOffset;
         u2 newOffset;
-        if(frameNumber == 0) {
+        if (frameNumber == 0) {
             stackFrameOffset = frameOffsetDelta;
             return (u2) map[stackFrameOffset];
         } else {
@@ -392,10 +392,10 @@
         u2 i;
         u2 offset;
         u1 tag;
-        for(i=0; i<count; i++) {
+        for (i=0; i<count; i++) {
             tag = get_u1();
             put_u1(tag);
-            if(tag == ITEM_Object) {
+            if (tag == ITEM_Object) {
                 copy_u2();
             } else if (tag == ITEM_Uninitialized) {
                 copy_u2();
@@ -421,10 +421,10 @@
 
 
 
-        for(i=0; i<number_of_entries; i++) {
+        for (i=0; i<number_of_entries; i++) {
             frame_type = get_u1();
 
-            if(frame_type <= SAME_END) {
+            if (frame_type <= SAME_END) {
                 // same_frame {
                 //        u1 frame_type = SAME; /* 0-63 */
                 // }
@@ -432,7 +432,7 @@
                 put_u1(SAME_FRAME_EXTENDED);
                 put_u2(calculateOffsetDelta(i, (u2) frame_type));
 
-            } else if((frame_type >= SAME_LOCALS_1_STACK_ITEM_BEGIN) && (frame_type<=SAME_LOCALS_1_STACK_ITEM_END)) {
+            } else if ((frame_type >= SAME_LOCALS_1_STACK_ITEM_BEGIN) && (frame_type<=SAME_LOCALS_1_STACK_ITEM_END)) {
                 // same_locals_1_stack_item_frame {
                 //         u1 frame_type = SAME_LOCALS_1_STACK_ITEM;/* 64-127 */
                 //         verification_type_info stack[1];
@@ -443,7 +443,7 @@
                 copyVerificationTypeInfo(1);
 
                 // Tags in the range [128-246] are reserved for future use.
-            } else if(frame_type == SAME_LOCALS_1_STACK_ITEM_EXTENDED) {
+            } else if (frame_type == SAME_LOCALS_1_STACK_ITEM_EXTENDED) {
                 // same_locals_1_stack_item_frame_extended {
                 //     u1 frame_type = SAME_LOCALS_1_STACK_ITEM_EXTENDED; /* 247 */
                 //     u2 offset_delta;
@@ -455,7 +455,7 @@
                 put_u2(calculateOffsetDelta(i, frameOffsetDelta));
                 copyVerificationTypeInfo(1);
 
-            } else if((frame_type >= CHOP_BEGIN) && (frame_type <= CHOP_END)) {
+            } else if ((frame_type >= CHOP_BEGIN) && (frame_type <= CHOP_END)) {
                 // chop_frame {
                 //         u1 frame_type = CHOP; /* 248-250 */
                 //         u2 offset_delta;
@@ -464,7 +464,7 @@
                 frameOffsetDelta = get_u2();
                 put_u2(calculateOffsetDelta(i, frameOffsetDelta));
 
-            } else if(frame_type == SAME_FRAME_EXTENDED) {
+            } else if (frame_type == SAME_FRAME_EXTENDED) {
                 // same_frame_extended {
                 //     u1 frame_type = SAME_FRAME_EXTENDED; /* 251 */
                 //     u2 offset_delta;
@@ -474,7 +474,7 @@
                 frameOffsetDelta = get_u2();
                 put_u2(calculateOffsetDelta(i, frameOffsetDelta));
 
-            } else if((frame_type >= APPEND_BEGIN) && (frame_type <= APPEND_END)) {
+            } else if ((frame_type >= APPEND_BEGIN) && (frame_type <= APPEND_END)) {
                 // append_frame {
                 //     u1 frame_type = APPEND; /* 252-254 */
                 //     u2 offset_delta;
@@ -486,7 +486,7 @@
                 put_u2(calculateOffsetDelta(i, frameOffsetDelta));
                 copyVerificationTypeInfo((u1)(frame_type - 251));
 
-            } else if(frame_type == FULL_FRAME) {
+            } else if (frame_type == FULL_FRAME) {
                 // sfull_frame {
                 //    u1 frame_type = FULL_FRAME; /* 255 */
                 //    u2 offset_delta;
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/aod/jvmti_aod.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/aod/jvmti_aod.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -116,7 +116,7 @@
 
 int nsk_jvmti_aod_getThreadName(jvmtiEnv * jvmti, jthread thread, char threadNameBuffer[]) {
     jvmtiThreadInfo info;
-    if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(thread, &info))){
+    if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(thread, &info))) {
         NSK_COMPLAIN0("Failed to get thread info\n");
         threadNameBuffer[0] = '\0';
         return NSK_FALSE;
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -268,7 +268,7 @@
          * If this break is not there then It will expects
          * to have. so a space should be sufficient as well.
          */
-        for(val_len=0; !(*opt_end == '\0' || isOptSep(*opt_end)); opt_end++,val_len++) {
+        for (val_len=0; !(*opt_end == '\0' || isOptSep(*opt_end)); opt_end++,val_len++) {
             //if (*opt_end == NSK_JVMTI_OPTION_START) {
             //    break;
             //}
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/locks/JNIMonitorLocker.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/locks/JNIMonitorLocker.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -59,7 +59,7 @@
 
         success = env->MonitorEnter(thisObject);
 
-        if(success != 0)
+        if (success != 0)
         {
                 NSK_COMPLAIN1("MonitorEnter return non-zero: %d\n", success);
 
@@ -103,7 +103,7 @@
 
         success = env->MonitorExit(thisObject);
 
-        if(success != 0)
+        if (success != 0)
         {
                 NSK_COMPLAIN1("MonitorExit return non-zero: %d\n", success);
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/locks/LockingThread.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/locks/LockingThread.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -34,7 +34,7 @@
 
         success  = env->MonitorEnter(object);
 
-        if(success != 0)
+        if (success != 0)
         {
                 NSK_COMPLAIN1("MonitorEnter return non-zero: %d\n", success);
 
@@ -50,7 +50,7 @@
 
         success  = env->MonitorExit(object);
 
-        if(success != 0)
+        if (success != 0)
         {
                 NSK_COMPLAIN1("MonitorExit return non-zero: %d\n", success);
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/except/except002.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/except/except002.java	Wed Nov 14 04:59:57 2018 +0100
@@ -234,8 +234,8 @@
 
         // Check ClassNotFoundException (positive):
         try {
-            trash = Class.forName("nsk.stress.except.except002.except002$Abra$Cadabra"); //   correct - should pass
-//          trash = Class.forName("nsk.stress.except.except002.except002.Abra.Cadabra"); // incorrect - should fail
+            trash = Class.forName("nsk.stress.except.except002$Abra$Cadabra"); //   correct - should pass
+//          trash = Class.forName("nsk.stress.except.except002.Abra.Cadabra"); // incorrect - should fail
             if (TRACE_ON)
                 log[messages++] = "Success: ClassNotFoundException (positive)";
         } catch (ClassNotFoundException cnfe) {
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/except/except003.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/except/except003.java	Wed Nov 14 04:59:57 2018 +0100
@@ -235,8 +235,8 @@
 
         // Check ClassNotFoundException (negative):
         try {
-//          trash = Class.forName("nsk.stress.except.except003.except003$Abra$Cadabra"); //   correct - should pass
-            trash = Class.forName("nsk.stress.except.except003.except003.Abra.Cadabra"); // incorrect - should fail
+//          trash = Class.forName("nsk.stress.except.except003$Abra$Cadabra"); //   correct - should pass
+            trash = Class.forName("nsk.stress.except.except003.Abra.Cadabra"); // incorrect - should fail
             log[messages++] = "Failure: ClassNotFoundException (negative)";
             exitCode = 2;
         } catch (ClassNotFoundException cnfe) {
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/except/except011.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/except/except011.java	Wed Nov 14 04:59:57 2018 +0100
@@ -123,7 +123,7 @@
      */
     private static int messages = 0;
 
-    private static final String className = "nsk.stress.except.except011.except011oops";
+    private static final String className = "nsk.stress.except.except011oops";
 
     /**
      * Re-call to the method <code>run(out)</code> (ignore <code>args[]</code>),
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress001.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress001.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -72,7 +72,7 @@
         for (j=0;j<nstr;j++)
             element->checkstr[j] = (char *)c_malloc(env, DIGESTLENGTH*sizeof(char));
     }
-    for(j=0;j<DIGESTLENGTH;j++) {
+    for (j=0;j<DIGESTLENGTH;j++) {
         digest[j]=0;
     }
     element->str[allocs] = env->GetStringUTFChars(jstr,0); CE
@@ -97,7 +97,7 @@
         tmpstr=env->NewStringUTF(element->str[allocs-1]); CE
         for (j=0; j<nstr; j++) {
 
-            for(i=0;i<DIGESTLENGTH;i++) {
+            for (i=0;i<DIGESTLENGTH;i++) {
                 digest[i]=0;
             }
             for (k=0; k < strlen(element->str[j]); k++) {
@@ -168,7 +168,7 @@
         for (j=0;j<nstr;j++)
             javachars->checkstr[j] = (char *)c_malloc(env, DIGESTLENGTH*sizeof(char));
     }
-    for(j=0;j<DIGESTLENGTH;j++) {
+    for (j=0;j<DIGESTLENGTH;j++) {
         digest[j]=0;
     }
     javachars->str[index] = env->GetStringChars(jstr,0); CE
@@ -181,7 +181,7 @@
     }
 
     //memcpy(digest, elem, javachars->size[index]);
-    for(j=0;j<elem_len; j++) {
+    for (j=0;j<elem_len; j++) {
         digest[j % DIGESTLENGTH]+=elem[j];
     }
     memcpy(javachars->checkstr[index++],digest,DIGESTLENGTH);
@@ -201,10 +201,10 @@
                 elem[i] = (char) javachars->str[j][i];
             }
             //memcpy(digest, elem, javachars->size[j]);
-            for(i=0;i<DIGESTLENGTH;i++) {
+            for (i=0;i<DIGESTLENGTH;i++) {
                 digest[i]=0;
             }
-            for(i=0;i<javachars->size[j]; i++) {
+            for (i=0;i<javachars->size[j]; i++) {
                 digest[i % DIGESTLENGTH]+=elem[i];
             }
             free(elem);
@@ -217,7 +217,7 @@
             else {
                 equal=0;
                 printf("The Unicode element No. %d has been corrupted\n",j);
-                for(i=0;i<DIGESTLENGTH;i++) {
+                for (i=0;i<DIGESTLENGTH;i++) {
                     printf("digest[%d]=%02x checkstr[%d]=%02x\n",i,digest[i],i,javachars->checkstr[j][i]);
                 }
             }
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress003.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress003.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -67,7 +67,7 @@
     arrayArray[FLOAT]=env->NewFloatArray(SIZE); CE
     arrayArray[DOUBLE]=env->NewDoubleArray(SIZE); CE
 
-    for(i=0;i<8;i++)
+    for (i=0;i<8;i++)
     {env->SetObjectArrayElement(objectsArray,i,arrayArray[i]); CE }
 
     boolBuf=(jboolean *)malloc(SIZE*sizeof(jboolean));
@@ -163,7 +163,7 @@
     env->MonitorExit(jobj); CE
     arrayOrig=(jarray *)malloc(8*sizeof(jarray));
     arrayClone=(jarray *)malloc(8*sizeof(jarray));
-    for(i=0;i<8;i++) {
+    for (i=0;i<8;i++) {
     arrayOrig[i]=(jarray) env->GetObjectArrayElement(orig,i); CE
     arrayClone[i]=(jarray) env->GetObjectArrayElement(clone,i); CE
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress004.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress004.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -43,7 +43,7 @@
     char *str;
     jint len=env->GetStringUTFLength(jstr); CE
 
-    for(i=0;i<DIGESTLENGTH;i++) {
+    for (i=0;i<DIGESTLENGTH;i++) {
       digest[i]=0;
     }
     str=(char *)malloc(len*sizeof(char));
@@ -56,10 +56,10 @@
         env->ExceptionClear();
     }
     critstr=env->GetStringCritical(jstr, 0); CE
-    for(i=0;i<len;i++)
+    for (i=0;i<len;i++)
     str[i] = (char) critstr[i];
     env->ReleaseStringCritical(jstr,critstr); CE
-    for(i=0;i<len;i++) {
+    for (i=0;i<len;i++) {
         digest[i % DIGESTLENGTH]+=str[i];
     }
     free(str);
@@ -93,7 +93,7 @@
     jint len;
     jchar *ch;
 
-    for(i=0;i<DIGESTLENGTH;i++) {
+    for (i=0;i<DIGESTLENGTH;i++) {
       digest[i]=0;
     }
     strlen =  env->GetStringUTFLength(jstr); CE
@@ -112,10 +112,10 @@
         env->ExceptionClear();
     }
     critstr=env->GetStringCritical(jstr, 0); CE
-    for(i=0;i<strlen;i++)
+    for (i=0;i<strlen;i++)
     str[i] = (char) critstr[i];
     env->ReleaseStringCritical(jstr,critstr); CE
-    for(i=0;i<strlen; i++) {
+    for (i=0;i<strlen; i++) {
       digest[i % DIGESTLENGTH]+=str[i % DIGESTLENGTH];
     }
 
@@ -139,8 +139,8 @@
     ch=(jchar *)env->GetPrimitiveArrayCritical(cArr,0); CE
 
     printf("Comparing: ");
-    for(i=0;i<len;i++)
-    if(ch[i]!=tmp[i]) {
+    for (i=0;i<len;i++)
+    if (ch[i]!=tmp[i]) {
         printf("Error in %d\n",i);
         printf("ch[%d]=%02x tmp[%d]=%02x\n",i,ch[i],i,tmp[i]);
         ret=JNI_FALSE;
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress005.cpp	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress005.cpp	Wed Nov 14 04:59:57 2018 +0100
@@ -55,7 +55,7 @@
     env->MonitorEnter(jobj);
     CHECK_EXCEPTION
     if (!env->Throw(tobj)) {
-    if(env->ExceptionOccurred())
+    if (env->ExceptionOccurred())
         if (Exceptcalls%1000==0)
         fprintf(stderr, "NATIVE: Throw has been catched in native\n");
     env->ExceptionClear();
--- a/test/jdk/TEST.groups	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/jdk/TEST.groups	Wed Nov 14 04:59:57 2018 +0100
@@ -460,7 +460,9 @@
     jdk/jfr/event/runtime/TestClassLoadEvent.java \
     jdk/jfr/event/runtime/TestJavaBlockedEvent.java \
     jdk/jfr/event/gc/collection/TestGCWithFasttime.java \
-    jdk/jfr/event/gc/configuration/TestGCConfigurationEvent.java
+    jdk/jfr/event/gc/configuration/TestGCConfigurationEvent.java \
+    jdk/jfr/event/metadata/TestDefaultConfigurations.java \
+    jdk/jfr/startupargs/TestDumpOnExit.java
 
 svc_tools_sanity =
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jndi/ldap/LdapDnsProviderTest.java	Wed Nov 14 04:59:57 2018 +0100
@@ -0,0 +1,231 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.security.Permission;
+import java.util.Hashtable;
+import java.util.concurrent.Callable;
+import java.util.concurrent.FutureTask;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.naming.directory.InitialDirContext;
+import javax.naming.directory.SearchControls;
+
+/**
+ * @test
+ * @bug 8160768
+ * @summary ctx provider tests for ldap
+ * @modules java.naming/com.sun.jndi.ldap
+ * @compile dnsprovider/TestDnsProvider.java
+ * @run main/othervm LdapDnsProviderTest
+ * @run main/othervm LdapDnsProviderTest nosm
+ * @run main/othervm LdapDnsProviderTest smnodns
+ * @run main/othervm LdapDnsProviderTest smdns
+ * @run main/othervm LdapDnsProviderTest nosmbaddns
+ */
+
+class DNSSecurityManager extends SecurityManager {
+
+
+
+    /* run main/othervm LdapDnsProviderTest
+
+     * run main/othervm LdapDnsProviderTest nosm
+     * run main/othervm LdapDnsProviderTest smnodns
+     * run main/othervm LdapDnsProviderTest smdns
+     * run main/othervm LdapDnsProviderTest nosmbaddns
+     */
+
+    private boolean dnsProvider = false;
+
+    public void setAllowDnsProvider(boolean allow) {
+        dnsProvider = allow;
+    }
+
+    @Override
+    public void checkPermission(Permission p) {
+        if (p.getName().equals("ldapDnsProvider") && !dnsProvider) {
+            throw new SecurityException(p.getName());
+        }
+    }
+}
+
+class ProviderTest implements Callable<Boolean> {
+
+    private final String url;
+    private final String expected;
+    private final Hashtable<String, String> env = new Hashtable<>(11);
+
+    public ProviderTest(String url, String expected) {
+        this.url = url;
+        this.expected = expected;
+        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
+    }
+
+    boolean shutItDown(InitialContext ctx) {
+        try {
+            if (ctx != null) ctx.close();
+            return true;
+        } catch (NamingException ex) {
+            return false;
+        }
+    }
+
+    public Boolean call() {
+        boolean passed;
+        InitialContext ctx = null;
+
+        if (url != null) {
+            env.put(Context.PROVIDER_URL, url);
+        }
+
+        try {
+            ctx = new InitialDirContext(env);
+            SearchControls scl = new SearchControls();
+            scl.setSearchScope(SearchControls.SUBTREE_SCOPE);
+            ((InitialDirContext)ctx).search(
+                    "ou=People,o=Test", "(objectClass=*)", scl);
+            throw new RuntimeException("Search should not complete");
+        } catch (NamingException e) {
+            e.printStackTrace();
+            passed = e.toString().contains(expected);
+        } finally {
+            shutItDown(ctx);
+        }
+        return passed;
+    }
+}
+
+public class LdapDnsProviderTest {
+
+    private static final String TEST_CLASSES =
+            System.getProperty("test.classes", ".");
+
+    public static void writeFile(String content, File dstFile)
+        throws IOException
+    {
+        try (FileOutputStream dst = new FileOutputStream(dstFile)) {
+            byte[] buf = content.getBytes();
+            dst.write(buf, 0, buf.length);
+        }
+    }
+
+    public static void installServiceConfigurationFile(String content) {
+        String filename = "javax.naming.ldap.spi.LdapDnsProvider";
+
+        File dstDir = new File(TEST_CLASSES, "META-INF/services");
+        if (!dstDir.exists()) {
+            if (!dstDir.mkdirs()) {
+                throw new RuntimeException(
+                    "could not create META-INF/services directory " + dstDir);
+            }
+        }
+        File dstFile = new File(dstDir, filename);
+
+        try {
+            writeFile(content, dstFile);
+        } catch (IOException e) {
+            throw new RuntimeException("could not install " + dstFile, e);
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        if (args.length > 0 && args[0].equals("nosm")) {
+            // no security manager, serviceloader
+            installServiceConfigurationFile("dnsprovider.TestDnsProvider");
+            runTest("ldap:///dc=example,dc=com", "yupyupyup:389");
+        } else if (args.length > 0 && args[0].equals("smnodns")) {
+            // security manager & serviceloader
+            installServiceConfigurationFile("dnsprovider.TestDnsProvider");
+            // install security manager
+            System.setSecurityManager(new DNSSecurityManager());
+            runTest("ldap:///dc=example,dc=com", "ServiceConfigurationError");
+        } else if (args.length > 0 && args[0].equals("smdns")) {
+            // security manager & serviceloader
+            DNSSecurityManager sm = new DNSSecurityManager();
+            installServiceConfigurationFile("dnsprovider.TestDnsProvider");
+            // install security manager
+            System.setSecurityManager(sm);
+            sm.setAllowDnsProvider(true);
+            runTest("ldap:///dc=example,dc=com", "yupyupyup:389");
+        } else if (args.length > 0 && args[0].equals("nosmbaddns")) {
+            // no security manager, no serviceloader
+            // DefaultLdapDnsProvider
+            installServiceConfigurationFile("dnsprovider.MissingDnsProvider");
+            // no SecurityManager
+            runTest("ldap:///dc=example,dc=com", "not found");
+        } else {
+            // no security manager, no serviceloader
+            // DefaultLdapDnsProvider
+            System.err.println("TEST_CLASSES:");
+            System.err.println(TEST_CLASSES);
+            File f = new File(
+                    TEST_CLASSES, "META-INF/services/javax.naming.ldap.spi.LdapDnsProvider");
+            if (f.exists()) {
+                f.delete();
+            }
+
+            // no SecurityManager
+            runTest("ldap:///dc=example,dc=com", "localhost:389");
+            runTest("ldap://localhost/dc=example,dc=com", "localhost:389");
+            runTest("ldap://localhost:111/dc=example,dc=com", "localhost:111");
+            runTest("ldaps://localhost:111/dc=example,dc=com", "localhost:111");
+            runTest("ldaps://localhost/dc=example,dc=com", "localhost:636");
+            runTest(null, "localhost:389");
+            runTest("", "ConfigurationException");
+        }
+    }
+
+    private static void runTest(String url, String expected) {
+        FutureTask<Boolean> future =
+            new FutureTask<>(
+                    new ProviderTest(url, expected));
+        new Thread(future).start();
+
+        System.err.println("Testing: " + url + ", " + expected);
+        while (!future.isDone()) {
+            try {
+                if (!future.get()) {
+                    System.err.println("Test failed");
+                    throw new RuntimeException(
+                            "Test failed, ProviderTest returned false");
+                }
+            } catch (Exception e) {
+                if (!e.toString().contains(expected)) {
+                    System.err.println("Test failed");
+                    throw new RuntimeException(
+                            "Test failed, unexpected result");
+                }
+            }
+        }
+        System.err.println("Test passed");
+    }
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jndi/ldap/dnsprovider/TestDnsProvider.java	Wed Nov 14 04:59:57 2018 +0100
@@ -0,0 +1,20 @@
+package dnsprovider;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import javax.naming.ldap.spi.LdapDnsProvider;
+import javax.naming.ldap.spi.LdapDnsProviderResult;
+
+public class TestDnsProvider extends LdapDnsProvider {
+    @Override
+    public Optional<LdapDnsProviderResult> lookupEndpoints(String url,
+                                                           Map<?, ?> env)
+    {
+        List<String> endpoints = new ArrayList<>();
+        endpoints.add("ldap://yupyupyup:389");
+        return Optional.of(
+                new LdapDnsProviderResult("test.com", endpoints));
+    }
+}
--- a/test/jdk/com/sun/security/auth/module/LdapLoginModule/CheckConfigs.policy	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/jdk/com/sun/security/auth/module/LdapLoginModule/CheckConfigs.policy	Wed Nov 14 04:59:57 2018 +0100
@@ -6,4 +6,5 @@
     //permission java.net.SocketPermission "*:636", "connect";
     //permission javax.security.auth.AuthPermission "modifyPrincipals";
     permission java.lang.RuntimePermission "accessClassInPackage.com.sun.jndi.ldap";
+    permission java.lang.RuntimePermission "ldapDnsProvider";
 };
--- a/test/jdk/java/lang/System/ClearProperty.java	Thu Nov 08 22:05:40 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +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.
- */
-
-/*
- * @test
- * @bug 4463345
- * @summary Simple test of System.clearProperty
- * @run main/othervm ClearProperty
- */
-
-public class ClearProperty {
-    public static void main(String [] argv) throws Exception {
-        clearTest();
-        paramTest();
-    }
-
-    static void clearTest() throws Exception {
-        System.setProperty("blah", "blech");
-        if (!System.getProperty("blah").equals("blech"))
-            throw new RuntimeException("Clear test failed 1");
-        System.clearProperty("blah");
-        if (System.getProperty("blah") != null)
-            throw new RuntimeException("Clear test failed 2");
-    }
-
-    static void paramTest() throws Exception {
-        try {
-            System.clearProperty(null);
-            throw new RuntimeException("Param test failed");
-        } catch (NullPointerException npe) {
-            // Correct result
-        }
-        try {
-            System.clearProperty("");
-            throw new RuntimeException("Param test failed");
-        } catch (IllegalArgumentException iae) {
-            // Correct result
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/System/PropertyTest.java	Wed Nov 14 04:59:57 2018 +0100
@@ -0,0 +1,260 @@
+/*
+ * 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.
+ */
+
+import java.lang.System;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import java.util.Properties;
+import java.util.stream.Collectors;
+
+import org.testng.Assert;
+import org.testng.IMethodInstance;
+import org.testng.IMethodInterceptor;
+import org.testng.TestListenerAdapter;
+import org.testng.TestNG;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+
+/*
+ * @test
+ * @bug 4463345 4244670 8030781
+ * @summary Simple test of System getProperty, setProperty, clearProperty,
+ *      getProperties, and setProperties
+ * @run testng/othervm PropertyTest
+ */
+
+@Test
+public class PropertyTest {
+
+    @DataProvider(name = "requiredProperties")
+    static Object[][] requiredProperties() {
+        return new Object[][]{
+                {"java.version"},
+                {"java.version.date"},
+                {"java.vendor"},
+                {"java.vendor.url"},
+                {"java.home"},
+                {"java.vm.specification.version"},
+                {"java.vm.specification.vendor"},
+                {"java.vm.specification.name"},
+                {"java.vm.version"},
+                {"java.vm.vendor"},
+                {"java.vm.name"},
+                {"java.specification.version"},
+                {"java.specification.vendor"},
+                {"java.specification.name"},
+                {"java.class.version"},
+                {"java.class.path"},
+                {"java.library.path"},
+                {"java.io.tmpdir"},
+                {"os.arch"},
+                {"os.version"},
+                {"file.separator"},
+                {"path.separator"},
+                {"line.separator"},
+                {"user.name"},
+                {"user.home"},
+                {"user.dir"},
+                {"java.runtime.version"},
+                {"java.runtime.name"},
+        };
+    }
+
+    @Test
+    static void getTest() {
+        System.setProperty("blah", "blech");
+        Assert.assertEquals(System.getProperty("blah"), "blech");
+
+        try {
+            System.getProperty(null);
+            Assert.fail("Failed: expected NullPointerException");
+        } catch (NullPointerException npe) {
+            // Correct result
+        }
+        try {
+            System.getProperty("");
+            Assert.fail("Failed: expected IllegalArgumentException");
+        } catch (IllegalArgumentException iae) {
+            // Correct result
+        }
+    }
+
+    @Test
+    static void clearTest() {
+        System.setProperty("blah", "blech");
+        Assert.assertEquals(System.getProperty("blah"), "blech");
+
+        System.clearProperty("blah");
+        Assert.assertNull(System.getProperty("blah"));
+
+        try {
+            System.clearProperty(null);
+            Assert.fail("Failed: expected NullPointerException");
+        } catch (NullPointerException npe) {
+            // Correct result
+        }
+        try {
+            System.clearProperty("");
+            Assert.fail("Failed: expected IllegalArgumentException");
+        } catch (IllegalArgumentException iae) {
+            // Correct result
+        }
+    }
+
+    @Test
+    static void setTest() {
+        System.setProperty("blah", "blech");
+        Assert.assertEquals(System.getProperty("blah"), "blech");
+
+        System.setProperty("blah", "");
+        Assert.assertEquals(System.getProperty("blah"), "");
+
+        try {
+            System.setProperty(null, null);
+            Assert.fail("Failed: expected NullPointerException");
+        } catch (NullPointerException npe) {
+            // Correct result
+        }
+
+        try {
+            System.setProperty("blah", null);
+            Assert.fail("Failed: expected NullPointerException");
+        } catch (NullPointerException npe) {
+            // Correct result
+        }
+
+        try {
+            System.setProperty(null, "blech");
+            Assert.fail("Failed: expected NullPointerException");
+        } catch (NullPointerException npe) {
+            // Correct result
+        }
+
+        try {
+            System.setProperty("", "blech");
+            Assert.fail("Failed: expected IllegalArgumentException");
+        } catch (IllegalArgumentException iae) {
+            // Correct result
+        }
+        try {
+            System.setProperty("", "");
+            Assert.fail("Failed: expected IllegalArgumentException");
+        } catch (IllegalArgumentException iae) {
+            // Correct result
+        }
+    }
+
+    @Test
+    static void replaceSetProperties() {
+        Properties oldProps = System.getProperties();
+        Properties newProps = new Properties();
+        oldProps.forEach( (k,v) -> newProps.put(k,v));
+        System.setProperties(newProps);
+
+        Assert.assertSame(System.getProperties(), newProps,
+                "getProperties not the same as setProperties");
+
+        final String KEY = "blah";
+        final String VALUE = "blech";
+
+        // Set via Property instance; get via System methods
+        newProps.setProperty(KEY, VALUE);
+        Assert.assertEquals(System.getProperty(KEY), VALUE, KEY);
+
+        String s = (String)newProps.remove(KEY);
+        Assert.assertEquals(s, VALUE);
+        Assert.assertNull(System.getProperty(KEY), KEY);
+
+        // Set via System methods; Get via Property instance;
+        System.setProperty(KEY, VALUE);
+        Assert.assertEquals(newProps.getProperty(KEY), VALUE);
+
+        String t = System.clearProperty(KEY);
+        Assert.assertEquals(t, VALUE, KEY);
+        Assert.assertNull(newProps.getProperty(KEY), KEY);
+    }
+
+    @Test
+    static void setNullProperties() {
+        Properties oldProps = System.getProperties();
+        Properties savedProps = new Properties();
+        oldProps.forEach((k,v) -> {
+            if (v == null) {
+                throw new RuntimeException("null value, key: " + k);
+            }
+            savedProps.put(k,v);
+        });
+
+        // Re-initialize properties
+        System.setProperties(null);
+
+        Properties newProps = System.getProperties();
+        Object[][] propnames = requiredProperties();
+        for (Object[] p : propnames) {
+            String name = (String)p[0];
+            Assert.assertEquals(System.getProperty(name), savedProps.getProperty(name), name);
+
+            Assert.assertEquals(newProps.getProperty(name), savedProps.getProperty(name), name);
+        }
+    }
+
+    // Verify all the required properties have values from System.getProperty and
+    // System.getProperties()
+    @Test(dataProvider = "requiredProperties")
+    static void checkRequiredProperties(String name) {
+        Assert.assertNotNull(System.getProperty(name), name);
+
+        Properties props = System.getProperties();
+        Assert.assertNotNull(props.getProperty(name), name);
+    }
+
+    @SuppressWarnings("raw_types")
+    @Test(enabled=false)
+    public static void main(String[] args) {
+        TestListenerAdapter tla = new TestListenerAdapter();
+
+        Class<?>[] testclass = {PropertyTest.class};
+        TestNG testng = new TestNG();
+        testng.setTestClasses(testclass);
+        testng.addListener(tla);
+        if (args.length > 0) {
+            IMethodInterceptor intercept = (m, c) -> {
+                List<IMethodInstance> x = m.stream()
+                        .filter(m1 -> m1.getMethod().getMethodName().contains(args[0]))
+                        .collect(Collectors.toList());
+                return x;
+            };
+            testng.setMethodInterceptor(intercept);
+        }
+        testng.run();
+        tla.getPassedTests()
+                .stream().forEach(t -> System.out.printf("Passed: %s%s%n", t.getName(),
+                List.of(t.getParameters())));
+        tla.getFailedTests()
+                .stream().forEach(t -> System.out.printf("Failed: %s%s%n", t.getName(),
+                List.of(t.getParameters())));
+    }
+}
--- a/test/jdk/java/lang/System/SetPropertiesNull.java	Thu Nov 08 22:05:40 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2014, 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.
- */
-
-/*
- * This class tests to see if the system property java.version is properly
- * reinitialized after setting System.setProperties(null).
- *
- * @test
- * @bug 4244670 8030781
- * @summary Test for System.setProperties(null).
- */
-
-public class SetPropertiesNull {
-
-    public static void main(String args[]) {
-        final String version = System.getProperty("java.version");
-        System.setProperties(null);
-        final String newVersion = System.getProperty("java.version");
-        if (!version.equals(newVersion)) {
-            throw new RuntimeException("java.version differs: '" + version + "'  '"
-                               + newVersion + "'");
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/net/MulticastSocket/PromiscuousIPv6.java	Wed Nov 14 04:59:57 2018 +0100
@@ -0,0 +1,162 @@
+/*
+ * 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.
+ *
+
+/*
+ * @test
+ * @bug 8210493
+ * @requires os.family == "linux"
+ * @library /test/lib
+ * @build jdk.test.lib.NetworkConfiguration
+ *        PromiscuousIPv6
+ * @run main PromiscuousIPv6
+ */
+import jdk.test.lib.NetworkConfiguration;
+import jtreg.SkippedException;
+
+import java.io.IOException;
+import java.net.DatagramPacket;
+import java.net.DatagramSocket;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.MulticastSocket;
+import java.net.SocketTimeoutException;
+
+import static java.lang.System.out;
+
+/*
+ * This test was created as a copy of the Promiscuous test and adapted for
+ * IPv6 node-local and link-local multicast addresses on Linux.
+ */
+public class PromiscuousIPv6 {
+
+    static final int TIMEOUT =  5 * 1000; // 5 secs
+    static int id = 1000;
+
+    static void receive(DatagramSocket mc, boolean datagramExpected, int id)
+            throws IOException
+    {
+        byte[] ba = new byte[100];
+        DatagramPacket p = new DatagramPacket(ba, ba.length);
+        try {
+            mc.receive(p);
+            int recvId = Integer.parseInt(
+                    new String(p.getData(), 0, p.getLength(), "UTF-8"));
+            if (datagramExpected) {
+                if (recvId != id)
+                    throw new RuntimeException("Unexpected id, got " + recvId
+                                                       + ", expected: " + id);
+                out.printf("Received message as expected, %s\n", p.getAddress());
+            } else {
+                throw new RuntimeException("Unexpected message received, "
+                                                   + p.getAddress());
+            }
+        } catch (SocketTimeoutException e) {
+            if (datagramExpected)
+                throw new RuntimeException("Expected message not received, "
+                                                   + e.getMessage());
+            else
+                out.printf("Message not received, as expected\n");
+        }
+    }
+
+    static void test(InetAddress group1, InetAddress group2)
+            throws IOException
+    {
+        try (MulticastSocket mc1 = new MulticastSocket(new InetSocketAddress(group1, 0));
+             MulticastSocket mc2 = new MulticastSocket(new InetSocketAddress(group2, mc1.getLocalPort()));
+             DatagramSocket ds = new DatagramSocket()) {
+
+            final int port = mc1.getLocalPort();
+            out.printf("Using port: %d\n", port);
+
+            mc1.setSoTimeout(TIMEOUT);
+            mc2.setSoTimeout(TIMEOUT);
+            int nextId = id;
+            byte[] msg = Integer.toString(nextId).getBytes("UTF-8");
+            DatagramPacket p = new DatagramPacket(msg, msg.length);
+            p.setAddress(group1);
+            p.setPort(port);
+
+            mc1.joinGroup(group1);
+            out.printf("mc1 joined the MC group: %s\n", group1);
+            mc2.joinGroup(group2);
+            out.printf("mc2 joined the MC group: %s\n", group2);
+
+            out.printf("Sending datagram to: %s/%d\n", group1, port);
+            ds.send(p);
+
+            // the packet should be received by mc1 only
+            receive(mc1, true, nextId);
+            receive(mc2, false, 0);
+
+            nextId = ++id;
+            msg = Integer.toString(nextId).getBytes("UTF-8");
+            p = new DatagramPacket(msg, msg.length);
+            p.setAddress(group2);
+            p.setPort(port);
+
+            out.printf("Sending datagram to: %s/%d\n", group2, port);
+            ds.send(p);
+
+            // the packet should be received by mc2 only
+            receive(mc2, true, nextId);
+            receive(mc1, false, 0);
+
+            mc1.leaveGroup(group1);
+            mc2.leaveGroup(group2);
+        }
+    }
+
+    public static void main(String args[]) throws IOException {
+        String os = System.getProperty("os.name");
+
+        if (!os.equals("Linux")) {
+            throw new SkippedException("This test should be run only on Linux");
+        } else {
+            String osVersion = System.getProperty("os.version");
+            String prefix = "3.10.0";
+            if (osVersion.startsWith(prefix)) {
+                throw new SkippedException(
+                        String.format("The behavior under test is known NOT to work on '%s' kernels", prefix));
+            }
+        }
+
+        NetworkConfiguration.printSystemConfiguration(System.out);
+
+        if (NetworkConfiguration.probe()
+                                .ip6MulticastInterfaces()
+                                .findAny()
+                                .isEmpty()) {
+            throw new SkippedException(
+                    "No IPv6 interfaces that support multicast found");
+        }
+
+        InetAddress interfaceLocal1 = InetAddress.getByName("ff11::2.3.4.5");
+        InetAddress interfaceLocal2 = InetAddress.getByName("ff11::6.7.8.9");
+        test(interfaceLocal1, interfaceLocal2);
+
+        InetAddress linkLocal1 = InetAddress.getByName("ff12::2.3.4.5");
+        InetAddress linkLocal2 = InetAddress.getByName("ff12::6.7.8.9");
+        test(linkLocal1, linkLocal2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/nio/channels/DatagramChannel/PromiscuousIPv6.java	Wed Nov 14 04:59:57 2018 +0100
@@ -0,0 +1,230 @@
+/*
+ * 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.
+ *
+
+/*
+ * @test
+ * @bug 8210493
+ * @requires os.family == "linux"
+ * @library /test/lib
+ * @build jdk.test.lib.NetworkConfiguration
+ *        PromiscuousIPv6
+ * @run main PromiscuousIPv6
+ * @key randomness
+ */
+
+import java.nio.ByteBuffer;
+import java.nio.channels.*;
+import java.net.*;
+import static java.net.StandardProtocolFamily.*;
+import java.util.*;
+import java.io.IOException;
+import java.util.stream.Collectors;
+
+import jdk.test.lib.NetworkConfiguration;
+import jtreg.SkippedException;
+
+/*
+ * This test was created as a copy of the Promiscuous test and adapted for
+ * IPv6 node-local and link-local multicast addresses on Linux.
+ */
+public class PromiscuousIPv6 {
+
+    static final Random rand = new Random();
+
+    static final ProtocolFamily UNSPEC = () -> "UNSPEC";
+
+    /**
+     * Sends a datagram to the given multicast group
+     */
+    static int sendDatagram(NetworkInterface nif,
+                            InetAddress group,
+                            int port)
+            throws IOException
+    {
+        ProtocolFamily family = (group instanceof Inet6Address) ?
+                StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
+        DatagramChannel dc = DatagramChannel.open(family)
+                .setOption(StandardSocketOptions.IP_MULTICAST_IF, nif);
+        int id = rand.nextInt();
+        byte[] msg = Integer.toString(id).getBytes("UTF-8");
+        ByteBuffer buf = ByteBuffer.wrap(msg);
+        System.out.format("Send message -> group %s (id=0x%x)\n",
+                          group.getHostAddress(), id);
+        dc.send(buf, new InetSocketAddress(group, port));
+        dc.close();
+        return id;
+    }
+
+    /**
+     * Wait (with timeout) for datagram. The {@code datagramExpected}
+     * parameter indicates whether a datagram is expected, and if
+     * {@code true} then {@code id} is the identifier in the payload.
+     */
+    static void receiveDatagram(DatagramChannel dc,
+                                String name,
+                                boolean datagramExpected,
+                                int id)
+            throws IOException
+    {
+        System.out.println("Checking if received by " + name);
+
+        Selector sel = Selector.open();
+        dc.configureBlocking(false);
+        dc.register(sel, SelectionKey.OP_READ);
+        ByteBuffer buf = ByteBuffer.allocateDirect(100);
+
+        try {
+            for (;;) {
+                System.out.println("Waiting to receive message");
+                sel.select(5*1000);
+                SocketAddress sa = dc.receive(buf);
+
+                // no datagram received
+                if (sa == null) {
+                    if (datagramExpected) {
+                        throw new RuntimeException("Expected message not received");
+                    }
+                    System.out.println("No message received (correct)");
+                    return;
+                }
+
+                // datagram received
+
+                InetAddress sender = ((InetSocketAddress)sa).getAddress();
+                buf.flip();
+                byte[] bytes = new byte[buf.remaining()];
+                buf.get(bytes);
+                String s = new String(bytes, "UTF-8");
+                int receivedId = -1;
+                try {
+                    receivedId = Integer.parseInt(s);
+                    System.out.format("Received message from %s (id=0x%x)\n",
+                                      sender, receivedId);
+                } catch (NumberFormatException x) {
+                    System.out.format("Received message from %s (msg=%s)\n", sender, s);
+                }
+
+                if (!datagramExpected) {
+                    if (receivedId == id)
+                        throw new RuntimeException("Message not expected");
+                    System.out.println("Message ignored (has wrong id)");
+                } else {
+                    if (receivedId == id) {
+                        System.out.println("Message expected");
+                        return;
+                    }
+                    System.out.println("Message ignored (wrong sender)");
+                }
+
+                sel.selectedKeys().clear();
+                buf.rewind();
+            }
+        } finally {
+            sel.close();
+        }
+    }
+
+    static void test(ProtocolFamily family,
+                     NetworkInterface nif,
+                     InetAddress group1,
+                     InetAddress group2)
+            throws IOException
+    {
+
+        System.out.format("%nTest family=%s%n", family.name());
+
+        DatagramChannel dc1 = (family == UNSPEC) ?
+                DatagramChannel.open() : DatagramChannel.open(family);
+        DatagramChannel dc2 = (family == UNSPEC) ?
+                DatagramChannel.open() : DatagramChannel.open(family);
+
+        try {
+            dc1.setOption(StandardSocketOptions.SO_REUSEADDR, true);
+            dc2.setOption(StandardSocketOptions.SO_REUSEADDR, true);
+
+            dc1.bind(new InetSocketAddress(group1, 0));
+            int port = dc1.socket().getLocalPort();
+            dc2.bind(new InetSocketAddress(group2, port));
+
+            System.out.format("dc1 joining [%s]:%d @ %s\n",
+                              group1.getHostAddress(), port, nif.getName());
+            System.out.format("dc2 joining [%s]:%d @ %s\n",
+                              group2.getHostAddress(), port, nif.getName());
+
+            dc1.join(group1, nif);
+            dc2.join(group2, nif);
+
+            int id = sendDatagram(nif, group1, port);
+
+            receiveDatagram(dc1, "dc1", true, id);
+            receiveDatagram(dc2, "dc2", false, id);
+
+            id = sendDatagram(nif, group2, port);
+
+            receiveDatagram(dc1, "dc1", false, id);
+            receiveDatagram(dc2, "dc2", true, id);
+
+        } finally {
+            dc1.close();
+            dc2.close();
+        }
+    }
+
+    public static void main(String[] args) throws IOException {
+
+        String os = System.getProperty("os.name");
+
+        if (!os.equals("Linux")) {
+            throw new SkippedException("This test should be run only on Linux");
+        } else {
+            String osVersion = System.getProperty("os.version");
+            String prefix = "3.10.0";
+            if (osVersion.startsWith(prefix)) {
+                throw new SkippedException(
+                        String.format("The behavior under test is known NOT to work on '%s' kernels", prefix));
+            }
+        }
+
+        NetworkConfiguration.printSystemConfiguration(System.out);
+
+        InetAddress interfaceLocal1 = InetAddress.getByName("ff11::2.3.4.5");
+        InetAddress interfaceLocal2 = InetAddress.getByName("ff11::6.7.8.9");
+
+        InetAddress linkLocal1 = InetAddress.getByName("ff12::2.3.4.5");
+        InetAddress linkLocal2 = InetAddress.getByName("ff12::6.7.8.9");
+
+        // get local network configuration to use
+        NetworkConfiguration config = NetworkConfiguration.probe();
+        boolean foundAtLeastOne = false;
+        for (NetworkInterface nif: config.ip6MulticastInterfaces()
+                .collect(Collectors.toList())) {
+            foundAtLeastOne = true;
+            test(INET6, nif, interfaceLocal1, interfaceLocal2);
+            test(INET6, nif, linkLocal1, linkLocal2);
+        }
+        if (!foundAtLeastOne) {
+            throw new SkippedException(
+                    "No IPv6 interfaces that support multicast found");
+        }
+    }
+}
--- a/test/jdk/java/nio/channels/SocketChannel/AsyncCloseChannel.java	Thu Nov 08 22:05:40 2018 +0100
+++ b/test/jdk/java/nio/channels/SocketChannel/AsyncCloseChannel.java	Wed Nov 14 04:59:57 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -24,13 +24,16 @@
 /* @test
  * @bug 6285901 6501089
  * @summary Check no data is written to wrong socket channel during async closing.
- * @author Xueming Shen
+ * @run main/othervm AsyncCloseChannel
  */
 
-import java.io.*;
-import java.nio.*;
-import java.nio.channels.*;
-import java.net.*;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.net.Socket;