changeset 52286:297450fcab26

Merge
author jdv
date Tue, 16 Oct 2018 23:21:05 +0530
parents d6c322e900b2 5e894b0f5e63
children 7530494ed51d
files src/java.xml.crypto/share/classes/javax/xml/crypto/dom/package.html src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/dom/package.html src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/package.html src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/package.html src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/package.html src/java.xml.crypto/share/classes/javax/xml/crypto/package.html test/jdk/java/util/Locale/LocaleCategory.sh test/jdk/java/util/Locale/LocaleProviders.sh test/jdk/java/util/PluggableLocale/BreakIteratorProviderTest.sh test/jdk/java/util/PluggableLocale/CalendarDataProviderTest.sh test/jdk/java/util/PluggableLocale/CalendarNameProviderTest.sh test/jdk/java/util/PluggableLocale/ClasspathTest.sh test/jdk/java/util/PluggableLocale/CollatorProviderTest.sh test/jdk/java/util/PluggableLocale/CurrencyNameProviderTest.sh test/jdk/java/util/PluggableLocale/DateFormatProviderTest.sh test/jdk/java/util/PluggableLocale/DateFormatSymbolsProviderTest.sh test/jdk/java/util/PluggableLocale/DecimalFormatSymbolsProviderTest.sh test/jdk/java/util/PluggableLocale/ExecTest.sh test/jdk/java/util/PluggableLocale/GenericTest.sh test/jdk/java/util/PluggableLocale/LocaleNameProviderTest.sh test/jdk/java/util/PluggableLocale/NumberFormatProviderTest.sh test/jdk/java/util/PluggableLocale/PermissionTest.sh test/jdk/java/util/PluggableLocale/TimeZoneNameProviderTest.sh test/jdk/java/util/PluggableLocale/barprovider.jar test/jdk/java/util/PluggableLocale/fooprovider.jar test/jdk/java/util/PluggableLocale/providersrc/BreakIteratorProviderImpl.java test/jdk/java/util/PluggableLocale/providersrc/CalendarDataProviderImpl.java test/jdk/java/util/PluggableLocale/providersrc/CalendarNameProviderImpl.java test/jdk/java/util/PluggableLocale/providersrc/CollatorProviderImpl.java test/jdk/java/util/PluggableLocale/providersrc/CurrencyNameProviderImpl.java test/jdk/java/util/PluggableLocale/providersrc/CurrencyNameProviderImpl2.java test/jdk/java/util/PluggableLocale/providersrc/DateFormatProviderImpl.java test/jdk/java/util/PluggableLocale/providersrc/DateFormatSymbolsProviderImpl.java test/jdk/java/util/PluggableLocale/providersrc/DecimalFormatSymbolsProviderImpl.java test/jdk/java/util/PluggableLocale/providersrc/FooDateFormat.java test/jdk/java/util/PluggableLocale/providersrc/FooNumberFormat.java test/jdk/java/util/PluggableLocale/providersrc/GenericTimeZoneNameProviderImpl.java test/jdk/java/util/PluggableLocale/providersrc/LocaleNameProviderImpl.java test/jdk/java/util/PluggableLocale/providersrc/LocaleNames.properties test/jdk/java/util/PluggableLocale/providersrc/LocaleNames_ja.properties test/jdk/java/util/PluggableLocale/providersrc/LocaleNames_ja_JP_kyoto.properties test/jdk/java/util/PluggableLocale/providersrc/LocaleNames_ja_JP_osaka.properties test/jdk/java/util/PluggableLocale/providersrc/LocaleNames_xx.properties test/jdk/java/util/PluggableLocale/providersrc/Makefile test/jdk/java/util/PluggableLocale/providersrc/NumberFormatProviderImpl.java test/jdk/java/util/PluggableLocale/providersrc/TimeZoneNameProviderImpl.java test/jdk/java/util/PluggableLocale/providersrc/Utils.java test/jdk/java/util/PluggableLocale/providersrc/java.text.spi.BreakIteratorProvider test/jdk/java/util/PluggableLocale/providersrc/java.text.spi.CollatorProvider test/jdk/java/util/PluggableLocale/providersrc/java.text.spi.DateFormatProvider test/jdk/java/util/PluggableLocale/providersrc/java.text.spi.DateFormatSymbolsProvider test/jdk/java/util/PluggableLocale/providersrc/java.text.spi.DecimalFormatSymbolsProvider test/jdk/java/util/PluggableLocale/providersrc/java.text.spi.NumberFormatProvider test/jdk/java/util/PluggableLocale/providersrc/java.util.spi.CalendarDataProvider test/jdk/java/util/PluggableLocale/providersrc/java.util.spi.CalendarNameProvider test/jdk/java/util/PluggableLocale/providersrc/java.util.spi.CurrencyNameProvider test/jdk/java/util/PluggableLocale/providersrc/java.util.spi.LocaleNameProvider test/jdk/java/util/PluggableLocale/providersrc/java.util.spi.TimeZoneNameProvider
diffstat 353 files changed, 10015 insertions(+), 5888 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Fri Oct 19 11:15:57 2018 -0700
+++ b/.hgtags	Tue Oct 16 23:21:05 2018 +0530
@@ -518,3 +518,4 @@
 8897e41b327c0a5601c6ba2bba5d07f15a3ffc91 jdk-12+14
 6f04692c7d5137ee34a6bd94c0c8a6c9219cb127 jdk-12+14
 f8626bcc169813a4b2a15880386b952719d1d6d1 jdk-12+15
+199658d1ef860cdc17055b4fd3e94b057f292fe9 jdk-12+16
--- a/make/CompileToolsJdk.gmk	Fri Oct 19 11:15:57 2018 -0700
+++ b/make/CompileToolsJdk.gmk	Tue Oct 16 23:21:05 2018 +0530
@@ -46,6 +46,7 @@
     SETUP := GENERATE_OLDBYTECODE, \
     SRC := $(BUILD_TOOLS_SRC_DIRS), \
     EXCLUDES := \
+        build/tools/classlist \
         build/tools/deps \
         build/tools/docs \
         build/tools/jigsaw \
--- a/make/GenerateLinkOptData.gmk	Fri Oct 19 11:15:57 2018 -0700
+++ b/make/GenerateLinkOptData.gmk	Tue Oct 16 23:21:05 2018 +0530
@@ -31,15 +31,17 @@
 
 include $(SPEC)
 include MakeBase.gmk
-include JarArchive.gmk
+include SetupJavaCompilers.gmk
 
 ################################################################################
 # Create a jar with our generator class. Using a jar is intentional since it
 # will load more classes
 
-$(eval $(call SetupJarArchive, CLASSLIST_JAR, \
-    SRCS := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes, \
+$(eval $(call SetupJavaCompilation, CLASSLIST_JAR, \
+    SETUP := GENERATE_JDKBYTECODE, \
+    SRC := $(TOPDIR)/make/jdk/src/classes, \
     INCLUDES := build/tools/classlist, \
+    BIN := $(BUILDTOOLS_OUTPUTDIR)/classlist_classes, \
     JAR := $(SUPPORT_OUTPUTDIR)/classlist.jar, \
 ))
 
--- a/make/common/MakeBase.gmk	Fri Oct 19 11:15:57 2018 -0700
+++ b/make/common/MakeBase.gmk	Tue Oct 16 23:21:05 2018 +0530
@@ -656,8 +656,11 @@
 
 # String equals
 equals = \
-    $(and $(findstring $(strip $1),$(strip $2)),\
-        $(findstring $(strip $2),$(strip $1)))
+    $(if $(strip $1)$(strip $2),$(strip \
+      $(and $(findstring $(strip $1),$(strip $2)),\
+        $(findstring $(strip $2),$(strip $1)))), \
+      true \
+    )
 
 # Remove a whole list of prefixes
 # $1 - List of prefixes
--- a/make/common/NativeCompilation.gmk	Fri Oct 19 11:15:57 2018 -0700
+++ b/make/common/NativeCompilation.gmk	Tue Oct 16 23:21:05 2018 +0530
@@ -67,7 +67,6 @@
 # Param 2: Working directory
 # Param 3: Source file
 # Param 4: Compile command
-# Param 5: Object name
 ################################################################################
 define WriteCompileCommandsFragment
   $(call LogInfo, Creating compile commands fragment for $(notdir $3))
@@ -76,8 +75,7 @@
       "directory": "$(strip $2)"$(COMMA) \
       "file": "$(strip $3)"$(COMMA) \
       "command": "$(strip $(subst $(DQUOTE),\$(DQUOTE),$(subst \,\\,\
-        $(subst $(FIXPATH),,$4))))"$(COMMA) \
-      "output": "$(strip $5)" \
+        $(subst $(FIXPATH),,$4))))" \
     }$(COMMA), \
     $1)
 endef
@@ -331,7 +329,7 @@
 
     $$($1_OBJ_JSON): $$($1_OBJ_DEPS)
 	$$(call WriteCompileCommandsFragment, $$@, $$(PWD), $$($1_SRC_FILE), \
-	    $$($1_COMPILER) $$($1_COMPILE_OPTIONS), $$($1_OBJ))
+	    $$($1_COMPILER) $$($1_COMPILE_OPTIONS))
 
     $$($1_OBJ): $$($1_OBJ_DEPS) | $$($$($1_BASE)_BUILD_INFO)
 	$$(call LogInfo, Compiling $$($1_FILENAME) (for $$($$($1_BASE)_BASENAME)))
@@ -744,7 +742,7 @@
 
         $$($1_PCH_FILE_JSON): $$($1_PRECOMPILED_HEADER) $$($1_COMPILE_VARDEPS_FILE)
 		$$(call WriteCompileCommandsFragment, $$@, $$(PWD), $$<, \
-		    $$($1_PCH_COMMAND) $$< -o $$($1_PCH_FILE), $$($1_PCH_FILE))
+		    $$($1_PCH_COMMAND) $$< -o $$($1_PCH_FILE))
       endif
     endif
   endif
--- a/make/jdk/src/classes/build/tools/classlist/HelloClasslist.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/make/jdk/src/classes/build/tools/classlist/HelloClasslist.java	Tue Oct 16 23:21:05 2018 +0530
@@ -66,6 +66,15 @@
         Stream.of(helloWorld.split(","))
               .forEach(System.out::println);
 
+        // Common concatenation patterns
+        String const_I = "string" + args.length;
+        String const_S = "string" + String.valueOf(args.length);
+        String S_const = String.valueOf(args.length) + "string";
+        String S_S     = String.valueOf(args.length) + String.valueOf(args.length);
+        String const_J = "string" + System.currentTimeMillis();
+        String I_const = args.length + "string";
+        String J_const = System.currentTimeMillis() + "string";
+
         String newDate = DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(
                 LocalDateTime.now(ZoneId.of("GMT")));
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/cpu/aarch64/gc/shared/barrierSetNMethod_aarch64.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc/shared/barrierSetNMethod.hpp"
+#include "utilities/debug.hpp"
+
+void BarrierSetNMethod::deoptimize(nmethod* nm, address* return_address_ptr) {
+  ShouldNotReachHere();
+}
+
+void BarrierSetNMethod::disarm(nmethod* nm) {
+  ShouldNotReachHere();
+}
+
+bool BarrierSetNMethod::is_armed(nmethod* nm) {
+  ShouldNotReachHere();
+  return false;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/cpu/arm/gc/shared/barrierSetNMethod_arm.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc/shared/barrierSetNMethod.hpp"
+#include "utilities/debug.hpp"
+
+void BarrierSetNMethod::deoptimize(nmethod* nm, address* return_address_ptr) {
+  ShouldNotReachHere();
+}
+
+void BarrierSetNMethod::disarm(nmethod* nm) {
+  ShouldNotReachHere();
+}
+
+bool BarrierSetNMethod::is_armed(nmethod* nm) {
+  ShouldNotReachHere();
+  return false;
+}
--- a/src/hotspot/cpu/arm/vm_version_arm.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/arm/vm_version_arm.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -110,7 +110,6 @@
   static bool supports_kuser_cmpxchg64() { return _kuser_helper_version >= KUSER_VERSION_CMPXCHG64; }
   // Override Abstract_VM_Version implementation
   static bool use_biased_locking();
-  static const char* vm_info_string();
 
   static bool has_vfp()             { return (_features & vfp_m) != 0; }
   static bool has_vfp3_32()         { return (_features & vfp3_32_m) != 0; }
--- a/src/hotspot/cpu/arm/vm_version_arm_32.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/arm/vm_version_arm_32.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -318,20 +318,3 @@
   //
   return (!os::is_MP() && (arm_arch() > 5)) ? false : true;
 }
-
-#define EXP
-
-// Temporary override for experimental features
-// Copied from Abstract_VM_Version
-const char* VM_Version::vm_info_string() {
-  switch (Arguments::mode()) {
-    case Arguments::_int:
-      return UseSharedSpaces ? "interpreted mode, sharing" EXP : "interpreted mode" EXP;
-    case Arguments::_mixed:
-      return UseSharedSpaces ? "mixed mode, sharing" EXP    :  "mixed mode" EXP;
-    case Arguments::_comp:
-      return UseSharedSpaces ? "compiled mode, sharing" EXP   : "compiled mode" EXP;
-  };
-  ShouldNotReachHere();
-  return "";
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/cpu/ppc/gc/shared/barrierSetNMethod_ppc.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc/shared/barrierSetNMethod.hpp"
+#include "utilities/debug.hpp"
+
+void BarrierSetNMethod::deoptimize(nmethod* nm, address* return_address_ptr) {
+  ShouldNotReachHere();
+}
+
+void BarrierSetNMethod::disarm(nmethod* nm) {
+  ShouldNotReachHere();
+}
+
+bool BarrierSetNMethod::is_armed(nmethod* nm) {
+  ShouldNotReachHere();
+  return false;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/cpu/s390/gc/shared/barrierSetNMethod_s390.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc/shared/barrierSetNMethod.hpp"
+#include "utilities/debug.hpp"
+
+void BarrierSetNMethod::deoptimize(nmethod* nm, address* return_address_ptr) {
+  ShouldNotReachHere();
+}
+
+void BarrierSetNMethod::disarm(nmethod* nm) {
+  ShouldNotReachHere();
+}
+
+bool BarrierSetNMethod::is_armed(nmethod* nm) {
+  ShouldNotReachHere();
+  return false;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/cpu/sparc/gc/shared/barrierSetNMethod_sparc.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc/shared/barrierSetNMethod.hpp"
+#include "utilities/debug.hpp"
+
+void BarrierSetNMethod::deoptimize(nmethod* nm, address* return_address_ptr) {
+  ShouldNotReachHere();
+}
+
+void BarrierSetNMethod::disarm(nmethod* nm) {
+  ShouldNotReachHere();
+}
+
+bool BarrierSetNMethod::is_armed(nmethod* nm) {
+  ShouldNotReachHere();
+  return false;
+}
--- a/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -26,6 +26,8 @@
 #include "c1/c1_MacroAssembler.hpp"
 #include "c1/c1_Runtime1.hpp"
 #include "classfile/systemDictionary.hpp"
+#include "gc/shared/barrierSet.hpp"
+#include "gc/shared/barrierSetAssembler.hpp"
 #include "gc/shared/collectedHeap.hpp"
 #include "interpreter/interpreter.hpp"
 #include "oops/arrayOop.hpp"
@@ -330,6 +332,9 @@
   }
 #endif // TIERED
   decrement(rsp, frame_size_in_bytes); // does not emit code for frame_size == 0
+
+  BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
+  bs->nmethod_entry_barrier(this);
 }
 
 
--- a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -23,7 +23,9 @@
  */
 
 #include "precompiled.hpp"
+#include "gc/shared/barrierSet.hpp"
 #include "gc/shared/barrierSetAssembler.hpp"
+#include "gc/shared/barrierSetNMethod.hpp"
 #include "gc/shared/collectedHeap.hpp"
 #include "interpreter/interp_masm.hpp"
 #include "runtime/jniHandles.hpp"
@@ -322,3 +324,22 @@
   __ adcl(Address(thread, in_bytes(JavaThread::allocated_bytes_offset())+4), 0);
 #endif
 }
+
+void BarrierSetAssembler::nmethod_entry_barrier(MacroAssembler* masm) {
+  BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
+  if (bs_nm == NULL) {
+    return;
+  }
+#ifndef _LP64
+  ShouldNotReachHere();
+#else
+  Label continuation;
+  Register thread = LP64_ONLY(r15_thread);
+  Address disarmed_addr(thread, in_bytes(bs_nm->thread_disarmed_offset()));
+  __ align(8);
+  __ cmpl(disarmed_addr, 0);
+  __ jcc(Assembler::equal, continuation);
+  __ call(RuntimeAddress(StubRoutines::x86::method_entry_barrier()));
+  __ bind(continuation);
+#endif
+}
--- a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -83,6 +83,8 @@
                              Label& slow_case);
 
   virtual void barrier_stubs_init() {}
+
+  virtual void nmethod_entry_barrier(MacroAssembler* masm);
 };
 
 #endif // CPU_X86_GC_SHARED_BARRIERSETASSEMBLER_X86_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/cpu/x86/gc/shared/barrierSetNMethod_x86.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "code/codeCache.hpp"
+#include "code/nativeInst.hpp"
+#include "gc/shared/barrierSetNMethod.hpp"
+#include "logging/log.hpp"
+#include "memory/resourceArea.hpp"
+#include "runtime/sharedRuntime.hpp"
+#include "runtime/thread.hpp"
+#include "utilities/align.hpp"
+#include "utilities/debug.hpp"
+
+class NativeNMethodCmpBarrier: public NativeInstruction {
+public:
+  enum Intel_specific_constants {
+    instruction_code        = 0x81,
+    instruction_size        = 8,
+    imm_offset              = 4,
+    instruction_rex_prefix  = Assembler::REX | Assembler::REX_B,
+    instruction_modrm       = 0x7f  // [r15 + offset]
+  };
+
+  address instruction_address() const { return addr_at(0); }
+  address immediate_address() const { return addr_at(imm_offset); }
+
+  jint get_immedate() const { return int_at(imm_offset); }
+  void set_immediate(jint imm) { set_int_at(imm_offset, imm); }
+  void verify() const;
+};
+
+void NativeNMethodCmpBarrier::verify() const {
+  if (((uintptr_t) instruction_address()) & 0x7) {
+    fatal("Not properly aligned");
+  }
+
+  int prefix = ubyte_at(0);
+  if (prefix != instruction_rex_prefix) {
+    tty->print_cr("Addr: " INTPTR_FORMAT " Prefix: 0x%x", p2i(instruction_address()),
+        prefix);
+    fatal("not a cmp barrier");
+  }
+
+  int inst = ubyte_at(1);
+  if (inst != instruction_code) {
+    tty->print_cr("Addr: " INTPTR_FORMAT " Code: 0x%x", p2i(instruction_address()),
+        inst);
+    fatal("not a cmp barrier");
+  }
+
+  int modrm = ubyte_at(2);
+  if (modrm != instruction_modrm) {
+    tty->print_cr("Addr: " INTPTR_FORMAT " mod/rm: 0x%x", p2i(instruction_address()),
+        modrm);
+    fatal("not a cmp barrier");
+  }
+}
+
+void BarrierSetNMethod::deoptimize(nmethod* nm, address* return_address_ptr) {
+  /*
+   * [ callers frame          ]
+   * [ callers return address ] <- callers rsp
+   * [ callers rbp            ] <- callers rbp
+   * [ callers frame slots    ]
+   * [ return_address         ] <- return_address_ptr
+   * [ cookie ]                 <- used to write the new rsp (callers rsp)
+   * [ stub rbp ]
+   * [ stub stuff             ]
+   */
+
+  address* stub_rbp = return_address_ptr - 2;
+  address* callers_rsp = return_address_ptr + nm->frame_size(); /* points to callers return_address now */
+  address* callers_rbp = callers_rsp - 1; // 1 to move to the callers return address, 1 more to move to the rbp
+  address* cookie = return_address_ptr - 1;
+
+  LogTarget(Trace, nmethod, barrier) out;
+  if (out.is_enabled()) {
+    Thread* thread = Thread::current();
+    assert(thread->is_Java_thread(), "must be JavaThread");
+    JavaThread* jth = (JavaThread*) thread;
+    ResourceMark mark;
+    log_trace(nmethod, barrier)("deoptimize(nmethod: %p, return_addr: %p, osr: %d, thread: %p(%s), making rsp: %p) -> %p",
+                               nm, (address *) return_address_ptr, nm->is_osr_method(), jth,
+                               jth->get_thread_name(), callers_rsp, nm->verified_entry_point());
+  }
+
+  assert(nm->frame_size() >= 3, "invariant");
+  assert(*cookie == (address) -1, "invariant");
+
+  // Preserve caller rbp.
+  *stub_rbp = *callers_rbp;
+
+  // At the cookie address put the callers rsp.
+  *cookie = (address) callers_rsp; // should point to the return address
+
+  // In the slot that used to be the callers rbp we put the address that our stub needs to jump to at the end.
+  // Overwriting the caller rbp should be okay since our stub rbp has the same value.
+  address* jmp_addr_ptr = callers_rbp;
+  *jmp_addr_ptr = SharedRuntime::get_handle_wrong_method_stub();
+}
+
+// This is the offset of the entry barrier from where the frame is completed.
+// If any code changes between the end of the verified entry where the entry
+// barrier resides, and the completion of the frame, then
+// NativeNMethodCmpBarrier::verify() will immediately complain when it does
+// not find the expected native instruction at this offset, which needs updating.
+// Note that this offset is invariant of PreserveFramePointer.
+static const int entry_barrier_offset = -19;
+
+static NativeNMethodCmpBarrier* native_nmethod_barrier(nmethod* nm) {
+  address barrier_address = nm->code_begin() + nm->frame_complete_offset() + entry_barrier_offset;
+  NativeNMethodCmpBarrier* barrier = reinterpret_cast<NativeNMethodCmpBarrier*>(barrier_address);
+  debug_only(barrier->verify());
+  return barrier;
+}
+
+void BarrierSetNMethod::disarm(nmethod* nm) {
+  if (!supports_entry_barrier(nm)) {
+    return;
+  }
+
+  NativeNMethodCmpBarrier* cmp = native_nmethod_barrier(nm);
+  cmp->set_immediate(disarmed_value());
+}
+
+bool BarrierSetNMethod::is_armed(nmethod* nm) {
+  if (!supports_entry_barrier(nm)) {
+    return false;
+  }
+
+  NativeNMethodCmpBarrier* cmp = native_nmethod_barrier(nm);
+  return (disarmed_value() != cmp->get_immedate());
+}
--- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -5453,7 +5453,7 @@
 #endif // _LP64
 
 // C2 compiled method's prolog code.
-void MacroAssembler::verified_entry(int framesize, int stack_bang_size, bool fp_mode_24b) {
+void MacroAssembler::verified_entry(int framesize, int stack_bang_size, bool fp_mode_24b, bool is_stub) {
 
   // WARNING: Initial instruction MUST be 5 bytes or longer so that
   // NativeJump::patch_verified_entry will be able to patch out the entry
@@ -5535,6 +5535,10 @@
   }
 #endif
 
+  if (!is_stub) {
+    BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
+    bs->nmethod_entry_barrier(this);
+  }
 }
 
 // clear memory of size 'cnt' qwords, starting at 'base' using XMM/YMM registers
--- a/src/hotspot/cpu/x86/macroAssembler_x86.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/x86/macroAssembler_x86.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -1588,7 +1588,7 @@
   void movl2ptr(Register dst, Register src) { LP64_ONLY(movslq(dst, src)) NOT_LP64(if (dst != src) movl(dst, src)); }
 
   // C2 compiled method's prolog code.
-  void verified_entry(int framesize, int stack_bang_size, bool fp_mode_24b);
+  void verified_entry(int framesize, int stack_bang_size, bool fp_mode_24b, bool is_stub);
 
   // clear memory of size 'cnt' qwords, starting at 'base';
   // if 'is_large' is set, do not try to produce short loop
--- a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -34,6 +34,8 @@
 #include "code/vtableStubs.hpp"
 #include "gc/shared/collectedHeap.hpp"
 #include "gc/shared/gcLocker.hpp"
+#include "gc/shared/barrierSet.hpp"
+#include "gc/shared/barrierSetAssembler.hpp"
 #include "interpreter/interpreter.hpp"
 #include "logging/log.hpp"
 #include "memory/resourceArea.hpp"
@@ -2160,6 +2162,9 @@
   // -2 because return address is already present and so is saved rbp
   __ subptr(rsp, stack_size - 2*wordSize);
 
+  BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
+  bs->nmethod_entry_barrier(masm);
+
   // Frame is now completed as far as size and linkage.
   int frame_complete = ((intptr_t)__ pc()) - start;
 
--- a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -28,6 +28,7 @@
 #include "ci/ciUtilities.hpp"
 #include "gc/shared/barrierSet.hpp"
 #include "gc/shared/barrierSetAssembler.hpp"
+#include "gc/shared/barrierSetNMethod.hpp"
 #include "interpreter/interpreter.hpp"
 #include "nativeInst_x86.hpp"
 #include "oops/instanceOop.hpp"
@@ -5194,6 +5195,83 @@
     return start;
   }
 
+  address generate_method_entry_barrier() {
+    __ align(CodeEntryAlignment);
+    StubCodeMark mark(this, "StubRoutines", "nmethod_entry_barrier");
+
+    Label deoptimize_label;
+
+    address start = __ pc();
+
+    __ push(-1); // cookie, this is used for writing the new rsp when deoptimizing
+
+    BLOCK_COMMENT("Entry:");
+    __ enter(); // save rbp
+
+    // save c_rarg0, because we want to use that value.
+    // We could do without it but then we depend on the number of slots used by pusha
+    __ push(c_rarg0);
+
+    __ lea(c_rarg0, Address(rsp, wordSize * 3)); // 1 for cookie, 1 for rbp, 1 for c_rarg0 - this should be the return address
+
+    __ pusha();
+
+    // The method may have floats as arguments, and we must spill them before calling
+    // the VM runtime.
+    assert(Argument::n_float_register_parameters_j == 8, "Assumption");
+    const int xmm_size = wordSize * 2;
+    const int xmm_spill_size = xmm_size * Argument::n_float_register_parameters_j;
+    __ subptr(rsp, xmm_spill_size);
+    __ movdqu(Address(rsp, xmm_size * 7), xmm7);
+    __ movdqu(Address(rsp, xmm_size * 6), xmm6);
+    __ movdqu(Address(rsp, xmm_size * 5), xmm5);
+    __ movdqu(Address(rsp, xmm_size * 4), xmm4);
+    __ movdqu(Address(rsp, xmm_size * 3), xmm3);
+    __ movdqu(Address(rsp, xmm_size * 2), xmm2);
+    __ movdqu(Address(rsp, xmm_size * 1), xmm1);
+    __ movdqu(Address(rsp, xmm_size * 0), xmm0);
+
+    __ call_VM_leaf(CAST_FROM_FN_PTR(address, static_cast<int (*)(address*)>(BarrierSetNMethod::nmethod_stub_entry_barrier)), 1);
+
+    __ movdqu(xmm0, Address(rsp, xmm_size * 0));
+    __ movdqu(xmm1, Address(rsp, xmm_size * 1));
+    __ movdqu(xmm2, Address(rsp, xmm_size * 2));
+    __ movdqu(xmm3, Address(rsp, xmm_size * 3));
+    __ movdqu(xmm4, Address(rsp, xmm_size * 4));
+    __ movdqu(xmm5, Address(rsp, xmm_size * 5));
+    __ movdqu(xmm6, Address(rsp, xmm_size * 6));
+    __ movdqu(xmm7, Address(rsp, xmm_size * 7));
+    __ addptr(rsp, xmm_spill_size);
+
+    __ cmpl(rax, 1); // 1 means deoptimize
+    __ jcc(Assembler::equal, deoptimize_label);
+
+    __ popa();
+    __ pop(c_rarg0);
+
+    __ leave();
+
+    __ addptr(rsp, 1 * wordSize); // cookie
+    __ ret(0);
+
+
+    __ BIND(deoptimize_label);
+
+    __ popa();
+    __ pop(c_rarg0);
+
+    __ leave();
+
+    // this can be taken out, but is good for verification purposes. getting a SIGSEGV
+    // here while still having a correct stack is valuable
+    __ testptr(rsp, Address(rsp, 0));
+
+    __ movptr(rsp, Address(rsp, 0)); // new rsp was written in the barrier
+    __ jmp(Address(rsp, -1 * wordSize)); // jmp target should be callers verified_entry_point
+
+    return start;
+  }
+
    /**
    *  Arguments:
    *
@@ -5831,6 +5909,11 @@
     generate_safefetch("SafeFetchN", sizeof(intptr_t), &StubRoutines::_safefetchN_entry,
                                                        &StubRoutines::_safefetchN_fault_pc,
                                                        &StubRoutines::_safefetchN_continuation_pc);
+
+    BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
+    if (bs_nm != NULL) {
+      StubRoutines::x86::_method_entry_barrier = generate_method_entry_barrier();
+    }
 #ifdef COMPILER2
     if (UseMultiplyToLenIntrinsic) {
       StubRoutines::_multiplyToLen = generate_multiplyToLen();
--- a/src/hotspot/cpu/x86/stubRoutines_x86.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/x86/stubRoutines_x86.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -55,8 +55,14 @@
   static address _double_sign_mask;
   static address _double_sign_flip;
 
+  static address _method_entry_barrier;
+
  public:
 
+  static address method_entry_barrier() {
+    return _method_entry_barrier;
+  }
+
   static address get_previous_fp_entry() {
     return _get_previous_fp_entry;
   }
--- a/src/hotspot/cpu/x86/stubRoutines_x86_64.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/x86/stubRoutines_x86_64.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -42,3 +42,4 @@
 address StubRoutines::x86::_float_sign_flip = NULL;
 address StubRoutines::x86::_double_sign_mask = NULL;
 address StubRoutines::x86::_double_sign_flip = NULL;
+address StubRoutines::x86::_method_entry_barrier = NULL;
--- a/src/hotspot/cpu/x86/x86_32.ad	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/x86/x86_32.ad	Tue Oct 16 23:21:05 2018 +0530
@@ -619,7 +619,7 @@
   int framesize = C->frame_size_in_bytes();
   int bangsize = C->bang_size_in_bytes();
 
-  __ verified_entry(framesize, C->need_stack_bang(bangsize)?bangsize:0, C->in_24_bit_fp_mode());
+  __ verified_entry(framesize, C->need_stack_bang(bangsize)?bangsize:0, C->in_24_bit_fp_mode(), C->stub_function() != NULL);
 
   C->set_frame_complete(cbuf.insts_size());
 
--- a/src/hotspot/cpu/x86/x86_64.ad	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/x86/x86_64.ad	Tue Oct 16 23:21:05 2018 +0530
@@ -890,6 +890,15 @@
     st->print("# stack alignment check");
 #endif
   }
+  if (C->stub_function() != NULL && BarrierSet::barrier_set()->barrier_set_nmethod() != NULL) {
+    st->print("\n\t");
+    st->print("cmpl    [r15_thread + #disarmed_offset], #disarmed_value\t");
+    st->print("\n\t");
+    st->print("je      fast_entry\t");
+    st->print("\n\t");
+    st->print("call    #nmethod_entry_barrier_stub\t");
+    st->print("\n\tfast_entry:");
+  }
   st->cr();
 }
 #endif
@@ -901,7 +910,7 @@
   int framesize = C->frame_size_in_bytes();
   int bangsize = C->bang_size_in_bytes();
 
-  __ verified_entry(framesize, C->need_stack_bang(bangsize)?bangsize:0, false);
+  __ verified_entry(framesize, C->need_stack_bang(bangsize)?bangsize:0, false, C->stub_function() != NULL);
 
   C->set_frame_complete(cbuf.insts_size());
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/cpu/zero/gc/shared/barrierSetNMethod_zero.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc/shared/barrierSetNMethod.hpp"
+#include "utilities/debug.hpp"
+
+void BarrierSetNMethod::deoptimize(nmethod* nm, address* return_address_ptr) {
+  ShouldNotReachHere();
+}
+
+void BarrierSetNMethod::disarm(nmethod* nm) {
+  ShouldNotReachHere();
+}
+
+bool BarrierSetNMethod::is_armed(nmethod* nm) {
+  ShouldNotReachHere();
+  return false;
+}
--- a/src/hotspot/share/aot/aotLoader.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/aot/aotLoader.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -137,6 +137,12 @@
       return;
     }
 
+#ifdef _WINDOWS
+    const char pathSep = ';';
+#else
+    const char pathSep = ':';
+#endif
+
     // Scan the AOTLibrary option.
     if (AOTLibrary != NULL) {
       const int len = (int)strlen(AOTLibrary);
@@ -147,7 +153,7 @@
         char* end = cp + len;
         while (cp < end) {
           const char* name = cp;
-          while ((*cp) != '\0' && (*cp) != '\n' && (*cp) != ',' && (*cp) != ':' && (*cp) != ';')  cp++;
+          while ((*cp) != '\0' && (*cp) != '\n' && (*cp) != ',' && (*cp) != pathSep) cp++;
           cp[0] = '\0';  // Terminate name
           cp++;
           load_library(name, true);
--- a/src/hotspot/share/ci/ciEnv.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/ci/ciEnv.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -77,7 +77,7 @@
 
 ciObject*              ciEnv::_null_object_instance;
 
-#define WK_KLASS_DEFN(name, ignore_s, ignore_o) ciInstanceKlass* ciEnv::_##name = NULL;
+#define WK_KLASS_DEFN(name, ignore_s) ciInstanceKlass* ciEnv::_##name = NULL;
 WK_KLASSES_DO(WK_KLASS_DEFN)
 #undef WK_KLASS_DEFN
 
--- a/src/hotspot/share/ci/ciEnv.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/ci/ciEnv.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -82,7 +82,7 @@
   // Distinguished instances of certain ciObjects..
   static ciObject*              _null_object_instance;
 
-#define WK_KLASS_DECL(name, ignore_s, ignore_o) static ciInstanceKlass* _##name;
+#define WK_KLASS_DECL(name, ignore_s) static ciInstanceKlass* _##name;
   WK_KLASSES_DO(WK_KLASS_DECL)
 #undef WK_KLASS_DECL
 
@@ -374,7 +374,7 @@
 
 
   // Access to certain well known ciObjects.
-#define WK_KLASS_FUNC(name, ignore_s, ignore_o) \
+#define WK_KLASS_FUNC(name, ignore_s) \
   ciInstanceKlass* name() { \
     return _##name;\
   }
--- a/src/hotspot/share/ci/ciObjectFactory.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/ci/ciObjectFactory.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -157,8 +157,8 @@
   ciEnv::_null_object_instance = new (_arena) ciNullObject();
   init_ident_of(ciEnv::_null_object_instance);
 
-#define WK_KLASS_DEFN(name, ignore_s, opt)                              \
-  if (SystemDictionary::name() != NULL) \
+#define WK_KLASS_DEFN(name, ignore_s)                              \
+  if (SystemDictionary::name##_is_loaded()) \
     ciEnv::_##name = get_metadata(SystemDictionary::name())->as_instance_klass();
 
   WK_KLASSES_DO(WK_KLASS_DEFN)
--- a/src/hotspot/share/classfile/classLoader.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/classfile/classLoader.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -163,7 +163,7 @@
   static char version_string[10] = "";
   if (version_string[0] == '\0') {
     jio_snprintf(version_string, sizeof(version_string), "%d.%d",
-                 Abstract_VM_Version::vm_major_version(), Abstract_VM_Version::vm_minor_version());
+                 VM_Version::vm_major_version(), VM_Version::vm_minor_version());
   }
   return (const char*)version_string;
 }
--- a/src/hotspot/share/classfile/classLoaderData.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/classfile/classLoaderData.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -139,7 +139,7 @@
   // it from being unloaded during parsing of the unsafe anonymous class.
   // The null-class-loader should always be kept alive.
   _keep_alive((is_unsafe_anonymous || h_class_loader.is_null()) ? 1 : 0),
-  _claimed(0),
+  _claim(0),
   _handles(),
   _klasses(NULL), _packages(NULL), _modules(NULL), _unnamed_module(NULL), _dictionary(NULL),
   _jmethod_ids(NULL),
@@ -268,12 +268,17 @@
 }
 #endif // PRODUCT
 
-bool ClassLoaderData::claim() {
-  if (_claimed == 1) {
-    return false;
+bool ClassLoaderData::try_claim(int claim) {
+  for (;;) {
+    int old_claim = Atomic::load(&_claim);
+    if ((old_claim & claim) == claim) {
+      return false;
+    }
+    int new_claim = old_claim | claim;
+    if (Atomic::cmpxchg(new_claim, &_claim, old_claim) == old_claim) {
+      return true;
+    }
   }
-
-  return (int) Atomic::cmpxchg(1, &_claimed, 0) == 0;
 }
 
 // Unsafe anonymous classes have their own ClassLoaderData that is marked to keep alive
@@ -295,8 +300,8 @@
   }
 }
 
-void ClassLoaderData::oops_do(OopClosure* f, bool must_claim, bool clear_mod_oops) {
-  if (must_claim && !claim()) {
+void ClassLoaderData::oops_do(OopClosure* f, int claim_value, bool clear_mod_oops) {
+  if (claim_value != ClassLoaderData::_claim_none && !try_claim(claim_value)) {
     return;
   }
 
--- a/src/hotspot/share/classfile/classLoaderData.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/classfile/classLoaderData.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -128,9 +128,8 @@
                            // loader. _keep_alive does not need to be volatile or
                            // atomic since there is one unique CLD per unsafe anonymous class.
 
-  volatile int _claimed;   // true if claimed, for example during GC traces.
-                           // To avoid applying oop closure more than once.
-                           // Has to be an int because we cas it.
+  volatile int _claim; // non-zero if claimed, for example during GC traces.
+                       // To avoid applying oop closure more than once.
   ChunkedHandleList _handles; // Handles to constant pool arrays, Modules, etc, which
                               // have the same life cycle of the corresponding ClassLoader.
 
@@ -200,11 +199,22 @@
   Dictionary* create_dictionary();
 
   void initialize_name(Handle class_loader);
+
  public:
   // GC interface.
-  void clear_claimed() { _claimed = 0; }
-  bool claimed() const { return _claimed == 1; }
-  bool claim();
+
+  // The "claim" is typically used to check if oops_do needs to be applied on
+  // the CLD or not. Most GCs only perform strong marking during the marking phase.
+  enum {
+    _claim_none        = 0,
+    _claim_finalizable = 2,
+    _claim_strong      = 3
+  };
+  void clear_claim() { _claim = 0; }
+  bool claimed() const { return _claim != 0; }
+  bool try_claim(int claim);
+  int get_claim() const { return _claim; }
+  void set_claim(int claim) { _claim = claim; }
 
   // Computes if the CLD is alive or not. This is safe to call in concurrent
   // contexts.
@@ -264,7 +274,7 @@
 
   void initialize_holder(Handle holder);
 
-  void oops_do(OopClosure* f, bool must_claim, bool clear_modified_oops = false);
+  void oops_do(OopClosure* f, int claim_value, bool clear_modified_oops = false);
 
   void classes_do(KlassClosure* klass_closure);
   Klass* klasses() { return _klasses; }
--- a/src/hotspot/share/classfile/classLoaderDataGraph.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/classfile/classLoaderDataGraph.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -48,7 +48,7 @@
 
 void ClassLoaderDataGraph::clear_claimed_marks() {
   for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
-    cld->clear_claimed();
+    cld->clear_claim();
   }
 }
 
@@ -231,14 +231,14 @@
 }
 
 void ClassLoaderDataGraph::cld_do(CLDClosure* cl) {
-  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
+  assert_locked_or_safepoint_weak(ClassLoaderDataGraph_lock);
   for (ClassLoaderData* cld = _head;  cld != NULL; cld = cld->_next) {
     cl->do_cld(cld);
   }
 }
 
 void ClassLoaderDataGraph::cld_unloading_do(CLDClosure* cl) {
-  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
+  assert_locked_or_safepoint_weak(ClassLoaderDataGraph_lock);
   // Only walk the head until any clds not purged from prior unloading
   // (CMS doesn't purge right away).
   for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) {
@@ -248,7 +248,7 @@
 }
 
 void ClassLoaderDataGraph::roots_cld_do(CLDClosure* strong, CLDClosure* weak) {
-  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
+  assert_locked_or_safepoint_weak(ClassLoaderDataGraph_lock);
   for (ClassLoaderData* cld = _head;  cld != NULL; cld = cld->_next) {
     CLDClosure* closure = cld->keep_alive() ? strong : weak;
     if (closure != NULL) {
@@ -258,7 +258,7 @@
 }
 
 void ClassLoaderDataGraph::always_strong_cld_do(CLDClosure* cl) {
-  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
+  assert_locked_or_safepoint_weak(ClassLoaderDataGraph_lock);
   if (ClassUnloading) {
     roots_cld_do(cl, NULL);
   } else {
--- a/src/hotspot/share/classfile/systemDictionary.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/classfile/systemDictionary.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -1963,41 +1963,30 @@
 
 // Compact table of directions on the initialization of klasses:
 static const short wk_init_info[] = {
-  #define WK_KLASS_INIT_INFO(name, symbol, option) \
-    ( ((int)vmSymbols::VM_SYMBOL_ENUM_NAME(symbol) \
-          << SystemDictionary::CEIL_LG_OPTION_LIMIT) \
-      | (int)SystemDictionary::option ),
+  #define WK_KLASS_INIT_INFO(name, symbol) \
+    ((short)vmSymbols::VM_SYMBOL_ENUM_NAME(symbol)),
+
   WK_KLASSES_DO(WK_KLASS_INIT_INFO)
   #undef WK_KLASS_INIT_INFO
   0
 };
 
-bool SystemDictionary::resolve_wk_klass(WKID id, int init_opt, TRAPS) {
+bool SystemDictionary::resolve_wk_klass(WKID id, TRAPS) {
   assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
-  int  info = wk_init_info[id - FIRST_WKID];
-  int  sid  = (info >> CEIL_LG_OPTION_LIMIT);
+  int sid = wk_init_info[id - FIRST_WKID];
   Symbol* symbol = vmSymbols::symbol_at((vmSymbols::SID)sid);
   InstanceKlass** klassp = &_well_known_klasses[id];
 
-  bool must_load;
+
 #if INCLUDE_JVMCI
-  if (EnableJVMCI) {
-    // If JVMCI is enabled we require its classes to be found.
-    must_load = (init_opt < SystemDictionary::Opt) || (init_opt == SystemDictionary::Jvmci);
-  } else
+  if (id >= FIRST_JVMCI_WKID) {
+    assert(EnableJVMCI, "resolve JVMCI classes only when EnableJVMCI is true");
+  }
 #endif
-  {
-    must_load = (init_opt < SystemDictionary::Opt);
-  }
 
   if ((*klassp) == NULL) {
-    Klass* k;
-    if (must_load) {
-      k = resolve_or_fail(symbol, true, CHECK_0); // load required class
-    } else {
-      k = resolve_or_null(symbol,       CHECK_0); // load optional klass
-    }
-    (*klassp) = (k == NULL) ? NULL : InstanceKlass::cast(k);
+    Klass* k = resolve_or_fail(symbol, true, CHECK_0);
+    (*klassp) = InstanceKlass::cast(k);
   }
   return ((*klassp) != NULL);
 }
@@ -2006,11 +1995,7 @@
   assert((int)start_id <= (int)limit_id, "IDs are out of order!");
   for (int id = (int)start_id; id < (int)limit_id; id++) {
     assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
-    int info = wk_init_info[id - FIRST_WKID];
-    int sid  = (info >> CEIL_LG_OPTION_LIMIT);
-    int opt  = (info & right_n_bits(CEIL_LG_OPTION_LIMIT));
-
-    resolve_wk_klass((WKID)id, opt, CHECK);
+    resolve_wk_klass((WKID)id, CHECK);
   }
 
   // move the starting value forward to the limit:
--- a/src/hotspot/share/classfile/systemDictionary.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/classfile/systemDictionary.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -94,127 +94,125 @@
 #define WK_KLASS_ENUM_NAME(kname)    kname##_knum
 
 // Each well-known class has a short klass name (like object_klass),
-// a vmSymbol name (like java_lang_Object), and a flag word
-// that makes some minor distinctions, like whether the klass
-// is preloaded, optional, release-specific, etc.
+// and a vmSymbol name (like java_lang_Object).
 // The order of these definitions is significant; it is the order in which
 // preloading is actually performed by resolve_preloaded_classes.
 
-#define WK_KLASSES_DO(do_klass)                                                                                          \
-  /* well-known classes */                                                                                               \
-  do_klass(Object_klass,                                java_lang_Object,                          Pre                 ) \
-  do_klass(String_klass,                                java_lang_String,                          Pre                 ) \
-  do_klass(Class_klass,                                 java_lang_Class,                           Pre                 ) \
-  do_klass(Cloneable_klass,                             java_lang_Cloneable,                       Pre                 ) \
-  do_klass(ClassLoader_klass,                           java_lang_ClassLoader,                     Pre                 ) \
-  do_klass(Serializable_klass,                          java_io_Serializable,                      Pre                 ) \
-  do_klass(System_klass,                                java_lang_System,                          Pre                 ) \
-  do_klass(Throwable_klass,                             java_lang_Throwable,                       Pre                 ) \
-  do_klass(Error_klass,                                 java_lang_Error,                           Pre                 ) \
-  do_klass(ThreadDeath_klass,                           java_lang_ThreadDeath,                     Pre                 ) \
-  do_klass(Exception_klass,                             java_lang_Exception,                       Pre                 ) \
-  do_klass(RuntimeException_klass,                      java_lang_RuntimeException,                Pre                 ) \
-  do_klass(SecurityManager_klass,                       java_lang_SecurityManager,                 Pre                 ) \
-  do_klass(ProtectionDomain_klass,                      java_security_ProtectionDomain,            Pre                 ) \
-  do_klass(AccessControlContext_klass,                  java_security_AccessControlContext,        Pre                 ) \
-  do_klass(SecureClassLoader_klass,                     java_security_SecureClassLoader,           Pre                 ) \
-  do_klass(ClassNotFoundException_klass,                java_lang_ClassNotFoundException,          Pre                 ) \
-  do_klass(NoClassDefFoundError_klass,                  java_lang_NoClassDefFoundError,            Pre                 ) \
-  do_klass(LinkageError_klass,                          java_lang_LinkageError,                    Pre                 ) \
-  do_klass(ClassCastException_klass,                    java_lang_ClassCastException,              Pre                 ) \
-  do_klass(ArrayStoreException_klass,                   java_lang_ArrayStoreException,             Pre                 ) \
-  do_klass(VirtualMachineError_klass,                   java_lang_VirtualMachineError,             Pre                 ) \
-  do_klass(OutOfMemoryError_klass,                      java_lang_OutOfMemoryError,                Pre                 ) \
-  do_klass(StackOverflowError_klass,                    java_lang_StackOverflowError,              Pre                 ) \
-  do_klass(IllegalMonitorStateException_klass,          java_lang_IllegalMonitorStateException,    Pre                 ) \
-  do_klass(Reference_klass,                             java_lang_ref_Reference,                   Pre                 ) \
-                                                                                                                         \
-  /* Preload ref klasses and set reference types */                                                                      \
-  do_klass(SoftReference_klass,                         java_lang_ref_SoftReference,               Pre                 ) \
-  do_klass(WeakReference_klass,                         java_lang_ref_WeakReference,               Pre                 ) \
-  do_klass(FinalReference_klass,                        java_lang_ref_FinalReference,              Pre                 ) \
-  do_klass(PhantomReference_klass,                      java_lang_ref_PhantomReference,            Pre                 ) \
-  do_klass(Finalizer_klass,                             java_lang_ref_Finalizer,                   Pre                 ) \
-                                                                                                                         \
-  do_klass(Thread_klass,                                java_lang_Thread,                          Pre                 ) \
-  do_klass(ThreadGroup_klass,                           java_lang_ThreadGroup,                     Pre                 ) \
-  do_klass(Properties_klass,                            java_util_Properties,                      Pre                 ) \
-  do_klass(Module_klass,                                java_lang_Module,                          Pre                 ) \
-  do_klass(reflect_AccessibleObject_klass,              java_lang_reflect_AccessibleObject,        Pre                 ) \
-  do_klass(reflect_Field_klass,                         java_lang_reflect_Field,                   Pre                 ) \
-  do_klass(reflect_Parameter_klass,                     java_lang_reflect_Parameter,               Opt                 ) \
-  do_klass(reflect_Method_klass,                        java_lang_reflect_Method,                  Pre                 ) \
-  do_klass(reflect_Constructor_klass,                   java_lang_reflect_Constructor,             Pre                 ) \
-                                                                                                                         \
-  /* NOTE: needed too early in bootstrapping process to have checks based on JDK version */                              \
-  /* It's okay if this turns out to be NULL in non-1.4 JDKs. */                                                          \
-  do_klass(reflect_MagicAccessorImpl_klass,             reflect_MagicAccessorImpl,                 Opt                 ) \
-  do_klass(reflect_MethodAccessorImpl_klass,            reflect_MethodAccessorImpl,                Pre                 ) \
-  do_klass(reflect_ConstructorAccessorImpl_klass,       reflect_ConstructorAccessorImpl,           Pre                 ) \
-  do_klass(reflect_DelegatingClassLoader_klass,         reflect_DelegatingClassLoader,             Opt                 ) \
-  do_klass(reflect_ConstantPool_klass,                  reflect_ConstantPool,                      Opt                 ) \
-  do_klass(reflect_UnsafeStaticFieldAccessorImpl_klass, reflect_UnsafeStaticFieldAccessorImpl,     Opt                 ) \
-  do_klass(reflect_CallerSensitive_klass,               reflect_CallerSensitive,                   Opt                 ) \
-                                                                                                                         \
-  /* support for dynamic typing; it's OK if these are NULL in earlier JDKs */                                            \
-  do_klass(DirectMethodHandle_klass,                    java_lang_invoke_DirectMethodHandle,       Opt                 ) \
-  do_klass(MethodHandle_klass,                          java_lang_invoke_MethodHandle,             Pre                 ) \
-  do_klass(VarHandle_klass,                             java_lang_invoke_VarHandle,                Pre                 ) \
-  do_klass(MemberName_klass,                            java_lang_invoke_MemberName,               Pre                 ) \
-  do_klass(ResolvedMethodName_klass,                    java_lang_invoke_ResolvedMethodName,       Pre                 ) \
-  do_klass(MethodHandleNatives_klass,                   java_lang_invoke_MethodHandleNatives,      Pre                 ) \
-  do_klass(LambdaForm_klass,                            java_lang_invoke_LambdaForm,               Opt                 ) \
-  do_klass(MethodType_klass,                            java_lang_invoke_MethodType,               Pre                 ) \
-  do_klass(BootstrapMethodError_klass,                  java_lang_BootstrapMethodError,            Pre                 ) \
-  do_klass(CallSite_klass,                              java_lang_invoke_CallSite,                 Pre                 ) \
-  do_klass(Context_klass,                               java_lang_invoke_MethodHandleNatives_CallSiteContext, Pre      ) \
-  do_klass(ConstantCallSite_klass,                      java_lang_invoke_ConstantCallSite,         Pre                 ) \
-  do_klass(MutableCallSite_klass,                       java_lang_invoke_MutableCallSite,          Pre                 ) \
-  do_klass(VolatileCallSite_klass,                      java_lang_invoke_VolatileCallSite,         Pre                 ) \
-  /* Note: MethodHandle must be first, and VolatileCallSite last in group */                                             \
-                                                                                                                         \
-  do_klass(AssertionStatusDirectives_klass,             java_lang_AssertionStatusDirectives,       Pre                 ) \
-  do_klass(StringBuffer_klass,                          java_lang_StringBuffer,                    Pre                 ) \
-  do_klass(StringBuilder_klass,                         java_lang_StringBuilder,                   Pre                 ) \
-  do_klass(internal_Unsafe_klass,                       jdk_internal_misc_Unsafe,                  Pre                 ) \
-  do_klass(module_Modules_klass,                        jdk_internal_module_Modules,               Pre                 ) \
-                                                                                                                         \
-  /* support for CDS */                                                                                                  \
-  do_klass(ByteArrayInputStream_klass,                  java_io_ByteArrayInputStream,              Pre                 ) \
-  do_klass(URL_klass,                                   java_net_URL,                              Pre                 ) \
-  do_klass(Jar_Manifest_klass,                          java_util_jar_Manifest,                    Pre                 ) \
-  do_klass(jdk_internal_loader_ClassLoaders_klass,      jdk_internal_loader_ClassLoaders,          Pre                 ) \
-  do_klass(jdk_internal_loader_ClassLoaders_AppClassLoader_klass,      jdk_internal_loader_ClassLoaders_AppClassLoader,       Pre ) \
-  do_klass(jdk_internal_loader_ClassLoaders_PlatformClassLoader_klass, jdk_internal_loader_ClassLoaders_PlatformClassLoader,  Pre ) \
-  do_klass(CodeSource_klass,                            java_security_CodeSource,                  Pre                 ) \
-                                                                                                                         \
-  do_klass(StackTraceElement_klass,                     java_lang_StackTraceElement,               Opt                 ) \
-                                                                                                                         \
-  /* It's okay if this turns out to be NULL in non-1.4 JDKs. */                                                          \
-  do_klass(nio_Buffer_klass,                            java_nio_Buffer,                           Opt                 ) \
-                                                                                                                         \
-  /* Stack Walking */                                                                                                    \
-  do_klass(StackWalker_klass,                           java_lang_StackWalker,                     Opt                 ) \
-  do_klass(AbstractStackWalker_klass,                   java_lang_StackStreamFactory_AbstractStackWalker, Opt          ) \
-  do_klass(StackFrameInfo_klass,                        java_lang_StackFrameInfo,                  Opt                 ) \
-  do_klass(LiveStackFrameInfo_klass,                    java_lang_LiveStackFrameInfo,              Opt                 ) \
-                                                                                                                         \
-  /* support for stack dump lock analysis */                                                                             \
-  do_klass(java_util_concurrent_locks_AbstractOwnableSynchronizer_klass, java_util_concurrent_locks_AbstractOwnableSynchronizer, Pre ) \
-                                                                                                                         \
-  /* Preload boxing klasses */                                                                                           \
-  do_klass(Boolean_klass,                               java_lang_Boolean,                         Pre                 ) \
-  do_klass(Character_klass,                             java_lang_Character,                       Pre                 ) \
-  do_klass(Float_klass,                                 java_lang_Float,                           Pre                 ) \
-  do_klass(Double_klass,                                java_lang_Double,                          Pre                 ) \
-  do_klass(Byte_klass,                                  java_lang_Byte,                            Pre                 ) \
-  do_klass(Short_klass,                                 java_lang_Short,                           Pre                 ) \
-  do_klass(Integer_klass,                               java_lang_Integer,                         Pre                 ) \
-  do_klass(Long_klass,                                  java_lang_Long,                            Pre                 ) \
-                                                                                                                         \
-  /* JVMCI classes. These are loaded on-demand. */                                                                       \
-  JVMCI_WK_KLASSES_DO(do_klass)                                                                                          \
-                                                                                                                         \
+#define WK_KLASSES_DO(do_klass)                                                                                 \
+  /* well-known classes */                                                                                      \
+  do_klass(Object_klass,                                java_lang_Object                                      ) \
+  do_klass(String_klass,                                java_lang_String                                      ) \
+  do_klass(Class_klass,                                 java_lang_Class                                       ) \
+  do_klass(Cloneable_klass,                             java_lang_Cloneable                                   ) \
+  do_klass(ClassLoader_klass,                           java_lang_ClassLoader                                 ) \
+  do_klass(Serializable_klass,                          java_io_Serializable                                  ) \
+  do_klass(System_klass,                                java_lang_System                                      ) \
+  do_klass(Throwable_klass,                             java_lang_Throwable                                   ) \
+  do_klass(Error_klass,                                 java_lang_Error                                       ) \
+  do_klass(ThreadDeath_klass,                           java_lang_ThreadDeath                                 ) \
+  do_klass(Exception_klass,                             java_lang_Exception                                   ) \
+  do_klass(RuntimeException_klass,                      java_lang_RuntimeException                            ) \
+  do_klass(SecurityManager_klass,                       java_lang_SecurityManager                             ) \
+  do_klass(ProtectionDomain_klass,                      java_security_ProtectionDomain                        ) \
+  do_klass(AccessControlContext_klass,                  java_security_AccessControlContext                    ) \
+  do_klass(SecureClassLoader_klass,                     java_security_SecureClassLoader                       ) \
+  do_klass(ClassNotFoundException_klass,                java_lang_ClassNotFoundException                      ) \
+  do_klass(NoClassDefFoundError_klass,                  java_lang_NoClassDefFoundError                        ) \
+  do_klass(LinkageError_klass,                          java_lang_LinkageError                                ) \
+  do_klass(ClassCastException_klass,                    java_lang_ClassCastException                          ) \
+  do_klass(ArrayStoreException_klass,                   java_lang_ArrayStoreException                         ) \
+  do_klass(VirtualMachineError_klass,                   java_lang_VirtualMachineError                         ) \
+  do_klass(OutOfMemoryError_klass,                      java_lang_OutOfMemoryError                            ) \
+  do_klass(StackOverflowError_klass,                    java_lang_StackOverflowError                          ) \
+  do_klass(IllegalMonitorStateException_klass,          java_lang_IllegalMonitorStateException                ) \
+  do_klass(Reference_klass,                             java_lang_ref_Reference                               ) \
+                                                                                                                \
+  /* Preload ref klasses and set reference types */                                                             \
+  do_klass(SoftReference_klass,                         java_lang_ref_SoftReference                           ) \
+  do_klass(WeakReference_klass,                         java_lang_ref_WeakReference                           ) \
+  do_klass(FinalReference_klass,                        java_lang_ref_FinalReference                          ) \
+  do_klass(PhantomReference_klass,                      java_lang_ref_PhantomReference                        ) \
+  do_klass(Finalizer_klass,                             java_lang_ref_Finalizer                               ) \
+                                                                                                                \
+  do_klass(Thread_klass,                                java_lang_Thread                                      ) \
+  do_klass(ThreadGroup_klass,                           java_lang_ThreadGroup                                 ) \
+  do_klass(Properties_klass,                            java_util_Properties                                  ) \
+  do_klass(Module_klass,                                java_lang_Module                                      ) \
+  do_klass(reflect_AccessibleObject_klass,              java_lang_reflect_AccessibleObject                    ) \
+  do_klass(reflect_Field_klass,                         java_lang_reflect_Field                               ) \
+  do_klass(reflect_Parameter_klass,                     java_lang_reflect_Parameter                           ) \
+  do_klass(reflect_Method_klass,                        java_lang_reflect_Method                              ) \
+  do_klass(reflect_Constructor_klass,                   java_lang_reflect_Constructor                         ) \
+                                                                                                                \
+  /* NOTE: needed too early in bootstrapping process to have checks based on JDK version */                     \
+  /* It's okay if this turns out to be NULL in non-1.4 JDKs. */                                                 \
+  do_klass(reflect_MagicAccessorImpl_klass,             reflect_MagicAccessorImpl                             ) \
+  do_klass(reflect_MethodAccessorImpl_klass,            reflect_MethodAccessorImpl                            ) \
+  do_klass(reflect_ConstructorAccessorImpl_klass,       reflect_ConstructorAccessorImpl                       ) \
+  do_klass(reflect_DelegatingClassLoader_klass,         reflect_DelegatingClassLoader                         ) \
+  do_klass(reflect_ConstantPool_klass,                  reflect_ConstantPool                                  ) \
+  do_klass(reflect_UnsafeStaticFieldAccessorImpl_klass, reflect_UnsafeStaticFieldAccessorImpl                 ) \
+  do_klass(reflect_CallerSensitive_klass,               reflect_CallerSensitive                               ) \
+                                                                                                                \
+  /* support for dynamic typing; it's OK if these are NULL in earlier JDKs */                                   \
+  do_klass(DirectMethodHandle_klass,                    java_lang_invoke_DirectMethodHandle                   ) \
+  do_klass(MethodHandle_klass,                          java_lang_invoke_MethodHandle                         ) \
+  do_klass(VarHandle_klass,                             java_lang_invoke_VarHandle                            ) \
+  do_klass(MemberName_klass,                            java_lang_invoke_MemberName                           ) \
+  do_klass(ResolvedMethodName_klass,                    java_lang_invoke_ResolvedMethodName                   ) \
+  do_klass(MethodHandleNatives_klass,                   java_lang_invoke_MethodHandleNatives                  ) \
+  do_klass(LambdaForm_klass,                            java_lang_invoke_LambdaForm                           ) \
+  do_klass(MethodType_klass,                            java_lang_invoke_MethodType                           ) \
+  do_klass(BootstrapMethodError_klass,                  java_lang_BootstrapMethodError                        ) \
+  do_klass(CallSite_klass,                              java_lang_invoke_CallSite                             ) \
+  do_klass(Context_klass,                               java_lang_invoke_MethodHandleNatives_CallSiteContext  ) \
+  do_klass(ConstantCallSite_klass,                      java_lang_invoke_ConstantCallSite                     ) \
+  do_klass(MutableCallSite_klass,                       java_lang_invoke_MutableCallSite                      ) \
+  do_klass(VolatileCallSite_klass,                      java_lang_invoke_VolatileCallSite                     ) \
+  /* Note: MethodHandle must be first, and VolatileCallSite last in group */                                    \
+                                                                                                                \
+  do_klass(AssertionStatusDirectives_klass,             java_lang_AssertionStatusDirectives                   ) \
+  do_klass(StringBuffer_klass,                          java_lang_StringBuffer                                ) \
+  do_klass(StringBuilder_klass,                         java_lang_StringBuilder                               ) \
+  do_klass(internal_Unsafe_klass,                       jdk_internal_misc_Unsafe                              ) \
+  do_klass(module_Modules_klass,                        jdk_internal_module_Modules                           ) \
+                                                                                                                \
+  /* support for CDS */                                                                                         \
+  do_klass(ByteArrayInputStream_klass,                  java_io_ByteArrayInputStream                          ) \
+  do_klass(URL_klass,                                   java_net_URL                                          ) \
+  do_klass(Jar_Manifest_klass,                          java_util_jar_Manifest                                ) \
+  do_klass(jdk_internal_loader_ClassLoaders_klass,      jdk_internal_loader_ClassLoaders                      ) \
+  do_klass(jdk_internal_loader_ClassLoaders_AppClassLoader_klass,      jdk_internal_loader_ClassLoaders_AppClassLoader) \
+  do_klass(jdk_internal_loader_ClassLoaders_PlatformClassLoader_klass, jdk_internal_loader_ClassLoaders_PlatformClassLoader) \
+  do_klass(CodeSource_klass,                            java_security_CodeSource                              ) \
+                                                                                                                \
+  do_klass(StackTraceElement_klass,                     java_lang_StackTraceElement                           ) \
+                                                                                                                \
+  /* It's okay if this turns out to be NULL in non-1.4 JDKs. */                                                 \
+  do_klass(nio_Buffer_klass,                            java_nio_Buffer                                       ) \
+                                                                                                                \
+  /* Stack Walking */                                                                                           \
+  do_klass(StackWalker_klass,                           java_lang_StackWalker                                 ) \
+  do_klass(AbstractStackWalker_klass,                   java_lang_StackStreamFactory_AbstractStackWalker      ) \
+  do_klass(StackFrameInfo_klass,                        java_lang_StackFrameInfo                              ) \
+  do_klass(LiveStackFrameInfo_klass,                    java_lang_LiveStackFrameInfo                          ) \
+                                                                                                                \
+  /* support for stack dump lock analysis */                                                                    \
+  do_klass(java_util_concurrent_locks_AbstractOwnableSynchronizer_klass, java_util_concurrent_locks_AbstractOwnableSynchronizer) \
+                                                                                                                \
+  /* Preload boxing klasses */                                                                                  \
+  do_klass(Boolean_klass,                               java_lang_Boolean                                     ) \
+  do_klass(Character_klass,                             java_lang_Character                                   ) \
+  do_klass(Float_klass,                                 java_lang_Float                                       ) \
+  do_klass(Double_klass,                                java_lang_Double                                      ) \
+  do_klass(Byte_klass,                                  java_lang_Byte                                        ) \
+  do_klass(Short_klass,                                 java_lang_Short                                       ) \
+  do_klass(Integer_klass,                               java_lang_Integer                                     ) \
+  do_klass(Long_klass,                                  java_lang_Long                                        ) \
+                                                                                                                \
+  /* JVMCI classes. These are loaded on-demand. */                                                              \
+  JVMCI_WK_KLASSES_DO(do_klass)                                                                                 \
+                                                                                                                \
   /*end*/
 
 
@@ -226,7 +224,7 @@
   enum WKID {
     NO_WKID = 0,
 
-    #define WK_KLASS_ENUM(name, symbol, ignore_o) WK_KLASS_ENUM_NAME(name), WK_KLASS_ENUM_NAME(symbol) = WK_KLASS_ENUM_NAME(name),
+    #define WK_KLASS_ENUM(name, symbol) WK_KLASS_ENUM_NAME(name), WK_KLASS_ENUM_NAME(symbol) = WK_KLASS_ENUM_NAME(name),
     WK_KLASSES_DO(WK_KLASS_ENUM)
     #undef WK_KLASS_ENUM
 
@@ -240,21 +238,6 @@
     FIRST_WKID = NO_WKID + 1
   };
 
-  enum InitOption {
-    Pre,                        // preloaded; error if not present
-
-    // Order is significant.  Options before this point require resolve_or_fail.
-    // Options after this point will use resolve_or_null instead.
-
-    Opt,                        // preload tried; NULL if not present
-#if INCLUDE_JVMCI
-    Jvmci,                      // preload tried; error if not present if JVMCI enabled
-#endif
-    OPTION_LIMIT,
-    CEIL_LG_OPTION_LIMIT = 2    // OPTION_LIMIT <= (1<<CEIL_LG_OPTION_LIMIT)
-  };
-
-
   // Returns a class with a given class name and class loader.  Loads the
   // class if needed. If not found a NoClassDefFoundError or a
   // ClassNotFoundException is thrown, depending on the value on the
@@ -414,12 +397,7 @@
     return k;
   }
 
-  static InstanceKlass* check_klass_Pre(InstanceKlass* k) { return check_klass(k); }
-  static InstanceKlass* check_klass_Opt(InstanceKlass* k) { return k; }
-
-  JVMCI_ONLY(static InstanceKlass* check_klass_Jvmci(InstanceKlass* k) { return k; })
-
-  static bool resolve_wk_klass(WKID id, int init_opt, TRAPS);
+  static bool resolve_wk_klass(WKID id, TRAPS);
   static void resolve_wk_klasses_until(WKID limit_id, WKID &start_id, TRAPS);
   static void resolve_wk_klasses_through(WKID end_id, WKID &start_id, TRAPS) {
     int limit = (int)end_id + 1;
@@ -427,10 +405,13 @@
   }
 
 public:
-  #define WK_KLASS_DECLARE(name, symbol, option) \
-    static InstanceKlass* name() { return check_klass_##option(_well_known_klasses[WK_KLASS_ENUM_NAME(name)]); } \
-    static InstanceKlass** name##_addr() {                                                                       \
-      return &SystemDictionary::_well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)];           \
+  #define WK_KLASS_DECLARE(name, symbol) \
+    static InstanceKlass* name() { return check_klass(_well_known_klasses[WK_KLASS_ENUM_NAME(name)]); } \
+    static InstanceKlass** name##_addr() {                                                              \
+      return &_well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)];                          \
+    }                                                                                                   \
+    static bool name##_is_loaded() {                                                                    \
+      return _well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)] != NULL;                   \
     }
   WK_KLASSES_DO(WK_KLASS_DECLARE);
   #undef WK_KLASS_DECLARE
--- a/src/hotspot/share/classfile/verificationType.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/classfile/verificationType.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -172,7 +172,11 @@
       } else if (is_uninitialized()) {
         st->print("uninitialized %d", bci());
       } else {
-        name()->print_value_on(st);
+        if (name() != NULL) {
+          name()->print_value_on(st);
+        } else {
+          st->print_cr("NULL");
+        }
       }
   }
 }
--- a/src/hotspot/share/code/codeBlob.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/code/codeBlob.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -186,6 +186,7 @@
   bool contains(address addr) const              { return content_begin()      <= addr && addr < content_end();    }
   bool is_frame_complete_at(address addr) const  { return _frame_complete_offset != CodeOffsets::frame_never_safe &&
                                                           code_contains(addr) && addr >= code_begin() + _frame_complete_offset; }
+  int frame_complete_offset() const              { return _frame_complete_offset; }
 
   // CodeCache support: really only used by the nmethods, but in order to get
   // asserts and certain bookkeeping to work in the CodeCache they are defined
--- a/src/hotspot/share/gc/cms/cmsArguments.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/cms/cmsArguments.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2017, Red Hat, Inc. and/or its affiliates.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -45,7 +46,7 @@
   assert(UseConcMarkSweepGC, "CMS is expected to be on here");
 
   if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
-    FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads());
+    FLAG_SET_DEFAULT(ParallelGCThreads, VM_Version::parallel_worker_threads());
     assert(ParallelGCThreads > 0, "We should always have at least one thread by default");
   } else if (ParallelGCThreads == 0) {
     jio_fprintf(defaultStream::error_stream(),
--- a/src/hotspot/share/gc/cms/cmsOopClosures.inline.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/cms/cmsOopClosures.inline.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -41,8 +41,7 @@
 }
 
 inline void MetadataVisitingOopsInGenClosure::do_cld(ClassLoaderData* cld) {
-  bool claim = true;  // Must claim the class loader data before processing.
-  cld->oops_do(this, claim);
+  cld->oops_do(this, ClassLoaderData::_claim_strong);
 }
 
 // Decode the oop and call do_oop on it.
--- a/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -2398,7 +2398,7 @@
  public:
   VerifyCLDOopsCLDClosure(CMSBitMap* bitmap) : _oop_closure(bitmap) {}
   void do_cld(ClassLoaderData* cld) {
-    cld->oops_do(&_oop_closure, false, false);
+    cld->oops_do(&_oop_closure, ClassLoaderData::_claim_none, false);
   }
 };
 
@@ -2413,7 +2413,7 @@
   // Mark from roots one level into CMS
   MarkRefsIntoVerifyClosure notOlder(_span, verification_mark_bm(),
                                      markBitMap());
-  CLDToOopClosure cld_closure(&notOlder, true);
+  CLDToOopClosure cld_closure(&notOlder, ClassLoaderData::_claim_strong);
 
   heap->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
 
@@ -2886,7 +2886,7 @@
       }
     } else {
       // The serial version.
-      CLDToOopClosure cld_closure(&notOlder, true);
+      CLDToOopClosure cld_closure(&notOlder, ClassLoaderData::_claim_strong);
       heap->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
 
       StrongRootsScope srs(1);
@@ -4269,7 +4269,7 @@
   _timer.reset();
   _timer.start();
 
-  CLDToOopClosure cld_closure(&par_mri_cl, true);
+  CLDToOopClosure cld_closure(&par_mri_cl, ClassLoaderData::_claim_strong);
 
   heap->cms_process_roots(_strong_roots_scope,
                           false,     // yg was scanned above
@@ -4331,7 +4331,7 @@
 class RemarkCLDClosure : public CLDClosure {
   CLDToOopClosure _cm_closure;
  public:
-  RemarkCLDClosure(OopClosure* oop_closure) : _cm_closure(oop_closure) {}
+  RemarkCLDClosure(OopClosure* oop_closure) : _cm_closure(oop_closure, ClassLoaderData::_claim_strong) {}
   void do_cld(ClassLoaderData* cld) {
     // Check if we have modified any oops in the CLD during the concurrent marking.
     if (cld->has_accumulated_modified_oops()) {
--- a/src/hotspot/share/gc/epsilon/epsilonBarrierSet.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/epsilon/epsilonBarrierSet.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -40,6 +40,7 @@
           make_barrier_set_assembler<BarrierSetAssembler>(),
           make_barrier_set_c1<BarrierSetC1>(),
           make_barrier_set_c2<BarrierSetC2>(),
+          NULL /* barrier_set_nmethod */,
           BarrierSet::FakeRtti(BarrierSet::EpsilonBarrierSet)) {};
 
 void EpsilonBarrierSet::on_thread_create(Thread *thread) {
--- a/src/hotspot/share/gc/epsilon/epsilonHeap.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/epsilon/epsilonHeap.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -47,7 +47,7 @@
   _space->initialize(committed_region, /* clear_space = */ true, /* mangle_space = */ true);
 
   // Precompute hot fields
-  _max_tlab_size = MIN2(CollectedHeap::max_tlab_size(), EpsilonMaxTLABSize / HeapWordSize);
+  _max_tlab_size = MIN2(CollectedHeap::max_tlab_size(), align_object_size(EpsilonMaxTLABSize / HeapWordSize));
   _step_counter_update = MIN2<size_t>(max_byte_size / 16, EpsilonUpdateCountersStep);
   _step_heap_print = (EpsilonPrintHeapSteps == 0) ? SIZE_MAX : (max_byte_size / EpsilonPrintHeapSteps);
   _decay_time_ns = (int64_t) EpsilonTLABDecayTime * NANOSECS_PER_MILLISEC;
@@ -217,6 +217,16 @@
   // Always honor alignment
   size = align_up(size, MinObjAlignment);
 
+  // Check that adjustments did not break local and global invariants
+  assert(is_object_aligned(size),
+         "Size honors object alignment: " SIZE_FORMAT, size);
+  assert(min_size <= size,
+         "Size honors min size: "  SIZE_FORMAT " <= " SIZE_FORMAT, min_size, size);
+  assert(size <= _max_tlab_size,
+         "Size honors max size: "  SIZE_FORMAT " <= " SIZE_FORMAT, size, _max_tlab_size);
+  assert(size <= CollectedHeap::max_tlab_size(),
+         "Size honors global max size: "  SIZE_FORMAT " <= " SIZE_FORMAT, size, CollectedHeap::max_tlab_size());
+
   if (log_is_enabled(Trace, gc)) {
     ResourceMark rm;
     log_trace(gc)("TLAB size for \"%s\" (Requested: " SIZE_FORMAT "K, Min: " SIZE_FORMAT
--- a/src/hotspot/share/gc/g1/g1Arguments.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1Arguments.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -75,7 +75,7 @@
 void G1Arguments::initialize() {
   GCArguments::initialize();
   assert(UseG1GC, "Error");
-  FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads());
+  FLAG_SET_DEFAULT(ParallelGCThreads, VM_Version::parallel_worker_threads());
   if (ParallelGCThreads == 0) {
     assert(!FLAG_IS_DEFAULT(ParallelGCThreads), "The default value for ParallelGCThreads should not be 0.");
     vm_exit_during_initialization("The flag -XX:+UseG1GC can not be combined with -XX:ParallelGCThreads=0", NULL);
--- a/src/hotspot/share/gc/g1/g1FullGCAdjustTask.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1FullGCAdjustTask.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -108,7 +108,7 @@
   AlwaysTrueClosure always_alive;
   _weak_proc_task.work(worker_id, &always_alive, &_adjust);
 
-  CLDToOopClosure adjust_cld(&_adjust);
+  CLDToOopClosure adjust_cld(&_adjust, ClassLoaderData::_claim_strong);
   CodeBlobToOopClosure adjust_code(&_adjust, CodeBlobToOopClosure::FixRelocations);
   _root_processor.process_all_roots(
       &_adjust,
--- a/src/hotspot/share/gc/g1/g1FullGCMarker.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1FullGCMarker.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "classfile/classLoaderData.hpp"
 #include "gc/g1/g1FullGCMarker.inline.hpp"
 #include "gc/shared/referenceProcessor.hpp"
 #include "memory/iterator.inline.hpp"
@@ -36,7 +37,7 @@
     _mark_closure(worker_id, this, G1CollectedHeap::heap()->ref_processor_stw()),
     _verify_closure(VerifyOption_G1UseFullMarking),
     _stack_closure(this),
-    _cld_closure(mark_closure()) {
+    _cld_closure(mark_closure(), ClassLoaderData::_claim_strong) {
   _oop_stack.initialize();
   _objarray_stack.initialize();
 }
--- a/src/hotspot/share/gc/g1/g1FullGCOopClosures.inline.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1FullGCOopClosures.inline.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -25,7 +25,7 @@
 #ifndef SHARE_VM_GC_G1_G1FULLGCOOPCLOSURES_INLINE_HPP
 #define SHARE_VM_GC_G1_G1FULLGCOOPCLOSURES_INLINE_HPP
 
-#include "gc/g1/g1Allocator.hpp"
+#include "gc/g1/g1Allocator.inline.hpp"
 #include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp"
 #include "gc/g1/g1FullGCMarker.inline.hpp"
 #include "gc/g1/g1FullGCOopClosures.hpp"
--- a/src/hotspot/share/gc/g1/g1HeapVerifier.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1HeapVerifier.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -24,14 +24,12 @@
 
 #include "precompiled.hpp"
 #include "gc/g1/g1Allocator.inline.hpp"
-#include "gc/g1/g1CollectedHeap.hpp"
 #include "gc/g1/g1CollectedHeap.inline.hpp"
 #include "gc/g1/g1ConcurrentMarkThread.hpp"
 #include "gc/g1/g1HeapVerifier.hpp"
 #include "gc/g1/g1Policy.hpp"
 #include "gc/g1/g1RemSet.hpp"
 #include "gc/g1/g1RootProcessor.hpp"
-#include "gc/g1/heapRegion.hpp"
 #include "gc/g1/heapRegion.inline.hpp"
 #include "gc/g1/heapRegionRemSet.hpp"
 #include "gc/g1/g1StringDedup.hpp"
@@ -170,10 +168,10 @@
  public:
   VerifyCLDClosure(G1CollectedHeap* g1h, OopClosure* cl) : _young_ref_counter_closure(g1h), _oop_closure(cl) {}
   void do_cld(ClassLoaderData* cld) {
-    cld->oops_do(_oop_closure, false);
+    cld->oops_do(_oop_closure, ClassLoaderData::_claim_none);
 
     _young_ref_counter_closure.reset_count();
-    cld->oops_do(&_young_ref_counter_closure, false);
+    cld->oops_do(&_young_ref_counter_closure, ClassLoaderData::_claim_none);
     if (_young_ref_counter_closure.count() > 0) {
       guarantee(cld->has_modified_oops(), "CLD " PTR_FORMAT ", has young %d refs but is not dirty.", p2i(cld), _young_ref_counter_closure.count());
     }
--- a/src/hotspot/share/gc/g1/g1OopClosures.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1OopClosures.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -52,7 +52,7 @@
 
     // Clean the cld since we're going to scavenge all the metadata.
     // Clear modified oops only if this cld is claimed.
-    cld->oops_do(_closure, _must_claim, /*clear_modified_oops*/true);
+    cld->oops_do(_closure, _claim, /*clear_modified_oops*/true);
 
     _closure->set_scanned_cld(NULL);
 
--- a/src/hotspot/share/gc/g1/g1OopClosures.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1OopClosures.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -160,12 +160,12 @@
 class G1CLDScanClosure : public CLDClosure {
   G1ParCopyHelper* _closure;
   bool             _process_only_dirty;
-  bool             _must_claim;
+  int              _claim;
   int              _count;
 public:
   G1CLDScanClosure(G1ParCopyHelper* closure,
-                   bool process_only_dirty, bool must_claim)
-  : _closure(closure), _process_only_dirty(process_only_dirty), _must_claim(must_claim), _count(0) {}
+                   bool process_only_dirty, int claim_value)
+  : _closure(closure), _process_only_dirty(process_only_dirty), _claim(claim_value), _count(0) {}
   void do_cld(ClassLoaderData* cld);
 };
 
--- a/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -201,11 +201,11 @@
                                                   HeapWord * const obj_ptr) const {
   PLAB* alloc_buf = _plab_allocator->alloc_buffer(dest_state);
   if (alloc_buf->contains(obj_ptr)) {
-    _g1h->_gc_tracer_stw->report_promotion_in_new_plab_event(old->klass(), word_sz, age,
+    _g1h->_gc_tracer_stw->report_promotion_in_new_plab_event(old->klass(), word_sz * HeapWordSize, age,
                                                              dest_state.value() == InCSetState::Old,
                                                              alloc_buf->word_sz());
   } else {
-    _g1h->_gc_tracer_stw->report_promotion_outside_plab_event(old->klass(), word_sz, age,
+    _g1h->_gc_tracer_stw->report_promotion_outside_plab_event(old->klass(), word_sz * HeapWordSize, age,
                                                               dest_state.value() == InCSetState::Old);
   }
 }
--- a/src/hotspot/share/gc/g1/g1RootClosures.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1RootClosures.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -35,7 +35,7 @@
   G1EvacuationClosures(G1CollectedHeap* g1h,
                        G1ParScanThreadState* pss,
                        bool in_young_gc) :
-      _closures(g1h, pss, in_young_gc, /* must_claim_cld */ false) {}
+      _closures(g1h, pss, in_young_gc, /* cld_claim */ ClassLoaderData::_claim_none) {}
 
   OopClosure* weak_oops()   { return &_closures._oops; }
   OopClosure* strong_oops() { return &_closures._oops; }
@@ -73,8 +73,8 @@
 public:
   G1InitialMarkClosures(G1CollectedHeap* g1h,
                         G1ParScanThreadState* pss) :
-      _strong(g1h, pss, /* process_only_dirty_klasses */ false, /* must_claim_cld */ true),
-      _weak(g1h, pss,   /* process_only_dirty_klasses */ false, /* must_claim_cld */ true) {}
+      _strong(g1h, pss, /* process_only_dirty_klasses */ false, /* cld_claim */ ClassLoaderData::_claim_strong),
+      _weak(g1h, pss,   /* process_only_dirty_klasses */ false, /* cld_claim */ ClassLoaderData::_claim_strong) {}
 
   OopClosure* weak_oops()   { return &_weak._oops; }
   OopClosure* strong_oops() { return &_strong._oops; }
--- a/src/hotspot/share/gc/g1/g1SharedClosures.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1SharedClosures.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -39,9 +39,9 @@
   G1CLDScanClosure                _clds;
   G1CodeBlobClosure               _codeblobs;
 
-  G1SharedClosures(G1CollectedHeap* g1h, G1ParScanThreadState* pss, bool process_only_dirty, bool must_claim_cld) :
+  G1SharedClosures(G1CollectedHeap* g1h, G1ParScanThreadState* pss, bool process_only_dirty, int cld_claim) :
     _oops(g1h, pss),
     _oops_in_cld(g1h, pss),
-    _clds(&_oops_in_cld, process_only_dirty, must_claim_cld),
+    _clds(&_oops_in_cld, process_only_dirty, cld_claim),
     _codeblobs(&_oops) {}
 };
--- a/src/hotspot/share/gc/parallel/parallelArguments.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/parallel/parallelArguments.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2017, Red Hat, Inc. and/or its affiliates.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -50,7 +51,7 @@
   // If no heap maximum was requested explicitly, use some reasonable fraction
   // of the physical memory, up to a maximum of 1GB.
   FLAG_SET_DEFAULT(ParallelGCThreads,
-                   Abstract_VM_Version::parallel_worker_threads());
+                   VM_Version::parallel_worker_threads());
   if (ParallelGCThreads == 0) {
     jio_fprintf(defaultStream::error_stream(),
         "The Parallel GC can not be combined with -XX:ParallelGCThreads=0\n");
--- a/src/hotspot/share/gc/parallel/pcTasks.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/parallel/pcTasks.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -110,7 +110,7 @@
       break;
 
     case class_loader_data: {
-        CLDToOopClosure cld_closure(&mark_and_push_closure);
+        CLDToOopClosure cld_closure(&mark_and_push_closure, ClassLoaderData::_claim_strong);
         ClassLoaderDataGraph::always_strong_cld_do(&cld_closure);
       }
       break;
--- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/parallel/psParallelCompact.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -2213,7 +2213,7 @@
   Management::oops_do(&oop_closure);
   JvmtiExport::oops_do(&oop_closure);
   SystemDictionary::oops_do(&oop_closure);
-  CLDToOopClosure cld_closure(&oop_closure);
+  CLDToOopClosure cld_closure(&oop_closure, ClassLoaderData::_claim_strong);
   ClassLoaderDataGraph::cld_do(&cld_closure);
 
   // Now adjust pointers in remaining weak roots.  (All of which should
--- a/src/hotspot/share/gc/serial/defNewGeneration.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/serial/defNewGeneration.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -137,7 +137,7 @@
     _scavenge_closure->set_scanned_cld(cld);
 
     // Clean the cld since we're going to scavenge all the metadata.
-    cld->oops_do(_scavenge_closure, false, /*clear_modified_oops*/true);
+    cld->oops_do(_scavenge_closure, ClassLoaderData::_claim_none, /*clear_modified_oops*/true);
 
     _scavenge_closure->set_scanned_cld(NULL);
   }
--- a/src/hotspot/share/gc/serial/markSweep.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/serial/markSweep.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -58,9 +58,9 @@
 
 MarkSweep::FollowRootClosure  MarkSweep::follow_root_closure;
 
-MarkAndPushClosure            MarkSweep::mark_and_push_closure;
-CLDToOopClosure               MarkSweep::follow_cld_closure(&mark_and_push_closure);
-CLDToOopClosure               MarkSweep::adjust_cld_closure(&adjust_pointer_closure);
+MarkAndPushClosure MarkSweep::mark_and_push_closure;
+CLDToOopClosure    MarkSweep::follow_cld_closure(&mark_and_push_closure, ClassLoaderData::_claim_strong);
+CLDToOopClosure    MarkSweep::adjust_cld_closure(&adjust_pointer_closure, ClassLoaderData::_claim_strong);
 
 template <class T> inline void MarkSweep::KeepAliveClosure::do_oop_work(T* p) {
   mark_and_push(p);
--- a/src/hotspot/share/gc/shared/barrierSet.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/shared/barrierSet.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -36,6 +36,7 @@
 class BarrierSetAssembler;
 class BarrierSetC1;
 class BarrierSetC2;
+class BarrierSetNMethod;
 class JavaThread;
 
 // This class provides the interface between a barrier implementation and
@@ -72,6 +73,7 @@
   BarrierSetAssembler* _barrier_set_assembler;
   BarrierSetC1* _barrier_set_c1;
   BarrierSetC2* _barrier_set_c2;
+  BarrierSetNMethod* _barrier_set_nmethod;
 
 public:
   // Metafunction mapping a class derived from BarrierSet to the
@@ -95,11 +97,13 @@
   BarrierSet(BarrierSetAssembler* barrier_set_assembler,
              BarrierSetC1* barrier_set_c1,
              BarrierSetC2* barrier_set_c2,
+             BarrierSetNMethod* barrier_set_nmethod,
              const FakeRtti& fake_rtti) :
     _fake_rtti(fake_rtti),
     _barrier_set_assembler(barrier_set_assembler),
     _barrier_set_c1(barrier_set_c1),
-    _barrier_set_c2(barrier_set_c2) {}
+    _barrier_set_c2(barrier_set_c2),
+    _barrier_set_nmethod(barrier_set_nmethod) {}
   ~BarrierSet() { }
 
   template <class BarrierSetAssemblerT>
@@ -156,6 +160,10 @@
     return _barrier_set_c2;
   }
 
+  BarrierSetNMethod* barrier_set_nmethod() {
+    return _barrier_set_nmethod;
+  }
+
   // The AccessBarrier of a BarrierSet subclass is called by the Access API
   // (cf. oops/access.hpp) to perform decorated accesses. GC implementations
   // may override these default access operations by declaring an
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/shared/barrierSetNMethod.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -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.
+ *
+ * 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 "code/codeCache.hpp"
+#include "code/nmethod.hpp"
+#include "gc/shared/barrierSet.hpp"
+#include "gc/shared/barrierSetNMethod.hpp"
+#include "logging/log.hpp"
+#include "runtime/thread.hpp"
+#include "utilities/debug.hpp"
+
+int BarrierSetNMethod::disarmed_value() const {
+  char* disarmed_addr = reinterpret_cast<char*>(Thread::current());
+  disarmed_addr += in_bytes(thread_disarmed_offset());
+  return *reinterpret_cast<int*>(disarmed_addr);
+}
+
+bool BarrierSetNMethod::supports_entry_barrier(nmethod* nm) {
+  if (nm->method()->is_method_handle_intrinsic()) {
+    return false;
+  }
+
+  if (!nm->is_native_method() && !nm->is_compiled_by_c2() && !nm->is_compiled_by_c1()) {
+    return false;
+  }
+
+  return true;
+}
+
+int BarrierSetNMethod::nmethod_stub_entry_barrier(address* return_address_ptr) {
+  address return_address = *return_address_ptr;
+  CodeBlob* cb = CodeCache::find_blob(return_address);
+  assert(cb != NULL, "invariant");
+
+  nmethod* nm = cb->as_nmethod();
+  BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
+
+  if (!bs_nm->is_armed(nm)) {
+    return 0;
+  }
+
+  assert(!nm->is_osr_method(), "Should not reach here");
+  // Called upon first entry after being armed
+  bool may_enter = bs_nm->nmethod_entry_barrier(nm);
+  if (!may_enter) {
+    log_trace(nmethod, barrier)("Deoptimizing nmethod: " PTR_FORMAT, p2i(nm));
+    bs_nm->deoptimize(nm, return_address_ptr);
+  }
+  return may_enter ? 0 : 1;
+}
+
+bool BarrierSetNMethod::nmethod_osr_entry_barrier(nmethod* nm) {
+  // This check depends on the invariant that all nmethods that are deoptimized / made not entrant
+  // are NOT disarmed.
+  // This invariant is important because a method can be deoptimized after the method have been
+  // resolved / looked up by OSR by another thread. By not deoptimizing them we guarantee that
+  // a deoptimized method will always hit the barrier and come to the same conclusion - deoptimize
+  if (!is_armed(nm)) {
+    return true;
+  }
+
+  assert(nm->is_osr_method(), "Should not reach here");
+  log_trace(nmethod, barrier)("Running osr nmethod entry barrier: " PTR_FORMAT, p2i(nm));
+  return nmethod_entry_barrier(nm);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/shared/barrierSetNMethod.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_CODE_NMETHOD_BARRIER_HPP
+#define SHARE_CODE_NMETHOD_BARRIER_HPP
+
+#include "memory/allocation.hpp"
+#include "utilities/globalDefinitions.hpp"
+#include "utilities/sizes.hpp"
+
+class nmethod;
+
+class BarrierSetNMethod: public CHeapObj<mtGC> {
+  bool supports_entry_barrier(nmethod* nm);
+  void deoptimize(nmethod* nm, address* return_addr_ptr);
+
+protected:
+  virtual int disarmed_value() const;
+  virtual bool nmethod_entry_barrier(nmethod* nm) = 0;
+
+public:
+  virtual ByteSize thread_disarmed_offset() const = 0;
+
+  static int nmethod_stub_entry_barrier(address* return_address_ptr);
+  bool nmethod_osr_entry_barrier(nmethod* nm);
+  bool is_armed(nmethod* nm);
+  void disarm(nmethod* nm);
+};
+
+
+#endif // SHARE_CODE_NMETHOD_BARRIER_HPP
--- a/src/hotspot/share/gc/shared/modRefBarrierSet.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/shared/modRefBarrierSet.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -39,6 +39,7 @@
     : BarrierSet(barrier_set_assembler,
                  barrier_set_c1,
                  barrier_set_c2,
+                 NULL /* barrier_set_nmethod */,
                  fake_rtti.add_tag(BarrierSet::ModRef)) { }
   ~ModRefBarrierSet() { }
 
--- a/src/hotspot/share/gc/z/zBarrierSet.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zBarrierSet.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -43,6 +43,7 @@
     BarrierSet(make_barrier_set_assembler<ZBarrierSetAssembler>(),
                make_barrier_set_c1<ZBarrierSetC1>(),
                make_barrier_set_c2<ZBarrierSetC2>(),
+               NULL /* barrier_set_nmethod */,
                BarrierSet::FakeRtti(BarrierSet::ZBarrierSet)) {}
 
 ZBarrierSetAssembler* ZBarrierSet::assembler() {
--- a/src/hotspot/share/gc/z/zCollectedHeap.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zCollectedHeap.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -23,6 +23,7 @@
 
 #include "precompiled.hpp"
 #include "gc/shared/gcHeapSummary.hpp"
+#include "gc/shared/suspendibleThreadSet.hpp"
 #include "gc/z/zCollectedHeap.hpp"
 #include "gc/z/zGlobals.hpp"
 #include "gc/z/zHeap.inline.hpp"
@@ -295,6 +296,14 @@
                              reserved_region().start() + max_capacity_in_words);
 }
 
+void ZCollectedHeap::safepoint_synchronize_begin() {
+  SuspendibleThreadSet::synchronize();
+}
+
+void ZCollectedHeap::safepoint_synchronize_end() {
+  SuspendibleThreadSet::desynchronize();
+}
+
 void ZCollectedHeap::prepare_for_verify() {
   // Does nothing
 }
--- a/src/hotspot/share/gc/z/zCollectedHeap.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zCollectedHeap.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -117,6 +117,9 @@
 
   virtual VirtualSpaceSummary create_heap_space_summary();
 
+  virtual void safepoint_synchronize_begin();
+  virtual void safepoint_synchronize_end();
+
   virtual void print_on(outputStream* st) const;
   virtual void print_on_error(outputStream* st) const;
   virtual void print_extended_on(outputStream* st) const;
--- a/src/hotspot/share/gc/z/zDriver.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zDriver.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -336,7 +336,7 @@
   // Phase 2: Concurrent Mark
   {
     ZStatTimer timer(ZPhaseConcurrentMark);
-    ZHeap::heap()->mark();
+    ZHeap::heap()->mark(true /* initial */);
   }
 
   // Phase 3: Pause Mark End
@@ -345,7 +345,7 @@
     while (!vm_operation(&cl)) {
       // Phase 3.5: Concurrent Mark Continue
       ZStatTimer timer(ZPhaseConcurrentMarkContinue);
-      ZHeap::heap()->mark();
+      ZHeap::heap()->mark(false /* initial */);
     }
   }
 
--- a/src/hotspot/share/gc/z/zHeap.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zHeap.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -296,8 +296,8 @@
   ZStatHeap::set_at_mark_start(capacity(), used());
 }
 
-void ZHeap::mark() {
-  _mark.mark();
+void ZHeap::mark(bool initial) {
+  _mark.mark(initial);
 }
 
 void ZHeap::mark_flush_and_free(Thread* thread) {
--- a/src/hotspot/share/gc/z/zHeap.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zHeap.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -133,7 +133,7 @@
   bool is_object_strongly_live(uintptr_t addr) const;
   template <bool finalizable, bool publish> void mark_object(uintptr_t addr);
   void mark_start();
-  void mark();
+  void mark(bool initial);
   void mark_flush_and_free(Thread* thread);
   bool mark_end();
 
--- a/src/hotspot/share/gc/z/zHeapIterator.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zHeapIterator.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -29,7 +29,6 @@
 #include "gc/z/zOop.inline.hpp"
 #include "gc/z/zRootsIterator.hpp"
 #include "memory/iterator.inline.hpp"
-#include "oops/oop.inline.hpp"
 #include "utilities/bitMap.inline.hpp"
 #include "utilities/stack.inline.hpp"
 
@@ -54,19 +53,18 @@
 class ZHeapIteratorRootOopClosure : public ZRootsIteratorClosure {
 private:
   ZHeapIterator* const _iter;
-  ObjectClosure* const _cl;
 
 public:
-  ZHeapIteratorRootOopClosure(ZHeapIterator* iter, ObjectClosure* cl) :
-      _iter(iter),
-      _cl(cl) {}
+  ZHeapIteratorRootOopClosure(ZHeapIterator* iter) :
+      _iter(iter) {}
 
   virtual void do_oop(oop* p) {
     // Load barrier needed here for the same reason we
-    // need fixup_partial_loads() in ZHeap::mark_end()
+    // need fixup_partial_loads() in ZHeap::mark_end().
+    // This barrier is also needed here in case we're
+    // treating the JVMTI weak tag map as strong roots.
     const oop obj = ZBarrier::load_barrier_on_oop_field(p);
     _iter->push(obj);
-    _iter->drain(_cl);
   }
 
   virtual void do_oop(narrowOop* p) {
@@ -74,19 +72,13 @@
   }
 };
 
-class ZHeapIteratorPushOopClosure : public BasicOopIterateClosure {
+class ZHeapIteratorOopClosure : public BasicOopIterateClosure {
 private:
   ZHeapIterator* const _iter;
   const oop            _base;
   const bool           _visit_referents;
 
-public:
-  ZHeapIteratorPushOopClosure(ZHeapIterator* iter, oop base) :
-      _iter(iter),
-      _base(base),
-      _visit_referents(iter->visit_referents()) {}
-
-  oop load_oop(oop* p) {
+  oop load_oop(oop* p) const {
     if (_visit_referents) {
       return HeapAccess<ON_UNKNOWN_OOP_REF>::oop_load_at(_base, _base->field_offset(p));
     } else {
@@ -94,6 +86,12 @@
     }
   }
 
+public:
+  ZHeapIteratorOopClosure(ZHeapIterator* iter, oop base, bool visit_referents) :
+      _iter(iter),
+      _base(base),
+      _visit_referents(visit_referents) {}
+
   virtual ReferenceIterationMode reference_iteration_mode() {
     return _visit_referents ? DO_FIELDS : DO_FIELDS_EXCEPT_REFERENT;
   }
@@ -126,11 +124,11 @@
   }
 }
 
-size_t ZHeapIterator::object_index_max() const {
+static size_t object_index_max() {
   return ZPageSizeMin >> ZObjectAlignmentSmallShift;
 }
 
-size_t ZHeapIterator::object_index(oop obj) const {
+static size_t object_index(oop obj) {
   const uintptr_t addr = ZOop::to_address(obj);
   const uintptr_t offset = ZAddress::offset(addr);
   const uintptr_t mask = (1 << ZPageSizeMinShift) - 1;
@@ -165,7 +163,22 @@
   _visit_stack.push(obj);
 }
 
-void ZHeapIterator::drain(ObjectClosure* cl) {
+void ZHeapIterator::objects_do(ObjectClosure* cl) {
+  // Push roots onto stack
+  {
+    // Note that we also visit the JVMTI weak tag map as if they were
+    // strong roots to make sure we visit all tagged objects, even
+    // those that might now have become unreachable. If we didn't do
+    // this the user would have expected to see ObjectFree events for
+    // unreachable objects in the tag map.
+    ZRootsIterator roots;
+    ZConcurrentRootsIterator concurrent_roots(false /* marking */);
+    ZHeapIteratorRootOopClosure root_cl(this);
+    roots.oops_do(&root_cl, true /* visit_jvmti_weak_export */);
+    concurrent_roots.oops_do(&root_cl);
+  }
+
+  // Drain stack
   while (!_visit_stack.is_empty()) {
     const oop obj = _visit_stack.pop();
 
@@ -173,23 +186,7 @@
     cl->do_object(obj);
 
     // Push members to visit
-    ZHeapIteratorPushOopClosure push_cl(this, obj);
+    ZHeapIteratorOopClosure push_cl(this, obj, _visit_referents);
     obj->oop_iterate(&push_cl);
   }
 }
-
-bool ZHeapIterator::visit_referents() const {
-  return _visit_referents;
-}
-
-void ZHeapIterator::objects_do(ObjectClosure* cl) {
-  ZHeapIteratorRootOopClosure root_cl(this, cl);
-  ZRootsIterator roots;
-
-  // Follow roots. Note that we also visit the JVMTI weak tag map
-  // as if they were strong roots to make sure we visit all tagged
-  // objects, even those that might now have become unreachable.
-  // If we didn't do this the user would have expected to see
-  // ObjectFree events for unreachable objects in the tag map.
-  roots.oops_do(&root_cl, true /* visit_jvmti_weak_export */);
-}
--- a/src/hotspot/share/gc/z/zHeapIterator.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zHeapIterator.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -33,7 +33,7 @@
 
 class ZHeapIterator : public StackObj {
   friend class ZHeapIteratorRootOopClosure;
-  friend class ZHeapIteratorPushOopClosure;
+  friend class ZHeapIteratorOopClosure;
 
 private:
   typedef ZAddressRangeMap<ZHeapIteratorBitMap*, ZPageSizeMinShift>         ZVisitMap;
@@ -44,14 +44,8 @@
   ZVisitMap   _visit_map;
   const bool  _visit_referents;
 
-  size_t object_index_max() const;
-  size_t object_index(oop obj) const;
   ZHeapIteratorBitMap* object_map(oop obj);
-
   void push(oop obj);
-  void drain(ObjectClosure* cl);
-
-  bool visit_referents() const;
 
 public:
   ZHeapIterator(bool visit_referents);
--- a/src/hotspot/share/gc/z/zInitialize.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zInitialize.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -38,8 +38,8 @@
 ZInitialize::ZInitialize(ZBarrierSet* barrier_set) {
   log_info(gc, init)("Initializing %s", ZGCName);
   log_info(gc, init)("Version: %s (%s)",
-                     Abstract_VM_Version::vm_release(),
-                     Abstract_VM_Version::jdk_debug_level());
+                     VM_Version::vm_release(),
+                     VM_Version::jdk_debug_level());
 
   // Early initialization
   ZAddressMasks::initialize();
--- a/src/hotspot/share/gc/z/zMark.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zMark.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -615,6 +615,34 @@
   stacks->free(&_allocator);
 }
 
+class ZMarkConcurrentRootsIteratorClosure : public ZRootsIteratorClosure {
+public:
+  virtual void do_oop(oop* p) {
+    ZBarrier::mark_barrier_on_oop_field(p, false /* finalizable */);
+  }
+
+  virtual void do_oop(narrowOop* p) {
+    ShouldNotReachHere();
+  }
+};
+
+
+class ZMarkConcurrentRootsTask : public ZTask {
+private:
+  ZConcurrentRootsIterator            _roots;
+  ZMarkConcurrentRootsIteratorClosure _cl;
+
+public:
+  ZMarkConcurrentRootsTask(ZMark* mark) :
+      ZTask("ZMarkConcurrentRootsTask"),
+      _roots(true /* marking */),
+      _cl() {}
+
+  virtual void work() {
+    _roots.oops_do(&_cl);
+  }
+};
+
 class ZMarkTask : public ZTask {
 private:
   ZMark* const   _mark;
@@ -637,7 +665,12 @@
   }
 };
 
-void ZMark::mark() {
+void ZMark::mark(bool initial) {
+  if (initial) {
+    ZMarkConcurrentRootsTask task(this);
+    _workers->run_concurrent(&task);
+  }
+
   ZMarkTask task(this);
   _workers->run_concurrent(&task);
 }
--- a/src/hotspot/share/gc/z/zMark.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zMark.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -108,7 +108,7 @@
   template <bool finalizable, bool publish> void mark_object(uintptr_t addr);
 
   void start();
-  void mark();
+  void mark(bool initial);
   bool end();
 
   void flush_and_free();
--- a/src/hotspot/share/gc/z/zRootsIterator.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zRootsIterator.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -28,6 +28,7 @@
 #include "code/codeCache.hpp"
 #include "compiler/oopMap.hpp"
 #include "gc/shared/oopStorageParState.inline.hpp"
+#include "gc/shared/suspendibleThreadSet.hpp"
 #include "gc/z/zGlobals.hpp"
 #include "gc/z/zNMethodTable.hpp"
 #include "gc/z/zOopClosures.inline.hpp"
@@ -52,16 +53,20 @@
 static const ZStatSubPhase ZSubPhasePauseRoots("Pause Roots");
 static const ZStatSubPhase ZSubPhasePauseRootsTeardown("Pause Roots Teardown");
 static const ZStatSubPhase ZSubPhasePauseRootsUniverse("Pause Roots Universe");
-static const ZStatSubPhase ZSubPhasePauseRootsJNIHandles("Pause Roots JNIHandles");
 static const ZStatSubPhase ZSubPhasePauseRootsObjectSynchronizer("Pause Roots ObjectSynchronizer");
 static const ZStatSubPhase ZSubPhasePauseRootsManagement("Pause Roots Management");
 static const ZStatSubPhase ZSubPhasePauseRootsJVMTIExport("Pause Roots JVMTIExport");
 static const ZStatSubPhase ZSubPhasePauseRootsJVMTIWeakExport("Pause Roots JVMTIWeakExport");
 static const ZStatSubPhase ZSubPhasePauseRootsSystemDictionary("Pause Roots SystemDictionary");
-static const ZStatSubPhase ZSubPhasePauseRootsClassLoaderDataGraph("Pause Roots ClassLoaderDataGraph");
 static const ZStatSubPhase ZSubPhasePauseRootsThreads("Pause Roots Threads");
 static const ZStatSubPhase ZSubPhasePauseRootsCodeCache("Pause Roots CodeCache");
 
+static const ZStatSubPhase ZSubPhaseConcurrentRootsSetup("Concurrent Roots Setup");
+static const ZStatSubPhase ZSubPhaseConcurrentRoots("Concurrent Roots");
+static const ZStatSubPhase ZSubPhaseConcurrentRootsTeardown("Concurrent Roots Teardown");
+static const ZStatSubPhase ZSubPhaseConcurrentRootsJNIHandles("Concurrent Roots JNIHandles");
+static const ZStatSubPhase ZSubPhaseConcurrentRootsClassLoaderDataGraph("Concurrent Roots ClassLoaderDataGraph");
+
 static const ZStatSubPhase ZSubPhasePauseWeakRootsSetup("Pause Weak Roots Setup");
 static const ZStatSubPhase ZSubPhasePauseWeakRoots("Pause Weak Roots");
 static const ZStatSubPhase ZSubPhasePauseWeakRootsTeardown("Pause Weak Roots Teardown");
@@ -128,21 +133,17 @@
 }
 
 ZRootsIterator::ZRootsIterator() :
-    _jni_handles_iter(JNIHandles::global_handles()),
     _universe(this),
     _object_synchronizer(this),
     _management(this),
     _jvmti_export(this),
     _jvmti_weak_export(this),
     _system_dictionary(this),
-    _jni_handles(this),
-    _class_loader_data_graph(this),
     _threads(this),
     _code_cache(this) {
   assert(SafepointSynchronize::is_at_safepoint(), "Should be at safepoint");
   ZStatTimer timer(ZSubPhasePauseRootsSetup);
   Threads::change_thread_claim_parity();
-  ClassLoaderDataGraph::clear_claimed_marks();
   COMPILER2_PRESENT(DerivedPointerTable::clear());
   CodeCache::gc_prologue();
   ZNMethodTable::gc_prologue();
@@ -163,11 +164,6 @@
   Universe::oops_do(cl);
 }
 
-void ZRootsIterator::do_jni_handles(ZRootsIteratorClosure* cl) {
-  ZStatTimer timer(ZSubPhasePauseRootsJNIHandles);
-  _jni_handles_iter.oops_do(cl);
-}
-
 void ZRootsIterator::do_object_synchronizer(ZRootsIteratorClosure* cl) {
   ZStatTimer timer(ZSubPhasePauseRootsObjectSynchronizer);
   ObjectSynchronizer::oops_do(cl);
@@ -194,12 +190,6 @@
   SystemDictionary::oops_do(cl);
 }
 
-void ZRootsIterator::do_class_loader_data_graph(ZRootsIteratorClosure* cl) {
-  ZStatTimer timer(ZSubPhasePauseRootsClassLoaderDataGraph);
-  CLDToOopClosure cld_cl(cl);
-  ClassLoaderDataGraph::cld_do(&cld_cl);
-}
-
 void ZRootsIterator::do_threads(ZRootsIteratorClosure* cl) {
   ZStatTimer timer(ZSubPhasePauseRootsThreads);
   ResourceMark rm;
@@ -218,8 +208,6 @@
   _management.oops_do(cl);
   _jvmti_export.oops_do(cl);
   _system_dictionary.oops_do(cl);
-  _jni_handles.oops_do(cl);
-  _class_loader_data_graph.oops_do(cl);
   _threads.oops_do(cl);
   _code_cache.oops_do(cl);
   if (visit_jvmti_weak_export) {
@@ -227,6 +215,43 @@
   }
 }
 
+ZConcurrentRootsIterator::ZConcurrentRootsIterator(bool marking) :
+    _marking(marking),
+    _sts_joiner(marking /* active */),
+    _jni_handles_iter(JNIHandles::global_handles()),
+    _jni_handles(this),
+    _class_loader_data_graph(this) {
+  ZStatTimer timer(ZSubPhaseConcurrentRootsSetup);
+  if (_marking) {
+    ClassLoaderDataGraph_lock->lock();
+    ClassLoaderDataGraph::clear_claimed_marks();
+  }
+}
+
+ZConcurrentRootsIterator::~ZConcurrentRootsIterator() {
+  ZStatTimer timer(ZSubPhaseConcurrentRootsTeardown);
+  if (_marking) {
+    ClassLoaderDataGraph_lock->unlock();
+  }
+}
+
+void ZConcurrentRootsIterator::do_jni_handles(ZRootsIteratorClosure* cl) {
+  ZStatTimer timer(ZSubPhaseConcurrentRootsJNIHandles);
+  _jni_handles_iter.oops_do(cl);
+}
+
+void ZConcurrentRootsIterator::do_class_loader_data_graph(ZRootsIteratorClosure* cl) {
+  ZStatTimer timer(ZSubPhaseConcurrentRootsClassLoaderDataGraph);
+  CLDToOopClosure cld_cl(cl, _marking ? ClassLoaderData::_claim_strong : ClassLoaderData::_claim_none);
+  ClassLoaderDataGraph::cld_do(&cld_cl);
+}
+
+void ZConcurrentRootsIterator::oops_do(ZRootsIteratorClosure* cl) {
+  ZStatTimer timer(ZSubPhaseConcurrentRoots);
+  _jni_handles.oops_do(cl);
+  _class_loader_data_graph.oops_do(cl);
+}
+
 ZWeakRootsIterator::ZWeakRootsIterator() :
     _jvmti_weak_export(this),
     _jfr_weak(this) {
--- a/src/hotspot/share/gc/z/zRootsIterator.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zRootsIterator.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -25,6 +25,7 @@
 #define SHARE_GC_Z_ZROOTSITERATOR_HPP
 
 #include "gc/shared/oopStorageParState.hpp"
+#include "gc/shared/suspendibleThreadSet.hpp"
 #include "memory/allocation.hpp"
 #include "memory/iterator.hpp"
 #include "runtime/thread.hpp"
@@ -37,8 +38,7 @@
   }
 };
 
-typedef OopStorage::ParState<false /* concurrent */, false /* is_const */> ZOopStorageIterator;
-typedef OopStorage::ParState<true /* concurrent */, false /* is_const */>  ZConcurrentOopStorageIterator;
+typedef OopStorage::ParState<true /* concurrent */, false /* is_const */> ZOopStorageIterator;
 
 template <typename T, void (T::*F)(ZRootsIteratorClosure*)>
 class ZSerialOopsDo {
@@ -86,29 +86,23 @@
 
 class ZRootsIterator {
 private:
-  ZOopStorageIterator _jni_handles_iter;
-
   void do_universe(ZRootsIteratorClosure* cl);
-  void do_jni_handles(ZRootsIteratorClosure* cl);
   void do_object_synchronizer(ZRootsIteratorClosure* cl);
   void do_management(ZRootsIteratorClosure* cl);
   void do_jvmti_export(ZRootsIteratorClosure* cl);
   void do_jvmti_weak_export(ZRootsIteratorClosure* cl);
   void do_system_dictionary(ZRootsIteratorClosure* cl);
-  void do_class_loader_data_graph(ZRootsIteratorClosure* cl);
   void do_threads(ZRootsIteratorClosure* cl);
   void do_code_cache(ZRootsIteratorClosure* cl);
 
-  ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_universe>                  _universe;
-  ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_object_synchronizer>       _object_synchronizer;
-  ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_management>                _management;
-  ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jvmti_export>              _jvmti_export;
-  ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jvmti_weak_export>         _jvmti_weak_export;
-  ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_system_dictionary>         _system_dictionary;
-  ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_jni_handles>             _jni_handles;
-  ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_class_loader_data_graph> _class_loader_data_graph;
-  ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_threads>                 _threads;
-  ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_code_cache>              _code_cache;
+  ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_universe>            _universe;
+  ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_object_synchronizer> _object_synchronizer;
+  ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_management>          _management;
+  ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jvmti_export>        _jvmti_export;
+  ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jvmti_weak_export>   _jvmti_weak_export;
+  ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_system_dictionary>   _system_dictionary;
+  ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_threads>           _threads;
+  ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_code_cache>        _code_cache;
 
 public:
   ZRootsIterator();
@@ -117,6 +111,25 @@
   void oops_do(ZRootsIteratorClosure* cl, bool visit_jvmti_weak_export = false);
 };
 
+class ZConcurrentRootsIterator {
+private:
+  const bool                 _marking;
+  SuspendibleThreadSetJoiner _sts_joiner;
+  ZOopStorageIterator        _jni_handles_iter;
+
+  void do_jni_handles(ZRootsIteratorClosure* cl);
+  void do_class_loader_data_graph(ZRootsIteratorClosure* cl);
+
+  ZParallelOopsDo<ZConcurrentRootsIterator, &ZConcurrentRootsIterator::do_jni_handles>             _jni_handles;
+  ZParallelOopsDo<ZConcurrentRootsIterator, &ZConcurrentRootsIterator::do_class_loader_data_graph> _class_loader_data_graph;
+
+public:
+  ZConcurrentRootsIterator(bool marking);
+  ~ZConcurrentRootsIterator();
+
+  void oops_do(ZRootsIteratorClosure* cl);
+};
+
 class ZWeakRootsIterator {
 private:
   void do_jvmti_weak_export(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl);
@@ -135,9 +148,9 @@
 
 class ZConcurrentWeakRootsIterator {
 private:
-  ZConcurrentOopStorageIterator _vm_weak_handles_iter;
-  ZConcurrentOopStorageIterator _jni_weak_handles_iter;
-  ZConcurrentOopStorageIterator _string_table_iter;
+  ZOopStorageIterator _vm_weak_handles_iter;
+  ZOopStorageIterator _jni_weak_handles_iter;
+  ZOopStorageIterator _string_table_iter;
 
   void do_vm_weak_handles(ZRootsIteratorClosure* cl);
   void do_jni_weak_handles(ZRootsIteratorClosure* cl);
--- a/src/hotspot/share/interpreter/interpreterRuntime.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/interpreter/interpreterRuntime.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -29,6 +29,7 @@
 #include "code/codeCache.hpp"
 #include "compiler/compileBroker.hpp"
 #include "compiler/disassembler.hpp"
+#include "gc/shared/barrierSetNMethod.hpp"
 #include "gc/shared/collectedHeap.hpp"
 #include "interpreter/interpreter.hpp"
 #include "interpreter/interpreterRuntime.hpp"
@@ -1045,6 +1046,13 @@
     Method* method =  last_frame.method();
     int bci = method->bci_from(last_frame.bcp());
     nm = method->lookup_osr_nmethod_for(bci, CompLevel_none, false);
+    BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
+    if (nm != NULL && bs_nm != NULL) {
+      // in case the transition passed a safepoint we need to barrier this again
+      if (!bs_nm->nmethod_osr_entry_barrier(nm)) {
+        nm = NULL;
+      }
+    }
   }
   if (nm != NULL && thread->is_interp_only_mode()) {
     // Normally we never get an nm if is_interp_only_mode() is true, because
@@ -1081,6 +1089,13 @@
   nmethod* osr_nm = CompilationPolicy::policy()->event(method, method, branch_bci, bci, CompLevel_none, NULL, thread);
   assert(!HAS_PENDING_EXCEPTION, "Event handler should not throw any exceptions");
 
+  BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
+  if (osr_nm != NULL && bs_nm != NULL) {
+    if (!bs_nm->nmethod_osr_entry_barrier(osr_nm)) {
+      osr_nm = NULL;
+    }
+  }
+
   if (osr_nm != NULL) {
     // We may need to do on-stack replacement which requires that no
     // monitors in the activation are biased because their
--- a/src/hotspot/share/interpreter/linkResolver.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/interpreter/linkResolver.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -974,68 +974,68 @@
     THROW_MSG(vmSymbols::java_lang_NoSuchFieldError(), field->as_C_string());
   }
 
-  if (!link_info.check_access())
-    // Access checking may be turned off when calling from within the VM.
-    return;
+  // Access checking may be turned off when calling from within the VM.
+  Klass* current_klass = link_info.current_klass();
+  if (link_info.check_access()) {
 
-  // check access
-  Klass* current_klass = link_info.current_klass();
-  check_field_accessability(current_klass, resolved_klass, sel_klass, fd, CHECK);
+    // check access
+    check_field_accessability(current_klass, resolved_klass, sel_klass, fd, CHECK);
 
-  // check for errors
-  if (is_static != fd.is_static()) {
-    ResourceMark rm(THREAD);
-    char msg[200];
-    jio_snprintf(msg, sizeof(msg), "Expected %s field %s.%s", is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string());
-    THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), msg);
-  }
-
-  // A final field can be modified only
-  // (1) by methods declared in the class declaring the field and
-  // (2) by the <clinit> method (in case of a static field)
-  //     or by the <init> method (in case of an instance field).
-  if (is_put && fd.access_flags().is_final()) {
-    ResourceMark rm(THREAD);
-    stringStream ss;
-
-    if (sel_klass != current_klass) {
-      ss.print("Update to %s final field %s.%s attempted from a different class (%s) than the field's declaring class",
-                is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string(),
-                current_klass->external_name());
-      THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string());
+    // check for errors
+    if (is_static != fd.is_static()) {
+      ResourceMark rm(THREAD);
+      char msg[200];
+      jio_snprintf(msg, sizeof(msg), "Expected %s field %s.%s", is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string());
+      THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), msg);
     }
 
-    if (fd.constants()->pool_holder()->major_version() >= 53) {
-      methodHandle m = link_info.current_method();
-      assert(!m.is_null(), "information about the current method must be available for 'put' bytecodes");
-      bool is_initialized_static_final_update = (byte == Bytecodes::_putstatic &&
-                                                 fd.is_static() &&
-                                                 !m()->is_static_initializer());
-      bool is_initialized_instance_final_update = ((byte == Bytecodes::_putfield || byte == Bytecodes::_nofast_putfield) &&
-                                                   !fd.is_static() &&
-                                                   !m->is_object_initializer());
+    // A final field can be modified only
+    // (1) by methods declared in the class declaring the field and
+    // (2) by the <clinit> method (in case of a static field)
+    //     or by the <init> method (in case of an instance field).
+    if (is_put && fd.access_flags().is_final()) {
+      ResourceMark rm(THREAD);
+      stringStream ss;
 
-      if (is_initialized_static_final_update || is_initialized_instance_final_update) {
-        ss.print("Update to %s final field %s.%s attempted from a different method (%s) than the initializer method %s ",
+      if (sel_klass != current_klass) {
+        ss.print("Update to %s final field %s.%s attempted from a different class (%s) than the field's declaring class",
                  is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string(),
-                 m()->name()->as_C_string(),
-                 is_static ? "<clinit>" : "<init>");
+                current_klass->external_name());
         THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string());
       }
+
+      if (fd.constants()->pool_holder()->major_version() >= 53) {
+        methodHandle m = link_info.current_method();
+        assert(!m.is_null(), "information about the current method must be available for 'put' bytecodes");
+        bool is_initialized_static_final_update = (byte == Bytecodes::_putstatic &&
+                                                   fd.is_static() &&
+                                                   !m()->is_static_initializer());
+        bool is_initialized_instance_final_update = ((byte == Bytecodes::_putfield || byte == Bytecodes::_nofast_putfield) &&
+                                                     !fd.is_static() &&
+                                                     !m->is_object_initializer());
+
+        if (is_initialized_static_final_update || is_initialized_instance_final_update) {
+          ss.print("Update to %s final field %s.%s attempted from a different method (%s) than the initializer method %s ",
+                   is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string(),
+                   m()->name()->as_C_string(),
+                   is_static ? "<clinit>" : "<init>");
+          THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string());
+        }
+      }
+    }
+
+    // initialize resolved_klass if necessary
+    // note 1: the klass which declared the field must be initialized (i.e, sel_klass)
+    //         according to the newest JVM spec (5.5, p.170) - was bug (gri 7/28/99)
+    //
+    // note 2: we don't want to force initialization if we are just checking
+    //         if the field access is legal; e.g., during compilation
+    if (is_static && initialize_class) {
+      sel_klass->initialize(CHECK);
     }
   }
 
-  // initialize resolved_klass if necessary
-  // note 1: the klass which declared the field must be initialized (i.e, sel_klass)
-  //         according to the newest JVM spec (5.5, p.170) - was bug (gri 7/28/99)
-  //
-  // note 2: we don't want to force initialization if we are just checking
-  //         if the field access is legal; e.g., during compilation
-  if (is_static && initialize_class) {
-    sel_klass->initialize(CHECK);
-  }
-
-  if (sel_klass != current_klass) {
+  if ((sel_klass != current_klass) && (current_klass != NULL)) {
     check_field_loader_constraints(field, sig, current_klass, sel_klass, CHECK);
   }
 
--- a/src/hotspot/share/jfr/leakprofiler/chains/rootSetClosure.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/jfr/leakprofiler/chains/rootSetClosure.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -92,7 +92,7 @@
   SaveRestoreCLDClaimBits save_restore_cld_claim_bits;
   RootSetClosureMarkScope mark_scope;
 
-  CLDToOopClosure cldt_closure(closure);
+  CLDToOopClosure cldt_closure(closure, ClassLoaderData::_claim_strong);
   ClassLoaderDataGraph::always_strong_cld_do(&cldt_closure);
   CodeBlobToOopClosure blobs(closure, false);
   Threads::oops_do(closure, &blobs);
--- a/src/hotspot/share/jfr/leakprofiler/checkpoint/rootResolver.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/jfr/leakprofiler/checkpoint/rootResolver.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -128,7 +128,7 @@
 bool ReferenceToRootClosure::do_cldg_roots() {
   assert(!complete(), "invariant");
   ReferenceLocateClosure rlc(_callback, OldObjectRoot::_class_loader_data, OldObjectRoot::_type_undetermined, NULL);
-  CLDToOopClosure cldt_closure(&rlc);
+  CLDToOopClosure cldt_closure(&rlc, ClassLoaderData::_claim_strong);
   ClassLoaderDataGraph::always_strong_cld_do(&cldt_closure);
   return rlc.complete();
 }
--- a/src/hotspot/share/jfr/leakprofiler/utilities/saveRestore.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/jfr/leakprofiler/utilities/saveRestore.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -69,12 +69,12 @@
 
 CLDClaimContext::CLDClaimContext(ClassLoaderData* cld) : _cld(cld) {
   assert(_cld->claimed(), "invariant");
-  _cld->clear_claimed();
+  _cld->clear_claim();
 }
 
 CLDClaimContext::~CLDClaimContext() {
   if (_cld != NULL) {
-    _cld->claim();
+    _cld->try_claim(ClassLoaderData::_claim_strong);
     assert(_cld->claimed(), "invariant");
   }
 }
--- a/src/hotspot/share/jvmci/jvmciJavaClasses.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/jvmci/jvmciJavaClasses.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -323,7 +323,7 @@
     static void check(oop obj, const char* field_name, int offset);                                                                                            \
     static void compute_offsets(TRAPS);                                                                                                                        \
   public:                                                                                                                                                      \
-    static InstanceKlass* klass() { return SystemDictionary::name##_klass(); }
+  static InstanceKlass* klass() { return SystemDictionary::name##_klass_is_loaded() ? SystemDictionary::name##_klass() : NULL; }
 
 #define END_CLASS };
 
--- a/src/hotspot/share/jvmci/systemDictionary_jvmci.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/jvmci/systemDictionary_jvmci.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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,68 +27,68 @@
 #if !INCLUDE_JVMCI
 #define JVMCI_WK_KLASSES_DO(do_klass)
 #else
-#define JVMCI_WK_KLASSES_DO(do_klass)                                                                                           \
-  /* JVMCI classes. These are loaded on-demand. */                                                                              \
-  do_klass(JVMCI_klass,                                  jdk_vm_ci_runtime_JVMCI,                               Jvmci) \
-  do_klass(HotSpotCompiledCode_klass,                    jdk_vm_ci_hotspot_HotSpotCompiledCode,                 Jvmci) \
-  do_klass(HotSpotCompiledCode_Comment_klass,            jdk_vm_ci_hotspot_HotSpotCompiledCode_Comment,         Jvmci) \
-  do_klass(HotSpotCompiledNmethod_klass,                 jdk_vm_ci_hotspot_HotSpotCompiledNmethod,              Jvmci) \
-  do_klass(HotSpotForeignCallTarget_klass,               jdk_vm_ci_hotspot_HotSpotForeignCallTarget,            Jvmci) \
-  do_klass(HotSpotReferenceMap_klass,                    jdk_vm_ci_hotspot_HotSpotReferenceMap,                 Jvmci) \
-  do_klass(HotSpotInstalledCode_klass,                   jdk_vm_ci_hotspot_HotSpotInstalledCode,                Jvmci) \
-  do_klass(HotSpotNmethod_klass,                         jdk_vm_ci_hotspot_HotSpotNmethod,                      Jvmci) \
-  do_klass(HotSpotResolvedJavaMethodImpl_klass,          jdk_vm_ci_hotspot_HotSpotResolvedJavaMethodImpl,       Jvmci) \
-  do_klass(HotSpotResolvedObjectTypeImpl_klass,          jdk_vm_ci_hotspot_HotSpotResolvedObjectTypeImpl,       Jvmci) \
-  do_klass(HotSpotCompressedNullConstant_klass,          jdk_vm_ci_hotspot_HotSpotCompressedNullConstant,       Jvmci) \
-  do_klass(HotSpotObjectConstantImpl_klass,              jdk_vm_ci_hotspot_HotSpotObjectConstantImpl,           Jvmci) \
-  do_klass(HotSpotMetaspaceConstantImpl_klass,           jdk_vm_ci_hotspot_HotSpotMetaspaceConstantImpl,        Jvmci) \
-  do_klass(HotSpotSentinelConstant_klass,                jdk_vm_ci_hotspot_HotSpotSentinelConstant,             Jvmci) \
-  do_klass(HotSpotStackFrameReference_klass,             jdk_vm_ci_hotspot_HotSpotStackFrameReference,          Jvmci) \
-  do_klass(HotSpotMetaData_klass,                        jdk_vm_ci_hotspot_HotSpotMetaData,                     Jvmci) \
-  do_klass(HotSpotConstantPool_klass,                    jdk_vm_ci_hotspot_HotSpotConstantPool,                 Jvmci) \
-  do_klass(HotSpotJVMCIMetaAccessContext_klass,          jdk_vm_ci_hotspot_HotSpotJVMCIMetaAccessContext,       Jvmci) \
-  do_klass(HotSpotJVMCIRuntime_klass,                    jdk_vm_ci_hotspot_HotSpotJVMCIRuntime,                 Jvmci) \
-  do_klass(HotSpotSpeculationLog_klass,                  jdk_vm_ci_hotspot_HotSpotSpeculationLog,               Jvmci) \
-  do_klass(HotSpotCompilationRequestResult_klass,        jdk_vm_ci_hotspot_HotSpotCompilationRequestResult,     Jvmci) \
-  do_klass(VMField_klass,                                jdk_vm_ci_hotspot_VMField,                             Jvmci) \
-  do_klass(VMFlag_klass,                                 jdk_vm_ci_hotspot_VMFlag,                              Jvmci) \
-  do_klass(VMIntrinsicMethod_klass,                      jdk_vm_ci_hotspot_VMIntrinsicMethod,                   Jvmci) \
-  do_klass(Assumptions_ConcreteMethod_klass,             jdk_vm_ci_meta_Assumptions_ConcreteMethod,             Jvmci) \
-  do_klass(Assumptions_NoFinalizableSubclass_klass,      jdk_vm_ci_meta_Assumptions_NoFinalizableSubclass,      Jvmci) \
-  do_klass(Assumptions_ConcreteSubtype_klass,            jdk_vm_ci_meta_Assumptions_ConcreteSubtype,            Jvmci) \
-  do_klass(Assumptions_LeafType_klass,                   jdk_vm_ci_meta_Assumptions_LeafType,                   Jvmci) \
-  do_klass(Assumptions_CallSiteTargetValue_klass,        jdk_vm_ci_meta_Assumptions_CallSiteTargetValue,        Jvmci) \
-  do_klass(Architecture_klass,                           jdk_vm_ci_code_Architecture,                           Jvmci) \
-  do_klass(TargetDescription_klass,                      jdk_vm_ci_code_TargetDescription,                      Jvmci) \
-  do_klass(BytecodePosition_klass,                       jdk_vm_ci_code_BytecodePosition,                       Jvmci) \
-  do_klass(DebugInfo_klass,                              jdk_vm_ci_code_DebugInfo,                              Jvmci) \
-  do_klass(RegisterSaveLayout_klass,                     jdk_vm_ci_code_RegisterSaveLayout,                     Jvmci) \
-  do_klass(BytecodeFrame_klass,                          jdk_vm_ci_code_BytecodeFrame,                          Jvmci) \
-  do_klass(InstalledCode_klass,                          jdk_vm_ci_code_InstalledCode,                          Jvmci) \
-  do_klass(code_Location_klass,                          jdk_vm_ci_code_Location,                               Jvmci) \
-  do_klass(code_Register_klass,                          jdk_vm_ci_code_Register,                               Jvmci) \
-  do_klass(RegisterValue_klass,                          jdk_vm_ci_code_RegisterValue,                          Jvmci) \
-  do_klass(StackSlot_klass,                              jdk_vm_ci_code_StackSlot,                              Jvmci) \
-  do_klass(StackLockValue_klass,                         jdk_vm_ci_code_StackLockValue,                         Jvmci) \
-  do_klass(VirtualObject_klass,                          jdk_vm_ci_code_VirtualObject,                          Jvmci) \
-  do_klass(site_Call_klass,                              jdk_vm_ci_code_site_Call,                              Jvmci) \
-  do_klass(site_ConstantReference_klass,                 jdk_vm_ci_code_site_ConstantReference,                 Jvmci) \
-  do_klass(site_DataPatch_klass,                         jdk_vm_ci_code_site_DataPatch,                         Jvmci) \
-  do_klass(site_DataSectionReference_klass,              jdk_vm_ci_code_site_DataSectionReference,              Jvmci) \
-  do_klass(site_ExceptionHandler_klass,                  jdk_vm_ci_code_site_ExceptionHandler,                  Jvmci) \
-  do_klass(site_Mark_klass,                              jdk_vm_ci_code_site_Mark,                              Jvmci) \
-  do_klass(site_Infopoint_klass,                         jdk_vm_ci_code_site_Infopoint,                         Jvmci) \
-  do_klass(site_Site_klass,                              jdk_vm_ci_code_site_Site,                              Jvmci) \
-  do_klass(site_InfopointReason_klass,                   jdk_vm_ci_code_site_InfopointReason,                   Jvmci) \
-  do_klass(InspectedFrameVisitor_klass,                  jdk_vm_ci_code_stack_InspectedFrameVisitor,            Jvmci) \
-  do_klass(JavaConstant_klass,                           jdk_vm_ci_meta_JavaConstant,                           Jvmci) \
-  do_klass(PrimitiveConstant_klass,                      jdk_vm_ci_meta_PrimitiveConstant,                      Jvmci) \
-  do_klass(RawConstant_klass,                            jdk_vm_ci_meta_RawConstant,                            Jvmci) \
-  do_klass(NullConstant_klass,                           jdk_vm_ci_meta_NullConstant,                           Jvmci) \
-  do_klass(ExceptionHandler_klass,                       jdk_vm_ci_meta_ExceptionHandler,                       Jvmci) \
-  do_klass(JavaKind_klass,                               jdk_vm_ci_meta_JavaKind,                               Jvmci) \
-  do_klass(ValueKind_klass,                              jdk_vm_ci_meta_ValueKind,                              Jvmci) \
-  do_klass(Value_klass,                                  jdk_vm_ci_meta_Value,                                  Jvmci)
+#define JVMCI_WK_KLASSES_DO(do_klass)                                                                      \
+  /* JVMCI classes. These are loaded on-demand. */                                                         \
+  do_klass(JVMCI_klass,                                  jdk_vm_ci_runtime_JVMCI                          ) \
+  do_klass(HotSpotCompiledCode_klass,                    jdk_vm_ci_hotspot_HotSpotCompiledCode            ) \
+  do_klass(HotSpotCompiledCode_Comment_klass,            jdk_vm_ci_hotspot_HotSpotCompiledCode_Comment    ) \
+  do_klass(HotSpotCompiledNmethod_klass,                 jdk_vm_ci_hotspot_HotSpotCompiledNmethod         ) \
+  do_klass(HotSpotForeignCallTarget_klass,               jdk_vm_ci_hotspot_HotSpotForeignCallTarget       ) \
+  do_klass(HotSpotReferenceMap_klass,                    jdk_vm_ci_hotspot_HotSpotReferenceMap            ) \
+  do_klass(HotSpotInstalledCode_klass,                   jdk_vm_ci_hotspot_HotSpotInstalledCode           ) \
+  do_klass(HotSpotNmethod_klass,                         jdk_vm_ci_hotspot_HotSpotNmethod                 ) \
+  do_klass(HotSpotResolvedJavaMethodImpl_klass,          jdk_vm_ci_hotspot_HotSpotResolvedJavaMethodImpl  ) \
+  do_klass(HotSpotResolvedObjectTypeImpl_klass,          jdk_vm_ci_hotspot_HotSpotResolvedObjectTypeImpl  ) \
+  do_klass(HotSpotCompressedNullConstant_klass,          jdk_vm_ci_hotspot_HotSpotCompressedNullConstant  ) \
+  do_klass(HotSpotObjectConstantImpl_klass,              jdk_vm_ci_hotspot_HotSpotObjectConstantImpl      ) \
+  do_klass(HotSpotMetaspaceConstantImpl_klass,           jdk_vm_ci_hotspot_HotSpotMetaspaceConstantImpl   ) \
+  do_klass(HotSpotSentinelConstant_klass,                jdk_vm_ci_hotspot_HotSpotSentinelConstant        ) \
+  do_klass(HotSpotStackFrameReference_klass,             jdk_vm_ci_hotspot_HotSpotStackFrameReference     ) \
+  do_klass(HotSpotMetaData_klass,                        jdk_vm_ci_hotspot_HotSpotMetaData                ) \
+  do_klass(HotSpotConstantPool_klass,                    jdk_vm_ci_hotspot_HotSpotConstantPool            ) \
+  do_klass(HotSpotJVMCIMetaAccessContext_klass,          jdk_vm_ci_hotspot_HotSpotJVMCIMetaAccessContext  ) \
+  do_klass(HotSpotJVMCIRuntime_klass,                    jdk_vm_ci_hotspot_HotSpotJVMCIRuntime            ) \
+  do_klass(HotSpotSpeculationLog_klass,                  jdk_vm_ci_hotspot_HotSpotSpeculationLog          ) \
+  do_klass(HotSpotCompilationRequestResult_klass,        jdk_vm_ci_hotspot_HotSpotCompilationRequestResult) \
+  do_klass(VMField_klass,                                jdk_vm_ci_hotspot_VMField                        ) \
+  do_klass(VMFlag_klass,                                 jdk_vm_ci_hotspot_VMFlag                         ) \
+  do_klass(VMIntrinsicMethod_klass,                      jdk_vm_ci_hotspot_VMIntrinsicMethod              ) \
+  do_klass(Assumptions_ConcreteMethod_klass,             jdk_vm_ci_meta_Assumptions_ConcreteMethod        ) \
+  do_klass(Assumptions_NoFinalizableSubclass_klass,      jdk_vm_ci_meta_Assumptions_NoFinalizableSubclass ) \
+  do_klass(Assumptions_ConcreteSubtype_klass,            jdk_vm_ci_meta_Assumptions_ConcreteSubtype       ) \
+  do_klass(Assumptions_LeafType_klass,                   jdk_vm_ci_meta_Assumptions_LeafType              ) \
+  do_klass(Assumptions_CallSiteTargetValue_klass,        jdk_vm_ci_meta_Assumptions_CallSiteTargetValue   ) \
+  do_klass(Architecture_klass,                           jdk_vm_ci_code_Architecture                      ) \
+  do_klass(TargetDescription_klass,                      jdk_vm_ci_code_TargetDescription                 ) \
+  do_klass(BytecodePosition_klass,                       jdk_vm_ci_code_BytecodePosition                  ) \
+  do_klass(DebugInfo_klass,                              jdk_vm_ci_code_DebugInfo                         ) \
+  do_klass(RegisterSaveLayout_klass,                     jdk_vm_ci_code_RegisterSaveLayout                ) \
+  do_klass(BytecodeFrame_klass,                          jdk_vm_ci_code_BytecodeFrame                     ) \
+  do_klass(InstalledCode_klass,                          jdk_vm_ci_code_InstalledCode                     ) \
+  do_klass(code_Location_klass,                          jdk_vm_ci_code_Location                          ) \
+  do_klass(code_Register_klass,                          jdk_vm_ci_code_Register                          ) \
+  do_klass(RegisterValue_klass,                          jdk_vm_ci_code_RegisterValue                     ) \
+  do_klass(StackSlot_klass,                              jdk_vm_ci_code_StackSlot                         ) \
+  do_klass(StackLockValue_klass,                         jdk_vm_ci_code_StackLockValue                    ) \
+  do_klass(VirtualObject_klass,                          jdk_vm_ci_code_VirtualObject                     ) \
+  do_klass(site_Call_klass,                              jdk_vm_ci_code_site_Call                         ) \
+  do_klass(site_ConstantReference_klass,                 jdk_vm_ci_code_site_ConstantReference            ) \
+  do_klass(site_DataPatch_klass,                         jdk_vm_ci_code_site_DataPatch                    ) \
+  do_klass(site_DataSectionReference_klass,              jdk_vm_ci_code_site_DataSectionReference         ) \
+  do_klass(site_ExceptionHandler_klass,                  jdk_vm_ci_code_site_ExceptionHandler             ) \
+  do_klass(site_Mark_klass,                              jdk_vm_ci_code_site_Mark                         ) \
+  do_klass(site_Infopoint_klass,                         jdk_vm_ci_code_site_Infopoint                    ) \
+  do_klass(site_Site_klass,                              jdk_vm_ci_code_site_Site                         ) \
+  do_klass(site_InfopointReason_klass,                   jdk_vm_ci_code_site_InfopointReason              ) \
+  do_klass(InspectedFrameVisitor_klass,                  jdk_vm_ci_code_stack_InspectedFrameVisitor       ) \
+  do_klass(JavaConstant_klass,                           jdk_vm_ci_meta_JavaConstant                      ) \
+  do_klass(PrimitiveConstant_klass,                      jdk_vm_ci_meta_PrimitiveConstant                 ) \
+  do_klass(RawConstant_klass,                            jdk_vm_ci_meta_RawConstant                       ) \
+  do_klass(NullConstant_klass,                           jdk_vm_ci_meta_NullConstant                      ) \
+  do_klass(ExceptionHandler_klass,                       jdk_vm_ci_meta_ExceptionHandler                  ) \
+  do_klass(JavaKind_klass,                               jdk_vm_ci_meta_JavaKind                          ) \
+  do_klass(ValueKind_klass,                              jdk_vm_ci_meta_ValueKind                         ) \
+  do_klass(Value_klass,                                  jdk_vm_ci_meta_Value                             )
 #endif
 
 #endif // SHARE_VM_JVMCI_SYSTEMDICTIONARY_JVMCI_HPP
--- a/src/hotspot/share/memory/iterator.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/memory/iterator.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -32,7 +32,7 @@
 DoNothingClosure do_nothing_cl;
 
 void CLDToOopClosure::do_cld(ClassLoaderData* cld) {
-  cld->oops_do(_oop_closure, _must_claim_cld);
+  cld->oops_do(_oop_closure, _cld_claim);
 }
 
 void ObjectToOopClosure::do_object(oop obj) {
--- a/src/hotspot/share/memory/iterator.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/memory/iterator.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -127,12 +127,13 @@
 
 class CLDToOopClosure : public CLDClosure {
   OopClosure*       _oop_closure;
-  bool              _must_claim_cld;
+  int               _cld_claim;
 
  public:
-  CLDToOopClosure(OopClosure* oop_closure, bool must_claim_cld = true) :
+  CLDToOopClosure(OopClosure* oop_closure,
+                  int cld_claim) :
       _oop_closure(oop_closure),
-      _must_claim_cld(must_claim_cld) {}
+      _cld_claim(cld_claim) {}
 
   void do_cld(ClassLoaderData* cld);
 };
--- a/src/hotspot/share/memory/iterator.inline.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/memory/iterator.inline.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -39,8 +39,7 @@
 #include "utilities/debug.hpp"
 
 inline void MetadataVisitingOopIterateClosure::do_cld(ClassLoaderData* cld) {
-  bool claim = true;  // Must claim the class loader data before processing.
-  cld->oops_do(this, claim);
+  cld->oops_do(this, ClassLoaderData::_claim_strong);
 }
 
 inline void MetadataVisitingOopIterateClosure::do_klass(Klass* k) {
--- a/src/hotspot/share/oops/instanceKlass.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/oops/instanceKlass.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -1195,7 +1195,7 @@
 
   // Iterate over all oop fields and metadata.
   template <typename T, class OopClosureType>
-  inline int oop_oop_iterate(oop obj, OopClosureType* closure);
+  inline void oop_oop_iterate(oop obj, OopClosureType* closure);
 
   // Iterate over all oop fields in one oop map.
   template <typename T, class OopClosureType>
@@ -1205,7 +1205,7 @@
   // Reverse iteration
   // Iterate over all oop fields and metadata.
   template <typename T, class OopClosureType>
-  inline int oop_oop_iterate_reverse(oop obj, OopClosureType* closure);
+  inline void oop_oop_iterate_reverse(oop obj, OopClosureType* closure);
 
  private:
   // Iterate over all oop fields in the oop maps.
@@ -1225,7 +1225,7 @@
 
   // Iterate over all oop fields and metadata.
   template <typename T, class OopClosureType>
-  inline int oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr);
+  inline void oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr);
 
  private:
   // Iterate over all oop fields in one oop map.
--- a/src/hotspot/share/oops/instanceKlass.inline.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/oops/instanceKlass.inline.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -130,28 +130,24 @@
 }
 
 template <typename T, class OopClosureType>
-ALWAYSINLINE int InstanceKlass::oop_oop_iterate(oop obj, OopClosureType* closure) {
+ALWAYSINLINE void InstanceKlass::oop_oop_iterate(oop obj, OopClosureType* closure) {
   if (Devirtualizer::do_metadata(closure)) {
     Devirtualizer::do_klass(closure, this);
   }
 
   oop_oop_iterate_oop_maps<T>(obj, closure);
-
-  return size_helper();
 }
 
 template <typename T, class OopClosureType>
-ALWAYSINLINE int InstanceKlass::oop_oop_iterate_reverse(oop obj, OopClosureType* closure) {
+ALWAYSINLINE void InstanceKlass::oop_oop_iterate_reverse(oop obj, OopClosureType* closure) {
   assert(!Devirtualizer::do_metadata(closure),
       "Code to handle metadata is not implemented");
 
   oop_oop_iterate_oop_maps_reverse<T>(obj, closure);
-
-  return size_helper();
 }
 
 template <typename T, class OopClosureType>
-ALWAYSINLINE int InstanceKlass::oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr) {
+ALWAYSINLINE void InstanceKlass::oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr) {
   if (Devirtualizer::do_metadata(closure)) {
     if (mr.contains(obj)) {
       Devirtualizer::do_klass(closure, this);
@@ -159,8 +155,6 @@
   }
 
   oop_oop_iterate_oop_maps_bounded<T>(obj, closure, mr);
-
-  return size_helper();
 }
 
 #endif // SHARE_VM_OOPS_INSTANCEKLASS_INLINE_HPP
--- a/src/hotspot/share/oops/symbol.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/oops/symbol.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -294,28 +294,20 @@
 }
 
 void Symbol::print_on(outputStream* st) const {
-  if (this == NULL) {
-    st->print_cr("NULL");
-  } else {
-    st->print("Symbol: '");
-    print_symbol_on(st);
-    st->print("'");
-    st->print(" count %d", refcount());
-  }
+  st->print("Symbol: '");
+  print_symbol_on(st);
+  st->print("'");
+  st->print(" count %d", refcount());
 }
 
 // The print_value functions are present in all builds, to support the
 // disassembler and error reporting.
 void Symbol::print_value_on(outputStream* st) const {
-  if (this == NULL) {
-    st->print("NULL");
-  } else {
-    st->print("'");
-    for (int i = 0; i < utf8_length(); i++) {
-      st->print("%c", char_at(i));
-    }
-    st->print("'");
+  st->print("'");
+  for (int i = 0; i < utf8_length(); i++) {
+    st->print("%c", char_at(i));
   }
+  st->print("'");
 }
 
 bool Symbol::is_valid(Symbol* s) {
--- a/src/hotspot/share/opto/cfgnode.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/opto/cfgnode.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -714,10 +714,151 @@
     }
   }
 
+  if (can_reshape) {
+    modified |= optimize_trichotomy(phase->is_IterGVN());
+  }
+
   return modified ? this : NULL;
 }
 
-
+//------------------------------optimize_trichotomy--------------------------
+// Optimize nested comparisons of the following kind:
+//
+// int compare(int a, int b) {
+//   return (a < b) ? -1 : (a == b) ? 0 : 1;
+// }
+//
+// Shape 1:
+// if (compare(a, b) == 1) { ... } -> if (a > b) { ... }
+//
+// Shape 2:
+// if (compare(a, b) == 0) { ... } -> if (a == b) { ... }
+//
+// Above code leads to the following IR shapes where both Ifs compare the
+// same value and two out of three region inputs idx1 and idx2 map to
+// the same value and control flow.
+//
+// (1)   If                 (2)   If
+//      /  \                     /  \
+//   Proj  Proj               Proj  Proj
+//     |      \                |      \
+//     |       If              |      If                      If
+//     |      /  \             |     /  \                    /  \
+//     |   Proj  Proj          |  Proj  Proj      ==>     Proj  Proj
+//     |   /      /            \    |    /                  |    /
+//    Region     /              \   |   /                   |   /
+//         \    /                \  |  /                    |  /
+//         Region                Region                    Region
+//
+// The method returns true if 'this' is modified and false otherwise.
+bool RegionNode::optimize_trichotomy(PhaseIterGVN* igvn) {
+  int idx1 = 1, idx2 = 2;
+  Node* region = NULL;
+  if (req() == 3 && in(1) != NULL && in(2) != NULL) {
+    // Shape 1: Check if one of the inputs is a region that merges two control
+    // inputs and has no other users (especially no Phi users).
+    region = in(1)->isa_Region() ? in(1) : in(2)->isa_Region();
+    if (region == NULL || region->outcnt() != 2 || region->req() != 3) {
+      return false; // No suitable region input found
+    }
+  } else if (req() == 4) {
+    // Shape 2: Check if two control inputs map to the same value of the unique phi
+    // user and treat these as if they would come from another region (shape (1)).
+    PhiNode* phi = has_unique_phi();
+    if (phi == NULL) {
+      return false; // No unique phi user
+    }
+    if (phi->in(idx1) != phi->in(idx2)) {
+      idx2 = 3;
+      if (phi->in(idx1) != phi->in(idx2)) {
+        idx1 = 2;
+        if (phi->in(idx1) != phi->in(idx2)) {
+          return false; // No equal phi inputs found
+        }
+      }
+    }
+    assert(phi->in(idx1) == phi->in(idx2), "must be"); // Region is merging same value
+    region = this;
+  }
+  if (region == NULL || region->in(idx1) == NULL || region->in(idx2) == NULL) {
+    return false; // Region does not merge two control inputs
+  }
+  // At this point we know that region->in(idx1) and region->(idx2) map to the same
+  // value and control flow. Now search for ifs that feed into these region inputs.
+  ProjNode* proj1 = region->in(idx1)->isa_Proj();
+  ProjNode* proj2 = region->in(idx2)->isa_Proj();
+  if (proj1 == NULL || proj1->outcnt() != 1 ||
+      proj2 == NULL || proj2->outcnt() != 1) {
+    return false; // No projection inputs with region as unique user found
+  }
+  assert(proj1 != proj2, "should be different projections");
+  IfNode* iff1 = proj1->in(0)->isa_If();
+  IfNode* iff2 = proj2->in(0)->isa_If();
+  if (iff1 == NULL || iff1->outcnt() != 2 ||
+      iff2 == NULL || iff2->outcnt() != 2) {
+    return false; // No ifs found
+  }
+  if (iff1 == iff2) {
+    igvn->add_users_to_worklist(iff1); // Make sure dead if is eliminated
+    igvn->replace_input_of(region, idx1, iff1->in(0));
+    igvn->replace_input_of(region, idx2, igvn->C->top());
+    return (region == this); // Remove useless if (both projections map to the same control/value)
+  }
+  BoolNode* bol1 = iff1->in(1)->isa_Bool();
+  BoolNode* bol2 = iff2->in(1)->isa_Bool();
+  if (bol1 == NULL || bol2 == NULL) {
+    return false; // No bool inputs found
+  }
+  Node* cmp1 = bol1->in(1);
+  Node* cmp2 = bol2->in(1);
+  bool commute = false;
+  if (!cmp1->is_Cmp() || !cmp2->is_Cmp()) {
+    return false; // No comparison
+  } else if (cmp1->Opcode() == Op_CmpF || cmp1->Opcode() == Op_CmpD ||
+             cmp2->Opcode() == Op_CmpF || cmp2->Opcode() == Op_CmpD ||
+             cmp1->Opcode() == Op_CmpP || cmp1->Opcode() == Op_CmpN ||
+             cmp2->Opcode() == Op_CmpP || cmp2->Opcode() == Op_CmpN) {
+    // Floats and pointers don't exactly obey trichotomy. To be on the safe side, don't transform their tests.
+    return false;
+  } else if (cmp1 != cmp2) {
+    if (cmp1->in(1) == cmp2->in(2) &&
+        cmp1->in(2) == cmp2->in(1)) {
+      commute = true; // Same but swapped inputs, commute the test
+    } else {
+      return false; // Ifs are not comparing the same values
+    }
+  }
+  proj1 = proj1->other_if_proj();
+  proj2 = proj2->other_if_proj();
+  if (!((proj1->unique_ctrl_out() == iff2 &&
+         proj2->unique_ctrl_out() == this) ||
+        (proj2->unique_ctrl_out() == iff1 &&
+         proj1->unique_ctrl_out() == this))) {
+    return false; // Ifs are not connected through other projs
+  }
+  // Found 'iff -> proj -> iff -> proj -> this' shape where all other projs are merged
+  // through 'region' and map to the same value. Merge the boolean tests and replace
+  // the ifs by a single comparison.
+  BoolTest test1 = (proj1->_con == 1) ? bol1->_test : bol1->_test.negate();
+  BoolTest test2 = (proj2->_con == 1) ? bol2->_test : bol2->_test.negate();
+  test1 = commute ? test1.commute() : test1;
+  // After possibly commuting test1, if we can merge test1 & test2, then proj2/iff2/bol2 are the nodes to refine.
+  BoolTest::mask res = test1.merge(test2);
+  if (res == BoolTest::illegal) {
+    return false; // Unable to merge tests
+  }
+  // Adjust iff1 to always pass (only iff2 will remain)
+  igvn->replace_input_of(iff1, 1, igvn->intcon(proj1->_con));
+  if (res == BoolTest::never) {
+    // Merged test is always false, adjust iff2 to always fail
+    igvn->replace_input_of(iff2, 1, igvn->intcon(1 - proj2->_con));
+  } else {
+    // Replace bool input of iff2 with merged test
+    BoolNode* new_bol = new BoolNode(bol2->in(1), res);
+    igvn->replace_input_of(iff2, 1, igvn->transform((proj2->_con == 1) ? new_bol : new_bol->negate(igvn)));
+  }
+  return false;
+}
 
 const RegMask &RegionNode::out_RegMask() const {
   return RegMask::Empty;
--- a/src/hotspot/share/opto/cfgnode.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/opto/cfgnode.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -96,6 +96,7 @@
   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
   virtual const RegMask &out_RegMask() const;
   bool try_clean_mem_phi(PhaseGVN *phase);
+  bool optimize_trichotomy(PhaseIterGVN* igvn);
 };
 
 //------------------------------JProjNode--------------------------------------
--- a/src/hotspot/share/opto/node.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/opto/node.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -899,6 +899,13 @@
     return (Node*) this;
 }
 
+bool Node::eqv_uncast(const Node* n) const {
+  BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
+  Node* obj1 = bs->step_over_gc_barrier(const_cast<Node*>(this));
+  Node* obj2 = bs->step_over_gc_barrier(const_cast<Node*>(n));
+  return (obj1->uncast() == obj2->uncast());
+}
+
 // Find out of current node that matches opcode.
 Node* Node::find_out_with(int opcode) {
   for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) {
--- a/src/hotspot/share/opto/node.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/opto/node.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -457,10 +457,9 @@
 
   // Strip away casting.  (It is depth-limited.)
   Node* uncast() const;
-  // Return whether two Nodes are equivalent, after stripping casting.
-  bool eqv_uncast(const Node* n) const {
-    return (this->uncast() == n->uncast());
-  }
+  // Return whether two Nodes are equivalent, after stripping casting
+  // and GC barriers.
+  bool eqv_uncast(const Node* n) const;
 
   // Find out of current node that matches opcode.
   Node* find_out_with(int opcode);
--- a/src/hotspot/share/opto/subnode.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/opto/subnode.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -1252,6 +1252,24 @@
   st->print("%s", msg[_test]);
 }
 
+// Returns the logical AND of two tests (or 'never' if both tests can never be true).
+// For example, a test for 'le' followed by a test for 'lt' is equivalent with 'lt'.
+BoolTest::mask BoolTest::merge(BoolTest other) const {
+  const mask res[illegal+1][illegal+1] = {
+    // eq,      gt,      of,      lt,      ne,      le,      nof,     ge,      never,   illegal
+      {eq,      never,   illegal, never,   never,   eq,      illegal, eq,      never,   illegal},  // eq
+      {never,   gt,      illegal, never,   gt,      never,   illegal, gt,      never,   illegal},  // gt
+      {illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal, never,   illegal},  // of
+      {never,   never,   illegal, lt,      lt,      lt,      illegal, never,   never,   illegal},  // lt
+      {never,   gt,      illegal, lt,      ne,      lt,      illegal, gt,      never,   illegal},  // ne
+      {eq,      never,   illegal, lt,      lt,      le,      illegal, eq,      never,   illegal},  // le
+      {illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal, never,   illegal},  // nof
+      {eq,      gt,      illegal, never,   gt,      eq,      illegal, ge,      never,   illegal},  // ge
+      {never,   never,   never,   never,   never,   never,   never,   never,   never,   illegal},  // never
+      {illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal}}; // illegal
+  return res[_test][other._test];
+}
+
 //=============================================================================
 uint BoolNode::hash() const { return (Node::hash() << 3)|(_test._test+1); }
 uint BoolNode::size_of() const { return sizeof(BoolNode); }
--- a/src/hotspot/share/opto/subnode.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/opto/subnode.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -280,7 +280,7 @@
 // We pick the values as 3 bits; the low order 2 bits we compare against the
 // condition codes, the high bit flips the sense of the result.
 struct BoolTest {
-  enum mask { eq = 0, ne = 4, le = 5, ge = 7, lt = 3, gt = 1, overflow = 2, no_overflow = 6, illegal = 8 };
+  enum mask { eq = 0, ne = 4, le = 5, ge = 7, lt = 3, gt = 1, overflow = 2, no_overflow = 6, never = 8, illegal = 9 };
   mask _test;
   BoolTest( mask btm ) : _test(btm) {}
   const Type *cc2logical( const Type *CC ) const;
@@ -293,6 +293,7 @@
   bool is_less( )  const { return _test == BoolTest::lt || _test == BoolTest::le; }
   bool is_greater( ) const { return _test == BoolTest::gt || _test == BoolTest::ge; }
   void dump_on(outputStream *st) const;
+  mask merge(BoolTest other) const;
 };
 
 //------------------------------BoolNode---------------------------------------
--- a/src/hotspot/share/prims/jvm.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/prims/jvm.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -3736,8 +3736,8 @@
 {
   memset(info, 0, info_size);
 
-  info->jvm_version = Abstract_VM_Version::jvm_version();
-  info->patch_version = Abstract_VM_Version::vm_patch_version();
+  info->jvm_version = VM_Version::jvm_version();
+  info->patch_version = VM_Version::vm_patch_version();
 
   // when we add a new capability in the jvm_version_info struct, we should also
   // consider to expose this new capability in the sun.rt.jvmCapabilities jvmstat
--- a/src/hotspot/share/prims/jvmtiEnv.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/prims/jvmtiEnv.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -919,7 +919,7 @@
   thread_objs = NEW_RESOURCE_ARRAY(Handle, nthreads);
   NULL_CHECK(thread_objs, JVMTI_ERROR_OUT_OF_MEMORY);
 
-  for (int i=0; i < nthreads; i++) {
+  for (int i = 0; i < nthreads; i++) {
     thread_objs[i] = Handle(tle.get_threadObj(i));
   }
 
@@ -1144,16 +1144,14 @@
   Handle context_class_loader;
   bool          is_daemon;
 
-  { MutexLocker mu(Threads_lock);
-
-    name = Handle(current_thread, java_lang_Thread::name(thread_obj()));
-    priority = java_lang_Thread::priority(thread_obj());
-    thread_group = Handle(current_thread, java_lang_Thread::threadGroup(thread_obj()));
-    is_daemon = java_lang_Thread::is_daemon(thread_obj());
-
-    oop loader = java_lang_Thread::context_class_loader(thread_obj());
-    context_class_loader = Handle(current_thread, loader);
-  }
+  name = Handle(current_thread, java_lang_Thread::name(thread_obj()));
+  priority = java_lang_Thread::priority(thread_obj());
+  thread_group = Handle(current_thread, java_lang_Thread::threadGroup(thread_obj()));
+  is_daemon = java_lang_Thread::is_daemon(thread_obj());
+
+  oop loader = java_lang_Thread::context_class_loader(thread_obj());
+  context_class_loader = Handle(current_thread, loader);
+
   { const char *n;
 
     if (name() != NULL) {
@@ -1402,13 +1400,10 @@
   bool is_daemon;
   ThreadPriority max_priority;
 
-  { MutexLocker mu(Threads_lock);
-
-    name         = java_lang_ThreadGroup::name(group_obj());
-    parent_group = Handle(current_thread, java_lang_ThreadGroup::parent(group_obj()));
-    is_daemon    = java_lang_ThreadGroup::is_daemon(group_obj());
-    max_priority = java_lang_ThreadGroup::maxPriority(group_obj());
-  }
+  name         = java_lang_ThreadGroup::name(group_obj());
+  parent_group = Handle(current_thread, java_lang_ThreadGroup::parent(group_obj()));
+  is_daemon    = java_lang_ThreadGroup::is_daemon(group_obj());
+  max_priority = java_lang_ThreadGroup::maxPriority(group_obj());
 
   info_ptr->is_daemon    = is_daemon;
   info_ptr->max_priority = max_priority;
@@ -1448,7 +1443,7 @@
   Handle group_hdl(current_thread, group_obj);
 
   { // Cannot allow thread or group counts to change.
-    MutexLocker mu(Threads_lock);
+    ObjectLocker ol(group_hdl, current_thread);
 
     nthreads = java_lang_ThreadGroup::nthreads(group_hdl());
     ngroups  = java_lang_ThreadGroup::ngroups(group_hdl());
@@ -1458,7 +1453,7 @@
       objArrayOop threads = java_lang_ThreadGroup::threads(group_hdl());
       assert(nthreads <= threads->length(), "too many threads");
       thread_objs = NEW_RESOURCE_ARRAY(Handle,nthreads);
-      for (int i=0, j=0; i<nthreads; i++) {
+      for (int i = 0, j = 0; i < nthreads; i++) {
         oop thread_obj = threads->obj_at(i);
         assert(thread_obj != NULL, "thread_obj is NULL");
         JavaThread *java_thread = NULL;
@@ -1490,15 +1485,14 @@
       objArrayOop groups = java_lang_ThreadGroup::groups(group_hdl());
       assert(ngroups <= groups->length(), "too many groups");
       group_objs = NEW_RESOURCE_ARRAY(Handle,ngroups);
-      for (int i=0; i<ngroups; i++) {
+      for (int i = 0; i < ngroups; i++) {
         oop group_obj = groups->obj_at(i);
         assert(group_obj != NULL, "group_obj != NULL");
         group_objs[i] = Handle(current_thread, group_obj);
       }
     }
-  }
-
-  // have to make global handles outside of Threads_lock
+  } // ThreadGroup unlocked here
+
   *group_count_ptr  = ngroups;
   *thread_count_ptr = nthreads;
   *threads_ptr     = new_jthreadArray(nthreads, thread_objs);
@@ -3246,7 +3240,7 @@
       // objects that are locked.
       int r;
       intptr_t recursion = rmonitor->recursions();
-      for (intptr_t i=0; i <= recursion; i++) {
+      for (intptr_t i = 0; i <= recursion; i++) {
         r = rmonitor->raw_exit(thread);
         assert(r == ObjectMonitor::OM_OK, "raw_exit should have worked");
         if (r != ObjectMonitor::OM_OK) {  // robustness
@@ -3676,7 +3670,7 @@
         strcpy(*tmp_value, key);
       } else {
         // clean up previously allocated memory.
-        for (int j=0; j<readable_count; j++) {
+        for (int j = 0; j < readable_count; j++) {
           Deallocate((unsigned char*)*property_ptr+j);
         }
         Deallocate((unsigned char*)property_ptr);
--- a/src/hotspot/share/prims/jvmtiExport.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/prims/jvmtiExport.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -1044,7 +1044,7 @@
  public:
    JvmtiObjectAllocEventMark(JavaThread *thread, oop obj) : JvmtiClassEventMark(thread, oop_to_klass(obj)) {
      _jobj = (jobject)to_jobject(obj);
-     _size = obj->size() * wordSize;
+     _size = Universe::heap()->obj_size(obj) * wordSize;
    };
    jobject jni_jobject() { return _jobj; }
    jlong size() { return _size; }
--- a/src/hotspot/share/prims/jvmtiTagMap.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/prims/jvmtiTagMap.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -105,7 +105,7 @@
   }
 
   inline bool equals(oop object) {
-    return object == object_peek();
+    return oopDesc::equals(object, object_peek());
   }
 
   inline JvmtiTagHashmapEntry* next() const        { return _next; }
@@ -186,6 +186,7 @@
 
     // shift right to get better distribution (as these bits will be zero
     // with aligned addresses)
+    key = Access<>::resolve(key);
     unsigned int addr = (unsigned int)(cast_from_oop<intptr_t>(key));
 #ifdef _LP64
     return (addr >> 3) % size;
--- a/src/hotspot/share/runtime/arguments.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/runtime/arguments.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -106,6 +106,9 @@
 AgentLibraryList Arguments::_libraryList;
 AgentLibraryList Arguments::_agentList;
 
+// These are not set by the JDK's built-in launchers, but they can be set by
+// programs that embed the JVM using JNI_CreateJavaVM. See comments around
+// JavaVMOption in jni.h.
 abort_hook_t     Arguments::_abort_hook         = NULL;
 exit_hook_t      Arguments::_exit_hook          = NULL;
 vfprintf_hook_t  Arguments::_vfprintf_hook      = NULL;
--- a/src/hotspot/share/runtime/arguments.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/runtime/arguments.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -36,7 +36,7 @@
 
 // Arguments parses the command line and recognizes options
 
-// Invocation API hook typedefs (these should really be defined in jni.hpp)
+// Invocation API hook typedefs (these should really be defined in jni.h)
 extern "C" {
   typedef void (JNICALL *abort_hook_t)(void);
   typedef void (JNICALL *exit_hook_t)(jint code);
--- a/src/hotspot/share/runtime/mutexLocker.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/runtime/mutexLocker.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -166,6 +166,16 @@
   fatal("must own lock %s", lock->name());
 }
 
+// a weaker assertion than the above
+void assert_locked_or_safepoint_weak(const Monitor * lock) {
+  if (IgnoreLockingAssertions) return;
+  assert(lock != NULL, "Need non-NULL lock");
+  if (lock->is_locked()) return;
+  if (SafepointSynchronize::is_at_safepoint()) return;
+  if (!Universe::is_fully_initialized()) return;
+  fatal("must own lock %s", lock->name());
+}
+
 // a stronger assertion than the above
 void assert_lock_strong(const Monitor * lock) {
   if (IgnoreLockingAssertions) return;
--- a/src/hotspot/share/runtime/mutexLocker.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/runtime/mutexLocker.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -199,9 +199,11 @@
 // for debugging: check that we're already owning this lock (or are at a safepoint)
 #ifdef ASSERT
 void assert_locked_or_safepoint(const Monitor * lock);
+void assert_locked_or_safepoint_weak(const Monitor * lock);
 void assert_lock_strong(const Monitor * lock);
 #else
 #define assert_locked_or_safepoint(lock)
+#define assert_locked_or_safepoint_weak(lock)
 #define assert_lock_strong(lock)
 #endif
 
--- a/src/hotspot/share/runtime/perfData.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/runtime/perfData.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -323,7 +323,12 @@
 }
 
 PerfData* PerfDataManager::find_by_name(const char* name) {
-  return _all->find_by_name(name);
+  // if add_item hasn't been called the list won't be initialized
+  if (_all != NULL) {
+    return _all->find_by_name(name);
+  } else {
+    return NULL;
+  }
 }
 
 PerfDataList* PerfDataManager::all() {
@@ -591,10 +596,6 @@
 
 PerfData* PerfDataList::find_by_name(const char* name) {
 
-  // if add_item hasn't been called the list won't be initialized
-  if (this == NULL)
-    return NULL;
-
   int i = _set->find((void*)name, PerfDataList::by_name);
 
   if (i >= 0 && i <= _set->length())
--- a/src/hotspot/share/runtime/perfData.inline.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/runtime/perfData.inline.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -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
@@ -58,7 +58,11 @@
 }
 
 inline bool PerfDataManager::exists(const char* name) {
-  return _all->contains(name);
+  if (_all != NULL) {
+    return _all->contains(name);
+  } else {
+    return false;
+  }
 }
 
 #endif // SHARE_VM_RUNTIME_PERFDATA_INLINE_HPP
--- a/src/hotspot/share/runtime/reflection.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/runtime/reflection.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -503,7 +503,8 @@
   }
   // Allow all accesses from jdk/internal/reflect/MagicAccessorImpl subclasses to
   // succeed trivially.
-  if (current_class->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
+  if (SystemDictionary::reflect_MagicAccessorImpl_klass_is_loaded() &&
+      current_class->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
     return ACCESS_OK;
   }
 
--- a/src/hotspot/share/runtime/thread.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/runtime/thread.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -4569,9 +4569,9 @@
   st->print_raw_cr(os::local_time_string(buf, sizeof(buf)));
 
   st->print_cr("Full thread dump %s (%s %s):",
-               Abstract_VM_Version::vm_name(),
-               Abstract_VM_Version::vm_release(),
-               Abstract_VM_Version::vm_info_string());
+               VM_Version::vm_name(),
+               VM_Version::vm_release(),
+               VM_Version::vm_info_string());
   st->cr();
 
 #if INCLUDE_SERVICES
--- a/src/hotspot/share/runtime/vm_version.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/runtime/vm_version.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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 @@
   // occurred.  Examines a variety of the hardware capabilities of
   // the platform to determine which features can be used to execute the
   // program.
-  static void initialize();
+  static void initialize() { }
 
   // This allows for early initialization of VM_Version information
   // that may be needed later in the initialization sequence but before
--- a/src/hotspot/share/services/diagnosticCommand.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/services/diagnosticCommand.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -213,8 +213,8 @@
 }
 
 void VersionDCmd::execute(DCmdSource source, TRAPS) {
-  output()->print_cr("%s version %s", Abstract_VM_Version::vm_name(),
-          Abstract_VM_Version::vm_release());
+  output()->print_cr("%s version %s", VM_Version::vm_name(),
+          VM_Version::vm_release());
   JDK_Version jdk_version = JDK_Version::current();
   if (jdk_version.patch_version() > 0) {
     output()->print_cr("JDK %d.%d.%d.%d", jdk_version.major_version(),
--- a/src/hotspot/share/services/memoryService.hpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/services/memoryService.hpp	Tue Oct 16 23:21:05 2018 +0530
@@ -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
--- a/src/hotspot/share/services/runtimeService.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/services/runtimeService.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, 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
@@ -66,7 +66,7 @@
 
     // create performance counters for jvm_version and its capabilities
     PerfDataManager::create_constant(SUN_RT, "jvmVersion", PerfData::U_None,
-                                     (jlong) Abstract_VM_Version::jvm_version(), CHECK);
+                                     (jlong) VM_Version::jvm_version(), CHECK);
 
     // The capabilities counter is a binary representation of the VM capabilities in string.
     // This string respresentation simplifies the implementation of the client side
--- a/src/hotspot/share/utilities/internalVMTests.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/utilities/internalVMTests.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -42,9 +42,7 @@
 
 void InternalVMTests::run() {
   tty->print_cr("Running internal VM tests");
-  run_unit_test(TestReservedSpace_test);
   run_unit_test(TestReserveMemorySpecial_test);
-  run_unit_test(TestVirtualSpace_test);
   run_unit_test(TestMetaspaceUtils_test);
   run_unit_test(GCTimer_test);
   // These tests require the "C" locale to correctly parse decimal values
--- a/src/hotspot/share/utilities/vmError.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/utilities/vmError.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -319,18 +319,18 @@
                                 JDK_Version::runtime_name() : "";
    const char* runtime_version = JDK_Version::runtime_version() != NULL ?
                                    JDK_Version::runtime_version() : "";
-   const char* jdk_debug_level = Abstract_VM_Version::printable_jdk_debug_level() != NULL ?
-                                   Abstract_VM_Version::printable_jdk_debug_level() : "";
+   const char* jdk_debug_level = VM_Version::printable_jdk_debug_level() != NULL ?
+                                   VM_Version::printable_jdk_debug_level() : "";
 
    st->print_cr("# JRE version: %s (%s) (%sbuild %s)", runtime_name, buf,
                  jdk_debug_level, runtime_version);
 
    // This is the long version with some default settings added
    st->print_cr("# Java VM: %s (%s%s, %s%s%s%s%s, %s, %s)",
-                 Abstract_VM_Version::vm_name(),
+                 VM_Version::vm_name(),
                  jdk_debug_level,
-                 Abstract_VM_Version::vm_release(),
-                 Abstract_VM_Version::vm_info_string(),
+                 VM_Version::vm_release(),
+                 VM_Version::vm_info_string(),
                  TieredCompilation ? ", tiered" : "",
 #if INCLUDE_JVMCI
                  EnableJVMCI ? ", jvmci" : "",
@@ -340,7 +340,7 @@
 #endif
                  UseCompressedOops ? ", compressed oops" : "",
                  GCConfig::hs_err_name(),
-                 Abstract_VM_Version::vm_platform_string()
+                 VM_Version::vm_platform_string()
                );
 }
 
@@ -1007,7 +1007,7 @@
   STEP("printing internal vm info")
 
      if (_verbose) {
-       st->print_cr("vm_info: %s", Abstract_VM_Version::internal_vm_info_string());
+       st->print_cr("vm_info: %s", VM_Version::internal_vm_info_string());
        st->cr();
      }
 
@@ -1170,7 +1170,7 @@
 
   // STEP("printing internal vm info")
 
-  st->print_cr("vm_info: %s", Abstract_VM_Version::internal_vm_info_string());
+  st->print_cr("vm_info: %s", VM_Version::internal_vm_info_string());
   st->cr();
 
   // print a defined marker to show that error handling finished correctly.
--- a/src/java.base/share/classes/java/io/FileInputStream.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/io/FileInputStream.java	Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -79,8 +79,6 @@
 
     private volatile boolean closed;
 
-    private final Object altFinalizer;
-
     /**
      * Creates a <code>FileInputStream</code> by
      * opening a connection to an actual file,
@@ -155,10 +153,7 @@
         fd.attach(this);
         path = name;
         open(name);
-        altFinalizer = getFinalizer(this);
-        if (altFinalizer == null) {
-            FileCleanable.register(fd);       // open set the fd, register the cleanup
-        }
+        FileCleanable.register(fd);       // open set the fd, register the cleanup
     }
 
     /**
@@ -195,7 +190,6 @@
         }
         fd = fdObj;
         path = null;
-        altFinalizer = null;
 
         /*
          * FileDescriptor is being shared by streams.
@@ -438,85 +432,4 @@
     static {
         initIDs();
     }
-
-    /**
-     * Ensures that the {@link #close} method of this file input stream is
-     * called when there are no more references to it.
-     * The {@link #finalize} method does not call {@link #close} directly.
-     *
-     * @apiNote
-     * To release resources used by this stream {@link #close} should be called
-     * directly or by try-with-resources.
-     *
-     * @implSpec
-     * If this FileInputStream has been subclassed and the {@link #close}
-     * method has been overridden, the {@link #close} method will be
-     * called when the FileInputStream is unreachable.
-     * Otherwise, it is implementation specific how the resource cleanup described in
-     * {@link #close} is performed.
-     *
-     * @deprecated The {@code finalize} method has been deprecated and will be removed.
-     *     Subclasses that override {@code finalize} in order to perform cleanup
-     *     should be modified to use alternative cleanup mechanisms and
-     *     to remove the overriding {@code finalize} method.
-     *     When overriding the {@code finalize} method, its implementation must explicitly
-     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
-     *     See the specification for {@link Object#finalize()} for further
-     *     information about migration options.
-     *
-     * @exception  IOException  if an I/O error occurs.
-     * @see        java.io.FileInputStream#close()
-     */
-    @Deprecated(since="9", forRemoval = true)
-    protected void finalize() throws IOException {
-    }
-
-    /*
-     * Returns a finalizer object if the FIS needs a finalizer; otherwise null.
-     * If the FIS has a close method; it needs an AltFinalizer.
-     */
-    private static Object getFinalizer(FileInputStream fis) {
-        Class<?> clazz = fis.getClass();
-        while (clazz != FileInputStream.class) {
-            try {
-                clazz.getDeclaredMethod("close");
-                return new AltFinalizer(fis);
-            } catch (NoSuchMethodException nsme) {
-                // ignore
-            }
-            clazz = clazz.getSuperclass();
-        }
-        return null;
-    }
-    /**
-     * Class to call {@code FileInputStream.close} when finalized.
-     * If finalization of the stream is needed, an instance is created
-     * in its constructor(s).  When the set of instances
-     * related to the stream is unreachable, the AltFinalizer performs
-     * the needed call to the stream's {@code close} method.
-     */
-    static class AltFinalizer {
-        private final FileInputStream fis;
-
-        AltFinalizer(FileInputStream fis) {
-            this.fis = fis;
-        }
-
-        @Override
-        @SuppressWarnings("deprecation")
-        protected final void finalize() {
-            try {
-                if ((fis.fd != null) && (fis.fd != FileDescriptor.in)) {
-                    /* if fd is shared, the references in FileDescriptor
-                     * will ensure that finalizer is only called when
-                     * safe to do so. All references using the fd have
-                     * become unreachable. We can call close()
-                     */
-                    fis.close();
-                }
-            } catch (IOException ioe) {
-                // ignore
-            }
-        }
-    }
 }
--- a/src/java.base/share/classes/java/io/FileOutputStream.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/io/FileOutputStream.java	Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -95,8 +95,6 @@
 
     private volatile boolean closed;
 
-    private final Object altFinalizer;
-
     /**
      * Creates a file output stream to write to the file with the
      * specified name. A new <code>FileDescriptor</code> object is
@@ -235,10 +233,7 @@
         this.path = name;
 
         open(name, append);
-        altFinalizer = getFinalizer(this);
-        if (altFinalizer == null) {
-            FileCleanable.register(fd);   // open sets the fd, register the cleanup
-        }
+        FileCleanable.register(fd);   // open sets the fd, register the cleanup
     }
 
     /**
@@ -274,7 +269,6 @@
         }
         this.fd = fdObj;
         this.path = null;
-        this.altFinalizer = null;
 
         fd.attach(this);
     }
@@ -457,98 +451,9 @@
         return fc;
     }
 
-    /**
-     * Cleans up the connection to the file, and ensures that the
-     * {@link #close} method of this file output stream is
-     * called when there are no more references to this stream.
-     * The {@link #finalize} method does not call {@link #close} directly.
-     *
-     * @apiNote
-     * To release resources used by this stream {@link #close} should be called
-     * directly or by try-with-resources.
-     *
-     * @implSpec
-     * If this FileOutputStream has been subclassed and the {@link #close}
-     * method has been overridden, the {@link #close} method will be
-     * called when the FileOutputStream is unreachable.
-     * Otherwise, it is implementation specific how the resource cleanup described in
-     * {@link #close} is performed.
-     *
-     * @deprecated The {@code finalize} method has been deprecated and will be removed.
-     *     Subclasses that override {@code finalize} in order to perform cleanup
-     *     should be modified to use alternative cleanup mechanisms and
-     *     to remove the overriding {@code finalize} method.
-     *     When overriding the {@code finalize} method, its implementation must explicitly
-     *     ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
-     *     See the specification for {@link Object#finalize()} for further
-     *     information about migration options.
-     *
-     * @exception  IOException  if an I/O error occurs.
-     * @see        java.io.FileInputStream#close()
-     */
-    @Deprecated(since="9", forRemoval = true)
-    protected void finalize() throws IOException {
-    }
-
     private static native void initIDs();
 
     static {
         initIDs();
     }
-
-    /*
-     * Returns a finalizer object if the FOS needs a finalizer; otherwise null.
-     * If the FOS has a close method; it needs an AltFinalizer.
-     */
-    private static Object getFinalizer(FileOutputStream fos) {
-        Class<?> clazz = fos.getClass();
-        while (clazz != FileOutputStream.class) {
-            try {
-                clazz.getDeclaredMethod("close");
-                return new AltFinalizer(fos);
-            } catch (NoSuchMethodException nsme) {
-                // ignore
-            }
-            clazz = clazz.getSuperclass();
-        }
-        return null;
-    }
-
-    /**
-     * Class to call {@code FileOutputStream.close} when finalized.
-     * If finalization of the stream is needed, an instance is created
-     * in its constructor(s).  When the set of instances
-     * related to the stream is unreachable, the AltFinalizer performs
-     * the needed call to the stream's {@code close} method.
-     */
-    static class AltFinalizer {
-        private final FileOutputStream fos;
-
-        AltFinalizer(FileOutputStream fos) {
-            this.fos = fos;
-        }
-
-        @Override
-        @SuppressWarnings("deprecation")
-        protected final void finalize() {
-            try {
-                if (fos.fd != null) {
-                    if (fos.fd == FileDescriptor.out || fos.fd == FileDescriptor.err) {
-                        // Subclass may override flush; otherwise it is no-op
-                        fos.flush();
-                    } else {
-                        /* if fd is shared, the references in FileDescriptor
-                         * will ensure that finalizer is only called when
-                         * safe to do so. All references using the fd have
-                         * become unreachable. We can call close()
-                         */
-                        fos.close();
-                    }
-                }
-            } catch (IOException ioe) {
-                // ignore
-            }
-        }
-    }
-
 }
--- a/src/java.base/share/classes/java/lang/AbstractStringBuilder.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/lang/AbstractStringBuilder.java	Tue Oct 16 23:21:05 2018 +0530
@@ -69,10 +69,13 @@
      */
     int count;
 
+    private static final byte[] EMPTYVALUE = new byte[0];
+
     /**
      * This no-arg constructor is necessary for serialization of subclasses.
      */
     AbstractStringBuilder() {
+        value = EMPTYVALUE;
     }
 
     /**
--- a/src/java.base/share/classes/java/lang/StringConcatHelper.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/lang/StringConcatHelper.java	Tue Oct 16 23:21:05 2018 +0530
@@ -139,61 +139,6 @@
     }
 
     /**
-     * Mix coder into current coder
-     * @param current current coder
-     * @param value   value to mix in
-     * @return new coder
-     */
-    static byte mixCoder(byte current, boolean value) {
-        // Booleans are represented with Latin1
-        return current;
-    }
-
-    /**
-     * Mix coder into current coder
-     * @param current current coder
-     * @param value   value to mix in
-     * @return new coder
-     */
-    static byte mixCoder(byte current, byte value) {
-        // Bytes are represented with Latin1
-        return current;
-    }
-
-    /**
-     * Mix coder into current coder
-     * @param current current coder
-     * @param value   value to mix in
-     * @return new coder
-     */
-    static byte mixCoder(byte current, short value) {
-        // Shorts are represented with Latin1
-        return current;
-    }
-
-    /**
-     * Mix coder into current coder
-     * @param current current coder
-     * @param value   value to mix in
-     * @return new coder
-     */
-    static byte mixCoder(byte current, int value) {
-        // Ints are represented with Latin1
-        return current;
-    }
-
-    /**
-     * Mix coder into current coder
-     * @param current current coder
-     * @param value   value to mix in
-     * @return new coder
-     */
-    static byte mixCoder(byte current, long value) {
-        // Longs are represented with Latin1
-        return current;
-    }
-
-    /**
      * Prepends the stringly representation of boolean value into buffer,
      * given the coder and final index. Index is measured in chars, not in bytes!
      *
--- a/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java	Tue Oct 16 23:21:05 2018 +0530
@@ -1588,28 +1588,47 @@
 
                         Class<?> argClass = ptypes[ac];
                         MethodHandle lm = lengthMixer(argClass);
-                        MethodHandle cm = coderMixer(argClass);
 
-                        // Read this bottom up:
+                        // Read these bottom up:
 
-                        // 4. Drop old index and coder, producing ("new-index", "new-coder", <args>)
-                        mh = MethodHandles.dropArguments(mh, 2, int.class, byte.class);
+                        if (argClass.isPrimitive() && argClass != char.class) {
 
-                        // 3. Compute "new-index", producing ("new-index", "new-coder", "old-index", "old-coder", <args>)
-                        //    Length mixer needs old index, plus the appropriate argument
-                        mh = MethodHandles.foldArguments(mh, 0, lm,
-                                2, // old-index
-                                4 + ac // selected argument
-                        );
+                            // 3. Drop old index, producing ("new-index", "coder", <args>)
+                            mh = MethodHandles.dropArguments(mh, 1, int.class);
 
-                        // 2. Compute "new-coder", producing ("new-coder", "old-index", "old-coder", <args>)
-                        //    Coder mixer needs old coder, plus the appropriate argument.
-                        mh = MethodHandles.foldArguments(mh, 0, cm,
-                                2, // old-coder
-                                3 + ac // selected argument
-                        );
+                            // 2. Compute "new-index", producing ("new-index", "old-index", "coder", <args>)
+                            //    Length mixer needs old index, plus the appropriate argument
+                            mh = MethodHandles.foldArguments(mh, 0, lm,
+                                    1, // old-index
+                                    3 + ac // selected argument
+                            );
 
-                        // 1. The mh shape here is ("old-index", "old-coder", <args>)
+                            // 1. The mh shape here is ("old-index", "coder", <args>); we don't need to recalculate
+                            //    the coder for non-char primitive arguments
+
+                        } else {
+                            MethodHandle cm = coderMixer(argClass);
+
+                            // 4. Drop old index and coder, producing ("new-index", "new-coder", <args>)
+                            mh = MethodHandles.dropArguments(mh, 2, int.class, byte.class);
+
+                            // 3. Compute "new-index", producing ("new-index", "new-coder", "old-index", "old-coder", <args>)
+                            //    Length mixer needs old index, plus the appropriate argument
+                            mh = MethodHandles.foldArguments(mh, 0, lm,
+                                    2, // old-index
+                                    4 + ac // selected argument
+                            );
+
+                            // 2. Compute "new-coder", producing ("new-coder", "old-index", "old-coder", <args>)
+                            //    Coder mixer needs old coder, plus the appropriate argument.
+                            mh = MethodHandles.foldArguments(mh, 0, cm,
+                                    2, // old-coder
+                                    3 + ac // selected argument
+                            );
+
+                            // 1. The mh shape here is ("old-index", "old-coder", <args>)
+                        }
+
                         break;
                     default:
                         throw new StringConcatException("Unhandled tag: " + el.getTag());
--- a/src/java.base/share/classes/java/lang/ref/Cleaner.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/lang/ref/Cleaner.java	Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -100,8 +100,8 @@
  *            }
  *        }
  *
- *        private final State;
- *        private final Cleaner.Cleanable cleanable
+ *        private final State state;
+ *        private final Cleaner.Cleanable cleanable;
  *
  *        public CleaningExample() {
  *            this.state = new State(...);
--- a/src/java.base/share/classes/java/net/InetAddress.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/net/InetAddress.java	Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -35,6 +35,7 @@
 import java.io.ObjectStreamException;
 import java.io.ObjectStreamField;
 import java.io.IOException;
+import java.io.InvalidObjectException;
 import java.io.ObjectInputStream;
 import java.io.ObjectInputStream.GetField;
 import java.io.ObjectOutputStream;
@@ -1727,8 +1728,11 @@
         }
         GetField gf = s.readFields();
         String host = (String)gf.get("hostName", null);
-        int address= gf.get("address", 0);
-        int family= gf.get("family", 0);
+        int address = gf.get("address", 0);
+        int family = gf.get("family", 0);
+        if (family != IPv4 && family != IPv6) {
+            throw new InvalidObjectException("invalid address family type: " + family);
+        }
         InetAddressHolder h = new InetAddressHolder(host, address, family);
         UNSAFE.putObject(this, FIELDS_OFFSET, h);
     }
--- a/src/java.base/share/classes/java/net/NetworkInterface.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/net/NetworkInterface.java	Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -321,8 +321,20 @@
         if (addr == null) {
             throw new NullPointerException();
         }
-        if (!(addr instanceof Inet4Address || addr instanceof Inet6Address)) {
-            throw new IllegalArgumentException ("invalid address type");
+        if (addr instanceof Inet4Address) {
+            Inet4Address inet4Address = (Inet4Address) addr;
+            if (inet4Address.holder.family != InetAddress.IPv4) {
+                throw new IllegalArgumentException("invalid family type: "
+                        + inet4Address.holder.family);
+            }
+        } else if (addr instanceof Inet6Address) {
+            Inet6Address inet6Address = (Inet6Address) addr;
+            if (inet6Address.holder.family != InetAddress.IPv6) {
+                throw new IllegalArgumentException("invalid family type: "
+                        + inet6Address.holder.family);
+            }
+        } else {
+            throw new IllegalArgumentException("invalid address type: " + addr);
         }
         return getByInetAddress0(addr);
     }
--- a/src/java.base/share/classes/java/net/URLClassLoader.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/net/URLClassLoader.java	Tue Oct 16 23:21:05 2018 +0530
@@ -535,13 +535,13 @@
      * @spec JPMS
      */
     protected Package definePackage(String name, Manifest man, URL url) {
-        String path = name.replace('.', '/').concat("/");
         String specTitle = null, specVersion = null, specVendor = null;
         String implTitle = null, implVersion = null, implVendor = null;
         String sealed = null;
         URL sealBase = null;
 
-        Attributes attr = man.getAttributes(path);
+        Attributes attr = SharedSecrets.javaUtilJarAccess()
+                .getTrustedAttributes(man, name.replace('.', '/').concat("/"));
         if (attr != null) {
             specTitle   = attr.getValue(Name.SPECIFICATION_TITLE);
             specVersion = attr.getValue(Name.SPECIFICATION_VERSION);
@@ -585,10 +585,12 @@
     /*
      * Returns true if the specified package name is sealed according to the
      * given manifest.
+     *
+     * @throws SecurityException if the package name is untrusted in the manifest
      */
     private boolean isSealed(String name, Manifest man) {
-        String path = name.replace('.', '/').concat("/");
-        Attributes attr = man.getAttributes(path);
+        Attributes attr = SharedSecrets.javaUtilJarAccess()
+                .getTrustedAttributes(man, name.replace('.', '/').concat("/"));
         String sealed = null;
         if (attr != null) {
             sealed = attr.getValue(Name.SEALED);
--- a/src/java.base/share/classes/java/util/jar/JarFile.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/util/jar/JarFile.java	Tue Oct 16 23:21:05 2018 +0530
@@ -417,10 +417,10 @@
             if (manEntry != null) {
                 if (verify) {
                     byte[] b = getBytes(manEntry);
-                    man = new Manifest(new ByteArrayInputStream(b), getName());
                     if (!jvInitialized) {
                         jv = new JarVerifier(b);
                     }
+                    man = new Manifest(jv, new ByteArrayInputStream(b), getName());
                 } else {
                     man = new Manifest(super.getInputStream(manEntry), getName());
                 }
@@ -1011,29 +1011,13 @@
                     int i = match(MULTIRELEASE_CHARS, b, MULTIRELEASE_LASTOCC,
                             MULTIRELEASE_OPTOSFT);
                     if (i != -1) {
-                        i += MULTIRELEASE_CHARS.length;
-                        if (i < b.length) {
-                            byte c = b[i++];
-                            // Check that the value is followed by a newline
-                            // and does not have a continuation
-                            if (c == '\n' &&
-                                    (i == b.length || b[i] != ' ')) {
-                                isMultiRelease = true;
-                            } else if (c == '\r') {
-                                if (i == b.length) {
-                                    isMultiRelease = true;
-                                } else {
-                                    c = b[i++];
-                                    if (c == '\n') {
-                                        if (i == b.length || b[i] != ' ') {
-                                            isMultiRelease = true;
-                                        }
-                                    } else if (c != ' ') {
-                                        isMultiRelease = true;
-                                    }
-                                }
-                            }
-                        }
+                        // Read the main attributes of the manifest
+                        byte[] lbuf = new byte[512];
+                        Attributes attr = new Attributes();
+                        attr.read(new Manifest.FastInputStream(
+                            new ByteArrayInputStream(b)), lbuf);
+                        isMultiRelease = Boolean.parseBoolean(
+                            attr.getValue(Attributes.Name.MULTI_RELEASE));
                     }
                 }
             }
@@ -1041,7 +1025,7 @@
         }
     }
 
-    private synchronized void ensureInitialization() {
+    synchronized void ensureInitialization() {
         try {
             maybeInstantiateVerifier();
         } catch (IOException e) {
--- a/src/java.base/share/classes/java/util/jar/JarVerifier.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/util/jar/JarVerifier.java	Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -866,4 +866,24 @@
     static CodeSource getUnsignedCS(URL url) {
         return new VerifierCodeSource(null, url, (java.security.cert.Certificate[]) null);
     }
+
+    /**
+     * Returns whether the name is trusted. Used by
+     * {@link Manifest#getTrustedAttributes(String)}.
+     */
+    boolean isTrustedManifestEntry(String name) {
+        // How many signers? MANIFEST.MF is always verified
+        CodeSigner[] forMan = verifiedSigners.get(JarFile.MANIFEST_NAME);
+        if (forMan == null) {
+            return true;
+        }
+        // Check sigFileSigners first, because we are mainly dealing with
+        // non-file entries which will stay in sigFileSigners forever.
+        CodeSigner[] forName = sigFileSigners.get(name);
+        if (forName == null) {
+            forName = verifiedSigners.get(name);
+        }
+        // Returns trusted if all signers sign the entry
+        return forName != null && forName.length == forMan.length;
+    }
 }
--- a/src/java.base/share/classes/java/util/jar/JavaUtilJarAccessImpl.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/util/jar/JavaUtilJarAccessImpl.java	Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, 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
@@ -60,4 +60,12 @@
     public List<Object> getManifestDigests(JarFile jar) {
         return jar.getManifestDigests();
     }
+
+    public Attributes getTrustedAttributes(Manifest man, String name) {
+        return man.getTrustedAttributes(name);
+    }
+
+    public void ensureInitialization(JarFile jar) {
+        jar.ensureInitialization();
+    }
 }
--- a/src/java.base/share/classes/java/util/jar/Manifest.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/util/jar/Manifest.java	Tue Oct 16 23:21:05 2018 +0530
@@ -50,10 +50,13 @@
 public class Manifest implements Cloneable {
 
     // manifest main attributes
-    private Attributes attr = new Attributes();
+    private final Attributes attr = new Attributes();
 
     // manifest entries
-    private Map<String, Attributes> entries = new HashMap<>();
+    private final Map<String, Attributes> entries = new HashMap<>();
+
+    // associated JarVerifier, not null when called by JarFile::getManifest.
+    private final JarVerifier jv;
 
     // name of the corresponding jar archive if available.
     private final String jarFilename;
@@ -63,6 +66,7 @@
      */
     public Manifest() {
         jarFilename = null;
+        jv = null;
     }
 
     /**
@@ -72,8 +76,7 @@
      * @throws IOException if an I/O error has occurred
      */
     public Manifest(InputStream is) throws IOException {
-        this();
-        read(is);
+        this(null, is, null);
     }
 
     /**
@@ -84,8 +87,17 @@
      * @throws IOException if an I/O error has occured
      */
     Manifest(InputStream is, String jarFilename) throws IOException {
+        this(null, is, jarFilename);
+    }
+
+    /**
+     * Constructs a new Manifest from the specified input stream
+     * and associates it with a JarVerifier.
+     */
+    Manifest(JarVerifier jv, InputStream is, String jarFilename) throws IOException {
         read(is);
         this.jarFilename = jarFilename;
+        this.jv = jv;
     }
 
     /**
@@ -94,9 +106,10 @@
      * @param man the Manifest to copy
      */
     public Manifest(Manifest man) {
-        this();
         attr.putAll(man.getMainAttributes());
         entries.putAll(man.getEntries());
+        jarFilename = null;
+        jv = man.jv;
     }
 
     /**
@@ -147,6 +160,27 @@
     }
 
     /**
+     * Returns the Attributes for the specified entry name, if trusted.
+     *
+     * @param name entry name
+     * @return returns the same result as {@link #getAttributes(String)}
+     * @throws SecurityException if the associated jar is signed but this entry
+     *      has been modified after signing (i.e. the section in the manifest
+     *      does not exist in SF files of all signers).
+     */
+    Attributes getTrustedAttributes(String name) {
+        // Note: Before the verification of MANIFEST.MF/.SF/.RSA files is done,
+        // jv.isTrustedManifestEntry() isn't able to detect MANIFEST.MF change.
+        // Users of this method should call SharedSecrets.javaUtilJarAccess()
+        // .ensureInitialization() first.
+        Attributes result = getAttributes(name);
+        if (result != null && jv != null && ! jv.isTrustedManifestEntry(name)) {
+            throw new SecurityException("Untrusted manifest entry: " + name);
+        }
+        return result;
+    }
+
+    /**
      * Clears the main Attributes as well as the entries in this Manifest.
      */
     public void clear() {
--- a/src/java.base/share/classes/javax/crypto/CipherInputStream.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/javax/crypto/CipherInputStream.java	Tue Oct 16 23:21:05 2018 +0530
@@ -50,6 +50,13 @@
  * that are not thrown by its ancestor classes.  In particular, the
  * <code>skip</code> method skips, and the <code>available</code>
  * method counts only data that have been processed by the encapsulated Cipher.
+ * This class may catch BadPaddingException and other exceptions thrown by
+ * failed integrity checks during decryption. These exceptions are not
+ * re-thrown, so the client may not be informed that integrity checks
+ * failed. Because of this behavior, this class may not be suitable
+ * for use with decryption in an authenticated mode of operation (e.g. GCM).
+ * Applications that require authenticated encryption can use the Cipher API
+ * directly as an alternative to using this class.
  *
  * <p> It is crucial for a programmer using this class not to use
  * methods that are not defined or overridden in this class (such as a
--- a/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java	Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -60,6 +60,7 @@
 import java.util.jar.Manifest;
 import java.util.stream.Stream;
 
+import jdk.internal.misc.SharedSecrets;
 import jdk.internal.misc.VM;
 import jdk.internal.module.ModulePatcher.PatchedModuleReader;
 import jdk.internal.module.Resources;
@@ -862,7 +863,8 @@
      * Manifest are used to get the package version and sealing information.
      *
      * @throws IllegalArgumentException if the package name duplicates an
-     * existing package either in this class loader or one of its ancestors
+     *      existing package either in this class loader or one of its ancestors
+     * @throws SecurityException if the package name is untrusted in the manifest
      */
     private Package definePackage(String pn, Manifest man, URL url) {
         String specTitle = null;
@@ -875,7 +877,8 @@
         URL sealBase = null;
 
         if (man != null) {
-            Attributes attr = man.getAttributes(pn.replace('.', '/').concat("/"));
+            Attributes attr = SharedSecrets.javaUtilJarAccess()
+                    .getTrustedAttributes(man, pn.replace('.', '/').concat("/"));
             if (attr != null) {
                 specTitle = attr.getValue(Attributes.Name.SPECIFICATION_TITLE);
                 specVersion = attr.getValue(Attributes.Name.SPECIFICATION_VERSION);
@@ -921,10 +924,12 @@
     /**
      * Returns {@code true} if the specified package name is sealed according to
      * the given manifest.
+     *
+     * @throws SecurityException if the package name is untrusted in the manifest
      */
     private boolean isSealed(String pn, Manifest man) {
-        String path = pn.replace('.', '/').concat("/");
-        Attributes attr = man.getAttributes(path);
+        Attributes attr = SharedSecrets.javaUtilJarAccess()
+                .getTrustedAttributes(man, pn.replace('.', '/').concat("/"));
         String sealed = null;
         if (attr != null)
             sealed = attr.getValue(Attributes.Name.SEALED);
--- a/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java	Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -34,6 +34,7 @@
 import java.net.HttpURLConnection;
 import java.net.JarURLConnection;
 import java.net.MalformedURLException;
+import java.net.URI;
 import java.net.URL;
 import java.net.URLConnection;
 import java.net.URLStreamHandler;
@@ -88,6 +89,8 @@
     private static final boolean DEBUG;
     private static final boolean DISABLE_JAR_CHECKING;
     private static final boolean DISABLE_ACC_CHECKING;
+    private static final boolean DISABLE_CP_URL_CHECK;
+    private static final boolean DEBUG_CP_URL_CHECK;
 
     static {
         Properties props = GetPropertyAction.privilegedGetProperties();
@@ -98,6 +101,12 @@
 
         p = props.getProperty("jdk.net.URLClassPath.disableRestrictedPermissions");
         DISABLE_ACC_CHECKING = p != null ? p.equals("true") || p.equals("") : false;
+
+        // This property will be removed in a later release
+        p = props.getProperty("jdk.net.URLClassPath.disableClassPathURLCheck", "true");
+
+        DISABLE_CP_URL_CHECK = p != null ? p.equals("true") || p.isEmpty() : false;
+        DEBUG_CP_URL_CHECK = "debug".equals(p);
     }
 
     /* The original search path of URLs. */
@@ -857,8 +866,10 @@
                     { return jar.getInputStream(entry); }
                 public int getContentLength()
                     { return (int)entry.getSize(); }
-                public Manifest getManifest() throws IOException
-                    { return jar.getManifest(); };
+                public Manifest getManifest() throws IOException {
+                    SharedSecrets.javaUtilJarAccess().ensureInitialization(jar);
+                    return jar.getManifest();
+                }
                 public Certificate[] getCertificates()
                     { return entry.getCertificates(); };
                 public CodeSigner[] getCodeSigners()
@@ -1081,11 +1092,51 @@
             int i = 0;
             while (st.hasMoreTokens()) {
                 String path = st.nextToken();
-                urls[i] = new URL(base, path);
-                i++;
+                URL url = DISABLE_CP_URL_CHECK ? new URL(base, path) : safeResolve(base, path);
+                if (url != null) {
+                    urls[i] = url;
+                    i++;
+                }
+            }
+            if (i == 0) {
+                urls = null;
+            } else if (i != urls.length) {
+                // Truncate nulls from end of array
+                urls = Arrays.copyOf(urls, i);
             }
             return urls;
         }
+
+        /*
+         * Return a URL for the given path resolved against the base URL, or
+         * null if the resulting URL is invalid.
+         */
+        static URL safeResolve(URL base, String path) {
+            String child = path.replace(File.separatorChar, '/');
+            try {
+                if (!URI.create(child).isAbsolute()) {
+                    URL url = new URL(base, child);
+                    if (base.getProtocol().equalsIgnoreCase("file")) {
+                        return url;
+                    } else {
+                        String bp = base.getPath();
+                        String urlp = url.getPath();
+                        int pos = bp.lastIndexOf('/');
+                        if (pos == -1) {
+                            pos = bp.length() - 1;
+                        }
+                        if (urlp.regionMatches(0, bp, 0, pos + 1)
+                            && urlp.indexOf("..", pos) == -1) {
+                            return url;
+                        }
+                    }
+                }
+            } catch (MalformedURLException | IllegalArgumentException e) {}
+            if (DEBUG_CP_URL_CHECK) {
+                System.err.println("Class-Path entry: \"" + path + "\" ignored in JAR file " + base);
+            }
+            return null;
+        }
     }
 
     /*
--- a/src/java.base/share/classes/jdk/internal/misc/JavaUtilJarAccess.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/jdk/internal/misc/JavaUtilJarAccess.java	Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, 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
@@ -30,8 +30,10 @@
 import java.security.CodeSource;
 import java.util.Enumeration;
 import java.util.List;
+import java.util.jar.Attributes;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
+import java.util.jar.Manifest;
 
 public interface JavaUtilJarAccess {
     public boolean jarFileHasClassPathAttribute(JarFile jar) throws IOException;
@@ -41,4 +43,6 @@
     public Enumeration<JarEntry> entries2(JarFile jar);
     public void setEagerValidation(JarFile jar, boolean eager);
     public List<Object> getManifestDigests(JarFile jar);
+    public Attributes getTrustedAttributes(Manifest man, String name);
+    public void ensureInitialization(JarFile jar);
 }
--- a/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -2725,6 +2725,8 @@
             // doesn't know about proxy.
             useProxyResponseCode = true;
         } else {
+            final URL prevURL = url;
+
             // maintain previous headers, just change the name
             // of the file we're getting
             url = locUrl;
@@ -2753,6 +2755,14 @@
                 poster = null;
                 if (!checkReuseConnection())
                     connect();
+
+                if (!sameDestination(prevURL, url)) {
+                    // Ensures pre-redirect user-set cookie will not be reset.
+                    // CookieHandler, if any, will be queried to determine
+                    // cookies for redirected URL, if any.
+                    userCookies = null;
+                    userCookies2 = null;
+                }
             } else {
                 if (!checkReuseConnection())
                     connect();
@@ -2775,11 +2785,52 @@
                     }
                     requests.set("Host", host);
                 }
+
+                if (!sameDestination(prevURL, url)) {
+                    // Redirecting to a different destination will drop any
+                    // security-sensitive headers, regardless of whether
+                    // they are user-set or not. CookieHandler, if any, will be
+                    // queried to determine cookies for redirected URL, if any.
+                    userCookies = null;
+                    userCookies2 = null;
+                    requests.remove("Cookie");
+                    requests.remove("Cookie2");
+                    requests.remove("Authorization");
+
+                    // check for preemptive authorization
+                    AuthenticationInfo sauth =
+                            AuthenticationInfo.getServerAuth(url, getAuthenticatorKey());
+                    if (sauth != null && sauth.supportsPreemptiveAuthorization() ) {
+                        // Sets "Authorization"
+                        requests.setIfNotSet(sauth.getHeaderName(), sauth.getHeaderValue(url,method));
+                        currentServerCredentials = sauth;
+                    }
+                }
             }
         }
         return true;
     }
 
+    /* Returns true iff the given URLs have the same host and effective port. */
+    private static boolean sameDestination(URL firstURL, URL secondURL) {
+        assert firstURL.getProtocol().equalsIgnoreCase(secondURL.getProtocol()):
+               "protocols not equal: " + firstURL +  " - " + secondURL;
+
+        if (!firstURL.getHost().equalsIgnoreCase(secondURL.getHost()))
+            return false;
+
+        int firstPort = firstURL.getPort();
+        if (firstPort == -1)
+            firstPort = firstURL.getDefaultPort();
+        int secondPort = secondURL.getPort();
+        if (secondPort == -1)
+            secondPort = secondURL.getDefaultPort();
+        if (firstPort != secondPort)
+            return false;
+
+        return true;
+    }
+
     /* dummy byte buffer for reading off socket prior to closing */
     byte[] cdata = new byte [128];
 
--- a/src/java.base/share/classes/sun/security/ssl/CertSignAlgsExtension.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/CertSignAlgsExtension.java	Tue Oct 16 23:21:05 2018 +0530
@@ -243,18 +243,16 @@
             }
 
             // Produce the extension.
-            if (shc.localSupportedSignAlgs == null) {
-                shc.localSupportedSignAlgs =
+            List<SignatureScheme> sigAlgs =
                     SignatureScheme.getSupportedAlgorithms(
-                            shc.algorithmConstraints, shc.activeProtocols);
-            }
+                            shc.algorithmConstraints,
+                            List.of(shc.negotiatedProtocol));
 
-            int vectorLen = SignatureScheme.sizeInRecord() *
-                    shc.localSupportedSignAlgs.size();
+            int vectorLen = SignatureScheme.sizeInRecord() * sigAlgs.size();
             byte[] extData = new byte[vectorLen + 2];
             ByteBuffer m = ByteBuffer.wrap(extData);
             Record.putInt16(m, vectorLen);
-            for (SignatureScheme ss : shc.localSupportedSignAlgs) {
+            for (SignatureScheme ss : sigAlgs) {
                 Record.putInt16(m, ss.id);
             }
 
--- a/src/java.base/share/classes/sun/security/ssl/CertificateRequest.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/CertificateRequest.java	Tue Oct 16 23:21:05 2018 +0530
@@ -31,7 +31,9 @@
 import java.security.cert.X509Certificate;
 import java.text.MessageFormat;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
@@ -675,44 +677,85 @@
             chc.peerRequestedSignatureSchemes = sss;
             chc.peerRequestedCertSignSchemes = sss;     // use the same schemes
             chc.handshakeSession.setPeerSupportedSignatureAlgorithms(sss);
+            chc.peerSupportedAuthorities = crm.getAuthorities();
 
-            X509ExtendedKeyManager km = chc.sslContext.getX509KeyManager();
-            String clientAlias = null;
-            if (chc.conContext.transport instanceof SSLSocketImpl) {
-                clientAlias = km.chooseClientAlias(crm.getKeyTypes(),
-                    crm.getAuthorities(), (SSLSocket)chc.conContext.transport);
-            } else if (chc.conContext.transport instanceof SSLEngineImpl) {
-                clientAlias = km.chooseEngineClientAlias(crm.getKeyTypes(),
-                    crm.getAuthorities(), (SSLEngine)chc.conContext.transport);
-            }
-
-            if (clientAlias == null) {
-                if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
-                    SSLLogger.warning("No available client authentication");
-                }
+            // For TLS 1.2, we no longer use the certificate_types field
+            // from the CertificateRequest message to directly determine
+            // the SSLPossession.  Instead, the choosePossession method
+            // will use the accepted signature schemes in the message to
+            // determine the set of acceptable certificate types to select from.
+            SSLPossession pos = choosePossession(chc);
+            if (pos == null) {
                 return;
             }
 
-            PrivateKey clientPrivateKey = km.getPrivateKey(clientAlias);
-            if (clientPrivateKey == null) {
+            chc.handshakePossessions.add(pos);
+            chc.handshakeProducers.put(SSLHandshake.CERTIFICATE_VERIFY.id,
+                    SSLHandshake.CERTIFICATE_VERIFY);
+        }
+
+        private static SSLPossession choosePossession(HandshakeContext hc)
+                throws IOException {
+            if (hc.peerRequestedCertSignSchemes == null ||
+                    hc.peerRequestedCertSignSchemes.isEmpty()) {
                 if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
-                    SSLLogger.warning("No available client private key");
+                    SSLLogger.warning("No signature and hash algorithms " +
+                            "in CertificateRequest");
                 }
-                return;
+                return null;
             }
 
-            X509Certificate[] clientCerts = km.getCertificateChain(clientAlias);
-            if ((clientCerts == null) || (clientCerts.length == 0)) {
-                if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
-                    SSLLogger.warning("No available client certificate");
+            Collection<String> checkedKeyTypes = new HashSet<>();
+            for (SignatureScheme ss : hc.peerRequestedCertSignSchemes) {
+                if (checkedKeyTypes.contains(ss.keyAlgorithm)) {
+                    if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
+                        SSLLogger.warning(
+                            "Unsupported authentication scheme: " + ss.name);
+                    }
+                    continue;
                 }
-                return;
+
+                // Don't select a signature scheme unless we will be able to
+                // produce a CertificateVerify message later
+                if (SignatureScheme.getPreferableAlgorithm(
+                        hc.peerRequestedSignatureSchemes,
+                        ss, hc.negotiatedProtocol) == null) {
+
+                    if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
+                        SSLLogger.warning(
+                            "Unable to produce CertificateVerify for " +
+                            "signature scheme: " + ss.name);
+                    }
+                    checkedKeyTypes.add(ss.keyAlgorithm);
+                    continue;
+                }
+
+                SSLAuthentication ka = X509Authentication.valueOf(ss);
+                if (ka == null) {
+                    if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
+                        SSLLogger.warning(
+                            "Unsupported authentication scheme: " + ss.name);
+                    }
+                    checkedKeyTypes.add(ss.keyAlgorithm);
+                    continue;
+                }
+
+                SSLPossession pos = ka.createPossession(hc);
+                if (pos == null) {
+                    if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
+                        SSLLogger.warning(
+                            "Unavailable authentication scheme: " + ss.name);
+                    }
+                    continue;
+                }
+
+                return pos;
             }
 
-            chc.handshakePossessions.add(
-                    new X509Possession(clientPrivateKey, clientCerts));
-            chc.handshakeProducers.put(SSLHandshake.CERTIFICATE_VERIFY.id,
-                    SSLHandshake.CERTIFICATE_VERIFY);
+            if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
+                SSLLogger.warning("No available authentication scheme");
+            }
+            return null;
         }
     }
 
--- a/src/java.base/share/classes/sun/security/ssl/ClientHello.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/ClientHello.java	Tue Oct 16 23:21:05 2018 +0530
@@ -35,6 +35,7 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
+import java.util.Objects;
 import javax.net.ssl.SSLException;
 import javax.net.ssl.SSLHandshakeException;
 import javax.net.ssl.SSLPeerUnverifiedException;
@@ -510,6 +511,23 @@
                 }
             }
 
+            // ensure that the endpoint identification algorithm matches the
+            // one in the session
+            String identityAlg = chc.sslConfig.identificationProtocol;
+            if (session != null && identityAlg != null) {
+                String sessionIdentityAlg =
+                    session.getIdentificationProtocol();
+                if (!Objects.equals(identityAlg, sessionIdentityAlg)) {
+                    if (SSLLogger.isOn &&
+                    SSLLogger.isOn("ssl,handshake,verbose")) {
+                        SSLLogger.finest("Can't resume, endpoint id" +
+                            " algorithm does not match, requested: " +
+                            identityAlg + ", cached: " + sessionIdentityAlg);
+                    }
+                    session = null;
+                }
+            }
+
             if (session != null) {
                 if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake,verbose")) {
                     SSLLogger.finest("Try resuming session", session);
@@ -1011,6 +1029,23 @@
                     }
                 }
 
+                // ensure that the endpoint identification algorithm matches the
+                // one in the session
+                String identityAlg = shc.sslConfig.identificationProtocol;
+                if (resumingSession && identityAlg != null) {
+                    String sessionIdentityAlg =
+                        previous.getIdentificationProtocol();
+                    if (!Objects.equals(identityAlg, sessionIdentityAlg)) {
+                        if (SSLLogger.isOn &&
+                        SSLLogger.isOn("ssl,handshake,verbose")) {
+                            SSLLogger.finest("Can't resume, endpoint id" +
+                            " algorithm does not match, requested: " +
+                            identityAlg + ", cached: " + sessionIdentityAlg);
+                        }
+                        resumingSession = false;
+                    }
+                }
+
                 // So far so good.  Note that the handshake extensions may reset
                 // the resuming options later.
                 shc.isResumption = resumingSession;
--- a/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java	Tue Oct 16 23:21:05 2018 +0530
@@ -43,6 +43,7 @@
 import javax.crypto.SecretKey;
 import javax.net.ssl.SNIServerName;
 import javax.net.ssl.SSLHandshakeException;
+import javax.security.auth.x500.X500Principal;
 import sun.security.ssl.SupportedGroupsExtension.NamedGroup;
 import sun.security.ssl.SupportedGroupsExtension.NamedGroupType;
 import static sun.security.ssl.SupportedGroupsExtension.NamedGroupType.*;
@@ -136,6 +137,9 @@
     List<SignatureScheme>                   peerRequestedSignatureSchemes;
     List<SignatureScheme>                   peerRequestedCertSignSchemes;
 
+    // Known authorities
+    X500Principal[]                         peerSupportedAuthorities = null;
+
     // SupportedGroups
     List<NamedGroup>                        clientRequestedNamedGroups;
 
--- a/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java	Tue Oct 16 23:21:05 2018 +0530
@@ -50,6 +50,9 @@
         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	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java	Tue Oct 16 23:21:05 2018 +0530
@@ -32,6 +32,7 @@
 import java.util.ArrayList;
 import java.util.Locale;
 import java.util.Arrays;
+import java.util.Objects;
 import java.util.Optional;
 import java.util.Collection;
 import javax.crypto.Mac;
@@ -170,7 +171,7 @@
 
         int getIdsEncodedLength() {
             int idEncodedLength = 0;
-            for (PskIdentity curId : identities) {
+            for(PskIdentity curId : identities) {
                 idEncodedLength += curId.getEncodedLength();
             }
 
@@ -193,7 +194,7 @@
             byte[] buffer = new byte[encodedLength];
             ByteBuffer m = ByteBuffer.wrap(buffer);
             Record.putInt16(m, idsEncodedLength);
-            for (PskIdentity curId : identities) {
+            for(PskIdentity curId : identities) {
                 curId.writeEncoded(m);
             }
             Record.putInt16(m, bindersEncodedLength);
@@ -443,6 +444,23 @@
             }
         }
 
+        // ensure that the endpoint identification algorithm matches the
+        // one in the session
+        String identityAlg = shc.sslConfig.identificationProtocol;
+        if (result && identityAlg != null) {
+            String sessionIdentityAlg = s.getIdentificationProtocol();
+            if (!Objects.equals(identityAlg, sessionIdentityAlg)) {
+                if (SSLLogger.isOn &&
+                    SSLLogger.isOn("ssl,handshake,verbose")) {
+
+                    SSLLogger.finest("Can't resume, endpoint id" +
+                        " algorithm does not match, requested: " +
+                        identityAlg + ", cached: " + sessionIdentityAlg);
+                }
+                result = false;
+            }
+        }
+
         // Ensure cipher suite can be negotiated
         if (result && (!shc.isNegotiable(s.getSuite()) ||
             !clientHello.cipherSuites.contains(s.getSuite()))) {
--- a/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java	Tue Oct 16 23:21:05 2018 +0530
@@ -132,6 +132,10 @@
     // Counter used to create unique nonces in NewSessionTicket
     private BigInteger ticketNonceCounter = BigInteger.ONE;
 
+    // The endpoint identification algorithm used to check certificates
+    // in this session.
+    private final String              identificationProtocol;
+
     /*
      * Create a new non-rejoinable session, using the default (null)
      * cipher spec.  This constructor returns a session which could
@@ -149,6 +153,7 @@
         this.requestedServerNames = Collections.<SNIServerName>emptyList();
         this.useExtendedMasterSecret = false;
         this.creationTime = System.currentTimeMillis();
+        this.identificationProtocol = null;
     }
 
     /*
@@ -198,6 +203,7 @@
                 (!hc.negotiatedProtocol.useTLS13PlusSpec());
         }
         this.creationTime = creationTime;
+        this.identificationProtocol = hc.sslConfig.identificationProtocol;
 
         if (SSLLogger.isOn && SSLLogger.isOn("session")) {
              SSLLogger.finest("Session initialized:  " + this);
@@ -259,6 +265,10 @@
         return ticketAgeAdd;
     }
 
+    String getIdentificationProtocol() {
+        return this.identificationProtocol;
+    }
+
     /*
      * Get the PSK identity. Take care not to use it in multiple connections.
      */
--- a/src/java.base/share/classes/sun/security/ssl/SignatureAlgorithmsExtension.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/SignatureAlgorithmsExtension.java	Tue Oct 16 23:21:05 2018 +0530
@@ -410,18 +410,16 @@
             }
 
             // Produce the extension.
-            if (shc.localSupportedSignAlgs == null) {
-                shc.localSupportedSignAlgs =
+            List<SignatureScheme> sigAlgs =
                     SignatureScheme.getSupportedAlgorithms(
-                            shc.algorithmConstraints, shc.activeProtocols);
-            }
+                            shc.algorithmConstraints,
+                            List.of(shc.negotiatedProtocol));
 
-            int vectorLen = SignatureScheme.sizeInRecord() *
-                    shc.localSupportedSignAlgs.size();
+            int vectorLen = SignatureScheme.sizeInRecord() * sigAlgs.size();
             byte[] extData = new byte[vectorLen + 2];
             ByteBuffer m = ByteBuffer.wrap(extData);
             Record.putInt16(m, vectorLen);
-            for (SignatureScheme ss : shc.localSupportedSignAlgs) {
+            for (SignatureScheme ss : sigAlgs) {
                 Record.putInt16(m, ss.id);
             }
 
--- a/src/java.base/share/classes/sun/security/ssl/X509Authentication.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/X509Authentication.java	Tue Oct 16 23:21:05 2018 +0530
@@ -170,7 +170,7 @@
             return null;
         }
 
-        // Used by TLS 1.3 only.
+        // Used by TLS 1.2 and TLS 1.3.
         private SSLPossession createClientPossession(
                 ClientHandshakeContext chc, String keyType) {
             X509ExtendedKeyManager km = chc.sslContext.getX509KeyManager();
@@ -178,11 +178,13 @@
             if (chc.conContext.transport instanceof SSLSocketImpl) {
                 clientAlias = km.chooseClientAlias(
                         new String[] { keyType },
-                        null, (SSLSocket)chc.conContext.transport);
+                        chc.peerSupportedAuthorities,
+                        (SSLSocket)chc.conContext.transport);
             } else if (chc.conContext.transport instanceof SSLEngineImpl) {
                 clientAlias = km.chooseEngineClientAlias(
                         new String[] { keyType },
-                        null, (SSLEngine)chc.conContext.transport);
+                        chc.peerSupportedAuthorities,
+                        (SSLEngine)chc.conContext.transport);
             }
 
             if (clientAlias == null) {
Binary file src/java.base/share/lib/security/cacerts has changed
--- a/src/java.base/share/native/include/jni.h	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/native/include/jni.h	Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2016, 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
@@ -1871,6 +1871,20 @@
 #endif /* __cplusplus */
 };
 
+/*
+ * optionString may be any option accepted by the JVM, or one of the
+ * following:
+ *
+ * -D<name>=<value>          Set a system property.
+ * -verbose[:class|gc|jni]   Enable verbose output, comma-separated. E.g.
+ *                           "-verbose:class" or "-verbose:gc,class"
+ *                           Standard names include: gc, class, and jni.
+ *                           All nonstandard (VM-specific) names must begin
+ *                           with "X".
+ * vfprintf                  extraInfo is a pointer to the vfprintf hook.
+ * exit                      extraInfo is a pointer to the exit hook.
+ * abort                     extraInfo is a pointer to the abort hook.
+ */
 typedef struct JavaVMOption {
     char *optionString;
     void *extraInfo;
--- a/src/java.base/unix/native/libnet/NetworkInterface.c	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/unix/native/libnet/NetworkInterface.c	Tue Oct 16 23:21:05 2018 +0530
@@ -331,9 +331,16 @@
     netif *ifs, *curr;
     jobject obj = NULL;
     jboolean match = JNI_FALSE;
-    int family = (getInetAddress_family(env, iaObj) == java_net_InetAddress_IPv4) ?
-        AF_INET : AF_INET6;
+    int family = getInetAddress_family(env, iaObj);
     JNU_CHECK_EXCEPTION_RETURN(env, NULL);
+
+    if (family == java_net_InetAddress_IPv4) {
+        family = AF_INET;
+    } else if (family == java_net_InetAddress_IPv6) {
+        family = AF_INET6;
+    } else {
+        return NULL; // Invalid family
+    }
     ifs = enumInterfaces(env);
     if (ifs == NULL) {
         return NULL;
@@ -351,7 +358,9 @@
                     int address1 = htonl(
                         ((struct sockaddr_in *)addrP->addr)->sin_addr.s_addr);
                     int address2 = getInetAddress_addr(env, iaObj);
-                    JNU_CHECK_EXCEPTION_RETURN(env, NULL);
+                    if ((*env)->ExceptionCheck(env)) {
+                        goto cleanup;
+                    }
                     if (address1 == address2) {
                         match = JNI_TRUE;
                         break;
@@ -397,6 +406,7 @@
         obj = createNetworkInterface(env, curr);
     }
 
+cleanup:
     // release the interface list
     freeif(ifs);
 
--- a/src/java.base/windows/native/libnet/NetworkInterface.c	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/windows/native/libnet/NetworkInterface.c	Tue Oct 16 23:21:05 2018 +0530
@@ -280,6 +280,7 @@
             if (curr->name == NULL || curr->displayName == NULL) {
                 if (curr->name) free(curr->name);
                 if (curr->displayName) free(curr->displayName);
+                free(curr);
                 curr = NULL;
             }
         }
@@ -586,7 +587,10 @@
             /* default ctor will set family to AF_INET */
 
             setInetAddress_addr(env, iaObj, ntohl(addrs->addr.sa4.sin_addr.s_addr));
-            JNU_CHECK_EXCEPTION_RETURN(env, NULL);
+            if ((*env)->ExceptionCheck(env)) {
+                free_netaddr(netaddrP);
+                return NULL;
+            }
             if (addrs->mask != -1) {
               ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID);
               if (ibObj == NULL) {
@@ -600,7 +604,10 @@
                 return NULL;
               }
               setInetAddress_addr(env, ia2Obj, ntohl(addrs->brdcast.sa4.sin_addr.s_addr));
-              JNU_CHECK_EXCEPTION_RETURN(env, NULL);
+              if ((*env)->ExceptionCheck(env)) {
+                  free_netaddr(netaddrP);
+                  return NULL;
+              }
               (*env)->SetObjectField(env, ibObj, ni_ibbroadcastID, ia2Obj);
               (*env)->SetShortField(env, ibObj, ni_ibmaskID, addrs->mask);
               (*env)->SetObjectArrayElement(env, bindsArr, bind_index++, ibObj);
@@ -611,6 +618,7 @@
             if (iaObj) {
                 jboolean ret = setInet6Address_ipaddress(env, iaObj,  (jbyte *)&(addrs->addr.sa6.sin6_addr.s6_addr));
                 if (ret == JNI_FALSE) {
+                    free_netaddr(netaddrP);
                     return NULL;
                 }
 
--- a/src/java.base/windows/native/libnet/NetworkInterface_winXP.c	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/windows/native/libnet/NetworkInterface_winXP.c	Tue Oct 16 23:21:05 2018 +0530
@@ -521,8 +521,9 @@
     jobjectArray addrArr, bindsArr, childArr;
     netaddr *addrs;
     jint addr_index;
-    int netaddrCount=ifs->naddrs;
-    netaddr *netaddrP=ifs->addrs;
+    int netaddrCount = ifs->naddrs;
+    netaddr *netaddrP = ifs->addrs;
+    netaddr *netaddrPToFree = NULL;
     jint bind_index;
 
     /*
@@ -553,21 +554,23 @@
      * Note that 0 is a valid number of addresses.
      */
     if (netaddrCount < 0) {
-        netaddrCount = enumAddresses_win(env, ifs, &netaddrP);
+        netaddrCount = enumAddresses_win(env, ifs, &netaddrPToFree);
         if (netaddrCount == -1) {
             return NULL;
         }
+        netaddrP = netaddrPToFree;
     }
 
     addrArr = (*env)->NewObjectArray(env, netaddrCount, ia_class, NULL);
     if (addrArr == NULL) {
+        free_netaddr(netaddrPToFree);
         return NULL;
     }
 
     bindsArr = (*env)->NewObjectArray(env, netaddrCount, ni_ibcls, NULL);
     if (bindsArr == NULL) {
-      free_netaddr(netaddrP);
-      return NULL;
+        free_netaddr(netaddrPToFree);
+        return NULL;
     }
 
     addrs = netaddrP;
@@ -579,25 +582,32 @@
         if (addrs->addr.sa.sa_family == AF_INET) {
             iaObj = (*env)->NewObject(env, ia4_class, ia4_ctrID);
             if (iaObj == NULL) {
+                free_netaddr(netaddrPToFree);
                 return NULL;
             }
             /* default ctor will set family to AF_INET */
 
             setInetAddress_addr(env, iaObj, ntohl(addrs->addr.sa4.sin_addr.s_addr));
-            JNU_CHECK_EXCEPTION_RETURN(env, NULL);
+            if ((*env)->ExceptionCheck(env)) {
+                free_netaddr(netaddrPToFree);
+                return NULL;
+            }
             ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID);
             if (ibObj == NULL) {
-              free_netaddr(netaddrP);
-              return NULL;
+                free_netaddr(netaddrPToFree);
+                return NULL;
             }
             (*env)->SetObjectField(env, ibObj, ni_ibaddressID, iaObj);
             ia2Obj = (*env)->NewObject(env, ia4_class, ia4_ctrID);
             if (ia2Obj == NULL) {
-              free_netaddr(netaddrP);
-              return NULL;
+                free_netaddr(netaddrPToFree);
+                return NULL;
             }
             setInetAddress_addr(env, ia2Obj, ntohl(addrs->brdcast.sa4.sin_addr.s_addr));
-            JNU_CHECK_EXCEPTION_RETURN(env, NULL);
+            if ((*env)->ExceptionCheck(env)) {
+                free_netaddr(netaddrPToFree);
+                return NULL;
+            }
             (*env)->SetObjectField(env, ibObj, ni_ibbroadcastID, ia2Obj);
             (*env)->SetShortField(env, ibObj, ni_ibmaskID, addrs->mask);
             (*env)->SetObjectArrayElement(env, bindsArr, bind_index++, ibObj);
@@ -606,10 +616,12 @@
             jboolean ret;
             iaObj = (*env)->NewObject(env, ia6_class, ia6_ctrID);
             if (iaObj == NULL) {
+                free_netaddr(netaddrPToFree);
                 return NULL;
             }
             ret = setInet6Address_ipaddress(env, iaObj, (jbyte *)&(addrs->addr.sa6.sin6_addr.s6_addr));
             if (ret == JNI_FALSE) {
+                free_netaddr(netaddrPToFree);
                 return NULL;
             }
             scope = addrs->addr.sa6.sin6_scope_id;
@@ -619,8 +631,8 @@
             }
             ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID);
             if (ibObj == NULL) {
-              free_netaddr(netaddrP);
-              return NULL;
+                free_netaddr(netaddrPToFree);
+                return NULL;
             }
             (*env)->SetObjectField(env, ibObj, ni_ibaddressID, iaObj);
             (*env)->SetShortField(env, ibObj, ni_ibmaskID, addrs->mask);
@@ -633,6 +645,8 @@
     (*env)->SetObjectField(env, netifObj, ni_addrsID, addrArr);
     (*env)->SetObjectField(env, netifObj, ni_bindsID, bindsArr);
 
+    free_netaddr(netaddrPToFree);
+
     /*
      * Windows doesn't have virtual interfaces, so child array
      * is always empty.
@@ -672,7 +686,7 @@
     }
 
     /* if found create a NetworkInterface */
-    if (curr != NULL) {;
+    if (curr != NULL) {
         netifObj = createNetworkInterfaceXP(env, curr);
     }
 
--- a/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java	Tue Oct 16 23:21:05 2018 +0530
@@ -736,7 +736,7 @@
         }
 
         try {
-            return invoke(new Callable<File[]>() {
+            File[] files = invoke(new Callable<File[]>() {
                 public File[] call() throws InterruptedException {
                     if (!isDirectory()) {
                         return null;
@@ -791,6 +791,8 @@
                         : list.toArray(new ShellFolder[list.size()]);
                 }
             }, InterruptedException.class);
+
+            return Win32ShellFolderManager2.checkFiles(files);
         } catch (InterruptedException e) {
             return new File[0];
         }
--- a/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java	Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, 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
@@ -387,21 +387,30 @@
         return null;
     }
 
-    private File checkFile(File file) {
+    private static File checkFile(File file) {
         SecurityManager sm = System.getSecurityManager();
         return (sm == null || file == null) ? file : checkFile(file, sm);
     }
 
-    private File checkFile(File file, SecurityManager sm) {
+    private static File checkFile(File file, SecurityManager sm) {
         try {
             sm.checkRead(file.getPath());
+
+            if (file instanceof Win32ShellFolder2) {
+                Win32ShellFolder2 f = (Win32ShellFolder2)file;
+                if (f.isLink()) {
+                    Win32ShellFolder2 link = (Win32ShellFolder2)f.getLinkLocation();
+                    if (link != null)
+                        sm.checkRead(link.getPath());
+                }
+            }
             return file;
         } catch (SecurityException se) {
             return null;
         }
     }
 
-    private File[] checkFiles(File[] files) {
+    static File[] checkFiles(File[] files) {
         SecurityManager sm = System.getSecurityManager();
         if (sm == null || files == null || files.length == 0) {
             return files;
@@ -409,7 +418,7 @@
         return checkFiles(Arrays.stream(files), sm);
     }
 
-    private File[] checkFiles(List<File> files) {
+    private static File[] checkFiles(List<File> files) {
         SecurityManager sm = System.getSecurityManager();
         if (sm == null || files.isEmpty()) {
             return files.toArray(new File[files.size()]);
@@ -417,7 +426,7 @@
         return checkFiles(files.stream(), sm);
     }
 
-    private File[] checkFiles(Stream<File> filesStream, SecurityManager sm) {
+    private static File[] checkFiles(Stream<File> filesStream, SecurityManager sm) {
         return filesStream.filter((file) -> checkFile(file, sm) != null)
                 .toArray(File[]::new);
     }
--- a/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiIn.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiIn.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -252,7 +252,7 @@
 }
 
 INT32 getMidiInCaps(INT32 deviceID, MIDIINCAPSW* caps, INT32* err) {
-    (*err) = midiInGetDevCapsW(deviceID, caps, sizeof(MIDIINCAPS));
+    (*err) = midiInGetDevCapsW(deviceID, caps, sizeof(MIDIINCAPSW));
     return ((*err) == MMSYSERR_NOERROR);
 }
 
@@ -260,6 +260,7 @@
     MIDIINCAPSW midiInCaps;
     INT32 err;
 
+    memset(&midiInCaps, 0, sizeof(midiInCaps));
     if (getMidiInCaps(deviceID, &midiInCaps, &err)) {
         UnicodeToUTF8AndCopy(name, midiInCaps.szPname, nameLength);
         return MIDI_SUCCESS;
@@ -284,6 +285,7 @@
     MIDIINCAPSW midiInCaps;
     INT32 err = MIDI_NOT_SUPPORTED;
 
+    memset(&midiInCaps, 0, sizeof(midiInCaps));
     if (getMidiInCaps(deviceID, &midiInCaps, &err) && (nameLength>7)) {
         sprintf(name, "%d.%d", (midiInCaps.vDriverVersion & 0xFF00) >> 8, midiInCaps.vDriverVersion & 0xFF);
         return MIDI_SUCCESS;
--- a/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiOut.c	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiOut.c	Tue Oct 16 23:21:05 2018 +0530
@@ -70,12 +70,13 @@
 
 
 INT32 getMidiOutCaps(INT32 deviceID, MIDIOUTCAPSW* caps, INT32* err) {
+    UINT_PTR id;
     if (deviceID == 0) {
-        deviceID = MIDI_MAPPER;
+        id = MIDI_MAPPER;
     } else {
-        deviceID--;
+        id = (UINT_PTR)(deviceID-1);
     }
-    (*err) = (INT32) midiOutGetDevCapsW(deviceID, caps, sizeof(MIDIOUTCAPS));
+    (*err) = (INT32) midiOutGetDevCapsW(id, caps, sizeof(MIDIOUTCAPSW));
     return ((*err) == MMSYSERR_NOERROR);
 }
 
@@ -84,6 +85,7 @@
     MIDIOUTCAPSW midiOutCaps;
     INT32 err;
 
+    memset(&midiOutCaps, 0, sizeof(midiOutCaps));
     if (getMidiOutCaps(deviceID, &midiOutCaps, &err)) {
         UnicodeToUTF8AndCopy(name, midiOutCaps.szPname, nameLength);
         return MIDI_SUCCESS;
@@ -103,6 +105,7 @@
     char *desc;
     INT32 err;
 
+    memset(&midiOutCaps, 0, sizeof(midiOutCaps));
     if (getMidiOutCaps(deviceID, &midiOutCaps, &err)) {
         int tech = (int)midiOutCaps.wTechnology;
         switch(tech) {
@@ -139,6 +142,7 @@
     MIDIOUTCAPSW midiOutCaps;
     INT32 err;
 
+    memset(&midiOutCaps, 0, sizeof(midiOutCaps));
     if (getMidiOutCaps(deviceID, &midiOutCaps, &err) && nameLength>7) {
         sprintf(name, "%d.%d", (midiOutCaps.vDriverVersion & 0xFF00) >> 8, midiOutCaps.vDriverVersion & 0xFF);
         return MIDI_SUCCESS;
--- a/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_Ports.c	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_Ports.c	Tue Oct 16 23:21:05 2018 +0530
@@ -357,7 +357,7 @@
 
 INT32 PORT_GetPortMixerDescription(INT32 mixerIndex, PortMixerDescription* description) {
     MIXERCAPSW mixerCaps;
-    if (mixerGetDevCapsW(mixerIndex, &mixerCaps, sizeof(MIXERCAPS)) == MMSYSERR_NOERROR) {
+    if (mixerGetDevCapsW(mixerIndex, &mixerCaps, sizeof(MIXERCAPSW)) == MMSYSERR_NOERROR) {
         UnicodeToUTF8AndCopy(description->name, mixerCaps.szPname, PORT_STRING_LENGTH);
         sprintf(description->version, "%d.%d", (mixerCaps.vDriverVersion & 0xFF00) >> 8, mixerCaps.vDriverVersion & 0xFF);
         strncpy(description->description, "Port Mixer", PORT_STRING_LENGTH-1);
@@ -368,9 +368,9 @@
 
 int getDestinationCount(HMIXER handle) {
     int ret = 0;
-    MIXERCAPS mixerCaps;
+    MIXERCAPSW mixerCaps;
 
-    if (mixerGetDevCaps((UINT_PTR) handle, &mixerCaps, sizeof(MIXERCAPS)) == MMSYSERR_NOERROR) {
+    if (mixerGetDevCapsW((UINT_PTR) handle, &mixerCaps, sizeof(MIXERCAPSW)) == MMSYSERR_NOERROR) {
         ret = mixerCaps.cDestinations;
     }
     return ret;
--- a/src/java.logging/share/classes/java/util/logging/SimpleFormatter.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.logging/share/classes/java/util/logging/SimpleFormatter.java	Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -38,8 +38,7 @@
  * <p>
  * <a id="formatting">
  * <b>Configuration:</b></a>
- * The {@code SimpleFormatter} is initialized with the
- * <a href="../Formatter.html#syntax">format string</a>
+ * The {@code SimpleFormatter} is initialized with the format string
  * specified in the {@code java.util.logging.SimpleFormatter.format}
  * property to {@linkplain #format(LogRecord) format} the log messages.
  * This property can be defined
@@ -69,8 +68,7 @@
     /**
      * Format the given LogRecord.
      * <p>
-     * The formatting can be customized by specifying the
-     * <a href="../Formatter.html#syntax">format string</a>
+     * The formatting can be customized by specifying the format string
      * in the <a href="#formatting">
      * {@code java.util.logging.SimpleFormatter.format}</a> property.
      * The given {@code LogRecord} will be formatted as if by calling:
--- a/src/java.management/share/classes/sun/management/StackTraceElementCompositeData.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.management/share/classes/sun/management/StackTraceElementCompositeData.java	Tue Oct 16 23:21:05 2018 +0530
@@ -78,14 +78,16 @@
         // CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
         // STACK_TRACE_ELEMENT_ATTRIBUTES!
         final Object[] stackTraceElementItemValues = {
-            ste.getClassLoaderName(),
-            ste.getModuleName(),
-            ste.getModuleVersion(),
+            // JDK 5 attributes
             ste.getClassName(),
             ste.getMethodName(),
             ste.getFileName(),
             ste.getLineNumber(),
             ste.isNativeMethod(),
+            // JDK 9 attributes
+            ste.getClassLoaderName(),
+            ste.getModuleName(),
+            ste.getModuleVersion(),
         };
         try {
             return new CompositeDataSupport(STACK_TRACE_ELEMENT_COMPOSITE_TYPE,
--- a/src/java.naming/share/classes/com/sun/naming/internal/VersionHelper.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.naming/share/classes/com/sun/naming/internal/VersionHelper.java	Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,6 +53,20 @@
 public final class VersionHelper {
     private static final VersionHelper helper = new VersionHelper();
 
+    /**
+     * Determines whether classes may be loaded from an arbitrary URL code base.
+     */
+    private static final boolean TRUST_URL_CODE_BASE;
+
+    static {
+        // System property to control whether classes may be loaded from an
+        // arbitrary URL code base
+        PrivilegedAction<String> act
+                = () -> System.getProperty("com.sun.jndi.ldap.object.trustURLCodebase", "false");
+        String trust = AccessController.doPrivileged(act);
+        TRUST_URL_CODE_BASE = "true".equalsIgnoreCase(trust);
+    }
+
     final static String[] PROPS = new String[]{
         javax.naming.Context.INITIAL_CONTEXT_FACTORY,
         javax.naming.Context.OBJECT_FACTORIES,
@@ -88,12 +102,14 @@
      */
     public Class<?> loadClass(String className, String codebase)
             throws ClassNotFoundException, MalformedURLException {
-
-        ClassLoader parent = getContextClassLoader();
-        ClassLoader cl =
-                URLClassLoader.newInstance(getUrlArray(codebase), parent);
-
-        return loadClass(className, cl);
+        if (TRUST_URL_CODE_BASE) {
+            ClassLoader parent = getContextClassLoader();
+            ClassLoader cl
+                    = URLClassLoader.newInstance(getUrlArray(codebase), parent);
+            return loadClass(className, cl);
+        } else {
+            return null;
+        }
     }
 
     /**
--- a/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java	Tue Oct 16 23:21:05 2018 +0530
@@ -26,21 +26,26 @@
 package jdk.internal.net.http;
 
 import java.io.IOException;
+import java.io.UncheckedIOException;
 import java.net.ConnectException;
 import java.net.http.HttpConnectTimeoutException;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.security.AccessControlContext;
 import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionStage;
 import java.util.concurrent.CompletionException;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Executor;
+import java.util.concurrent.Flow;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.function.Function;
 
 import java.net.http.HttpClient;
+import java.net.http.HttpHeaders;
 import java.net.http.HttpRequest;
 import java.net.http.HttpResponse;
+import java.net.http.HttpResponse.BodySubscriber;
 import java.net.http.HttpResponse.PushPromiseHandler;
 import java.net.http.HttpTimeoutException;
 import jdk.internal.net.http.common.Log;
@@ -200,11 +205,60 @@
         return cf;
     }
 
+    // return true if the response is a type where a response body is never possible
+    // and therefore doesn't have to include header information which indicates no
+    // body is present. This is distinct from responses that also do not contain
+    // response bodies (possibly ever) but which are required to have content length
+    // info in the header (eg 205). Those cases do not have to be handled specially
+
+    private static boolean bodyNotPermitted(Response r) {
+        return r.statusCode == 204;
+    }
+
+    private boolean bodyIsPresent(Response r) {
+        HttpHeaders headers = r.headers();
+        if (headers.firstValue("Content-length").isPresent())
+            return true;
+        if (headers.firstValue("Transfer-encoding").isPresent())
+            return true;
+        return false;
+    }
+
+    // Call the user's body handler to get an empty body object
+
+    private CompletableFuture<HttpResponse<T>> handleNoBody(Response r, Exchange<T> exch) {
+        BodySubscriber<T> bs = responseHandler.apply(new ResponseInfoImpl(r.statusCode(),
+                r.headers(), r.version()));
+        CompletionStage<T> cs = bs.getBody();
+        bs.onSubscribe(new NullSubscription());
+        bs.onComplete();
+        MinimalFuture<HttpResponse<T>> result = new MinimalFuture<>();
+        cs.whenComplete((nullBody, exception) -> {
+            if (exception != null)
+                result.completeExceptionally(exception);
+            else {
+                this.response =
+                        new HttpResponseImpl<>(r.request(), r, this.response, nullBody, exch);
+                result.complete(this.response);
+            }
+        });
+        return result;
+    }
+
     private CompletableFuture<HttpResponse<T>>
     responseAsync0(CompletableFuture<Void> start) {
         return start.thenCompose( v -> responseAsyncImpl())
                     .thenCompose((Response r) -> {
                         Exchange<T> exch = getExchange();
+                        if (bodyNotPermitted(r)) {
+                            if (bodyIsPresent(r)) {
+                                IOException ioe = new IOException(
+                                    "unexpected content length header with 204 response");
+                                exch.cancel(ioe);
+                                return MinimalFuture.failedFuture(ioe);
+                            } else
+                                return handleNoBody(r, exch);
+                        }
                         return exch.readBodyAsync(responseHandler)
                             .thenApply((T body) -> {
                                 this.response =
@@ -214,6 +268,16 @@
                     });
     }
 
+    static class NullSubscription implements Flow.Subscription {
+        @Override
+        public void request(long n) {
+        }
+
+        @Override
+        public void cancel() {
+        }
+    }
+
     private CompletableFuture<Response> responseAsyncImpl() {
         CompletableFuture<Response> cf;
         if (attempts.incrementAndGet() > max_attempts) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dom/package-info.java	Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2005, 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.
+ */
+
+/**
+ * DOM-specific classes for the {@link javax.xml.crypto} package.
+ * Only users who are using DOM-based XML cryptographic implementations (ex:
+ * {@link javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory} or
+ * {@link javax.xml.crypto.dsig.keyinfo.KeyInfoFactory})
+ * should need to make direct use of this package.
+ *
+ * <h2>Package Specification</h2>
+ *
+ * <ul>
+ * <li>
+ * <a href="http://www.w3.org/TR/xmldsig-core/">
+ * XML-Signature Syntax and Processing: W3C Recommendation</a>
+ * <li>
+ * <a href="http://www.ietf.org/rfc/rfc3275.txt">
+ * RFC 3275: XML-Signature Syntax and Processing</a>
+ * </ul>
+ *
+ * @since 1.6
+ */
+
+package javax.xml.crypto.dom;
--- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dom/package.html	Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-<html>
-<head>
-<!--
-Copyright (c) 2005, 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.
--->
-
-</head>
-<body>
-DOM-specific classes for the {@link javax.xml.crypto} package. 
-Only users who are using a DOM-based XML cryptographic implementations (ex: 
-{@link javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory} or 
-{@link javax.xml.crypto.dsig.keyinfo.KeyInfoFactory}) 
-should need to make direct use of this package.
-
-<h2>Package Specification</h2>
-
-<ul>
-<li>
-<a href="http://www.w3.org/TR/xmldsig-core/">
-XML-Signature Syntax and Processing: W3C Recommendation</a>
-<li>
-<a href="http://www.ietf.org/rfc/rfc3275.txt">
-RFC 3275: XML-Signature Syntax and Processing</a>
-</ul>
-
-@since 1.6
-
-</body>
-</html>
--- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/TransformService.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/TransformService.java	Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -68,11 +68,11 @@
  * </pre>
  * <code>TransformService</code> implementations that support the DOM
  * mechanism type must abide by the DOM interoperability requirements defined
- * in the
- * {@extLink security_guide_xmldsig_rqmts DOM Mechanism Requirements} section
- * of the API overview. See the
- * {@extLink security_guide_xmldsig_provider Service Providers} section of
- * the API overview for a list of standard mechanism types.
+ * in the <a href="package-summary.html#dom_req">DOM Mechanism
+ * Requirements</a>. See the {@code TransformService} section in the <a href=
+ * "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms">
+ * Java Security Standard Algorithm Names Specification</a> for a list of
+ * standard algorithm URIs and mechanism types.
  * <p>
  * Once a <code>TransformService</code> has been created, it can be used
  * to process <code>Transform</code> or <code>CanonicalizationMethod</code>
--- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java	Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -66,10 +66,11 @@
  *
  * <p>The objects that this factory produces will be based
  * on DOM and abide by the DOM interoperability requirements as defined in the
- * {@extLink security_guide_xmldsig_rqmts DOM Mechanism Requirements} section
- * of the API overview. See the
- * {@extLink security_guide_xmldsig_provider Service Providers} section of
- * the API overview for a list of standard mechanism types.
+ * <a href="package-summary.html#dom_req">DOM Mechanism Requirements</a>.
+ * See the {@code XMLSignatureFactory} section in the <a href=
+ * "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms">
+ * Java Security Standard Algorithm Names Specification</a> for a list of
+ * standard mechanism types.
  *
  * <p><code>XMLSignatureFactory</code> implementations are registered and loaded
  * using the {@link java.security.Provider} mechanism.
@@ -180,8 +181,10 @@
      * {@link Security#getProviders() Security.getProviders()}.
      *
      * @param mechanismType the type of the XML processing mechanism and
-     *    representation. See the {@extLink security_guide_xmldsig_provider
-     *    Service Providers} section of the API overview for a list of
+     *    representation. See the {@code XMLSignatureFactory} section in the
+     *    <a href=
+     *    "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms">
+     *    Java Security Standard Algorithm Names Specification</a> for a list of
      *    standard mechanism types.
      * @return a new <code>XMLSignatureFactory</code>
      * @throws NullPointerException if <code>mechanismType</code> is
@@ -225,8 +228,10 @@
      * provider list.
      *
      * @param mechanismType the type of the XML processing mechanism and
-     *    representation. See the {@extLink security_guide_xmldsig_provider
-     *    Service Providers} section of the API overview for a list of
+     *    representation. See the {@code XMLSignatureFactory} section in the
+     *    <a href=
+     *    "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms">
+     *    Java Security Standard Algorithm Names Specification</a> for a list of
      *    standard mechanism types.
      * @param provider the <code>Provider</code> object
      * @return a new <code>XMLSignatureFactory</code>
@@ -276,8 +281,10 @@
      * the {@link Security#getProviders() Security.getProviders()} method.
      *
      * @param mechanismType the type of the XML processing mechanism and
-     *    representation. See the {@extLink security_guide_xmldsig_provider
-     *    Service Providers} section of the API overview for a list of
+     *    representation. See the {@code XMLSignatureFactory} section in the
+     *    <a href=
+     *    "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms">
+     *    Java Security Standard Algorithm Names Specification</a> for a list of
      *    standard mechanism types.
      * @param provider the string name of the provider
      * @return a new <code>XMLSignatureFactory</code>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/dom/package-info.java	Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2005, 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.
+ */
+
+/**
+ * DOM-specific classes for the {@link javax.xml.crypto.dsig} package.
+ * Only users who are using a DOM-based {@link
+ * javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory} or
+ * {@link javax.xml.crypto.dsig.keyinfo.KeyInfoFactory}
+ * should need to make direct use of this package.
+ *
+ * <h2>Package Specification</h2>
+ *
+ * <ul>
+ * <li>
+ * <a href="http://www.w3.org/TR/xmldsig-core/">
+ * XML-Signature Syntax and Processing: W3C Recommendation</a>
+ * <li>
+ * <a href="http://www.ietf.org/rfc/rfc3275.txt">
+ * RFC 3275: XML-Signature Syntax and Processing</a>
+ * </ul>
+ *
+ * @since 1.6
+ */
+
+package javax.xml.crypto.dsig.dom;
--- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/dom/package.html	Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-<html>
-<head>
-<!--
-Copyright (c) 2005, 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.
--->
-
-</head>
-<body>
-DOM-specific classes for the {@link javax.xml.crypto.dsig} package. 
-Only users who are using a DOM-based {@link 
-javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory} or 
-{@link javax.xml.crypto.dsig.keyinfo.KeyInfoFactory} 
-should need to make direct use of this package.
-
-<h2>Package Specification</h2>
-
-<ul>
-<li>
-<a href="http://www.w3.org/TR/xmldsig-core/">
-XML-Signature Syntax and Processing: W3C Recommendation</a>
-<li>
-<a href="http://www.ietf.org/rfc/rfc3275.txt">
-RFC 3275: XML-Signature Syntax and Processing</a>
-</ul>
-
-@since 1.6
-
-</body>
-</html>
--- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java	Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -61,11 +61,11 @@
  *
  * <p>The objects that this factory produces will be based
  * on DOM and abide by the DOM interoperability requirements as defined in the
- * {@extLink security_guide_xmldsig_rqmts DOM Mechanism Requirements} section
- * of the API overview.  See the <a href=
+ * <a href="../package-summary.html#dom_req">DOM Mechanism Requirements</a>.
+ * See the {@code KeyInfoFactory} section in the <a href=
  * "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms">
- * Java Security Standard Algorithm Names</a> document
- * for more information.
+ * Java Security Standard Algorithm Names Specification</a> for a list of
+ * standard mechanism types.
  *
  * <p><code>KeyInfoFactory</code> implementations are registered and loaded
  * using the {@link java.security.Provider} mechanism.
@@ -137,10 +137,11 @@
      * {@link Security#getProviders() Security.getProviders()}.
      *
      * @param mechanismType the type of the XML processing mechanism and
-     *    representation.  See the <a href=
+     *    representation.  See the {@code KeyInfoFactory} section in the
+     *    <a href=
      *    "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms">
-     *    Java Security Standard Algorithm Names</a> document
-     * for more information.
+     *    Java Security Standard Algorithm Names Specification</a> for a list
+     *    of standard mechanism types.
      * @return a new <code>KeyInfoFactory</code>
      * @throws NullPointerException if <code>mechanismType</code> is
      *    <code>null</code>
@@ -182,10 +183,11 @@
      * provider list.
      *
      * @param mechanismType the type of the XML processing mechanism and
-     *    representation.  See the <a href=
+     *    representation.  See the {@code KeyInfoFactory} section in the
+     *    <a href=
      *    "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms">
-     *    Java Security Standard Algorithm Names</a> document
-     *    for more information.
+     *    Java Security Standard Algorithm Names Specification</a> for a list
+     *    of standard mechanism types.
      * @param provider the <code>Provider</code> object
      * @return a new <code>KeyInfoFactory</code>
      * @throws NullPointerException if <code>mechanismType</code> or
@@ -233,10 +235,11 @@
      * the {@link Security#getProviders() Security.getProviders()} method.
      *
      * @param mechanismType the type of the XML processing mechanism and
-     *    representation.  See the <a href=
+     *    representation.  See the {@code KeyInfoFactory} section in the
+     *    <a href=
      *    "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms">
-     *    Java Security Standard Algorithm Names</a> document
-     *    for more information.
+     *    Java Security Standard Algorithm Names Specification</a> for a list
+     *    of standard mechanism types.
      * @param provider the string name of the provider
      * @return a new <code>KeyInfoFactory</code>
      * @throws NoSuchProviderException if the specified provider is not
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/package-info.java	Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2005, 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.
+ */
+
+/**
+ * Classes for parsing and processing {@link
+ * javax.xml.crypto.dsig.keyinfo.KeyInfo KeyInfo} elements and structures.
+ * <code>KeyInfo</code> is an optional element that enables the recipient(s) to
+ * obtain the key needed to validate an {@link
+ * javax.xml.crypto.dsig.XMLSignature XMLSignature}. <code>KeyInfo</code> may
+ * contain keys, names, certificates and other public key management
+ * information, such as in-band key distribution or key agreement data. This
+ * package contains classes representing types defined in the W3C specification
+ * for XML Signatures, such as
+ * {@link javax.xml.crypto.dsig.keyinfo.KeyName KeyName},
+ * {@link javax.xml.crypto.dsig.keyinfo.KeyValue KeyValue},
+ * {@link javax.xml.crypto.dsig.keyinfo.RetrievalMethod RetrievalMethod},
+ * {@link javax.xml.crypto.dsig.keyinfo.X509Data X509Data},
+ * {@link javax.xml.crypto.dsig.keyinfo.X509IssuerSerial X509IssuerSerial}, and
+ * {@link javax.xml.crypto.dsig.keyinfo.PGPData PGPData}.
+ * {@link javax.xml.crypto.dsig.keyinfo.KeyInfoFactory KeyInfoFactory} is an
+ * abstract factory that creates <code>KeyInfo</code> objects from scratch.
+ *
+ * <h2>Package Specification</h2>
+ *
+ * <ul>
+ * <li>
+ * <a href="http://www.w3.org/TR/xmldsig-core/">
+ * XML-Signature Syntax and Processing: W3C Recommendation</a>
+ * <li>
+ * <a href="http://www.ietf.org/rfc/rfc3275.txt">
+ * RFC 3275: XML-Signature Syntax and Processing</a>
+ * </ul>
+ *
+ * @since 1.6
+ */
+
+package javax.xml.crypto.dsig.keyinfo;
--- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/package.html	Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-<html>
-<head>
-<!--
-Copyright (c) 2005, 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.
--->
-
-</head>
-<body>
-Classes for parsing and processing {@link javax.xml.crypto.dsig.keyinfo.KeyInfo 
-KeyInfo} elements and structures. <code>KeyInfo</code> is an optional element
-that enables the recipient(s) to obtain the key needed to validate an 
-{@link javax.xml.crypto.dsig.XMLSignature XMLSignature}. <code>KeyInfo</code> 
-may contain keys, names, certificates and other public key management 
-information, such as in-band key distribution or key agreement data. This 
-package contains classes representing types defined in the W3C specification 
-for XML Signatures, such as 
-{@link javax.xml.crypto.dsig.keyinfo.KeyName KeyName},
-{@link javax.xml.crypto.dsig.keyinfo.KeyValue KeyValue},
-{@link javax.xml.crypto.dsig.keyinfo.RetrievalMethod RetrievalMethod},
-{@link javax.xml.crypto.dsig.keyinfo.X509Data X509Data},
-{@link javax.xml.crypto.dsig.keyinfo.X509IssuerSerial X509IssuerSerial}, and
-{@link javax.xml.crypto.dsig.keyinfo.PGPData PGPData}.
-{@link javax.xml.crypto.dsig.keyinfo.KeyInfoFactory KeyInfoFactory}
-is an abstract factory that creates <code>KeyInfo</code> objects from scratch.
-
-<h2>Package Specification</h2>
-
-<ul>
-<li>
-<a href="http://www.w3.org/TR/xmldsig-core/">
-XML-Signature Syntax and Processing: W3C Recommendation</a>
-<li>
-<a href="http://www.ietf.org/rfc/rfc3275.txt">
-RFC 3275: XML-Signature Syntax and Processing</a>
-</ul>
-
-@since 1.6
-
-</body>
-</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/package-info.java	Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2005, 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.
+ */
+
+/**
+ * Classes for generating and validating XML digital
+ * signatures. This package includes classes that represent the core elements
+ * defined in the W3C XML digital signature specification:
+ * {@link javax.xml.crypto.dsig.XMLSignature XMLSignature},
+ * {@link javax.xml.crypto.dsig.SignedInfo SignedInfo},
+ * {@link javax.xml.crypto.dsig.CanonicalizationMethod CanonicalizationMethod},
+ * {@link javax.xml.crypto.dsig.SignatureMethod SignatureMethod},
+ * {@link javax.xml.crypto.dsig.Reference Reference},
+ * {@link javax.xml.crypto.dsig.DigestMethod DigestMethod},
+ * {@link javax.xml.crypto.dsig.XMLObject XMLObject},
+ * {@link javax.xml.crypto.dsig.Manifest Manifest},
+ * {@link javax.xml.crypto.dsig.SignatureProperties SignatureProperties}, and
+ * {@link javax.xml.crypto.dsig.SignatureProperty SignatureProperty}.
+ * {@code KeyInfo} types are defined in the
+ * {@link javax.xml.crypto.dsig.keyinfo} subpackage.
+ * {@link javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory}
+ * is an abstract factory that creates
+ * {@link javax.xml.crypto.dsig.XMLSignature XMLSignature} objects from scratch
+ * or from a pre-existing XML representation, such as a DOM node.
+ * {@link javax.xml.crypto.dsig.TransformService} is a service provider
+ * interface for creating and plugging in implementations of
+ * transform and canonicalization algorithms.
+ *
+ * <p>Of primary significance in this package is the
+ * {@link javax.xml.crypto.dsig.XMLSignature XMLSignature} class,
+ * which allows you to sign and validate an XML digital signature.
+ *
+ * <h2><a id="service_providers"></a>Service Providers</h2>
+ * A service provider is a concrete implementation of the abstract
+ * {@link javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory} and
+ * {@link javax.xml.crypto.dsig.keyinfo.KeyInfoFactory KeyInfoFactory} classes
+ * and is responsible for creating objects and algorithms that parse, generate
+ * and validate XML Signatures and KeyInfo structures. A concrete implementation
+ * of {@code XMLSignatureFactory} MUST provide support for each of the REQUIRED
+ * algorithms as specified by the W3C recommendation for XML Signatures. It MAY
+ * support other algorithms as defined by the W3C recommendation or other
+ * specifications.
+ *
+ * <p>The API leverages the JCA provider model (see
+ * {@link java.security.Provider the Provider class}) for registering and
+ * loading {@code XMLSignatureFactory} and {@code KeyInfoFactory}
+ * implementations.
+ *
+ * <p>Each concrete {@code XMLSignatureFactory} or {@code KeyInfoFactory}
+ * implementation supports a specific XML mechanism type that identifies the XML
+ * processing mechanism that an implementation uses internally to parse and
+ * generate XML signature and KeyInfo structures.
+ *
+ * <p>A service provider implementation SHOULD use underlying JCA engine
+ * classes, such as {@link java.security.Signature} and
+ * {@link java.security.MessageDigest} to perform cryptographic operations.
+ *
+ * <p>In addition to the {@code XMLSignatureFactory} and {@code KeyInfoFactory}
+ * classes, the API supports a service provider interface for transform and
+ * canonicalization algorithms. The {@link
+ * javax.xml.crypto.dsig.TransformService TransformService} class allows you to
+ * develop and plug in an implementation of a specific transform or
+ * canonicalization algorithm for a particular XML mechanism type. The {@code
+ * TransformService} class uses the standard JCA provider model for registering
+ * and loading implementations. Each service provider implementation SHOULD use
+ * the {@code TransformService} class to find a provider that supports transform
+ * and canonicalization algorithms in XML Signatures that it is generating or
+ * validating.
+ *
+ * <h3><a id="dom_req"></a>DOM Mechanism Requirements</h3>
+ * The following requirements MUST be abided by when implementing a DOM-based
+ * {@code XMLSignatureFactory}, {@code KeyInfoFactory} or {@code
+ * TransformService} in order to minimize interoperability problems:
+ * <ol>
+ * <li>The {@code unmarshalXMLSignature} method of {@code XMLSignatureFactory}
+ * MUST support {@code DOMValidateContext} types. If the type is
+ * {@code DOMValidateContext}, it SHOULD contain an {@code Element} of type
+ * Signature. Additionally, the {@code unmarshalXMLSignature} method MAY
+ * populate the Id/Element mappings of the passed-in {@code DOMValidateContext}.
+ * </li>
+ *
+ * <li>The {@code sign} method of {@code XMLSignature}s produced by
+ * {@code XMLSignatureFactory} MUST support {@code DOMSignContext} types and the
+ * {@code validate} method MUST support {@code DOMValidateContext} types. This
+ * requirement also applies to the {@code validate} method of {@code
+ * SignatureValue} and the {@code validate} method of {@code Reference}.</li>
+ *
+ * <li>The implementation MUST support {@code DOMStructure}s as the mechanism
+ * for the application to specify extensible content (any elements or mixed
+ * content).</li>
+ *
+ * <li>If the {@code dereference} method of user-specified {@code
+ * URIDereferencer}s returns {@code NodeSetData} objects, the {@code iterator}
+ * method MUST return an iteration over objects of type {@code
+ * org.w3c.dom.Node}.</li>
+ *
+ * <li>{@code URIReference} objects passed to the {@code dereference} method of
+ * user-specified {@code URIDereferencer}s MUST be of type {@code
+ * DOMURIReference} and {@code XMLCryptoContext} objects MUST implement {@code
+ * DOMCryptoContext}.</li>
+ *
+ * <li>The previous 2 requirements also apply to {@code URIDereferencer}s
+ * returned by the {@code getURIDereferencer} method of {@code
+ * XMLSignatureFactory} and {@code KeyInfoFactory}.</li>
+ *
+ * <li>The {@code unmarshalKeyInfo} method of {@code KeyInfoFactory} MUST
+ * support {@code DOMStructure} types. If the type is {@code DOMStructure}, it
+ * SHOULD contain an {@code Element} of type {@code KeyInfo}.</li>
+ *
+ * <li>The {@code transform} method of {@code Transform} MUST support
+ * {@code DOMCryptoContext} context parameter types.</li>
+ *
+ * <li>The {@code newtransform} and {@code newCanonicalizationMethod} methods of
+ * {@code XMLSignatureFactory} MUST support {@code DOMStructure} parameter
+ * types.</li>
+ *
+ * <li>The {@code init}, and {@code marshalParams} methods of
+ * {@code TransformService} MUST support {@code DOMStructure} and
+ * {@code DOMCryptoContext} types.</li>
+ *
+ * <li>The {@code unmarshalXMLSignature} method of {@code XMLSignatureFactory}
+ * MUST support {@code DOMStructure} types. If the type is {@code DOMStructure},
+ * it SHOULD contain an {@code Element} of type {@code Signature}.</li>
+ *
+ * <li>The {@code marshal} method of {@code KeyInfo} MUST support
+ * {@code DOMStructure} and {@code DOMCryptoContext} parameter types.</li>
+ * </ol>
+ *
+ * <p>Note that a DOM implementation MAY internally use other XML parsing APIs
+ * other than DOM as long as it doesn't affect interoperability. For example, a
+ * DOM implementation of {@code XMLSignatureFactory} might use a SAX parser
+ * internally to canonicalize data.
+ *
+ * <h2>Package Specification</h2>
+ *
+ * <ul>
+ * <li>
+ * <a href="http://www.w3.org/TR/xmldsig-core/">
+ * XML-Signature Syntax and Processing: W3C Recommendation</a>
+ * <li>
+ * <a href="http://www.ietf.org/rfc/rfc3275.txt">
+ * RFC 3275: XML-Signature Syntax and Processing</a>
+ * </ul>
+ *
+ * @since 1.6
+ */
+
+package javax.xml.crypto.dsig;
--- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/package.html	Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-<html>
-<head>
-<!--
-Copyright (c) 2005, 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.
--->
-
-</head>
-<body>
-Classes for generating and validating XML digital
-signatures. This package includes classes that represent the core elements 
-defined in the W3C XML digital signature specification:
-{@link javax.xml.crypto.dsig.XMLSignature XMLSignature},
-{@link javax.xml.crypto.dsig.SignedInfo SignedInfo},
-{@link javax.xml.crypto.dsig.CanonicalizationMethod CanonicalizationMethod},
-{@link javax.xml.crypto.dsig.SignatureMethod SignatureMethod},
-{@link javax.xml.crypto.dsig.Reference Reference}, 
-{@link javax.xml.crypto.dsig.DigestMethod DigestMethod},
-{@link javax.xml.crypto.dsig.XMLObject XMLObject}, 
-{@link javax.xml.crypto.dsig.Manifest Manifest},
-{@link javax.xml.crypto.dsig.SignatureProperties SignatureProperties}, and
-{@link javax.xml.crypto.dsig.SignatureProperty SignatureProperty}. 
-<code>KeyInfo</code> types
-are defined in the {@link javax.xml.crypto.dsig.keyinfo} subpackage.
-{@link javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory}
-is an abstract factory that creates 
-{@link javax.xml.crypto.dsig.XMLSignature XMLSignature} objects from scratch
-or from a pre-existing XML representation, such as a DOM node.
-{@link javax.xml.crypto.dsig.TransformService} is a service provider
-interface for creating and plugging in implementations of
-transform and canonicalization algorithms.
-
-<p>Of primary significance in this package is the 
-{@link javax.xml.crypto.dsig.XMLSignature XMLSignature} class,
-which allows you to sign and validate an XML digital signature.
-
-<h2>Package Specification</h2>
-
-<ul>
-<li>
-<a href="http://www.w3.org/TR/xmldsig-core/">
-XML-Signature Syntax and Processing: W3C Recommendation</a>
-<li>
-<a href="http://www.ietf.org/rfc/rfc3275.txt">
-RFC 3275: XML-Signature Syntax and Processing</a>
-</ul>
-
-@since 1.6
-
-</body>
-</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/package-info.java	Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2005, 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.
+ */
+
+/**
+ * Parameter classes for XML digital signatures. This package
+ * contains interfaces and classes representing input parameters for the
+ * digest, signature, transform, or canonicalization algorithms used in
+ * the processing of XML signatures.
+ *
+ * <h2>Package Specification</h2>
+ *
+ * <ul>
+ * <li>
+ * <a href="http://www.w3.org/TR/xmldsig-core/">
+ * XML-Signature Syntax and Processing: W3C Recommendation</a>
+ * <li>
+ * <a href="http://www.ietf.org/rfc/rfc3275.txt">
+ * RFC 3275: XML-Signature Syntax and Processing</a>
+ * <li>
+ * <a href="http://www.w3.org/TR/xml-exc-c14n/">
+ * Exclusive XML Canonicalization algorithm: W3C Recommendation</a>
+ * <li>
+ * <a href="http://www.w3.org/TR/xmldsig-filter2/">
+ * XPath Filter 2.0 Transform Algorithm: W3C Recommendation</a>
+ * </ul>
+ *
+ * @since 1.6
+ */
+
+package javax.xml.crypto.dsig.spec;
--- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/package.html	Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-<html>
-<head>
-<!--
-Copyright (c) 2005, 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.
--->
-
-</head>
-<body>
-Parameter classes for XML digital signatures. This package
-contains interfaces and classes representing input parameters for the
-digest, signature, transform, or canonicalization algorithms used in
-the processing of XML signatures. 
-
-<h2>Package Specification</h2>
-
-<ul>
-<li>
-<a href="http://www.w3.org/TR/xmldsig-core/">
-XML-Signature Syntax and Processing: W3C Recommendation</a>
-<li>
-<a href="http://www.ietf.org/rfc/rfc3275.txt">
-RFC 3275: XML-Signature Syntax and Processing</a>
-<li>
-<a href="http://www.w3.org/TR/xml-exc-c14n/">
-Exclusive XML Canonicalization algorithm: W3C Recommendation</a>
-<li>
-<a href="http://www.w3.org/TR/xmldsig-filter2/">
-XPath Filter 2.0 Transform Algorithm: W3C Recommendation</a>
-</ul>
-
-@since 1.6
-
-</body>
-</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/package-info.java	Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2005, 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.
+ */
+
+/**
+ * Common classes for XML cryptography. This package includes common classes
+ * that are used to perform XML cryptographic operations, such as generating
+ * an XML signature or encrypting XML data.
+ *
+ * <h2>Package Specification</h2>
+ *
+ * <ul>
+ * <li>
+ * <a href="http://www.w3.org/TR/xmldsig-core/">
+ * XML-Signature Syntax and Processing: W3C Recommendation</a>
+ * <li>
+ * <a href="http://www.ietf.org/rfc/rfc3275.txt">
+ * RFC 3275: XML-Signature Syntax and Processing</a>
+ * </ul>
+ *
+ * @since 1.6
+ */
+
+package javax.xml.crypto;
--- a/src/java.xml.crypto/share/classes/javax/xml/crypto/package.html	Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-<html>
-<head>
-<!--
-Copyright (c) 2005, 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.
--->
-
-</head>
-<body>
-Common classes for XML cryptography. This package includes common classes that 
-are used to perform XML cryptographic operations, such as generating
-an XML signature or encrypting XML data. 
-
-<h2>Package Specification</h2>
-
-<ul>
-<li>
-<a href="http://www.w3.org/TR/xmldsig-core/">
-XML-Signature Syntax and Processing: W3C Recommendation</a>
-<li>
-<a href="http://www.ietf.org/rfc/rfc3275.txt">
-RFC 3275: XML-Signature Syntax and Processing</a>
-</ul>
-
-@since 1.6
-
-</body>
-</html>
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java	Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -190,6 +190,7 @@
  * @author Sunitha Reddy
  * @see javax.xml.datatype.Duration
  * @since 1.5
+ * @LastModified: June 2018
  */
 
 public class XMLGregorianCalendarImpl
@@ -2755,7 +2756,7 @@
             if ((fractional.compareTo(DECIMAL_ZERO) < 0) ||
                     (fractional.compareTo(DECIMAL_ONE) > 0)) {
                 throw new IllegalArgumentException(DatatypeMessageFormatter.formatMessage(null,
-                        "InvalidFractional", new Object[]{fractional}));
+                        "InvalidFractional", new Object[]{fractional.toString()}));
             }
         }
         this.fractionalSecond = fractional;
--- a/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -250,7 +250,6 @@
 {
 
     HCRYPTPROV hCryptProv = NULL;
-    BYTE*      pbData = NULL;
     jbyte*     reseedBytes = NULL;
     jbyte*     seedBytes = NULL;
     jbyteArray result = NULL;
@@ -294,28 +293,17 @@
 
             result = NULL;
 
-        } else if (length > 0) {
+        } else {
 
-            pbData = new (env) BYTE[length];
-            if (pbData == NULL) {
-                __leave;
+            if (length > 0) {
+                seed = env->NewByteArray(length);
+                if (seed == NULL) {
+                    __leave;
+                }
+            } else {
+                length = env->GetArrayLength(seed);
             }
 
-            if (::CryptGenRandom(
-                hCryptProv,
-                length,
-                pbData) == FALSE) {
-
-                ThrowException(env, PROVIDER_EXCEPTION, GetLastError());
-                __leave;
-            }
-
-            result = env->NewByteArray(length);
-            env->SetByteArrayRegion(result, 0, length, (jbyte*) pbData);
-
-        } else { // length == 0
-
-            length = env->GetArrayLength(seed);
             if ((seedBytes = env->GetByteArrayElements(seed, 0)) == NULL) {
                 __leave;
             }
@@ -340,9 +328,6 @@
         if (reseedBytes)
             env->ReleaseByteArrayElements(seed, reseedBytes, JNI_ABORT);
 
-        if (pbData)
-            delete [] pbData;
-
         if (seedBytes)
             env->ReleaseByteArrayElements(seed, seedBytes, 0); // update orig
 
--- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java	Tue Oct 16 23:21:05 2018 +0530
@@ -255,9 +255,7 @@
                     noContentToSend = true;
                     contentLen = 0;
                 }
-                if (noContentLengthHeader) {
-                    rspHdrs.remove("Content-length");
-                } else {
+                if (!noContentLengthHeader) {
                     rspHdrs.set("Content-length", Long.toString(contentLen));
                 }
                 o.setWrappedStream (new FixedLengthOutputStream (this, ros, contentLen));
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java	Tue Oct 16 23:21:05 2018 +0530
@@ -30,6 +30,8 @@
 import java.net.URI;
 import java.text.CollationKey;
 import java.text.Collator;
+import java.text.ParseException;
+import java.text.RuleBasedCollator;
 import java.util.*;
 import java.util.AbstractMap.SimpleEntry;
 import java.util.Map.Entry;
@@ -1483,7 +1485,7 @@
             return false;
         }
 
-        if (!getBlockTags(m).isEmpty())
+        if (!getBlockTags(m).isEmpty() || isDeprecated(m))
             return false;
 
         List<? extends DocTree> fullBody = getFullBody(m);
@@ -1588,7 +1590,7 @@
         private final Collator instance;
         private final int MAX_SIZE = 1000;
         private DocCollator(Locale locale, int strength) {
-            instance = Collator.getInstance(locale);
+            instance = createCollator(locale);
             instance.setStrength(strength);
 
             keys = new LinkedHashMap<String, CollationKey>(MAX_SIZE + 1, 0.75f, true) {
@@ -1607,6 +1609,21 @@
         public int compare(String s1, String s2) {
             return getKey(s1).compareTo(getKey(s2));
         }
+
+        private Collator createCollator(Locale locale) {
+            Collator baseCollator = Collator.getInstance(locale);
+            if (baseCollator instanceof RuleBasedCollator) {
+                // Extend collator to sort signatures with additional args and var-args in a well-defined order:
+                // () < (int) < (int, int) < (int...)
+                try {
+                    return new RuleBasedCollator(((RuleBasedCollator) baseCollator).getRules()
+                            + "& ')' < ',' < '.','['");
+                } catch (ParseException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+            return baseCollator;
+        }
     }
 
     private Comparator<Element> moduleComparator = null;
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberTable.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberTable.java	Tue Oct 16 23:21:05 2018 +0530
@@ -248,7 +248,7 @@
      * @param e the method to check
      * @return the overridden method or null
      */
-    public ExecutableElement getsimplyOverriddenMethod(ExecutableElement e) {
+    public ExecutableElement getSimplyOverriddenMethod(ExecutableElement e) {
         ensureInitialized();
 
         OverridingMethodInfo found = overriddenMethodTable.get(e);
@@ -869,7 +869,7 @@
     public List<ExecutableElement> getImplementedMethods(ExecutableElement method) {
         ImplementedMethods imf = getImplementedMethodsFinder(method);
         return imf.getImplementedMethods().stream()
-                .filter(m -> getsimplyOverriddenMethod(m) == null)
+                .filter(m -> getSimplyOverriddenMethod(m) == null)
                 .collect(Collectors.toList());
     }
 
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java	Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -1601,13 +1601,14 @@
             }
         }
 
-        switch (nameStr) {
-        case "context":
+        if ("context".equals(nameStr)) {
             return sctxt;
-        case "engine":
-            return global.engine;
-        default:
-            break;
+        } else if ("engine".equals(nameStr)) {
+            // expose "engine" variable only when there is no security manager
+            // or when no class filter is set.
+            if (System.getSecurityManager() == null || global.getClassFilter() == null) {
+                return global.engine;
+            }
         }
 
         if (self == UNDEFINED) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/gtest/memory/test_virtualspace.cpp	Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,339 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include "precompiled.hpp"
+#include "memory/virtualspace.hpp"
+#include "runtime/os.hpp"
+#include "oops/oop.hpp"
+#include "utilities/align.hpp"
+#include "unittest.hpp"
+
+namespace {
+  class MemoryReleaser {
+    ReservedSpace* const _rs;
+   public:
+    MemoryReleaser(ReservedSpace* rs) : _rs(rs) { }
+    ~MemoryReleaser() {
+      if (_rs->special()) {
+        EXPECT_TRUE(os::release_memory_special(_rs->base(), _rs->size()));
+      } else {
+        EXPECT_TRUE(os::release_memory(_rs->base(), _rs->size()));
+      }
+    }
+  };
+
+  static void small_page_write(void* addr, size_t size) {
+    size_t page_size = os::vm_page_size();
+
+    char* end = (char*) addr + size;
+    for (char* p = (char*) addr; p < end; p += page_size) {
+      *p = 1;
+    }
+  }
+
+  // have to use these functions, as gtest's _PRED macros don't like is_aligned
+  // nor (is_aligned<size_t, size_t>)
+  static bool is_size_aligned(size_t size, size_t alignment) {
+    return is_aligned(size, alignment);
+  }
+  static bool is_ptr_aligned(void* ptr, size_t alignment) {
+    return is_aligned(ptr, alignment);
+  }
+
+  static void test_reserved_size(size_t size) {
+    ASSERT_PRED2(is_size_aligned, size, os::vm_allocation_granularity());
+
+    ReservedSpace rs(size);
+    MemoryReleaser releaser(&rs);
+
+    EXPECT_TRUE(rs.base() != NULL) << "rs.special: " << rs.special();
+    EXPECT_EQ(size, rs.size()) << "rs.special: " << rs.special();
+
+    if (rs.special()) {
+      small_page_write(rs.base(), size);
+    }
+  }
+
+  static void test_reserved_size_alignment(size_t size, size_t alignment) {
+    ASSERT_PRED2(is_size_aligned, size, alignment) << "Incorrect input parameters";
+
+    ReservedSpace rs(size, alignment, UseLargePages, (char *) NULL);
+
+    ASSERT_TRUE(rs.base() != NULL) << "rs.special = " << rs.special();
+    ASSERT_EQ(size, rs.size()) << "rs.special = " << rs.special();
+
+    EXPECT_PRED2(is_ptr_aligned, rs.base(), alignment)
+            << "aligned sizes should always give aligned addresses";
+    EXPECT_PRED2(is_ptr_aligned, (void*) rs.size(), alignment)
+            << "aligned sizes should always give aligned addresses";
+
+    if (rs.special()) {
+      small_page_write(rs.base(), size);
+    }
+  }
+
+  static void test_reserved_size_alignment_page_type(size_t size, size_t alignment, bool maybe_large) {
+    if (size < alignment) {
+      // Tests might set -XX:LargePageSizeInBytes=<small pages> and cause unexpected input arguments for this test.
+      ASSERT_EQ((size_t) os::vm_page_size(), os::large_page_size()) << "Test needs further refinement";
+      return;
+    }
+
+    ASSERT_PRED2(is_size_aligned, size, os::vm_allocation_granularity()) << "Must be at least AG aligned";
+    ASSERT_PRED2(is_size_aligned, size, alignment) << "Must be at least AG aligned";
+
+    bool large = maybe_large && UseLargePages && size >= os::large_page_size();
+
+    ReservedSpace rs(size, alignment, large, false);
+    MemoryReleaser releaser(&rs);
+
+    EXPECT_TRUE(rs.base() != NULL) << "rs.special: " << rs.special();
+    EXPECT_EQ(size, rs.size()) << "rs.special: " << rs.special();
+
+    if (rs.special()) {
+      small_page_write(rs.base(), size);
+    }
+  }
+}
+
+TEST_VM(ReservedSpace, size_alignment) {
+  size_t size = 2 * 1024 * 1024;
+  size_t ag   = os::vm_allocation_granularity();
+
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment(size,      ag));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment(size * 2,  ag));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment(size * 10, ag));
+}
+
+TEST_VM(ReservedSpace, size) {
+  size_t size = 2 * 1024 * 1024;
+  size_t ag = os::vm_allocation_granularity();
+
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 1));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 2));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 10));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size(ag));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size(size - ag));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size(size));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size(size + ag));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 2));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 2 - ag));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 2 + ag));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 3));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 3 - ag));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 3 + ag));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 10));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 10 + size / 2));
+}
+
+TEST_VM(ReservedSpace, size_alignment_page_type) {
+  size_t ag = os::vm_allocation_granularity();
+
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag,      ag    , false));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag * 2,  ag    , false));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag * 3,  ag    , false));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag * 2,  ag * 2, false));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag * 4,  ag * 2, false));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag * 8,  ag * 2, false));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag * 4,  ag * 4, false));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag * 8,  ag * 4, false));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag * 16, ag * 4, false));
+}
+
+TEST_VM(ReservedSpace, size_alignment_page_type_large_page) {
+  if (!UseLargePages) {
+    return;
+  }
+
+  size_t ag = os::vm_allocation_granularity();
+  size_t lp = os::large_page_size();
+
+  // Without large pages
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp,     ag * 4, false));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 2, ag * 4, false));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 4, ag * 4, false));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp,     lp    , false));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 2, lp    , false));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 3, lp    , false));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 2, lp * 2, false));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 4, lp * 2, false));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 8, lp * 2, false));
+
+  // With large pages
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp, ag * 4    , true));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 2, ag * 4, true));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 4, ag * 4, true));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp, lp        , true));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 2, lp    , true));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 3, lp    , true));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 2, lp * 2, true));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 4, lp * 2, true));
+  EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 8, lp * 2, true));
+}
+
+namespace {
+  enum TestLargePages {
+    Default,
+    Disable,
+    Reserve,
+    Commit
+  };
+
+  class ReservedSpaceReleaser {
+    ReservedSpace* const _rs;
+   public:
+    ReservedSpaceReleaser(ReservedSpace* rs) : _rs(rs) { }
+    ~ReservedSpaceReleaser() {
+      _rs->release();
+    }
+  };
+
+  ReservedSpace reserve_memory(size_t reserve_size_aligned, TestLargePages mode) {
+    switch(mode) {
+      default:
+      case Default:
+      case Reserve:
+        return ReservedSpace(reserve_size_aligned);
+      case Disable:
+      case Commit:
+        return ReservedSpace(reserve_size_aligned,
+                             os::vm_allocation_granularity(),
+                             /* large */ false, /* exec */ false);
+    }
+  }
+
+  bool initialize_virtual_space(VirtualSpace& vs, ReservedSpace rs, TestLargePages mode) {
+    switch(mode) {
+      default:
+      case Default:
+      case Reserve:
+        return vs.initialize(rs, 0);
+      case Disable:
+        return vs.initialize_with_granularity(rs, 0, os::vm_page_size());
+      case Commit:
+        return vs.initialize_with_granularity(rs, 0, os::page_size_for_region_unaligned(rs.size(), 1));
+    }
+  }
+
+ void test_virtual_space_actual_committed_space(size_t reserve_size, size_t commit_size,
+                                                TestLargePages mode = Default) {
+    size_t granularity = os::vm_allocation_granularity();
+    size_t reserve_size_aligned = align_up(reserve_size, granularity);
+
+    ReservedSpace reserved = reserve_memory(reserve_size_aligned, mode);
+    ReservedSpaceReleaser releaser(&reserved);
+
+    ASSERT_TRUE(reserved.is_reserved());
+
+    VirtualSpace vs;
+    ASSERT_TRUE(initialize_virtual_space(vs, reserved, mode)) << "Failed to initialize VirtualSpace";
+    vs.expand_by(commit_size, false);
+
+    if (vs.special()) {
+      EXPECT_EQ(reserve_size_aligned, vs.actual_committed_size());
+    } else {
+      EXPECT_GE(vs.actual_committed_size(), commit_size);
+      // Approximate the commit granularity.
+      // Make sure that we don't commit using large pages
+      // if large pages has been disabled for this VirtualSpace.
+      size_t commit_granularity = (mode == Disable || !UseLargePages) ?
+                                   os::vm_page_size() : os::large_page_size();
+      EXPECT_LT(vs.actual_committed_size(), commit_size + commit_granularity);
+    }
+  }
+}
+
+TEST_VM(VirtualSpace, actual_committed_space) {
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(4 * K,  0));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(4 * K,  4 * K));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(8 * K,  0));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(8 * K,  4 * K));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(8 * K,  8 * K));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(12 * K, 0));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(12 * K, 4 * K));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(12 * K, 8 * K));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(12 * K, 12 * K));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(64 * K, 0));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(64 * K, 32 * K));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(64 * K, 64 * K));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(2 * M,  0));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(2 * M,  4 * K));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(2 * M,  64 * K));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(2 * M,  1 * M));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(2 * M,  2 * M));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 0));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 4 * K));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 8 * K));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 1 * M));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 2 * M));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 5 * M));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 10 * M));
+}
+
+TEST_VM(VirtualSpace, actual_committed_space_one_large_page) {
+  if (!UseLargePages) {
+    return;
+  }
+
+  size_t large_page_size = os::large_page_size();
+
+  ReservedSpace reserved(large_page_size, large_page_size, true, false);
+  ReservedSpaceReleaser releaser(&reserved);
+  ASSERT_TRUE(reserved.is_reserved());
+
+  VirtualSpace vs;
+  ASSERT_TRUE(vs.initialize(reserved, 0)) << "Failed to initialize VirtualSpace";
+  vs.expand_by(large_page_size, false);
+
+  EXPECT_EQ(large_page_size, vs.actual_committed_size());
+}
+
+TEST_VM(VirtualSpace, disable_large_pages) {
+  if (!UseLargePages) {
+    return;
+  }
+  // These test cases verify that if we force VirtualSpace to disable large pages
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 0,      Disable));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 4 * K,  Disable));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 8 * K,  Disable));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 1 * M,  Disable));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 2 * M,  Disable));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 5 * M,  Disable));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 10 * M, Disable));
+
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 0,      Reserve));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 4 * K,  Reserve));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 8 * K,  Reserve));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 1 * M,  Reserve));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 2 * M,  Reserve));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 5 * M,  Reserve));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 10 * M, Reserve));
+
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 0,      Commit));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 4 * K,  Commit));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 8 * K,  Commit));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 1 * M,  Commit));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 2 * M,  Commit));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 5 * M,  Commit));
+  EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 10 * M, Commit));
+}
--- a/test/hotspot/jtreg/compiler/aot/cli/MultipleAOTLibraryTest.java	Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/compiler/aot/cli/MultipleAOTLibraryTest.java	Tue Oct 16 23:21:05 2018 +0530
@@ -54,6 +54,7 @@
 package compiler.aot.cli;
 
 import compiler.aot.HelloWorldPrinter;
+import java.io.File;
 import java.util.Arrays;
 import jdk.test.lib.process.ExitCode;
 import jdk.test.lib.cli.CommandLineOptionTest;
@@ -75,8 +76,11 @@
             boolean addTestVMOptions = true;
             String[] allArgs = Arrays.copyOf(args, args.length + 4);
             allArgs[args.length] = "-XX:AOTLibrary="
-                    + "./libMultipleAOTLibraryTest1.so:"
-                    + "./libMultipleAOTLibraryTest2.so";
+                    + "." + File.separator
+                    + "libMultipleAOTLibraryTest1.so"
+                    + File.pathSeparator
+                    + "." + File.separator
+                    + "libMultipleAOTLibraryTest2.so";
             allArgs[args.length + 1] = "-XX:+PrintAOT";
             allArgs[args.length + 2] = "-XX:+UseAOT";
             allArgs[args.length + 3] = HelloWorldPrinter.class.getName();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/codegen/TestTrichotomyExpressions.java	Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,2516 @@
+/*
+ * 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 8210215
+ * @summary Test that C2 correctly optimizes trichotomy expressions.
+ * @library /test/lib
+ * @run main/othervm/timeout=240 -XX:-TieredCompilation -Xbatch
+ *                   -XX:CompileCommand=dontinline,compiler.codegen.TestTrichotomyExpressions::test*
+ *                   compiler.codegen.TestTrichotomyExpressions
+ */
+
+package compiler.codegen;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.reflect.Method;
+import java.util.Random;
+
+import jdk.test.lib.Asserts;
+import jdk.test.lib.Utils;
+
+enum Operation { SMALLER, SMALLER_EQUAL, EQUAL, GREATER_EQUAL, GREATER, ALWAYS_FALSE }
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@interface Test {
+    Operation op();
+}
+
+public class TestTrichotomyExpressions {
+
+    public static int compare1(int a, int b) {
+        return (a < b) ? -1 : (a == b) ? 0 : 1;
+    }
+
+    public static int compare2(int a, int b) {
+        return (a < b) ? -1 : (a <= b) ? 0 : 1;
+    }
+
+    public static int compare3(int a, int b) {
+        return (a < b) ? -1 : (a > b) ? 1 : 0;
+    }
+
+    public static int compare4(int a, int b) {
+        return (a < b) ? -1 : (a != b) ? 1 : 0;
+    }
+
+    public static int compare5(int a, int b) {
+        return (a > b) ? 1 : (a < b) ? -1 : 0;
+    }
+
+    public static int compare6(int a, int b) {
+        return (a > b) ? 1 : (a == b) ? 0 : -1;
+    }
+
+    public static int compare7(int a, int b) {
+        return (a > b) ? 1 : (a >= b) ? 0 : -1;
+    }
+
+    public static int compare8(int a, int b) {
+        return (a > b) ? 1 : (a != b) ? -1 : 0;
+    }
+
+    public static int compare9(int a, int b) {
+        return (a == b) ? 0 : (a < b) ? -1 : 1;
+    }
+
+    public static int compare10(int a, int b) {
+        return (a == b) ? 0 : (a <= b) ? -1 : 1;
+    }
+
+    public static int compare11(int a, int b) {
+        return (a == b) ? 0 : (a > b) ? 1 : -1;
+    }
+
+    public static int compare12(int a, int b) {
+        return (a == b) ? 0 : (a >= b) ? 1 : -1;
+    }
+
+    public static int compare13(int a, int b) {
+        return (a <= b) ? ((a == b) ? 0 : -1) : 1;
+    }
+
+    public static int compare14(int a, int b) {
+        return (a <= b) ? ((a < b) ? -1 : 0) : 1;
+    }
+
+    public static int compare15(int a, int b) {
+        return (a <= b) ? ((a >= b) ? 0 : -1) : 1;
+    }
+
+    public static int compare16(int a, int b) {
+        return (a <= b) ? ((a != b) ? -1 : 0) : 1;
+    }
+
+    public static int compare17(int a, int b) {
+        return (a >= b) ? ((a <= b) ? 0 : 1) : -1;
+    }
+
+    public static int compare18(int a, int b) {
+        return (a >= b) ? ((a == b) ? 0 : 1) : -1;
+    }
+
+    public static int compare19(int a, int b) {
+        return (a >= b) ? ((a > b) ? 1 : 0) : -1;
+    }
+
+    public static int compare20(int a, int b) {
+        return (a >= b) ? ((a != b) ? 1 : 0) : -1;
+    }
+
+    public static int compare21(int a, int b) {
+        return (a != b) ? ((a < b) ? -1 : 1) : 0;
+    }
+
+    public static int compare22(int a, int b) {
+        return (a != b) ? ((a <= b) ? -1 : 1) : 0;
+    }
+
+    public static int compare23(int a, int b) {
+        return (a != b) ? ((a > b) ? 1 : -1) : 0;
+    }
+
+    public static int compare24(int a, int b) {
+        return (a != b) ? ((a >= b) ? 1 : -1) : 0;
+    }
+
+    public static int compare25(int a, int b) {
+        return (a < b) ? -1 : (b == a) ? 0 : 1;
+    }
+
+    public static int compare26(int a, int b) {
+        return (a < b) ? -1 : (b >= a) ? 0 : 1;
+    }
+
+    public static int compare27(int a, int b) {
+        return (a < b) ? -1 : (b < a) ? 1 : 0;
+    }
+
+    public static int compare28(int a, int b) {
+        return (a < b) ? -1 : (b != a) ? 1 : 0;
+    }
+
+    public static int compare29(int a, int b) {
+        return (a > b) ? 1 : (b > a) ? -1 : 0;
+    }
+
+    public static int compare30(int a, int b) {
+        return (a > b) ? 1 : (b == a) ? 0 : -1;
+    }
+
+    public static int compare31(int a, int b) {
+        return (a > b) ? 1 : (b <= a) ? 0 : -1;
+    }
+
+    public static int compare32(int a, int b) {
+        return (a > b) ? 1 : (b != a) ? -1 : 0;
+    }
+
+    public static int compare33(int a, int b) {
+        return (a == b) ? 0 : (b > a) ? -1 : 1;
+    }
+
+    public static int compare34(int a, int b) {
+        return (a == b) ? 0 : (b >= a) ? -1 : 1;
+    }
+
+    public static int compare35(int a, int b) {
+        return (a == b) ? 0 : (b < a) ? 1 : -1;
+    }
+
+    public static int compare36(int a, int b) {
+        return (a == b) ? 0 : (b <= a) ? 1 : -1;
+    }
+
+    public static int compare37(int a, int b) {
+        return (a <= b) ? ((b == a) ? 0 : -1) : 1;
+    }
+
+    public static int compare38(int a, int b) {
+        return (a <= b) ? ((b > a) ? -1 : 0) : 1;
+    }
+
+    public static int compare39(int a, int b) {
+        return (a <= b) ? ((b <= a) ? 0 : -1) : 1;
+    }
+
+    public static int compare40(int a, int b) {
+        return (a <= b) ? ((b != a) ? -1 : 0) : 1;
+    }
+
+    public static int compare41(int a, int b) {
+        return (a >= b) ? ((b >= a) ? 0 : 1) : -1;
+    }
+
+    public static int compare42(int a, int b) {
+        return (a >= b) ? ((b == a) ? 0 : 1) : -1;
+    }
+
+    public static int compare43(int a, int b) {
+        return (a >= b) ? ((b < a) ? 1 : 0) : -1;
+    }
+
+    public static int compare44(int a, int b) {
+        return (a >= b) ? ((b != a) ? 1 : 0) : -1;
+    }
+
+    public static int compare45(int a, int b) {
+        return (a != b) ? ((b > a) ? -1 : 1) : 0;
+    }
+
+    public static int compare46(int a, int b) {
+        return (a != b) ? ((b >= a) ? -1 : 1) : 0;
+    }
+
+    public static int compare47(int a, int b) {
+        return (a != b) ? ((b < a) ? 1 : -1) : 0;
+    }
+
+    public static int compare48(int a, int b) {
+        return (a != b) ? ((b <= a) ? 1 : -1) : 0;
+    }
+
+
+    public static int compareAlwaysFalse1(int a, int b) {
+        return (a >= b) ? 1 : (a > b) ? 2 : -1;
+    }
+
+    public static int compareAlwaysFalse2(int a, int b) {
+        return (a <= b) ? 1 : (a < b) ? 2 : -1;
+    }
+
+    public static int compareAlwaysFalse3(int a, int b) {
+        return (a == b) ? 1 : (a == b) ? 2 : -1;
+    }
+
+    public static int compareAlwaysFalse4(int a, int b) {
+        return (a != b) ? 1 : (a < b) ? 2 : -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller1(int a, int b) {
+        return compare1(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller2(int a, int b) {
+        return compare1(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller3(int a, int b) {
+        return compare1(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller4(int a, int b) {
+        return compare2(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller5(int a, int b) {
+        return compare2(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller6(int a, int b) {
+        return compare2(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller7(int a, int b) {
+        return compare3(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller8(int a, int b) {
+        return compare3(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller9(int a, int b) {
+        return compare3(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller10(int a, int b) {
+        return compare4(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller11(int a, int b) {
+        return compare4(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller12(int a, int b) {
+        return compare4(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller13(int a, int b) {
+        return compare5(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller14(int a, int b) {
+        return compare5(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller15(int a, int b) {
+        return compare5(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller16(int a, int b) {
+        return compare6(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller17(int a, int b) {
+        return compare6(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller18(int a, int b) {
+        return compare6(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller19(int a, int b) {
+        return compare7(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller20(int a, int b) {
+        return compare7(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller21(int a, int b) {
+        return compare7(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller22(int a, int b) {
+        return compare8(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller23(int a, int b) {
+        return compare8(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller24(int a, int b) {
+        return compare8(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller25(int a, int b) {
+        return compare9(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller26(int a, int b) {
+        return compare9(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller27(int a, int b) {
+        return compare9(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller28(int a, int b) {
+        return compare10(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller29(int a, int b) {
+        return compare10(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller30(int a, int b) {
+        return compare10(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller31(int a, int b) {
+        return compare11(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller32(int a, int b) {
+        return compare11(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller33(int a, int b) {
+        return compare11(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller34(int a, int b) {
+        return compare12(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller35(int a, int b) {
+        return compare12(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller36(int a, int b) {
+        return compare12(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller37(int a, int b) {
+        return compare13(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller38(int a, int b) {
+        return compare13(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller39(int a, int b) {
+        return compare13(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller40(int a, int b) {
+        return compare14(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller41(int a, int b) {
+        return compare14(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller42(int a, int b) {
+        return compare14(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller43(int a, int b) {
+        return compare15(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller44(int a, int b) {
+        return compare15(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller45(int a, int b) {
+        return compare15(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller46(int a, int b) {
+        return compare16(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller47(int a, int b) {
+        return compare16(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller48(int a, int b) {
+        return compare16(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller49(int a, int b) {
+        return compare17(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller50(int a, int b) {
+        return compare17(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller51(int a, int b) {
+        return compare17(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller52(int a, int b) {
+        return compare18(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller53(int a, int b) {
+        return compare18(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller54(int a, int b) {
+        return compare18(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller55(int a, int b) {
+        return compare19(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller56(int a, int b) {
+        return compare19(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller57(int a, int b) {
+        return compare19(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller58(int a, int b) {
+        return compare20(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller59(int a, int b) {
+        return compare20(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller60(int a, int b) {
+        return compare20(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller61(int a, int b) {
+        return compare21(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller62(int a, int b) {
+        return compare21(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller63(int a, int b) {
+        return compare21(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller64(int a, int b) {
+        return compare22(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller65(int a, int b) {
+        return compare22(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller66(int a, int b) {
+        return compare22(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller67(int a, int b) {
+        return compare23(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller68(int a, int b) {
+        return compare23(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller69(int a, int b) {
+        return compare23(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller70(int a, int b) {
+        return compare24(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller71(int a, int b) {
+        return compare24(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller72(int a, int b) {
+        return compare24(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller73(int a, int b) {
+        return compare25(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller74(int a, int b) {
+        return compare25(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller75(int a, int b) {
+        return compare25(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller76(int a, int b) {
+        return compare26(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller77(int a, int b) {
+        return compare26(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller78(int a, int b) {
+        return compare26(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller79(int a, int b) {
+        return compare27(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller80(int a, int b) {
+        return compare27(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller81(int a, int b) {
+        return compare27(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller82(int a, int b) {
+        return compare28(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller83(int a, int b) {
+        return compare28(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller84(int a, int b) {
+        return compare28(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller85(int a, int b) {
+        return compare29(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller86(int a, int b) {
+        return compare29(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller87(int a, int b) {
+        return compare29(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller88(int a, int b) {
+        return compare30(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller89(int a, int b) {
+        return compare30(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller90(int a, int b) {
+        return compare30(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller91(int a, int b) {
+        return compare31(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller92(int a, int b) {
+        return compare31(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller93(int a, int b) {
+        return compare31(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller94(int a, int b) {
+        return compare32(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller95(int a, int b) {
+        return compare32(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller96(int a, int b) {
+        return compare32(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller97(int a, int b) {
+        return compare33(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller98(int a, int b) {
+        return compare33(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller99(int a, int b) {
+        return compare33(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller100(int a, int b) {
+        return compare34(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller101(int a, int b) {
+        return compare34(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller102(int a, int b) {
+        return compare34(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller103(int a, int b) {
+        return compare35(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller104(int a, int b) {
+        return compare35(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller105(int a, int b) {
+        return compare35(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller106(int a, int b) {
+        return compare36(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller107(int a, int b) {
+        return compare36(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller108(int a, int b) {
+        return compare36(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller109(int a, int b) {
+        return compare37(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller110(int a, int b) {
+        return compare37(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller111(int a, int b) {
+        return compare37(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller112(int a, int b) {
+        return compare38(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller113(int a, int b) {
+        return compare38(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller114(int a, int b) {
+        return compare38(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller115(int a, int b) {
+        return compare39(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller116(int a, int b) {
+        return compare39(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller117(int a, int b) {
+        return compare39(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller118(int a, int b) {
+        return compare40(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller119(int a, int b) {
+        return compare40(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller120(int a, int b) {
+        return compare40(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller121(int a, int b) {
+        return compare41(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller122(int a, int b) {
+        return compare41(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller123(int a, int b) {
+        return compare41(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller124(int a, int b) {
+        return compare42(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller125(int a, int b) {
+        return compare42(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller126(int a, int b) {
+        return compare42(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller127(int a, int b) {
+        return compare43(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller128(int a, int b) {
+        return compare43(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller129(int a, int b) {
+        return compare43(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller130(int a, int b) {
+        return compare44(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller131(int a, int b) {
+        return compare44(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller132(int a, int b) {
+        return compare44(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller133(int a, int b) {
+        return compare45(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller134(int a, int b) {
+        return compare45(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller135(int a, int b) {
+        return compare45(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller136(int a, int b) {
+        return compare46(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller137(int a, int b) {
+        return compare46(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller138(int a, int b) {
+        return compare46(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller139(int a, int b) {
+        return compare47(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller140(int a, int b) {
+        return compare47(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller141(int a, int b) {
+        return compare47(a, b) <= -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller142(int a, int b) {
+        return compare48(a, b) == -1;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller143(int a, int b) {
+        return compare48(a, b) < 0;
+    }
+
+    @Test(op = Operation.SMALLER)
+    public static boolean testSmaller144(int a, int b) {
+        return compare48(a, b) <= -1;
+    }
+
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual1(int a, int b) {
+        return compare1(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual2(int a, int b) {
+        return compare2(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual3(int a, int b) {
+        return compare3(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual4(int a, int b) {
+        return compare4(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual5(int a, int b) {
+        return compare5(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual6(int a, int b) {
+        return compare6(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual7(int a, int b) {
+        return compare7(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual8(int a, int b) {
+        return compare8(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual9(int a, int b) {
+        return compare9(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual10(int a, int b) {
+        return compare10(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual11(int a, int b) {
+        return compare11(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual12(int a, int b) {
+        return compare12(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual13(int a, int b) {
+        return compare13(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual14(int a, int b) {
+        return compare14(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual15(int a, int b) {
+        return compare15(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual16(int a, int b) {
+        return compare16(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual17(int a, int b) {
+        return compare17(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual18(int a, int b) {
+        return compare18(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual19(int a, int b) {
+        return compare19(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual20(int a, int b) {
+        return compare20(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual21(int a, int b) {
+        return compare21(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual22(int a, int b) {
+        return compare22(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual23(int a, int b) {
+        return compare23(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual24(int a, int b) {
+        return compare24(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual25(int a, int b) {
+        return compare2(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual26(int a, int b) {
+        return compare26(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual27(int a, int b) {
+        return compare27(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual28(int a, int b) {
+        return compare28(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual29(int a, int b) {
+        return compare29(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual30(int a, int b) {
+        return compare30(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual31(int a, int b) {
+        return compare31(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual32(int a, int b) {
+        return compare32(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual33(int a, int b) {
+        return compare33(a, b) <= 0;
+    }
+
+    @Test(op = Operation.SMALLER_EQUAL)
+    public static boolean testSmallerEqual34(int a, int