Merge
authorduke
Wed, 05 Jul 2017 22:19:13 +0200 (2017-07-05)
changeset 41427 d54424bc50b2
parent 41426 aa60c8d89a92 (current diff)
parent 41419 d76560472470 (diff)
child 41433 cb61e6c52097
Merge
hotspot/make/Dist.gmk
hotspot/src/share/vm/oops/arrayOop.cpp
hotspot/src/share/vm/utilities/chunkedList.cpp
hotspot/src/share/vm/utilities/linkedlist.cpp
hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodAtSlotTest.java
hotspot/test/native/runtime/test_instanceKlass.cpp
hotspot/test/runtime/SharedArchiveFile/SASymbolTableTestAttachee.java
jdk/make/Import.gmk
jdk/src/java.desktop/share/classes/sun/java2d/pipe/hw/AccelDeviceEventListener.java
jdk/src/java.desktop/share/classes/sun/java2d/pipe/hw/AccelDeviceEventNotifier.java
jdk/test/java/awt/image/multiresolution/MultiResolutionTrayIconTest/MultiResolutionTrayIconTest.html
make/StripBinaries.gmk
--- a/.hgtags-top-repo	Fri Oct 07 21:28:20 2016 +0530
+++ b/.hgtags-top-repo	Wed Jul 05 22:19:13 2017 +0200
@@ -381,3 +381,4 @@
 3ec350f5f32af249b59620d7e37b54bdcd77b233 jdk-9+136
 d7f519b004254b19e384131d9f0d0e40e31a0fd3 jdk-9+137
 67c4388142bdf58aec8fefa4475faaa8a5d7380c jdk-9+138
+7dcf453eacae79ee86a6bcc75fd0b546fc99b48a jdk-9+139
--- a/ASSEMBLY_EXCEPTION	Fri Oct 07 21:28:20 2016 +0530
+++ b/ASSEMBLY_EXCEPTION	Wed Jul 05 22:19:13 2017 +0200
@@ -1,27 +1,27 @@
 
 OPENJDK ASSEMBLY EXCEPTION
 
-The OpenJDK source code made available by Sun at openjdk.java.net and
-openjdk.dev.java.net ("OpenJDK Code") is distributed under the terms of the
-GNU General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
+The OpenJDK source code made available by Oracle America, Inc. (Oracle) at
+openjdk.java.net ("OpenJDK Code") is distributed under the terms of the GNU
+General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
 only ("GPL2"), with the following clarification and special exception.
 
     Linking this OpenJDK Code statically or dynamically with other code
     is making a combined work based on this library.  Thus, the terms
     and conditions of GPL2 cover the whole combination.
 
-    As a special exception, Sun gives you permission to link this
-    OpenJDK Code with certain code licensed by Sun as indicated at
+    As a special exception, Oracle gives you permission to link this
+    OpenJDK Code with certain code licensed by Oracle as indicated at
     http://openjdk.java.net/legal/exception-modules-2007-05-08.html
     ("Designated Exception Modules") to produce an executable,
     regardless of the license terms of the Designated Exception Modules,
     and to copy and distribute the resulting executable under GPL2,
     provided that the Designated Exception Modules continue to be
-    governed by the licenses under which they were offered by Sun.
+    governed by the licenses under which they were offered by Oracle.
 
-As such, it allows licensees and sublicensees of Sun's GPL2 OpenJDK Code to
-build an executable that includes those portions of necessary code that Sun
-could not provide under GPL2 (or that Sun has provided under GPL2 with the
-Classpath exception).  If you modify or add to the OpenJDK code, that new
-GPL2 code may still be combined with Designated Exception Modules if the
-new code is made subject to this exception by its copyright holder.
+As such, it allows licensees and sublicensees of Oracle's GPL2 OpenJDK Code
+to build an executable that includes those portions of necessary code that
+Oracle could not provide under GPL2 (or that Oracle has provided under GPL2
+with the Classpath exception).  If you modify or add to the OpenJDK code,
+that new GPL2 code may still be combined with Designated Exception Modules
+if the new code is made subject to this exception by its copyright holder.
--- a/common/bin/compare.sh	Fri Oct 07 21:28:20 2016 +0530
+++ b/common/bin/compare.sh	Wed Jul 05 22:19:13 2017 +0200
@@ -654,10 +654,10 @@
             OTHER_DIZ_FILE="$OTHER/support/native/java.base/java_objs/java.diz"
         elif [ "$NAME" = "jimage.exe" ] \
                && [ -f "$OTHER/support/native/jdk.jlink/jimage_objs/jimage.diz" ]; then
-            OTHER_DIZ_FILE="$OTHER/support/native/jdk.jlink/jimage_objs/jimage.diz"
+            OTHER_DIZ_FILE="$OTHER/support/modules_cmds/jdk.jlink/jimage.diz"
         elif [ "$NAME" = "javacpl.exe" ] \
                && [ -f "$OTHER/support/native/jdk.plugin/javacpl/javacpl.diz" ]; then
-            OTHER_DIZ_FILE="$OTHER/support/native/jdk.plugin/javacpl/javacpl.diz"
+            OTHER_DIZ_FILE="$OTHER/support/modules_cmds/jdk.deploy.controlpanel/javacpl.diz"
         elif [ -f "${OTHER_FILE_BASE}.diz" ]; then
             OTHER_DIZ_FILE=${OTHER_FILE_BASE}.diz
         else
@@ -686,10 +686,10 @@
             THIS_DIZ_FILE="$THIS/support/native/java.base/java_objs/java.diz"
         elif [ "$NAME" = "jimage.exe" ] \
                && [ -f "$THIS/support/native/jdk.jlink/jimage_objs/jimage.diz" ]; then
-            THIS_DIZ_FILE="$THIS/support/native/jdk.jlink/jimage_objs/jimage.diz"
+            THIS_DIZ_FILE="$THIS/support/modules_cmds/jdk.jlink/jimage.diz"
         elif [ "$NAME" = "javacpl.exe" ] \
                && [ -f "$THIS/support/native/jdk.plugin/javacpl/javacpl.diz" ]; then
-            THIS_DIZ_FILE="$THIS/support/native/jdk.plugin/javacpl/javacpl.diz"
+            THIS_DIZ_FILE="$THIS/support/modules_cmds/jdk.deploy.controlpanel/javacpl.diz"
         elif [ -f "${THIS_FILE_BASE}.diz" ]; then
             THIS_DIZ_FILE=${THIS_FILE/.dll/}.diz
         else
--- a/corba/.hgtags	Fri Oct 07 21:28:20 2016 +0530
+++ b/corba/.hgtags	Wed Jul 05 22:19:13 2017 +0200
@@ -381,3 +381,4 @@
 aa053a3faf266c12b4fd5272da431a3e08e4a3e3 jdk-9+136
 258cf18fa7fc59359b874f8743b7168dc48baf73 jdk-9+137
 27bb44be32076861a0951bcefb07a1d92509a4b6 jdk-9+138
+8c9da7fc5b07c606afd571c7012441b77dda83b2 jdk-9+139
--- a/corba/ASSEMBLY_EXCEPTION	Fri Oct 07 21:28:20 2016 +0530
+++ b/corba/ASSEMBLY_EXCEPTION	Wed Jul 05 22:19:13 2017 +0200
@@ -1,27 +1,27 @@
 
 OPENJDK ASSEMBLY EXCEPTION
 
-The OpenJDK source code made available by Sun at openjdk.java.net and
-openjdk.dev.java.net ("OpenJDK Code") is distributed under the terms of the
-GNU General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
+The OpenJDK source code made available by Oracle America, Inc. (Oracle) at
+openjdk.java.net ("OpenJDK Code") is distributed under the terms of the GNU
+General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
 only ("GPL2"), with the following clarification and special exception.
 
     Linking this OpenJDK Code statically or dynamically with other code
     is making a combined work based on this library.  Thus, the terms
     and conditions of GPL2 cover the whole combination.
 
-    As a special exception, Sun gives you permission to link this
-    OpenJDK Code with certain code licensed by Sun as indicated at
+    As a special exception, Oracle gives you permission to link this
+    OpenJDK Code with certain code licensed by Oracle as indicated at
     http://openjdk.java.net/legal/exception-modules-2007-05-08.html
     ("Designated Exception Modules") to produce an executable,
     regardless of the license terms of the Designated Exception Modules,
     and to copy and distribute the resulting executable under GPL2,
     provided that the Designated Exception Modules continue to be
-    governed by the licenses under which they were offered by Sun.
+    governed by the licenses under which they were offered by Oracle.
 
-As such, it allows licensees and sublicensees of Sun's GPL2 OpenJDK Code to
-build an executable that includes those portions of necessary code that Sun
-could not provide under GPL2 (or that Sun has provided under GPL2 with the
-Classpath exception).  If you modify or add to the OpenJDK code, that new
-GPL2 code may still be combined with Designated Exception Modules if the
-new code is made subject to this exception by its copyright holder.
+As such, it allows licensees and sublicensees of Oracle's GPL2 OpenJDK Code
+to build an executable that includes those portions of necessary code that
+Oracle could not provide under GPL2 (or that Oracle has provided under GPL2
+with the Classpath exception).  If you modify or add to the OpenJDK code,
+that new GPL2 code may still be combined with Designated Exception Modules
+if the new code is made subject to this exception by its copyright holder.
--- a/hotspot/.hgtags	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/.hgtags	Wed Jul 05 22:19:13 2017 +0200
@@ -541,3 +541,4 @@
 a20da289f646ee44440695b81abc0548330e4ca7 jdk-9+136
 dfcbf839e299e7e2bba1da69bdb347617ea4c7e8 jdk-9+137
 fc0956308c7a586267c5dd35dff74f773aa9c3eb jdk-9+138
+08492e67bf3226784dab3bf9ae967382ddbc1af5 jdk-9+139
--- a/hotspot/ASSEMBLY_EXCEPTION	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/ASSEMBLY_EXCEPTION	Wed Jul 05 22:19:13 2017 +0200
@@ -1,9 +1,9 @@
 
 OPENJDK ASSEMBLY EXCEPTION
 
-The OpenJDK source code made available by Oracle at openjdk.java.net and
-openjdk.dev.java.net ("OpenJDK Code") is distributed under the terms of the
-GNU General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
+The OpenJDK source code made available by Oracle America, Inc. (Oracle) at
+openjdk.java.net ("OpenJDK Code") is distributed under the terms of the GNU
+General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
 only ("GPL2"), with the following clarification and special exception.
 
     Linking this OpenJDK Code statically or dynamically with other code
@@ -19,9 +19,9 @@
     provided that the Designated Exception Modules continue to be
     governed by the licenses under which they were offered by Oracle.
 
-As such, it allows licensees and sublicensees of Oracle's GPL2 OpenJDK Code to
-build an executable that includes those portions of necessary code that Oracle
-could not provide under GPL2 (or that Oracle has provided under GPL2 with the
-Classpath exception).  If you modify or add to the OpenJDK code, that new
-GPL2 code may still be combined with Designated Exception Modules if the
-new code is made subject to this exception by its copyright holder.
+As such, it allows licensees and sublicensees of Oracle's GPL2 OpenJDK Code
+to build an executable that includes those portions of necessary code that
+Oracle could not provide under GPL2 (or that Oracle has provided under GPL2
+with the Classpath exception).  If you modify or add to the OpenJDK code,
+that new GPL2 code may still be combined with Designated Exception Modules
+if the new code is made subject to this exception by its copyright holder.
--- a/hotspot/make/BuildHotspot.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/make/BuildHotspot.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -45,10 +45,7 @@
 jsig:
 	+$(MAKE) -f lib/CompileLibjsig.gmk
 
-dist: $(VARIANT_TARGETS) jsig
-	+$(MAKE) -f Dist.gmk
-
-all: dist
+all: $(VARIANT_TARGETS) jsig
 
 .PHONY: $(VARIANT_TARGETS) $(VARIANT_GENSRC_TARGETS) $(VARIANT_LIBS_TARGETS) \
-    jsig dist all
+    jsig all
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/make/CopyToExplodedJdk.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,55 @@
+#
+# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+# 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.
+#
+
+# Copy all built libraries into exploded jdk
+LIB_TARGETS := $(filter $(LIB_OUTPUTDIR)/%, $(TARGETS))
+ifeq ($(OPENJDK_TARGET_OS), windows)
+  $(eval $(call SetupCopyFiles, COPY_LIBS_BIN, \
+      SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base, \
+      DEST := $(JDK_OUTPUTDIR)/bin, \
+      FILES := $(filter-out %.lib, $(LIB_TARGETS)), \
+  ))
+
+  $(eval $(call SetupCopyFiles, COPY_LIBS_LIB, \
+      SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base, \
+      DEST := $(JDK_OUTPUTDIR)/lib, \
+      FILES := $(filter %.lib, $(LIB_TARGETS))))
+
+  TARGETS += $(COPY_LIBS_BIN) $(COPY_LIBS_LIB)
+else
+  $(eval $(call SetupCopyFiles, COPY_LIBS, \
+      SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base, \
+      DEST := $(JDK_OUTPUTDIR)/lib, \
+      FILES := $(filter %$(SHARED_LIBRARY_SUFFIX), $(LIB_TARGETS)), \
+  ))
+  $(eval $(call SetupCopyFiles, LINK_LIBS, \
+      SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base, \
+      DEST := $(JDK_OUTPUTDIR)/lib, \
+      FILES := $(filter-out %$(SHARED_LIBRARY_SUFFIX), $(LIB_TARGETS)), \
+      MACRO := link-file-relative, \
+  ))
+
+  TARGETS += $(COPY_LIBS) $(LINK_LIBS)
+endif
--- a/hotspot/make/Dist.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,223 +0,0 @@
-#
-# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
-# 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.
-#
-
-################################################################################
-# Copy the generated output into well-defined places in the dist directory.
-
-# This must be the first rule
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-
-$(eval $(call IncludeCustomExtension, hotspot, Dist.gmk))
-
-DIST_OUTPUTDIR := $(HOTSPOT_OUTPUTDIR)/dist
-
-# Unfortunately, all platforms have different target subdirs.
-ifeq ($(OPENJDK_TARGET_OS), windows)
-  LIB_SUBDIR := bin
-else ifeq ($(OPENJDK_TARGET_OS), macosx)
-  LIB_SUBDIR := lib
-else
-  LIB_SUBDIR := lib$(OPENJDK_TARGET_CPU_LIBDIR)
-endif
-
-################################################################################
-# Setup make rules to copy a native library and associated data.
-#
-# Parameter 1 is the name of the rule. This name is used as variable prefix,
-# and the targets generated are listed in a variable by that name.
-#
-# Remaining parameters are named arguments. These include:
-#   NAME -- The base name of the native library (e.g. 'jvm')
-#   VARIANT -- The variant to copy from
-#   VARIANT_TARGET_DIR -- The variant target sub dir, with trailing slash, optional
-SetupDistLibFile = $(NamedParamsMacroTemplate)
-define SetupDistLibFileBody
-  ifneq ($$($1_VARIANT), )
-    $1_SRC_DIR := $$(HOTSPOT_OUTPUTDIR)/variant-$$($1_VARIANT)/lib$$($1_NAME)
-  else
-    $1_SRC_DIR := $$(HOTSPOT_OUTPUTDIR)/lib$$($1_NAME)
-  endif
-  $1_LIB_NAME := $(LIBRARY_PREFIX)$$($1_NAME)
-  $1_TARGET_DIR := $$(DIST_OUTPUTDIR)/$$(LIB_SUBDIR)/$$($1_VARIANT_TARGET_DIR)
-
-  # Copy the the native library.
-  $$(eval $$(call SetupCopyFiles, $1_COPY_LIB, \
-      DEST := $$($1_TARGET_DIR), \
-      FILES := $$(wildcard \
-          $$($1_SRC_DIR)/$$($1_LIB_NAME)$(SHARED_LIBRARY_SUFFIX)), \
-  ))
-
-  TARGETS += $$($1_COPY_LIB)
-
-  # Copy related data (debug symbols, static-build symbols file etc)
-  $$(eval $$(call SetupCopyFiles, $1_COPY_FILES, \
-      DEST := $$($1_TARGET_DIR), \
-      FILES := $$(wildcard \
-          $$(addprefix $$($1_SRC_DIR)/$$($1_LIB_NAME), \
-          .diz .debuginfo .pdb .map .symbols)), \
-  ))
-
-  TARGETS += $$($1_COPY_FILES)
-
-  ifeq ($(OPENJDK_TARGET_OS), macosx)
-    # Debug symbols on macosx is a directory, not a single file, per library.
-    $1_DSYM_SRC := $$($1_SRC_DIR)/$$($1_LIB_NAME)$(SHARED_LIBRARY_SUFFIX).dSYM)
-    ifneq ($$(wildcard $$($1_DSYM_SRC)), )
-      $$(eval $$(call SetupCopyFiles, $1_COPY_DSYM_DIR, \
-          DEST := $$($1_TARGET_DIR), \
-          SRC := $$($1_SRC_DIR), \
-          FILES := $$(shell $(FIND) $$($1_DSYM_SRC) -type f), \
-       ))
-       TARGETS += $$($1_COPY_DSYM_DIR)
-    endif
-  endif
-endef
-
-################################################################################
-# Copy common files, which are independent on the jvm variant(s) being built.
-# For files that were generated during the build, we assume all versions of
-# these files are identical, and just pick one arbitrarily to use as source.
-
-ANY_JVM_VARIANT := $(firstword $(JVM_VARIANTS))
-JVM_VARIANT_OUTPUTDIR := $(HOTSPOT_OUTPUTDIR)/variant-$(ANY_JVM_VARIANT)
-
-### Copy platform-independent .h files
-INCLUDE_FILES_SRC_DIR := $(HOTSPOT_TOPDIR)/src/share/vm
-$(eval $(call SetupCopyFiles, COPY_INCLUDE, \
-    SRC := $(INCLUDE_FILES_SRC_DIR), \
-    DEST := $(DIST_OUTPUTDIR)/include, \
-    FLATTEN := true, \
-    FILES := $(INCLUDE_FILES_SRC_DIR)/prims/jni.h \
-        $(INCLUDE_FILES_SRC_DIR)/code/jvmticmlr.h \
-        $(INCLUDE_FILES_SRC_DIR)/services/jmm.h))
-
-TARGETS += $(COPY_INCLUDE)
-
-### Copy jni_md.h
-
-# This might have been defined in a custom extension
-ifeq ($(JNI_MD_H_SRC), )
-  JNI_MD_H_SRC := $(HOTSPOT_TOPDIR)/src/cpu/$(HOTSPOT_TARGET_CPU_ARCH)/vm/jni_$(HOTSPOT_TARGET_CPU_ARCH).h
-endif
-
-ifeq ($(OPENJDK_TARGET_OS), macosx)
-  # NOTE: This should most likely be darwin, but the old hotspot build uses bsd
-  JNI_MD_SUBDIR := bsd
-else ifeq ($(OPENJDK_TARGET_OS), windows)
-  JNI_MD_SUBDIR := win32
-else
-  JNI_MD_SUBDIR := $(OPENJDK_TARGET_OS)
-endif
-
-# SetupCopyFiles is not used here since it's non-trivial to copy a single
-# file with a different target name.
-$(DIST_OUTPUTDIR)/include/$(JNI_MD_SUBDIR)/jni_md.h: $(JNI_MD_H_SRC)
-	$(call LogInfo, Copying hotspot/dist/include/$(JNI_MD_SUBDIR)/jni_md.h)
-	$(install-file)
-
-TARGETS += $(DIST_OUTPUTDIR)/include/$(JNI_MD_SUBDIR)/jni_md.h
-
-$(eval $(call SetupCopyFiles, COPY_JVMTI_H, \
-    DEST := $(DIST_OUTPUTDIR)/include, \
-    FLATTEN := true, \
-    FILES := $(JVM_VARIANT_OUTPUTDIR)/gensrc/jvmtifiles/jvmti.h))
-
-TARGETS += $(COPY_JVMTI_H)
-
-# NOTE: In the old build, this file was not copied on Windows.
-ifneq ($(OPENJDK_TARGET_OS), windows)
-  $(eval $(call SetupCopyFiles, COPY_JVMTI_HTML, \
-      DEST := $(DIST_OUTPUTDIR)/docs/platform/jvmti, \
-      FILES := $(JVM_VARIANT_OUTPUTDIR)/gensrc/jvmtifiles/jvmti.html))
-endif
-
-TARGETS += $(COPY_JVMTI_HTML)
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
-  $(eval $(call SetupCopyFiles, COPY_JVM_LIB, \
-      DEST := $(DIST_OUTPUTDIR)/lib, \
-      FILES :=$(JVM_VARIANT_OUTPUTDIR)/libjvm/objs/jvm.lib))
-
-  TARGETS += $(COPY_JVM_LIB)
-endif
-
-# Copy libjsig, if it exists
-$(eval $(call SetupDistLibFile, DIST_jsig, \
-    NAME := jsig, \
-))
-
-################################################################################
-# Copy variant-specific files
-
-# Setup make rules to copy a single variant to dist.
-# $1: The name of the variant
-define SetupDistForVariant
-  ifneq ($$(filter client minimal, $1), )
-    VARIANT_TARGET_DIR := $1
-  else
-    # Use 'server' as default target directory name for all other variants.
-    VARIANT_TARGET_DIR := server
-  endif
-
-  $$(eval $$(call SetupDistLibFile, DIST_$(strip $1)_jvm, \
-      NAME := jvm, \
-      VARIANT := $1, \
-      VARIANT_TARGET_DIR := $$(VARIANT_TARGET_DIR)/, \
-  ))
-
-  # Copy the dtrace libraries, if they exist
-  $$(eval $$(call SetupDistLibFile, DIST_$(strip $1)_jvm_db, \
-      NAME := jvm_db, \
-      VARIANT := $1, \
-      VARIANT_TARGET_DIR := $$(VARIANT_TARGET_DIR)/, \
-  ))
-
-  $$(eval $$(call SetupDistLibFile, DIST_$(strip $1)_jvm_dtrace, \
-      NAME := jvm_dtrace, \
-      VARIANT := $1, \
-      VARIANT_TARGET_DIR := $$(VARIANT_TARGET_DIR)/, \
-  ))
-
-  # Copy the Xusage.txt file
-  $$(eval $$(call SetupCopyFiles, DIST_$(strip $1)_Xusage, \
-      DEST := $$(DIST_OUTPUTDIR)/$$(LIB_SUBDIR)/$(strip $1), \
-      FILES := $$(HOTSPOT_OUTPUTDIR)/variant-$(strip $1)/support/misc/Xusage.txt, \
-  ))
-
-  TARGETS += $$(DIST_$(strip $1)_Xusage)
-endef
-
-$(foreach variant, $(JVM_VARIANTS), \
-  $(eval $(call SetupDistForVariant, $(variant))) \
-)
-
-################################################################################
-
-all: $(TARGETS)
-
-.PHONY: all
--- a/hotspot/make/HotspotCommon.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/make/HotspotCommon.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -33,6 +33,15 @@
 
 DTRACE_SUPPORT_DIR := $(JVM_SUPPORT_DIR)/dtrace
 
+LIB_OUTPUTDIR := $(call FindLibDirForModule, java.base)
+ifneq ($(filter client minimal, $(JVM_VARIANT)), )
+  JVM_VARIANT_SUBDIR := $(JVM_VARIANT)
+else
+  # Use 'server' as default target directory name for all other variants.
+  JVM_VARIANT_SUBDIR := server
+endif
+JVM_LIB_OUTPUTDIR := $(LIB_OUTPUTDIR)/$(JVM_VARIANT_SUBDIR)
+
 ################################################################################
 
 # Test if a feature is available in the present build of JVM_VARIANT. Will return
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/make/copy/Copy-java.base.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,67 @@
+#
+# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+# 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.
+#
+
+# These include files are currently being copied from the jdk repository for
+# historical reasons. Disable copying from here until this has been cleaned up.
+# The files in hotspot differ slightly from the corresponding files in jdk.
+# See JDK-8167078.
+
+INCLUDE_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE)
+
+################################################################################
+# Copy platform-independent .h files
+$(eval $(call SetupCopyFiles, COPY_INCLUDE_FILES, \
+    SRC := $(HOTSPOT_TOPDIR)/src/share/vm, \
+    DEST := $(INCLUDE_DST_DIR), \
+    FLATTEN := true, \
+    FILES := prims/jni.h code/jvmticmlr.h \
+))
+
+#TARGETS += $(COPY_INCLUDE_FILES)
+
+################################################################################
+# Copy jni_md.h
+
+# This might have been defined in a custom extension
+JNI_MD_H_SRC ?= $(HOTSPOT_TOPDIR)/src/cpu/$(HOTSPOT_TARGET_CPU_ARCH)/vm/jni_$(HOTSPOT_TARGET_CPU_ARCH).h
+
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+  # NOTE: This should most likely be darwin, but the old hotspot build uses bsd
+  JNI_MD_SUBDIR := bsd
+else ifeq ($(OPENJDK_TARGET_OS), windows)
+  JNI_MD_SUBDIR := win32
+else
+  JNI_MD_SUBDIR := $(OPENJDK_TARGET_OS)
+endif
+
+# SetupCopyFiles is not used here since it's non-trivial to copy a single
+# file with a different target name.
+$(INCLUDE_DST_DIR)/$(JNI_MD_SUBDIR)/jni_md.h: $(JNI_MD_H_SRC)
+	$(call LogInfo, Copying hotspot/dist/include/$(JNI_MD_SUBDIR)/jni_md.h)
+	$(install-file)
+
+#TARGETS += $(INCLUDE_DST_DIR)/$(JNI_MD_SUBDIR)/jni_md.h
+
+################################################################################
--- a/hotspot/make/gensrc/GenerateSources.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/make/gensrc/GenerateSources.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -47,7 +47,7 @@
 # The Xusage.txt file needs to have platform specific path separator
 $(eval $(call SetupTextFileProcessing, CREATE_XUSAGE, \
     SOURCE_FILES := $(HOTSPOT_TOPDIR)/src/share/vm/Xusage.txt, \
-    OUTPUT_FILE := $(JVM_SUPPORT_DIR)/misc/Xusage.txt, \
+    OUTPUT_FILE := $(JVM_LIB_OUTPUTDIR)/Xusage.txt, \
     REPLACEMENTS := separated by ;> => separated by $(PATH_SEP)> ; , \
 ))
 
--- a/hotspot/make/gensrc/GensrcJvmti.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/make/gensrc/GensrcJvmti.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -67,7 +67,8 @@
   $$($1_OUTPUT_DIR)/$1: $$($1_XML_FILE) $$($1_XSL_FILE) $$($1_DEPS) $$(BUILD_JVMTI_TOOLS)
 	$$(call LogInfo, Generating $$(@F))
 	$$(call MakeDir, $$(@D))
-	$$(call ExecuteWithLog, $$@, $$(TOOL_JVMTI_GEN) -IN $$($1_XML_FILE) -XSL $$($1_XSL_FILE) -OUT $$@ $$($1_ARGS))
+	$$(call ExecuteWithLog, $$@, $$(TOOL_JVMTI_GEN) -IN $$($1_XML_FILE) \
+	    -XSL $$($1_XSL_FILE) -OUT $$@ $$($1_ARGS))
         # jvmtiGen does not return error code properly on fail.
         # NOTE: We should really fix jvmtiGen.java instead.
 	test -f $$@
@@ -129,13 +130,28 @@
 TARGETS += $(JVMTI_OUTPUTDIR)/jvmtiEnvRecommended.cpp
 
 ################################################################################
+# Disable copy of jvmti.h from hotspot until this has been cleared up. The file
+# is currently being copied from the jdk repository. See JDK-8167078.
+# Copy jvmti.h to include dir
+
+# The file is the same regardless of jvm variant. Only let one do the copy.
+#ifeq ($(JVM_VARIANT), $(firstword $(JVM_VARIANTS)))
+#  $(eval $(call SetupCopyFiles, COPY_JVMTI_H, \
+#      DEST := $(SUPPORT_OUTPUTDIR)/modules_include/java.base, \
+#      FILES := $(JVMTI_OUTPUTDIR)/jvmti.h, \
+#  ))
+
+#  TARGETS += $(COPY_JVMTI_H)
+#endif
+
+################################################################################
 # Create trace files in gensrc/tracefiles
 
 TRACE_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/gensrc/tracefiles
 TRACE_SRCDIR := $(HOTSPOT_TOPDIR)/src/share/vm/trace
 
-# Append directories to search (might have been set by custom extensions)
-TRACE_SEARCH_DIRS += $(TRACE_SRCDIR)
+# Append list of XSL files to search (might have been set by custom extensions)
+TRACE_XSL_FILES += $(wildcard $(TRACE_SRCDIR)/*.xsl)
 
 TRACE_XML ?= $(TRACE_SRCDIR)/trace.xml
 
@@ -155,7 +171,7 @@
 define SetupTraceGeneration
   $$(eval $$(call SetupXslTransform, $1, \
       XML_FILE := $$(TRACE_XML), \
-      XSL_FILE := $$(firstword $$(wildcard $$(addsuffix /$$(basename $1).xsl, $$(TRACE_SEARCH_DIRS)))), \
+      XSL_FILE := $$(firstword $$(filter %/$$(basename $1).xsl, $$(TRACE_XSL_FILES))), \
       OUTPUT_DIR := $$(TRACE_OUTPUTDIR), \
       DEPS := $$(TRACE_DEPS), \
   ))
--- a/hotspot/make/lib/CompileDtracePostJvm.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/make/lib/CompileDtracePostJvm.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -180,7 +180,7 @@
 
     $(eval $(call SetupNativeCompilation, BUILD_LIBJVM_DTRACE, \
         LIBRARY := jvm_dtrace, \
-        OUTPUT_DIR := $(LIBJVM_DTRACE_OUTPUTDIR), \
+        OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \
         SRC := $(HOTSPOT_TOPDIR)/src/os/solaris/dtrace, \
         INCLUDE_FILES := jvm_dtrace.c, \
         CFLAGS := -m64 -G -mt -KPIC, \
@@ -197,7 +197,7 @@
     # the old build.
     $(eval $(call SetupNativeCompilation, BUILD_LIBJVM_DB, \
         LIBRARY := jvm_db, \
-        OUTPUT_DIR := $(LIBJVM_DB_OUTPUTDIR), \
+        OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \
         SRC := $(HOTSPOT_TOPDIR)/src/os/solaris/dtrace, \
         INCLUDE_FILES := libjvm_db.c, \
         CFLAGS := -I$(JVM_VARIANT_OUTPUTDIR)/gensrc -I$(DTRACE_SUPPORT_DIR) \
--- a/hotspot/make/lib/CompileJvm.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/make/lib/CompileJvm.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -174,13 +174,6 @@
   JVM_RCFLAGS += -D"HS_FILEDESC=$(HOTSPOT_VM_DISTRO) $(RC_DESC)$(JVM_VARIANT) VM"
 endif
 
-ifeq ($(OPENJDK_TARGET_OS), macosx)
-  # NOTE: The old build did not strip binaries on macosx.
-  JVM_STRIP_SYMBOLS := false
-else
-  JVM_STRIP_SYMBOLS := true
-endif
-
 JVM_OPTIMIZATION ?= HIGHEST_JVM
 
 ################################################################################
@@ -189,7 +182,7 @@
 $(eval $(call SetupNativeCompilation, BUILD_LIBJVM, \
     TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
     LIBRARY := jvm, \
-    OUTPUT_DIR := $(JVM_OUTPUTDIR), \
+    OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \
     SRC := $(JVM_SRC_DIRS), \
     EXCLUDES := $(JVM_EXCLUDES), \
     EXCLUDE_FILES := $(JVM_EXCLUDE_FILES), \
@@ -211,7 +204,6 @@
     OBJECT_DIR := $(JVM_OUTPUTDIR)/objs, \
     MAPFILE := $(JVM_MAPFILE), \
     USE_MAPFILE_FOR_SYMBOLS := true, \
-    STRIP_SYMBOLS := $(JVM_STRIP_SYMBOLS), \
     EMBED_MANIFEST := true, \
     RC_FLAGS := $(JVM_RCFLAGS), \
     VERSIONINFO_RESOURCE := $(HOTSPOT_TOPDIR)/src/os/windows/vm/version.rc, \
@@ -219,6 +211,18 @@
     PRECOMPILED_HEADER_EXCLUDE := $(JVM_PRECOMPILED_HEADER_EXCLUDE), \
 ))
 
+ifeq ($(OPENJDK_TARGET_OS), windows)
+  # It doesn't matter which jvm.lib file gets exported, but we need
+  # to pick just one.
+  ifeq ($(JVM_VARIANT), $(firstword $(JVM_VARIANTS)))
+    $(eval $(call SetupCopyFiles, COPY_JVM_LIB, \
+        DEST := $(LIB_OUTPUTDIR), \
+        FILES :=$(JVM_VARIANT_OUTPUTDIR)/libjvm/objs/jvm.lib, \
+    ))
+    TARGETS += $(COPY_JVM_LIB)
+  endif
+endif
+
 # AIX warning explanation:
 # 1500-010  : (W) WARNING in ...: Infinite loop.  Program may not stop.
 #             There are several infinite loops in the vm, so better suppress.
--- a/hotspot/make/lib/CompileLibjsig.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/make/lib/CompileLibjsig.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -34,7 +34,6 @@
 
 ifneq ($(OPENJDK_TARGET_OS), windows)
   ifeq ($(STATIC_BUILD), false)
-    LIBJSIG_STRIP_SYMBOLS := true
     ifeq ($(OPENJDK_TARGET_OS), linux)
       LIBJSIG_CFLAGS := -fPIC -D_GNU_SOURCE -D_REENTRANT $(EXTRA_CFLAGS)
       LIBJSIG_LDFLAGS := $(LDFLAGS_HASH_STYLE) $(EXTRA_CFLAGS)
@@ -72,8 +71,6 @@
     else ifeq ($(OPENJDK_TARGET_OS), macosx)
       LIBJSIG_CFLAGS := -m64 -D_GNU_SOURCE -pthread -mno-omit-leaf-frame-pointer -mstack-alignment=16 -fPIC
       LIBJSIG_LDFLAGS := $(LDFLAGS_HASH_STYLE)
-      # NOTE: This lib is not stripped on macosx in old build. Looks like a mistake.
-      LIBJSIG_STRIP_SYMBOLS := false
     else
       $(error Unknown target OS $(OPENJDK_TARGET_OS) in CompileLibjsig.gmk)
     endif
@@ -84,20 +81,71 @@
 
     LIBJSIG_LDFLAGS += $(SHARED_LIBRARY_FLAGS)
 
+    LIB_OUTPUTDIR := $(call FindLibDirForModule, java.base)
+
     $(eval $(call SetupNativeCompilation, BUILD_LIBJSIG, \
         LIBRARY := jsig, \
         EXTRA_FILES := $(LIBJSIG_SRC_FILE), \
-        OUTPUT_DIR := $(LIBJSIG_OUTPUTDIR), \
+        OUTPUT_DIR := $(LIB_OUTPUTDIR), \
         LANG := C, \
         CFLAGS := $(LIBJSIG_CFLAGS) $(LIBJSIG_CPU_FLAGS), \
         LDFLAGS := $(LIBJSIG_LDFLAGS) $(LIBJSIG_CPU_FLAGS), \
         LIBS := $(LIBJSIG_LIBS), \
         MAPFILE := $(LIBJSIG_MAPFILE), \
         OBJECT_DIR := $(LIBJSIG_OUTPUTDIR)/objs, \
-        STRIP_SYMBOLS := $(LIBJSIG_STRIP_SYMBOLS), \
     ))
 
     TARGETS += $(BUILD_LIBJSIG)
+
+    ############################################################################
+    # Create symlinks in each variant sub dir
+    ifeq ($(OPENJDK_TARGET_OS), macosx)
+      DEBUG_INFO_SUFFIX := $(SHARED_LIBRARY_SUFFIX).dSYM
+    else
+      DEBUG_INFO_SUFFIX := .debuginfo
+    endif
+
+    # $1 variant subdir
+    define CreateSymlinks
+      # Always symlink from libdir/variant/libjsig.so -> ../libjsig.so and
+      # the corresponding debuginfo.
+      $(LIB_OUTPUTDIR)/$1/$(call SHARED_LIBRARY,jsig): \
+          $(LIB_OUTPUTDIR)/$(call SHARED_LIBRARY,jsig)
+		$$(call MakeDir, $$(@D))
+		$(RM) $$@
+		$(LN) -s ../$$(@F) $$@
+
+      TARGETS += $(LIB_OUTPUTDIR)/$1/$(call SHARED_LIBRARY,jsig)
+
+      ifeq ($(COPY_DEBUG_SYMBOLS), true)
+        $(LIB_OUTPUTDIR)/$1/$(LIBRARY_PREFIX)jsig$(DEBUG_INFO_SUFFIX): \
+            $(LIB_OUTPUTDIR)/$(call SHARED_LIBRARY,jsig)
+		$$(call MakeDir, $$(@D))
+		$(RM) $$@
+		$(LN) -s ../$$(@F) $$@
+
+        TARGETS += $(LIB_OUTPUTDIR)/$1/$(LIBRARY_PREFIX)jsig$(DEBUG_INFO_SUFFIX)
+
+        ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
+          $(LIB_OUTPUTDIR)/$1/$(LIBRARY_PREFIX)jsig.diz: \
+              $(LIB_OUTPUTDIR)/$1/$(LIBRARY_PREFIX)jsig$(DEBUG_INFO_SUFFIX)
+			$(CD) $$(@D) && $(ZIP) -q -y $$@ $$(basename $$(@F))$(DEBUG_INFO_SUFFIX)
+
+          TARGETS += $(LIB_OUTPUTDIR)/$1/$(LIBRARY_PREFIX)jsig.diz
+        endif
+      endif
+    endef
+
+    # The subdir is the same as the variant for client and minimal, for all
+    # others it's server.
+    VARIANT_SUBDIRS := $(filter client minimal, $(JVM_VARIANTS)) \
+        $(if $(filter-out client minimal, $(JVM_VARIANTS)), server)
+    $(foreach v, $(VARIANT_SUBDIRS), $(eval $(call CreateSymlinks,$v)))
+
+    ############################################################################
+
+    include CopyToExplodedJdk.gmk
+
   endif
 endif
 
--- a/hotspot/make/lib/CompileLibraries.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/make/lib/CompileLibraries.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -41,6 +41,8 @@
   include lib/CompileGtest.gmk
 endif
 
+include CopyToExplodedJdk.gmk
+
 all: $(TARGETS)
 
 .PHONY: all
--- a/hotspot/make/lib/JvmOverrideFiles.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/make/lib/JvmOverrideFiles.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -31,6 +31,7 @@
 
 ifeq ($(TOOLCHAIN_TYPE), gcc)
   BUILD_LIBJVM_vmStructs.cpp_CXXFLAGS := -fno-var-tracking-assignments -O0
+  BUILD_LIBJVM_jvmciCompilerToVM.cpp_CXXFLAGS := -fno-var-tracking-assignments
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), linux)
--- a/hotspot/make/test/JtregNative.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/make/test/JtregNative.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -55,6 +55,9 @@
     $(HOTSPOT_TOPDIR)/test/testlibrary/jvmti \
     $(HOTSPOT_TOPDIR)/test/compiler/jvmci/jdk.vm.ci.code.test \
     $(HOTSPOT_TOPDIR)/test/serviceability/jvmti/GetModulesInfo \
+    $(HOTSPOT_TOPDIR)/test/serviceability/jvmti/ModuleAwareAgents/ClassFileLoadHook \
+    $(HOTSPOT_TOPDIR)/test/serviceability/jvmti/ModuleAwareAgents/ClassLoadPrepare \
+    $(HOTSPOT_TOPDIR)/test/serviceability/jvmti/ModuleAwareAgents/ThreadStart \
     #
 
 # Add conditional directories here when needed.
@@ -75,6 +78,9 @@
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_liboverflow := -lc
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libSimpleClassFileLoadHook := -lc
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libGetNamedModuleTest := -lc
+    BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libMAAClassFileLoadHook := -lc
+    BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libMAAClassLoadPrepare := -lc
+    BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libMAAThreadStart := -lc
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), linux)
--- a/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -140,10 +140,11 @@
 LIR_Address* LIRGenerator::generate_address(LIR_Opr base, LIR_Opr index,
                                             int shift, int disp, BasicType type) {
   assert(base->is_register(), "must be");
+  intx large_disp = disp;
 
   // accumulate fixed displacements
   if (index->is_constant()) {
-    disp += index->as_constant_ptr()->as_jint() << shift;
+    large_disp += (intx)(index->as_constant_ptr()->as_jint()) << shift;
     index = LIR_OprFact::illegalOpr;
   }
 
@@ -154,31 +155,31 @@
       __ shift_left(index, shift, tmp);
       index = tmp;
     }
-    if (disp != 0) {
+    if (large_disp != 0) {
       LIR_Opr tmp = new_pointer_register();
-      if (Assembler::operand_valid_for_add_sub_immediate(disp)) {
-        __ add(tmp, tmp, LIR_OprFact::intptrConst(disp));
+      if (Assembler::operand_valid_for_add_sub_immediate(large_disp)) {
+        __ add(tmp, tmp, LIR_OprFact::intptrConst(large_disp));
         index = tmp;
       } else {
-        __ move(tmp, LIR_OprFact::intptrConst(disp));
+        __ move(tmp, LIR_OprFact::intptrConst(large_disp));
         __ add(tmp, index, tmp);
         index = tmp;
       }
-      disp = 0;
+      large_disp = 0;
     }
-  } else if (disp != 0 && !Address::offset_ok_for_immed(disp, shift)) {
+  } else if (large_disp != 0 && !Address::offset_ok_for_immed(large_disp, shift)) {
     // index is illegal so replace it with the displacement loaded into a register
     index = new_pointer_register();
-    __ move(LIR_OprFact::intptrConst(disp), index);
-    disp = 0;
+    __ move(LIR_OprFact::intptrConst(large_disp), index);
+    large_disp = 0;
   }
 
   // at this point we either have base + index or base + displacement
-  if (disp == 0) {
+  if (large_disp == 0) {
     return new LIR_Address(base, index, type);
   } else {
-    assert(Address::offset_ok_for_immed(disp, 0), "must be");
-    return new LIR_Address(base, disp, type);
+    assert(Address::offset_ok_for_immed(large_disp, 0), "must be");
+    return new LIR_Address(base, large_disp, type);
   }
 }
 
@@ -192,7 +193,7 @@
   LIR_Address* addr;
   if (index_opr->is_constant()) {
     addr = new LIR_Address(array_opr,
-                           offset_in_bytes + index_opr->as_jint() * elem_size, type);
+                           offset_in_bytes + (intx)(index_opr->as_jint()) * elem_size, type);
   } else {
     if (offset_in_bytes) {
       LIR_Opr tmp = new_pointer_register();
@@ -1032,6 +1033,10 @@
   Unimplemented();
 }
 
+void LIRGenerator::do_FmaIntrinsic(Intrinsic* x) {
+  fatal("FMA intrinsic is not implemented on this platform");
+}
+
 void LIRGenerator::do_vectorizedMismatch(Intrinsic* x) {
   fatal("vectorizedMismatch intrinsic is not implemented on this platform");
 }
--- a/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -327,7 +327,7 @@
 
 void InterpreterMacroAssembler::push_l(Register r) {
   str(zr, pre(esp, -wordSize));
-  str(r, pre(esp, -wordsize));
+  str(r, pre(esp, - wordSize));
 }
 
 void InterpreterMacroAssembler::pop_f(FloatRegister r) {
--- a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -262,6 +262,11 @@
     FLAG_SET_DEFAULT(UseCRC32CIntrinsics, false);
   }
 
+  if (UseFMA) {
+    warning("FMA instructions are not available on this CPU");
+    FLAG_SET_DEFAULT(UseFMA, false);
+  }
+
   if (auxv & (HWCAP_SHA1 | HWCAP_SHA2)) {
     if (FLAG_IS_DEFAULT(UseSHA)) {
       FLAG_SET_DEFAULT(UseSHA, true);
--- a/hotspot/src/cpu/ppc/vm/assembler_ppc.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/ppc/vm/assembler_ppc.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -506,6 +506,8 @@
     // Vector-Scalar (VSX) instruction support.
     LXVD2X_OPCODE  = (31u << OPCODE_SHIFT |  844u << 1),
     STXVD2X_OPCODE = (31u << OPCODE_SHIFT |  972u << 1),
+    MTVSRD_OPCODE  = (31u << OPCODE_SHIFT |  179u << 1),
+    MFVSRD_OPCODE  = (31u << OPCODE_SHIFT |   51u << 1),
 
     // Vector Permute and Formatting
     VPKPX_OPCODE   = (4u  << OPCODE_SHIFT |  782u     ),
@@ -1573,6 +1575,9 @@
   inline void stdu( Register d, int si16,    Register s1);
   inline void stdux(Register s, Register a,  Register b);
 
+  inline void st_ptr(Register d, int si16,    Register s1);
+  DEBUG_ONLY(inline void st_ptr(Register d, ByteSize b, Register s1);)
+
   // PPC 1, section 3.3.13 Move To/From System Register Instructions
   inline void mtlr( Register s1);
   inline void mflr( Register d);
@@ -2099,6 +2104,8 @@
   // Vector-Scalar (VSX) instructions.
   inline void lxvd2x(   VectorSRegister d, Register a, Register b);
   inline void stxvd2x(  VectorSRegister d, Register a, Register b);
+  inline void mtvrd(    VectorRegister  d, Register a);
+  inline void mfvrd(    Register        a, VectorRegister d);
 
   // AES (introduced with Power 8)
   inline void vcipher(     VectorRegister d, VectorRegister a, VectorRegister b);
--- a/hotspot/src/cpu/ppc/vm/assembler_ppc.inline.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/ppc/vm/assembler_ppc.inline.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -349,6 +349,9 @@
 inline void Assembler::stdu( Register d, int si16,    Register s1) { emit_int32(STDU_OPCODE | rs(d) | ds(si16)   | rta0mem(s1));}
 inline void Assembler::stdux(Register s, Register a,  Register b)  { emit_int32(STDUX_OPCODE| rs(s) | rta0mem(a) | rb(b));}
 
+inline void Assembler::st_ptr(Register d, int b, Register s1) { std(d, b, s1); }
+DEBUG_ONLY(inline void Assembler::st_ptr(Register d, ByteSize b, Register s1) { std(d, in_bytes(b), s1); })
+
 // PPC 1, section 3.3.13 Move To/From System Register Instructions
 inline void Assembler::mtlr( Register s1)         { emit_int32(MTLR_OPCODE  | rs(s1)); }
 inline void Assembler::mflr( Register d )         { emit_int32(MFLR_OPCODE  | rt(d)); }
@@ -733,6 +736,8 @@
 // Vector-Scalar (VSX) instructions.
 inline void Assembler::lxvd2x (VectorSRegister d, Register s1, Register s2) { emit_int32( LXVD2X_OPCODE  | vsrt(d) | ra(s1) | rb(s2)); }
 inline void Assembler::stxvd2x(VectorSRegister d, Register s1, Register s2) { emit_int32( STXVD2X_OPCODE | vsrt(d) | ra(s1) | rb(s2)); }
+inline void Assembler::mtvrd(  VectorRegister  d, Register a)               { emit_int32( MTVSRD_OPCODE  | vrt(d)  | ra(a)  | 1u); } // 1u: d is treated as Vector (VMX/Altivec).
+inline void Assembler::mfvrd(  Register        a, VectorRegister d)         { emit_int32( MFVSRD_OPCODE  | vrt(d)  | ra(a)  | 1u); } // 1u: d is treated as Vector (VMX/Altivec).
 
 inline void Assembler::vpkpx(   VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VPKPX_OPCODE   | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vpkshss( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VPKSHSS_OPCODE | vrt(d) | vra(a) | vrb(b)); }
--- a/hotspot/src/cpu/ppc/vm/c1_LIRGenerator_ppc.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/ppc/vm/c1_LIRGenerator_ppc.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -157,10 +157,11 @@
 LIR_Address* LIRGenerator::generate_address(LIR_Opr base, LIR_Opr index,
                                             int shift, int disp, BasicType type) {
   assert(base->is_register(), "must be");
+  intx large_disp = disp;
 
   // Accumulate fixed displacements.
   if (index->is_constant()) {
-    disp += index->as_constant_ptr()->as_jint() << shift;
+    large_disp += (intx)(index->as_constant_ptr()->as_jint()) << shift;
     index = LIR_OprFact::illegalOpr;
   }
 
@@ -171,31 +172,31 @@
       __ shift_left(index, shift, tmp);
       index = tmp;
     }
-    if (disp != 0) {
+    if (large_disp != 0) {
       LIR_Opr tmp = new_pointer_register();
-      if (Assembler::is_simm16(disp)) {
-        __ add(index, LIR_OprFact::intptrConst(disp), tmp);
+      if (Assembler::is_simm16(large_disp)) {
+        __ add(index, LIR_OprFact::intptrConst(large_disp), tmp);
         index = tmp;
       } else {
-        __ move(LIR_OprFact::intptrConst(disp), tmp);
+        __ move(LIR_OprFact::intptrConst(large_disp), tmp);
         __ add(tmp, index, tmp);
         index = tmp;
       }
-      disp = 0;
+      large_disp = 0;
     }
-  } else if (!Assembler::is_simm16(disp)) {
+  } else if (!Assembler::is_simm16(large_disp)) {
     // Index is illegal so replace it with the displacement loaded into a register.
     index = new_pointer_register();
-    __ move(LIR_OprFact::intptrConst(disp), index);
-    disp = 0;
+    __ move(LIR_OprFact::intptrConst(large_disp), index);
+    large_disp = 0;
   }
 
   // At this point we either have base + index or base + displacement.
-  if (disp == 0) {
+  if (large_disp == 0) {
     return new LIR_Address(base, index, type);
   } else {
-    assert(Assembler::is_simm16(disp), "must be");
-    return new LIR_Address(base, disp, type);
+    assert(Assembler::is_simm16(large_disp), "must be");
+    return new LIR_Address(base, large_disp, type);
   }
 }
 
@@ -206,11 +207,11 @@
   int shift = exact_log2(elem_size);
 
   LIR_Opr base_opr;
-  int offset = arrayOopDesc::base_offset_in_bytes(type);
+  intx offset = arrayOopDesc::base_offset_in_bytes(type);
 
   if (index_opr->is_constant()) {
-    int i = index_opr->as_constant_ptr()->as_jint();
-    int array_offset = i * elem_size;
+    intx i = index_opr->as_constant_ptr()->as_jint();
+    intx array_offset = i * elem_size;
     if (Assembler::is_simm16(array_offset + offset)) {
       base_opr = array_opr;
       offset = array_offset + offset;
@@ -1433,6 +1434,10 @@
   }
 }
 
+void LIRGenerator::do_FmaIntrinsic(Intrinsic* x) {
+  fatal("FMA intrinsic is not implemented on this platform");
+}
+
 void LIRGenerator::do_vectorizedMismatch(Intrinsic* x) {
   fatal("vectorizedMismatch intrinsic is not implemented on this platform");
 }
--- a/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -261,6 +261,9 @@
 }
 
 void InterpreterMacroAssembler::push_l(Register r) {
+  // Clear unused slot.
+  load_const_optimized(R0, 0L);
+  std(R0, 0, R15_esp);
   std(r, - Interpreter::stackElementSize, R15_esp);
   addi(R15_esp, R15_esp, - 2 * Interpreter::stackElementSize );
 }
--- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -4332,6 +4332,565 @@
   BLOCK_COMMENT("} kernel_crc32_1byte");
 }
 
+/**
+ * @param crc             register containing existing CRC (32-bit)
+ * @param buf             register pointing to input byte buffer (byte*)
+ * @param len             register containing number of bytes
+ * @param table           register pointing to CRC table
+ * @param constants       register pointing to CRC table for 128-bit aligned memory
+ * @param barretConstants register pointing to table for barrett reduction
+ * @param t0              volatile register
+ * @param t1              volatile register
+ * @param t2              volatile register
+ * @param t3              volatile register
+ */
+void MacroAssembler::kernel_crc32_1word_vpmsumd(Register crc, Register buf, Register len, Register table,
+                        Register constants,  Register barretConstants,
+                        Register t0,  Register t1, Register t2, Register t3, Register t4) {
+  assert_different_registers(crc, buf, len, table);
+
+  Label L_alignedHead, L_tail, L_alignTail, L_start, L_end;
+
+  Register  prealign     = t0;
+  Register  postalign    = t0;
+
+  BLOCK_COMMENT("kernel_crc32_1word_vpmsumb {");
+
+  // 1. use kernel_crc32_1word for shorter than 384bit
+  clrldi(len, len, 32);
+  cmpdi(CCR0, len, 384);
+  bge(CCR0, L_start);
+
+    Register tc0 = t4;
+    Register tc1 = constants;
+    Register tc2 = barretConstants;
+    kernel_crc32_1word(crc, buf, len, table,t0, t1, t2, t3, tc0, tc1, tc2, table);
+    b(L_end);
+
+  BIND(L_start);
+
+    // 2. ~c
+    nand(crc, crc, crc);
+
+    // 3. calculate from 0 to first 128bit-aligned address
+    clrldi_(prealign, buf, 57);
+    beq(CCR0, L_alignedHead);
+
+    subfic(prealign, prealign, 128);
+
+    subf(len, prealign, len);
+    update_byteLoop_crc32(crc, buf, prealign, table, t2, false, false);
+
+    // 4. calculate from first 128bit-aligned address to last 128bit-aligned address
+    BIND(L_alignedHead);
+
+    clrldi(postalign, len, 57);
+    subf(len, postalign, len);
+
+    // len must be more than 256bit
+    kernel_crc32_1word_aligned(crc, buf, len, constants, barretConstants, t1, t2, t3);
+
+    // 5. calculate remaining
+    cmpdi(CCR0, postalign, 0);
+    beq(CCR0, L_tail);
+
+    update_byteLoop_crc32(crc, buf, postalign, table, t2, false, false);
+
+    BIND(L_tail);
+
+    // 6. ~c
+    nand(crc, crc, crc);
+
+  BIND(L_end);
+
+  BLOCK_COMMENT("} kernel_crc32_1word_vpmsumb");
+}
+
+/**
+ * @param crc             register containing existing CRC (32-bit)
+ * @param buf             register pointing to input byte buffer (byte*)
+ * @param len             register containing number of bytes
+ * @param constants       register pointing to CRC table for 128-bit aligned memory
+ * @param barretConstants register pointing to table for barrett reduction
+ * @param t0              volatile register
+ * @param t1              volatile register
+ * @param t2              volatile register
+ */
+void MacroAssembler::kernel_crc32_1word_aligned(Register crc, Register buf, Register len,
+    Register constants, Register barretConstants, Register t0, Register t1, Register t2) {
+  Label L_mainLoop, L_tail, L_alignTail, L_barrett_reduction, L_end, L_first_warm_up_done, L_first_cool_down, L_second_cool_down, L_XOR, L_test;
+  Label L_lv0, L_lv1, L_lv2, L_lv3, L_lv4, L_lv5, L_lv6, L_lv7, L_lv8, L_lv9, L_lv10, L_lv11, L_lv12, L_lv13, L_lv14, L_lv15;
+  Label L_1, L_2, L_3, L_4;
+
+  Register  rLoaded      = t0;
+  Register  rTmp1        = t1;
+  Register  rTmp2        = t2;
+  Register  off16        = R22;
+  Register  off32        = R23;
+  Register  off48        = R24;
+  Register  off64        = R25;
+  Register  off80        = R26;
+  Register  off96        = R27;
+  Register  off112       = R28;
+  Register  rIdx         = R29;
+  Register  rMax         = R30;
+  Register  constantsPos = R31;
+
+  VectorRegister mask_32bit = VR24;
+  VectorRegister mask_64bit = VR25;
+  VectorRegister zeroes     = VR26;
+  VectorRegister const1     = VR27;
+  VectorRegister const2     = VR28;
+
+  // Save non-volatile vector registers (frameless).
+  Register offset = t1;   int offsetInt = 0;
+  offsetInt -= 16; li(offset, -16);           stvx(VR20, offset, R1_SP);
+  offsetInt -= 16; addi(offset, offset, -16); stvx(VR21, offset, R1_SP);
+  offsetInt -= 16; addi(offset, offset, -16); stvx(VR22, offset, R1_SP);
+  offsetInt -= 16; addi(offset, offset, -16); stvx(VR23, offset, R1_SP);
+  offsetInt -= 16; addi(offset, offset, -16); stvx(VR24, offset, R1_SP);
+  offsetInt -= 16; addi(offset, offset, -16); stvx(VR25, offset, R1_SP);
+  offsetInt -= 16; addi(offset, offset, -16); stvx(VR26, offset, R1_SP);
+  offsetInt -= 16; addi(offset, offset, -16); stvx(VR27, offset, R1_SP);
+  offsetInt -= 16; addi(offset, offset, -16); stvx(VR28, offset, R1_SP);
+  offsetInt -= 8; std(R22, offsetInt, R1_SP);
+  offsetInt -= 8; std(R23, offsetInt, R1_SP);
+  offsetInt -= 8; std(R24, offsetInt, R1_SP);
+  offsetInt -= 8; std(R25, offsetInt, R1_SP);
+  offsetInt -= 8; std(R26, offsetInt, R1_SP);
+  offsetInt -= 8; std(R27, offsetInt, R1_SP);
+  offsetInt -= 8; std(R28, offsetInt, R1_SP);
+  offsetInt -= 8; std(R29, offsetInt, R1_SP);
+  offsetInt -= 8; std(R30, offsetInt, R1_SP);
+  offsetInt -= 8; std(R31, offsetInt, R1_SP);
+
+  // Set constants
+  li(off16, 16);
+  li(off32, 32);
+  li(off48, 48);
+  li(off64, 64);
+  li(off80, 80);
+  li(off96, 96);
+  li(off112, 112);
+
+  clrldi(crc, crc, 32);
+
+  vxor(zeroes, zeroes, zeroes);
+  vspltisw(VR0, -1);
+
+  vsldoi(mask_32bit, zeroes, VR0, 4);
+  vsldoi(mask_64bit, zeroes, VR0, -8);
+
+  // Get the initial value into v8
+  vxor(VR8, VR8, VR8);
+  mtvrd(VR8, crc);
+  vsldoi(VR8, zeroes, VR8, -8); // shift into bottom 32 bits
+
+  li (rLoaded, 0);
+
+  rldicr(rIdx, len, 0, 56);
+
+  {
+    BIND(L_1);
+    // Checksum in blocks of MAX_SIZE (32768)
+    lis(rMax, 0);
+    ori(rMax, rMax, 32768);
+    mr(rTmp2, rMax);
+    cmpd(CCR0, rIdx, rMax);
+    bgt(CCR0, L_2);
+    mr(rMax, rIdx);
+
+    BIND(L_2);
+    subf(rIdx, rMax, rIdx);
+
+    // our main loop does 128 bytes at a time
+    srdi(rMax, rMax, 7);
+
+    /*
+     * Work out the offset into the constants table to start at. Each
+     * constant is 16 bytes, and it is used against 128 bytes of input
+     * data - 128 / 16 = 8
+     */
+    sldi(rTmp1, rMax, 4);
+    srdi(rTmp2, rTmp2, 3);
+    subf(rTmp1, rTmp1, rTmp2);
+
+    // We reduce our final 128 bytes in a separate step
+    addi(rMax, rMax, -1);
+    mtctr(rMax);
+
+    // Find the start of our constants
+    add(constantsPos, constants, rTmp1);
+
+    // zero VR0-v7 which will contain our checksums
+    vxor(VR0, VR0, VR0);
+    vxor(VR1, VR1, VR1);
+    vxor(VR2, VR2, VR2);
+    vxor(VR3, VR3, VR3);
+    vxor(VR4, VR4, VR4);
+    vxor(VR5, VR5, VR5);
+    vxor(VR6, VR6, VR6);
+    vxor(VR7, VR7, VR7);
+
+    lvx(const1, constantsPos);
+
+    /*
+     * If we are looping back to consume more data we use the values
+     * already in VR16-v23.
+     */
+    cmpdi(CCR0, rLoaded, 1);
+    beq(CCR0, L_3);
+    {
+
+      // First warm up pass
+      lvx(VR16, buf);
+      lvx(VR17, off16, buf);
+      lvx(VR18, off32, buf);
+      lvx(VR19, off48, buf);
+      lvx(VR20, off64, buf);
+      lvx(VR21, off80, buf);
+      lvx(VR22, off96, buf);
+      lvx(VR23, off112, buf);
+      addi(buf, buf, 8*16);
+
+      // xor in initial value
+      vxor(VR16, VR16, VR8);
+    }
+
+    BIND(L_3);
+    bdz(L_first_warm_up_done);
+
+    addi(constantsPos, constantsPos, 16);
+    lvx(const2, constantsPos);
+
+    // Second warm up pass
+    vpmsumd(VR8, VR16, const1);
+    lvx(VR16, buf);
+
+    vpmsumd(VR9, VR17, const1);
+    lvx(VR17, off16, buf);
+
+    vpmsumd(VR10, VR18, const1);
+    lvx(VR18, off32, buf);
+
+    vpmsumd(VR11, VR19, const1);
+    lvx(VR19, off48, buf);
+
+    vpmsumd(VR12, VR20, const1);
+    lvx(VR20, off64, buf);
+
+    vpmsumd(VR13, VR21, const1);
+    lvx(VR21, off80, buf);
+
+    vpmsumd(VR14, VR22, const1);
+    lvx(VR22, off96, buf);
+
+    vpmsumd(VR15, VR23, const1);
+    lvx(VR23, off112, buf);
+
+    addi(buf, buf, 8 * 16);
+
+    bdz(L_first_cool_down);
+
+    /*
+     * main loop. We modulo schedule it such that it takes three iterations
+     * to complete - first iteration load, second iteration vpmsum, third
+     * iteration xor.
+     */
+    {
+      BIND(L_4);
+      lvx(const1, constantsPos); addi(constantsPos, constantsPos, 16);
+
+      vxor(VR0, VR0, VR8);
+      vpmsumd(VR8, VR16, const2);
+      lvx(VR16, buf);
+
+      vxor(VR1, VR1, VR9);
+      vpmsumd(VR9, VR17, const2);
+      lvx(VR17, off16, buf);
+
+      vxor(VR2, VR2, VR10);
+      vpmsumd(VR10, VR18, const2);
+      lvx(VR18, off32, buf);
+
+      vxor(VR3, VR3, VR11);
+      vpmsumd(VR11, VR19, const2);
+      lvx(VR19, off48, buf);
+      lvx(const2, constantsPos);
+
+      vxor(VR4, VR4, VR12);
+      vpmsumd(VR12, VR20, const1);
+      lvx(VR20, off64, buf);
+
+      vxor(VR5, VR5, VR13);
+      vpmsumd(VR13, VR21, const1);
+      lvx(VR21, off80, buf);
+
+      vxor(VR6, VR6, VR14);
+      vpmsumd(VR14, VR22, const1);
+      lvx(VR22, off96, buf);
+
+      vxor(VR7, VR7, VR15);
+      vpmsumd(VR15, VR23, const1);
+      lvx(VR23, off112, buf);
+
+      addi(buf, buf, 8 * 16);
+
+      bdnz(L_4);
+    }
+
+    BIND(L_first_cool_down);
+
+    // First cool down pass
+    lvx(const1, constantsPos);
+    addi(constantsPos, constantsPos, 16);
+
+    vxor(VR0, VR0, VR8);
+    vpmsumd(VR8, VR16, const1);
+
+    vxor(VR1, VR1, VR9);
+    vpmsumd(VR9, VR17, const1);
+
+    vxor(VR2, VR2, VR10);
+    vpmsumd(VR10, VR18, const1);
+
+    vxor(VR3, VR3, VR11);
+    vpmsumd(VR11, VR19, const1);
+
+    vxor(VR4, VR4, VR12);
+    vpmsumd(VR12, VR20, const1);
+
+    vxor(VR5, VR5, VR13);
+    vpmsumd(VR13, VR21, const1);
+
+    vxor(VR6, VR6, VR14);
+    vpmsumd(VR14, VR22, const1);
+
+    vxor(VR7, VR7, VR15);
+    vpmsumd(VR15, VR23, const1);
+
+    BIND(L_second_cool_down);
+    // Second cool down pass
+    vxor(VR0, VR0, VR8);
+    vxor(VR1, VR1, VR9);
+    vxor(VR2, VR2, VR10);
+    vxor(VR3, VR3, VR11);
+    vxor(VR4, VR4, VR12);
+    vxor(VR5, VR5, VR13);
+    vxor(VR6, VR6, VR14);
+    vxor(VR7, VR7, VR15);
+
+    /*
+     * vpmsumd produces a 96 bit result in the least significant bits
+     * of the register. Since we are bit reflected we have to shift it
+     * left 32 bits so it occupies the least significant bits in the
+     * bit reflected domain.
+     */
+    vsldoi(VR0, VR0, zeroes, 4);
+    vsldoi(VR1, VR1, zeroes, 4);
+    vsldoi(VR2, VR2, zeroes, 4);
+    vsldoi(VR3, VR3, zeroes, 4);
+    vsldoi(VR4, VR4, zeroes, 4);
+    vsldoi(VR5, VR5, zeroes, 4);
+    vsldoi(VR6, VR6, zeroes, 4);
+    vsldoi(VR7, VR7, zeroes, 4);
+
+    // xor with last 1024 bits
+    lvx(VR8, buf);
+    lvx(VR9, off16, buf);
+    lvx(VR10, off32, buf);
+    lvx(VR11, off48, buf);
+    lvx(VR12, off64, buf);
+    lvx(VR13, off80, buf);
+    lvx(VR14, off96, buf);
+    lvx(VR15, off112, buf);
+    addi(buf, buf, 8 * 16);
+
+    vxor(VR16, VR0, VR8);
+    vxor(VR17, VR1, VR9);
+    vxor(VR18, VR2, VR10);
+    vxor(VR19, VR3, VR11);
+    vxor(VR20, VR4, VR12);
+    vxor(VR21, VR5, VR13);
+    vxor(VR22, VR6, VR14);
+    vxor(VR23, VR7, VR15);
+
+    li(rLoaded, 1);
+    cmpdi(CCR0, rIdx, 0);
+    addi(rIdx, rIdx, 128);
+    bne(CCR0, L_1);
+  }
+
+  // Work out how many bytes we have left
+  andi_(len, len, 127);
+
+  // Calculate where in the constant table we need to start
+  subfic(rTmp1, len, 128);
+  add(constantsPos, constantsPos, rTmp1);
+
+  // How many 16 byte chunks are in the tail
+  srdi(rIdx, len, 4);
+  mtctr(rIdx);
+
+  /*
+   * Reduce the previously calculated 1024 bits to 64 bits, shifting
+   * 32 bits to include the trailing 32 bits of zeros
+   */
+  lvx(VR0, constantsPos);
+  lvx(VR1, off16, constantsPos);
+  lvx(VR2, off32, constantsPos);
+  lvx(VR3, off48, constantsPos);
+  lvx(VR4, off64, constantsPos);
+  lvx(VR5, off80, constantsPos);
+  lvx(VR6, off96, constantsPos);
+  lvx(VR7, off112, constantsPos);
+  addi(constantsPos, constantsPos, 8 * 16);
+
+  vpmsumw(VR0, VR16, VR0);
+  vpmsumw(VR1, VR17, VR1);
+  vpmsumw(VR2, VR18, VR2);
+  vpmsumw(VR3, VR19, VR3);
+  vpmsumw(VR4, VR20, VR4);
+  vpmsumw(VR5, VR21, VR5);
+  vpmsumw(VR6, VR22, VR6);
+  vpmsumw(VR7, VR23, VR7);
+
+  // Now reduce the tail (0 - 112 bytes)
+  cmpdi(CCR0, rIdx, 0);
+  beq(CCR0, L_XOR);
+
+  lvx(VR16, buf); addi(buf, buf, 16);
+  lvx(VR17, constantsPos);
+  vpmsumw(VR16, VR16, VR17);
+  vxor(VR0, VR0, VR16);
+  beq(CCR0, L_XOR);
+
+  lvx(VR16, buf); addi(buf, buf, 16);
+  lvx(VR17, off16, constantsPos);
+  vpmsumw(VR16, VR16, VR17);
+  vxor(VR0, VR0, VR16);
+  beq(CCR0, L_XOR);
+
+  lvx(VR16, buf); addi(buf, buf, 16);
+  lvx(VR17, off32, constantsPos);
+  vpmsumw(VR16, VR16, VR17);
+  vxor(VR0, VR0, VR16);
+  beq(CCR0, L_XOR);
+
+  lvx(VR16, buf); addi(buf, buf, 16);
+  lvx(VR17, off48,constantsPos);
+  vpmsumw(VR16, VR16, VR17);
+  vxor(VR0, VR0, VR16);
+  beq(CCR0, L_XOR);
+
+  lvx(VR16, buf); addi(buf, buf, 16);
+  lvx(VR17, off64, constantsPos);
+  vpmsumw(VR16, VR16, VR17);
+  vxor(VR0, VR0, VR16);
+  beq(CCR0, L_XOR);
+
+  lvx(VR16, buf); addi(buf, buf, 16);
+  lvx(VR17, off80, constantsPos);
+  vpmsumw(VR16, VR16, VR17);
+  vxor(VR0, VR0, VR16);
+  beq(CCR0, L_XOR);
+
+  lvx(VR16, buf); addi(buf, buf, 16);
+  lvx(VR17, off96, constantsPos);
+  vpmsumw(VR16, VR16, VR17);
+  vxor(VR0, VR0, VR16);
+
+  // Now xor all the parallel chunks together
+  BIND(L_XOR);
+  vxor(VR0, VR0, VR1);
+  vxor(VR2, VR2, VR3);
+  vxor(VR4, VR4, VR5);
+  vxor(VR6, VR6, VR7);
+
+  vxor(VR0, VR0, VR2);
+  vxor(VR4, VR4, VR6);
+
+  vxor(VR0, VR0, VR4);
+
+  b(L_barrett_reduction);
+
+  BIND(L_first_warm_up_done);
+  lvx(const1, constantsPos);
+  addi(constantsPos, constantsPos, 16);
+  vpmsumd(VR8,  VR16, const1);
+  vpmsumd(VR9,  VR17, const1);
+  vpmsumd(VR10, VR18, const1);
+  vpmsumd(VR11, VR19, const1);
+  vpmsumd(VR12, VR20, const1);
+  vpmsumd(VR13, VR21, const1);
+  vpmsumd(VR14, VR22, const1);
+  vpmsumd(VR15, VR23, const1);
+  b(L_second_cool_down);
+
+  BIND(L_barrett_reduction);
+
+  lvx(const1, barretConstants);
+  addi(barretConstants, barretConstants, 16);
+  lvx(const2, barretConstants);
+
+  vsldoi(VR1, VR0, VR0, -8);
+  vxor(VR0, VR0, VR1);    // xor two 64 bit results together
+
+  // shift left one bit
+  vspltisb(VR1, 1);
+  vsl(VR0, VR0, VR1);
+
+  vand(VR0, VR0, mask_64bit);
+
+  /*
+   * The reflected version of Barrett reduction. Instead of bit
+   * reflecting our data (which is expensive to do), we bit reflect our
+   * constants and our algorithm, which means the intermediate data in
+   * our vector registers goes from 0-63 instead of 63-0. We can reflect
+   * the algorithm because we don't carry in mod 2 arithmetic.
+   */
+  vand(VR1, VR0, mask_32bit);  // bottom 32 bits of a
+  vpmsumd(VR1, VR1, const1);   // ma
+  vand(VR1, VR1, mask_32bit);  // bottom 32bits of ma
+  vpmsumd(VR1, VR1, const2);   // qn */
+  vxor(VR0, VR0, VR1);         // a - qn, subtraction is xor in GF(2)
+
+  /*
+   * Since we are bit reflected, the result (ie the low 32 bits) is in
+   * the high 32 bits. We just need to shift it left 4 bytes
+   * V0 [ 0 1 X 3 ]
+   * V0 [ 0 X 2 3 ]
+   */
+  vsldoi(VR0, VR0, zeroes, 4);    // shift result into top 64 bits of
+
+  // Get it into r3
+  mfvrd(crc, VR0);
+
+  BIND(L_end);
+
+  offsetInt = 0;
+  // Restore non-volatile Vector registers (frameless).
+  offsetInt -= 16; li(offset, -16);           lvx(VR20, offset, R1_SP);
+  offsetInt -= 16; addi(offset, offset, -16); lvx(VR21, offset, R1_SP);
+  offsetInt -= 16; addi(offset, offset, -16); lvx(VR22, offset, R1_SP);
+  offsetInt -= 16; addi(offset, offset, -16); lvx(VR23, offset, R1_SP);
+  offsetInt -= 16; addi(offset, offset, -16); lvx(VR24, offset, R1_SP);
+  offsetInt -= 16; addi(offset, offset, -16); lvx(VR25, offset, R1_SP);
+  offsetInt -= 16; addi(offset, offset, -16); lvx(VR26, offset, R1_SP);
+  offsetInt -= 16; addi(offset, offset, -16); lvx(VR27, offset, R1_SP);
+  offsetInt -= 16; addi(offset, offset, -16); lvx(VR28, offset, R1_SP);
+  offsetInt -= 8;  ld(R22, offsetInt, R1_SP);
+  offsetInt -= 8;  ld(R23, offsetInt, R1_SP);
+  offsetInt -= 8;  ld(R24, offsetInt, R1_SP);
+  offsetInt -= 8;  ld(R25, offsetInt, R1_SP);
+  offsetInt -= 8;  ld(R26, offsetInt, R1_SP);
+  offsetInt -= 8;  ld(R27, offsetInt, R1_SP);
+  offsetInt -= 8;  ld(R28, offsetInt, R1_SP);
+  offsetInt -= 8;  ld(R29, offsetInt, R1_SP);
+  offsetInt -= 8;  ld(R30, offsetInt, R1_SP);
+  offsetInt -= 8;  ld(R31, offsetInt, R1_SP);
+}
+
 void MacroAssembler::kernel_crc32_singleByte(Register crc, Register buf, Register len, Register table, Register tmp) {
   assert_different_registers(crc, buf, /* len,  not used!! */ table, tmp);
 
--- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -834,6 +834,13 @@
                           Register tc0, Register tc1, Register tc2, Register tc3);
   void kernel_crc32_1byte(Register crc, Register buf, Register len, Register table,
                           Register t0,  Register t1,  Register t2,  Register t3);
+  void kernel_crc32_1word_vpmsumd(Register crc, Register buf, Register len, Register table,
+                          Register constants, Register barretConstants,
+                          Register t0,  Register t1, Register t2, Register t3, Register t4);
+  void kernel_crc32_1word_aligned(Register crc, Register buf, Register len,
+                          Register constants, Register barretConstants,
+                          Register t0, Register t1, Register t2);
+
   void kernel_crc32_singleByte(Register crc, Register buf, Register len, Register table, Register tmp);
 
   //
--- a/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -2489,6 +2489,11 @@
     __ verify_oop(R3_RET);
   }
 
+  if (CheckJNICalls) {
+    // clear_pending_jni_exception_check
+    __ load_const_optimized(R0, 0L);
+    __ st_ptr(R0, JavaThread::pending_jni_exception_check_fn_offset(), R16_thread);
+  }
 
   // Reset handle block.
   // --------------------------------------------------------------------------
--- a/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -3205,28 +3205,59 @@
     const Register crc     = R3_ARG1;  // Current checksum, preset by caller or result from previous call.
     const Register data    = R4_ARG2;  // source byte array
     const Register dataLen = R5_ARG3;  // #bytes to process
-    const Register table   = R6_ARG4;  // crc table address
-
-    const Register t0      = R2;
-    const Register t1      = R7;
-    const Register t2      = R8;
-    const Register t3      = R9;
-    const Register tc0     = R10;
-    const Register tc1     = R11;
-    const Register tc2     = R12;
-
-    BLOCK_COMMENT("Stub body {");
-    assert_different_registers(crc, data, dataLen, table);
-
-    StubRoutines::ppc64::generate_load_crc_table_addr(_masm, table);
-
-    __ kernel_crc32_1word(crc, data, dataLen, table, t0, t1, t2, t3, tc0, tc1, tc2, table);
-
-    BLOCK_COMMENT("return");
-    __ mr_if_needed(R3_RET, crc);      // Updated crc is function result. No copying required (R3_ARG1 == R3_RET).
-    __ blr();
-
-    BLOCK_COMMENT("} Stub body");
+
+    const Register table   = R6;       // crc table address
+
+#ifdef VM_LITTLE_ENDIAN
+    if (VM_Version::has_vpmsumb()) {
+      const Register constants    = R2;  // constants address
+      const Register bconstants   = R8;  // barret table address
+
+      const Register t0      = R9;
+      const Register t1      = R10;
+      const Register t2      = R11;
+      const Register t3      = R12;
+      const Register t4      = R7;
+
+      BLOCK_COMMENT("Stub body {");
+      assert_different_registers(crc, data, dataLen, table);
+
+      StubRoutines::ppc64::generate_load_crc_table_addr(_masm, table);
+      StubRoutines::ppc64::generate_load_crc_constants_addr(_masm, constants);
+      StubRoutines::ppc64::generate_load_crc_barret_constants_addr(_masm, bconstants);
+
+      __ kernel_crc32_1word_vpmsumd(crc, data, dataLen, table, constants, bconstants, t0, t1, t2, t3, t4);
+
+      BLOCK_COMMENT("return");
+      __ mr_if_needed(R3_RET, crc);      // Updated crc is function result. No copying required (R3_ARG1 == R3_RET).
+      __ blr();
+
+      BLOCK_COMMENT("} Stub body");
+    } else
+#endif
+    {
+      const Register t0      = R2;
+      const Register t1      = R7;
+      const Register t2      = R8;
+      const Register t3      = R9;
+      const Register tc0     = R10;
+      const Register tc1     = R11;
+      const Register tc2     = R12;
+
+      BLOCK_COMMENT("Stub body {");
+      assert_different_registers(crc, data, dataLen, table);
+
+      StubRoutines::ppc64::generate_load_crc_table_addr(_masm, table);
+
+      __ kernel_crc32_1word(crc, data, dataLen, table, t0, t1, t2, t3, tc0, tc1, tc2, table);
+
+      BLOCK_COMMENT("return");
+      __ mr_if_needed(R3_RET, crc);      // Updated crc is function result. No copying required (R3_ARG1 == R3_RET).
+      __ blr();
+
+      BLOCK_COMMENT("} Stub body");
+    }
+
     return start;
   }
 
--- a/hotspot/src/cpu/ppc/vm/stubRoutines_ppc.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/ppc/vm/stubRoutines_ppc.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -45,6 +45,8 @@
 #else
   #define CRC32_TABLES 1
 #endif
+#define CRC32_CONSTANTS_SIZE 1084
+#define CRC32_BARRET_CONSTANTS 10
 
 class ppc64 {
  friend class StubGenerator;
@@ -53,11 +55,17 @@
 
   // CRC32 Intrinsics.
   static juint _crc_table[CRC32_TABLES][CRC32_COLUMN_SIZE];
+  static juint* _constants;
+  static juint* _barret_constants;
 
  public:
 
   // CRC32 Intrinsics.
   static void generate_load_crc_table_addr(MacroAssembler* masm, Register table);
+  static void generate_load_crc_constants_addr(MacroAssembler* masm, Register table);
+  static void generate_load_crc_barret_constants_addr(MacroAssembler* masm, Register table);
+  static juint* generate_crc_constants();
+  static juint* generate_crc_barret_constants();
 
 };
 
--- a/hotspot/src/cpu/ppc/vm/stubRoutines_ppc_64.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/ppc/vm/stubRoutines_ppc_64.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -37,6 +37,311 @@
   __ load_const_optimized(table, StubRoutines::_crc_table_adr, R0);
 }
 
+void StubRoutines::ppc64::generate_load_crc_constants_addr(MacroAssembler* masm, Register table) {
+  __ load_const_optimized(table, (address)StubRoutines::ppc64::_constants, R0);
+}
+
+void StubRoutines::ppc64::generate_load_crc_barret_constants_addr(MacroAssembler* masm, Register table) {
+  __ load_const_optimized(table, (address)StubRoutines::ppc64::_barret_constants, R0);
+}
+
+juint* StubRoutines::ppc64::generate_crc_constants() {
+  juint constants[CRC32_CONSTANTS_SIZE] = {
+      // Reduce 262144 kbits to 1024 bits
+      0x99ea94a8UL, 0x00000000UL, 0x651797d2UL, 0x00000001UL,       // x^261120 mod p(x)` << 1, x^261184 mod p(x)` << 1
+      0x945a8420UL, 0x00000000UL, 0x21e0d56cUL, 0x00000000UL,       // x^260096 mod p(x)` << 1, x^260160 mod p(x)` << 1
+      0x30762706UL, 0x00000000UL, 0x0f95ecaaUL, 0x00000000UL,       // x^259072 mod p(x)` << 1, x^259136 mod p(x)` << 1
+      0xa52fc582UL, 0x00000001UL, 0xebd224acUL, 0x00000001UL,       // x^258048 mod p(x)` << 1, x^258112 mod p(x)` << 1
+      0xa4a7167aUL, 0x00000001UL, 0x0ccb97caUL, 0x00000000UL,       // x^257024 mod p(x)` << 1, x^257088 mod p(x)` << 1
+      0x0c18249aUL, 0x00000000UL, 0x006ec8a8UL, 0x00000001UL,       // x^256000 mod p(x)` << 1, x^256064 mod p(x)` << 1
+      0xa924ae7cUL, 0x00000000UL, 0x4f58f196UL, 0x00000001UL,       // x^254976 mod p(x)` << 1, x^255040 mod p(x)` << 1
+      0xe12ccc12UL, 0x00000001UL, 0xa7192ca6UL, 0x00000001UL,       // x^253952 mod p(x)` << 1, x^254016 mod p(x)` << 1
+      0xa0b9d4acUL, 0x00000000UL, 0x9a64bab2UL, 0x00000001UL,       // x^252928 mod p(x)` << 1, x^252992 mod p(x)` << 1
+      0x95e8ddfeUL, 0x00000000UL, 0x14f4ed2eUL, 0x00000000UL,       // x^251904 mod p(x)` << 1, x^251968 mod p(x)` << 1
+      0x233fddc4UL, 0x00000000UL, 0x1092b6a2UL, 0x00000001UL,       // x^250880 mod p(x)` << 1, x^250944 mod p(x)` << 1
+      0xb4529b62UL, 0x00000001UL, 0xc8a1629cUL, 0x00000000UL,       // x^249856 mod p(x)` << 1, x^249920 mod p(x)` << 1
+      0xa7fa0e64UL, 0x00000001UL, 0x7bf32e8eUL, 0x00000001UL,       // x^248832 mod p(x)` << 1, x^248896 mod p(x)` << 1
+      0xb5334592UL, 0x00000001UL, 0xf8cc6582UL, 0x00000001UL,       // x^247808 mod p(x)` << 1, x^247872 mod p(x)` << 1
+      0x1f8ee1b4UL, 0x00000001UL, 0x8631ddf0UL, 0x00000000UL,       // x^246784 mod p(x)` << 1, x^246848 mod p(x)` << 1
+      0x6252e632UL, 0x00000000UL, 0x7e5a76d0UL, 0x00000000UL,       // x^245760 mod p(x)` << 1, x^245824 mod p(x)` << 1
+      0xab973e84UL, 0x00000000UL, 0x2b09b31cUL, 0x00000000UL,       // x^244736 mod p(x)` << 1, x^244800 mod p(x)` << 1
+      0x7734f5ecUL, 0x00000000UL, 0xb2df1f84UL, 0x00000001UL,       // x^243712 mod p(x)` << 1, x^243776 mod p(x)` << 1
+      0x7c547798UL, 0x00000000UL, 0xd6f56afcUL, 0x00000001UL,       // x^242688 mod p(x)` << 1, x^242752 mod p(x)` << 1
+      0x7ec40210UL, 0x00000000UL, 0xb9b5e70cUL, 0x00000001UL,       // x^241664 mod p(x)` << 1, x^241728 mod p(x)` << 1
+      0xab1695a8UL, 0x00000001UL, 0x34b626d2UL, 0x00000000UL,       // x^240640 mod p(x)` << 1, x^240704 mod p(x)` << 1
+      0x90494bbaUL, 0x00000000UL, 0x4c53479aUL, 0x00000001UL,       // x^239616 mod p(x)` << 1, x^239680 mod p(x)` << 1
+      0x123fb816UL, 0x00000001UL, 0xa6d179a4UL, 0x00000001UL,       // x^238592 mod p(x)` << 1, x^238656 mod p(x)` << 1
+      0xe188c74cUL, 0x00000001UL, 0x5abd16b4UL, 0x00000001UL,       // x^237568 mod p(x)` << 1, x^237632 mod p(x)` << 1
+      0xc2d3451cUL, 0x00000001UL, 0x018f9852UL, 0x00000000UL,       // x^236544 mod p(x)` << 1, x^236608 mod p(x)` << 1
+      0xf55cf1caUL, 0x00000000UL, 0x1fb3084aUL, 0x00000000UL,       // x^235520 mod p(x)` << 1, x^235584 mod p(x)` << 1
+      0xa0531540UL, 0x00000001UL, 0xc53dfb04UL, 0x00000000UL,       // x^234496 mod p(x)` << 1, x^234560 mod p(x)` << 1
+      0x32cd7ebcUL, 0x00000001UL, 0xe10c9ad6UL, 0x00000000UL,       // x^233472 mod p(x)` << 1, x^233536 mod p(x)` << 1
+      0x73ab7f36UL, 0x00000000UL, 0x25aa994aUL, 0x00000000UL,       // x^232448 mod p(x)` << 1, x^232512 mod p(x)` << 1
+      0x41aed1c2UL, 0x00000000UL, 0xfa3a74c4UL, 0x00000000UL,       // x^231424 mod p(x)` << 1, x^231488 mod p(x)` << 1
+      0x36c53800UL, 0x00000001UL, 0x33eb3f40UL, 0x00000000UL,       // x^230400 mod p(x)` << 1, x^230464 mod p(x)` << 1
+      0x26835a30UL, 0x00000001UL, 0x7193f296UL, 0x00000001UL,       // x^229376 mod p(x)` << 1, x^229440 mod p(x)` << 1
+      0x6241b502UL, 0x00000000UL, 0x43f6c86aUL, 0x00000000UL,       // x^228352 mod p(x)` << 1, x^228416 mod p(x)` << 1
+      0xd5196ad4UL, 0x00000000UL, 0x6b513ec6UL, 0x00000001UL,       // x^227328 mod p(x)` << 1, x^227392 mod p(x)` << 1
+      0x9cfa769aUL, 0x00000000UL, 0xc8f25b4eUL, 0x00000000UL,       // x^226304 mod p(x)` << 1, x^226368 mod p(x)` << 1
+      0x920e5df4UL, 0x00000000UL, 0xa45048ecUL, 0x00000001UL,       // x^225280 mod p(x)` << 1, x^225344 mod p(x)` << 1
+      0x69dc310eUL, 0x00000001UL, 0x0c441004UL, 0x00000000UL,       // x^224256 mod p(x)` << 1, x^224320 mod p(x)` << 1
+      0x09fc331cUL, 0x00000000UL, 0x0e17cad6UL, 0x00000000UL,       // x^223232 mod p(x)` << 1, x^223296 mod p(x)` << 1
+      0x0d94a81eUL, 0x00000001UL, 0x253ae964UL, 0x00000001UL,       // x^222208 mod p(x)` << 1, x^222272 mod p(x)` << 1
+      0x27a20ab2UL, 0x00000000UL, 0xd7c88ebcUL, 0x00000001UL,       // x^221184 mod p(x)` << 1, x^221248 mod p(x)` << 1
+      0x14f87504UL, 0x00000001UL, 0xe7ca913aUL, 0x00000001UL,       // x^220160 mod p(x)` << 1, x^220224 mod p(x)` << 1
+      0x4b076d96UL, 0x00000000UL, 0x33ed078aUL, 0x00000000UL,       // x^219136 mod p(x)` << 1, x^219200 mod p(x)` << 1
+      0xda4d1e74UL, 0x00000000UL, 0xe1839c78UL, 0x00000000UL,       // x^218112 mod p(x)` << 1, x^218176 mod p(x)` << 1
+      0x1b81f672UL, 0x00000000UL, 0x322b267eUL, 0x00000001UL,       // x^217088 mod p(x)` << 1, x^217152 mod p(x)` << 1
+      0x9367c988UL, 0x00000000UL, 0x638231b6UL, 0x00000000UL,       // x^216064 mod p(x)` << 1, x^216128 mod p(x)` << 1
+      0x717214caUL, 0x00000001UL, 0xee7f16f4UL, 0x00000001UL,       // x^215040 mod p(x)` << 1, x^215104 mod p(x)` << 1
+      0x9f47d820UL, 0x00000000UL, 0x17d9924aUL, 0x00000001UL,       // x^214016 mod p(x)` << 1, x^214080 mod p(x)` << 1
+      0x0d9a47d2UL, 0x00000001UL, 0xe1a9e0c4UL, 0x00000000UL,       // x^212992 mod p(x)` << 1, x^213056 mod p(x)` << 1
+      0xa696c58cUL, 0x00000000UL, 0x403731dcUL, 0x00000001UL,       // x^211968 mod p(x)` << 1, x^212032 mod p(x)` << 1
+      0x2aa28ec6UL, 0x00000000UL, 0xa5ea9682UL, 0x00000001UL,       // x^210944 mod p(x)` << 1, x^211008 mod p(x)` << 1
+      0xfe18fd9aUL, 0x00000001UL, 0x01c5c578UL, 0x00000001UL,       // x^209920 mod p(x)` << 1, x^209984 mod p(x)` << 1
+      0x9d4fc1aeUL, 0x00000001UL, 0xdddf6494UL, 0x00000000UL,       // x^208896 mod p(x)` << 1, x^208960 mod p(x)` << 1
+      0xba0e3deaUL, 0x00000001UL, 0xf1c3db28UL, 0x00000000UL,       // x^207872 mod p(x)` << 1, x^207936 mod p(x)` << 1
+      0x74b59a5eUL, 0x00000000UL, 0x3112fb9cUL, 0x00000001UL,       // x^206848 mod p(x)` << 1, x^206912 mod p(x)` << 1
+      0xf2b5ea98UL, 0x00000000UL, 0xb680b906UL, 0x00000000UL,       // x^205824 mod p(x)` << 1, x^205888 mod p(x)` << 1
+      0x87132676UL, 0x00000001UL, 0x1a282932UL, 0x00000000UL,       // x^204800 mod p(x)` << 1, x^204864 mod p(x)` << 1
+      0x0a8c6ad4UL, 0x00000001UL, 0x89406e7eUL, 0x00000000UL,       // x^203776 mod p(x)` << 1, x^203840 mod p(x)` << 1
+      0xe21dfe70UL, 0x00000001UL, 0xdef6be8cUL, 0x00000001UL,       // x^202752 mod p(x)` << 1, x^202816 mod p(x)` << 1
+      0xda0050e4UL, 0x00000001UL, 0x75258728UL, 0x00000000UL,       // x^201728 mod p(x)` << 1, x^201792 mod p(x)` << 1
+      0x772172aeUL, 0x00000000UL, 0x9536090aUL, 0x00000001UL,       // x^200704 mod p(x)` << 1, x^200768 mod p(x)` << 1
+      0xe47724aaUL, 0x00000000UL, 0xf2455bfcUL, 0x00000000UL,       // x^199680 mod p(x)` << 1, x^199744 mod p(x)` << 1
+      0x3cd63ac4UL, 0x00000000UL, 0x8c40baf4UL, 0x00000001UL,       // x^198656 mod p(x)` << 1, x^198720 mod p(x)` << 1
+      0xbf47d352UL, 0x00000001UL, 0x4cd390d4UL, 0x00000000UL,       // x^197632 mod p(x)` << 1, x^197696 mod p(x)` << 1
+      0x8dc1d708UL, 0x00000001UL, 0xe4ece95aUL, 0x00000001UL,       // x^196608 mod p(x)` << 1, x^196672 mod p(x)` << 1
+      0x2d4620a4UL, 0x00000000UL, 0x1a3ee918UL, 0x00000000UL,       // x^195584 mod p(x)` << 1, x^195648 mod p(x)` << 1
+      0x58fd1740UL, 0x00000000UL, 0x7c652fb8UL, 0x00000000UL,       // x^194560 mod p(x)` << 1, x^194624 mod p(x)` << 1
+      0xdadd9bfcUL, 0x00000000UL, 0x1c67842cUL, 0x00000001UL,       // x^193536 mod p(x)` << 1, x^193600 mod p(x)` << 1
+      0xea2140beUL, 0x00000001UL, 0x254f759cUL, 0x00000000UL,       // x^192512 mod p(x)` << 1, x^192576 mod p(x)` << 1
+      0x9de128baUL, 0x00000000UL, 0x7ece94caUL, 0x00000000UL,       // x^191488 mod p(x)` << 1, x^191552 mod p(x)` << 1
+      0x3ac3aa8eUL, 0x00000001UL, 0x38f258c2UL, 0x00000000UL,       // x^190464 mod p(x)` << 1, x^190528 mod p(x)` << 1
+      0x99980562UL, 0x00000000UL, 0xcdf17b00UL, 0x00000001UL,       // x^189440 mod p(x)` << 1, x^189504 mod p(x)` << 1
+      0xc1579c86UL, 0x00000001UL, 0x1f882c16UL, 0x00000001UL,       // x^188416 mod p(x)` << 1, x^188480 mod p(x)` << 1
+      0x68dbbf94UL, 0x00000000UL, 0x00093fc8UL, 0x00000001UL,       // x^187392 mod p(x)` << 1, x^187456 mod p(x)` << 1
+      0x4509fb04UL, 0x00000000UL, 0xcd684f16UL, 0x00000001UL,       // x^186368 mod p(x)` << 1, x^186432 mod p(x)` << 1
+      0x202f6398UL, 0x00000001UL, 0x4bc6a70aUL, 0x00000000UL,       // x^185344 mod p(x)` << 1, x^185408 mod p(x)` << 1
+      0x3aea243eUL, 0x00000001UL, 0x4fc7e8e4UL, 0x00000000UL,       // x^184320 mod p(x)` << 1, x^184384 mod p(x)` << 1
+      0xb4052ae6UL, 0x00000001UL, 0x30103f1cUL, 0x00000001UL,       // x^183296 mod p(x)` << 1, x^183360 mod p(x)` << 1
+      0xcd2a0ae8UL, 0x00000001UL, 0x11b0024cUL, 0x00000001UL,       // x^182272 mod p(x)` << 1, x^182336 mod p(x)` << 1
+      0xfe4aa8b4UL, 0x00000001UL, 0x0b3079daUL, 0x00000001UL,       // x^181248 mod p(x)` << 1, x^181312 mod p(x)` << 1
+      0xd1559a42UL, 0x00000001UL, 0x0192bcc2UL, 0x00000001UL,       // x^180224 mod p(x)` << 1, x^180288 mod p(x)` << 1
+      0xf3e05eccUL, 0x00000001UL, 0x74838d50UL, 0x00000000UL,       // x^179200 mod p(x)` << 1, x^179264 mod p(x)` << 1
+      0x04ddd2ccUL, 0x00000001UL, 0x1b20f520UL, 0x00000000UL,       // x^178176 mod p(x)` << 1, x^178240 mod p(x)` << 1
+      0x5393153cUL, 0x00000001UL, 0x50c3590aUL, 0x00000000UL,       // x^177152 mod p(x)` << 1, x^177216 mod p(x)` << 1
+      0x57e942c6UL, 0x00000000UL, 0xb41cac8eUL, 0x00000000UL,       // x^176128 mod p(x)` << 1, x^176192 mod p(x)` << 1
+      0x2c633850UL, 0x00000001UL, 0x0c72cc78UL, 0x00000000UL,       // x^175104 mod p(x)` << 1, x^175168 mod p(x)` << 1
+      0xebcaae4cUL, 0x00000000UL, 0x30cdb032UL, 0x00000000UL,       // x^174080 mod p(x)` << 1, x^174144 mod p(x)` << 1
+      0x3ee532a6UL, 0x00000001UL, 0x3e09fc32UL, 0x00000001UL,       // x^173056 mod p(x)` << 1, x^173120 mod p(x)` << 1
+      0xbf0cbc7eUL, 0x00000001UL, 0x1ed624d2UL, 0x00000000UL,       // x^172032 mod p(x)` << 1, x^172096 mod p(x)` << 1
+      0xd50b7a5aUL, 0x00000000UL, 0x781aee1aUL, 0x00000000UL,       // x^171008 mod p(x)` << 1, x^171072 mod p(x)` << 1
+      0x02fca6e8UL, 0x00000000UL, 0xc4d8348cUL, 0x00000001UL,       // x^169984 mod p(x)` << 1, x^170048 mod p(x)` << 1
+      0x7af40044UL, 0x00000000UL, 0x57a40336UL, 0x00000000UL,       // x^168960 mod p(x)` << 1, x^169024 mod p(x)` << 1
+      0x16178744UL, 0x00000000UL, 0x85544940UL, 0x00000000UL,       // x^167936 mod p(x)` << 1, x^168000 mod p(x)` << 1
+      0x4c177458UL, 0x00000001UL, 0x9cd21e80UL, 0x00000001UL,       // x^166912 mod p(x)` << 1, x^166976 mod p(x)` << 1
+      0x1b6ddf04UL, 0x00000001UL, 0x3eb95bc0UL, 0x00000001UL,       // x^165888 mod p(x)` << 1, x^165952 mod p(x)` << 1
+      0xf3e29cccUL, 0x00000001UL, 0xdfc9fdfcUL, 0x00000001UL,       // x^164864 mod p(x)` << 1, x^164928 mod p(x)` << 1
+      0x35ae7562UL, 0x00000001UL, 0xcd028bc2UL, 0x00000000UL,       // x^163840 mod p(x)` << 1, x^163904 mod p(x)` << 1
+      0x90ef812cUL, 0x00000001UL, 0x90db8c44UL, 0x00000000UL,       // x^162816 mod p(x)` << 1, x^162880 mod p(x)` << 1
+      0x67a2c786UL, 0x00000000UL, 0x0010a4ceUL, 0x00000001UL,       // x^161792 mod p(x)` << 1, x^161856 mod p(x)` << 1
+      0x48b9496cUL, 0x00000000UL, 0xc8f4c72cUL, 0x00000001UL,       // x^160768 mod p(x)` << 1, x^160832 mod p(x)` << 1
+      0x5a422de6UL, 0x00000001UL, 0x1c26170cUL, 0x00000000UL,       // x^159744 mod p(x)` << 1, x^159808 mod p(x)` << 1
+      0xef0e3640UL, 0x00000001UL, 0xe3fccf68UL, 0x00000000UL,       // x^158720 mod p(x)` << 1, x^158784 mod p(x)` << 1
+      0x006d2d26UL, 0x00000001UL, 0xd513ed24UL, 0x00000000UL,       // x^157696 mod p(x)` << 1, x^157760 mod p(x)` << 1
+      0x170d56d6UL, 0x00000001UL, 0x141beadaUL, 0x00000000UL,       // x^156672 mod p(x)` << 1, x^156736 mod p(x)` << 1
+      0xa5fb613cUL, 0x00000000UL, 0x1071aea0UL, 0x00000001UL,       // x^155648 mod p(x)` << 1, x^155712 mod p(x)` << 1
+      0x40bbf7fcUL, 0x00000000UL, 0x2e19080aUL, 0x00000001UL,       // x^154624 mod p(x)` << 1, x^154688 mod p(x)` << 1
+      0x6ac3a5b2UL, 0x00000001UL, 0x00ecf826UL, 0x00000001UL,       // x^153600 mod p(x)` << 1, x^153664 mod p(x)` << 1
+      0xabf16230UL, 0x00000000UL, 0x69b09412UL, 0x00000000UL,       // x^152576 mod p(x)` << 1, x^152640 mod p(x)` << 1
+      0xebe23facUL, 0x00000001UL, 0x22297bacUL, 0x00000001UL,       // x^151552 mod p(x)` << 1, x^151616 mod p(x)` << 1
+      0x8b6a0894UL, 0x00000000UL, 0xe9e4b068UL, 0x00000000UL,       // x^150528 mod p(x)` << 1, x^150592 mod p(x)` << 1
+      0x288ea478UL, 0x00000001UL, 0x4b38651aUL, 0x00000000UL,       // x^149504 mod p(x)` << 1, x^149568 mod p(x)` << 1
+      0x6619c442UL, 0x00000001UL, 0x468360e2UL, 0x00000001UL,       // x^148480 mod p(x)` << 1, x^148544 mod p(x)` << 1
+      0x86230038UL, 0x00000000UL, 0x121c2408UL, 0x00000000UL,       // x^147456 mod p(x)` << 1, x^147520 mod p(x)` << 1
+      0x7746a756UL, 0x00000001UL, 0xda7e7d08UL, 0x00000000UL,       // x^146432 mod p(x)` << 1, x^146496 mod p(x)` << 1
+      0x91b8f8f8UL, 0x00000001UL, 0x058d7652UL, 0x00000001UL,       // x^145408 mod p(x)` << 1, x^145472 mod p(x)` << 1
+      0x8e167708UL, 0x00000000UL, 0x4a098a90UL, 0x00000001UL,       // x^144384 mod p(x)` << 1, x^144448 mod p(x)` << 1
+      0x48b22d54UL, 0x00000001UL, 0x20dbe72eUL, 0x00000000UL,       // x^143360 mod p(x)` << 1, x^143424 mod p(x)` << 1
+      0x44ba2c3cUL, 0x00000000UL, 0x1e7323e8UL, 0x00000001UL,       // x^142336 mod p(x)` << 1, x^142400 mod p(x)` << 1
+      0xb54d2b52UL, 0x00000000UL, 0xd5d4bf94UL, 0x00000000UL,       // x^141312 mod p(x)` << 1, x^141376 mod p(x)` << 1
+      0x05a4fd8aUL, 0x00000000UL, 0x99d8746cUL, 0x00000001UL,       // x^140288 mod p(x)` << 1, x^140352 mod p(x)` << 1
+      0x39f9fc46UL, 0x00000001UL, 0xce9ca8a0UL, 0x00000000UL,       // x^139264 mod p(x)` << 1, x^139328 mod p(x)` << 1
+      0x5a1fa824UL, 0x00000001UL, 0x136edeceUL, 0x00000000UL,       // x^138240 mod p(x)` << 1, x^138304 mod p(x)` << 1
+      0x0a61ae4cUL, 0x00000000UL, 0x9b92a068UL, 0x00000001UL,       // x^137216 mod p(x)` << 1, x^137280 mod p(x)` << 1
+      0x45e9113eUL, 0x00000001UL, 0x71d62206UL, 0x00000000UL,       // x^136192 mod p(x)` << 1, x^136256 mod p(x)` << 1
+      0x6a348448UL, 0x00000000UL, 0xdfc50158UL, 0x00000000UL,       // x^135168 mod p(x)` << 1, x^135232 mod p(x)` << 1
+      0x4d80a08cUL, 0x00000000UL, 0x517626bcUL, 0x00000001UL,       // x^134144 mod p(x)` << 1, x^134208 mod p(x)` << 1
+      0x4b6837a0UL, 0x00000001UL, 0x48d1e4faUL, 0x00000001UL,       // x^133120 mod p(x)` << 1, x^133184 mod p(x)` << 1
+      0x6896a7fcUL, 0x00000001UL, 0x94d8266eUL, 0x00000000UL,       // x^132096 mod p(x)` << 1, x^132160 mod p(x)` << 1
+      0x4f187140UL, 0x00000001UL, 0x606c5e34UL, 0x00000000UL,       // x^131072 mod p(x)` << 1, x^131136 mod p(x)` << 1
+      0x9581b9daUL, 0x00000001UL, 0x9766beaaUL, 0x00000001UL,       // x^130048 mod p(x)` << 1, x^130112 mod p(x)` << 1
+      0x091bc984UL, 0x00000001UL, 0xd80c506cUL, 0x00000001UL,       // x^129024 mod p(x)` << 1, x^129088 mod p(x)` << 1
+      0x1067223cUL, 0x00000000UL, 0x1e73837cUL, 0x00000000UL,       // x^128000 mod p(x)` << 1, x^128064 mod p(x)` << 1
+      0xab16ea02UL, 0x00000001UL, 0x64d587deUL, 0x00000000UL,       // x^126976 mod p(x)` << 1, x^127040 mod p(x)` << 1
+      0x3c4598a8UL, 0x00000001UL, 0xf4a507b0UL, 0x00000000UL,       // x^125952 mod p(x)` << 1, x^126016 mod p(x)` << 1
+      0xb3735430UL, 0x00000000UL, 0x40e342fcUL, 0x00000000UL,       // x^124928 mod p(x)` << 1, x^124992 mod p(x)` << 1
+      0xbb3fc0c0UL, 0x00000001UL, 0xd5ad9c3aUL, 0x00000001UL,       // x^123904 mod p(x)` << 1, x^123968 mod p(x)` << 1
+      0x570ae19cUL, 0x00000001UL, 0x94a691a4UL, 0x00000000UL,       // x^122880 mod p(x)` << 1, x^122944 mod p(x)` << 1
+      0xea910712UL, 0x00000001UL, 0x271ecdfaUL, 0x00000001UL,       // x^121856 mod p(x)` << 1, x^121920 mod p(x)` << 1
+      0x67127128UL, 0x00000001UL, 0x9e54475aUL, 0x00000000UL,       // x^120832 mod p(x)` << 1, x^120896 mod p(x)` << 1
+      0x19e790a2UL, 0x00000000UL, 0xc9c099eeUL, 0x00000000UL,       // x^119808 mod p(x)` << 1, x^119872 mod p(x)` << 1
+      0x3788f710UL, 0x00000000UL, 0x9a2f736cUL, 0x00000000UL,       // x^118784 mod p(x)` << 1, x^118848 mod p(x)` << 1
+      0x682a160eUL, 0x00000001UL, 0xbb9f4996UL, 0x00000000UL,       // x^117760 mod p(x)` << 1, x^117824 mod p(x)` << 1
+      0x7f0ebd2eUL, 0x00000000UL, 0xdb688050UL, 0x00000001UL,       // x^116736 mod p(x)` << 1, x^116800 mod p(x)` << 1
+      0x2b032080UL, 0x00000000UL, 0xe9b10af4UL, 0x00000000UL,       // x^115712 mod p(x)` << 1, x^115776 mod p(x)` << 1
+      0xcfd1664aUL, 0x00000000UL, 0x2d4545e4UL, 0x00000001UL,       // x^114688 mod p(x)` << 1, x^114752 mod p(x)` << 1
+      0xaa1181c2UL, 0x00000000UL, 0x0361139cUL, 0x00000000UL,       // x^113664 mod p(x)` << 1, x^113728 mod p(x)` << 1
+      0xddd08002UL, 0x00000000UL, 0xa5a1a3a8UL, 0x00000001UL,       // x^112640 mod p(x)` << 1, x^112704 mod p(x)` << 1
+      0xe8dd0446UL, 0x00000000UL, 0x6844e0b0UL, 0x00000000UL,       // x^111616 mod p(x)` << 1, x^111680 mod p(x)` << 1
+      0xbbd94a00UL, 0x00000001UL, 0xc3762f28UL, 0x00000000UL,       // x^110592 mod p(x)` << 1, x^110656 mod p(x)` << 1
+      0xab6cd180UL, 0x00000000UL, 0xd26287a2UL, 0x00000001UL,       // x^109568 mod p(x)` << 1, x^109632 mod p(x)` << 1
+      0x31803ce2UL, 0x00000000UL, 0xf6f0bba8UL, 0x00000001UL,       // x^108544 mod p(x)` << 1, x^108608 mod p(x)` << 1
+      0x24f40b0cUL, 0x00000000UL, 0x2ffabd62UL, 0x00000000UL,       // x^107520 mod p(x)` << 1, x^107584 mod p(x)` << 1
+      0xba1d9834UL, 0x00000001UL, 0xfb4516b8UL, 0x00000000UL,       // x^106496 mod p(x)` << 1, x^106560 mod p(x)` << 1
+      0x04de61aaUL, 0x00000001UL, 0x8cfa961cUL, 0x00000001UL,       // x^105472 mod p(x)` << 1, x^105536 mod p(x)` << 1
+      0x13e40d46UL, 0x00000001UL, 0x9e588d52UL, 0x00000001UL,       // x^104448 mod p(x)` << 1, x^104512 mod p(x)` << 1
+      0x415598a0UL, 0x00000001UL, 0x180f0bbcUL, 0x00000001UL,       // x^103424 mod p(x)` << 1, x^103488 mod p(x)` << 1
+      0xbf6c8c90UL, 0x00000000UL, 0xe1d9177aUL, 0x00000000UL,       // x^102400 mod p(x)` << 1, x^102464 mod p(x)` << 1
+      0x788b0504UL, 0x00000001UL, 0x05abc27cUL, 0x00000001UL,       // x^101376 mod p(x)` << 1, x^101440 mod p(x)` << 1
+      0x38385d02UL, 0x00000000UL, 0x972e4a58UL, 0x00000000UL,       // x^100352 mod p(x)` << 1, x^100416 mod p(x)` << 1
+      0xb6c83844UL, 0x00000001UL, 0x83499a5eUL, 0x00000001UL,       // x^99328 mod p(x)` << 1, x^99392 mod p(x)` << 1
+      0x51061a8aUL, 0x00000000UL, 0xc96a8ccaUL, 0x00000001UL,       // x^98304 mod p(x)` << 1, x^98368 mod p(x)` << 1
+      0x7351388aUL, 0x00000001UL, 0xa1a5b60cUL, 0x00000001UL,       // x^97280 mod p(x)` << 1, x^97344 mod p(x)` << 1
+      0x32928f92UL, 0x00000001UL, 0xe4b6ac9cUL, 0x00000000UL,       // x^96256 mod p(x)` << 1, x^96320 mod p(x)` << 1
+      0xe6b4f48aUL, 0x00000000UL, 0x807e7f5aUL, 0x00000001UL,       // x^95232 mod p(x)` << 1, x^95296 mod p(x)` << 1
+      0x39d15e90UL, 0x00000000UL, 0x7a7e3bc8UL, 0x00000001UL,       // x^94208 mod p(x)` << 1, x^94272 mod p(x)` << 1
+      0x312d6074UL, 0x00000000UL, 0xd73975daUL, 0x00000000UL,       // x^93184 mod p(x)` << 1, x^93248 mod p(x)` << 1
+      0x7bbb2cc4UL, 0x00000001UL, 0x7375d038UL, 0x00000001UL,       // x^92160 mod p(x)` << 1, x^92224 mod p(x)` << 1
+      0x6ded3e18UL, 0x00000001UL, 0x193680bcUL, 0x00000000UL,       // x^91136 mod p(x)` << 1, x^91200 mod p(x)` << 1
+      0xf1638b16UL, 0x00000000UL, 0x999b06f6UL, 0x00000000UL,       // x^90112 mod p(x)` << 1, x^90176 mod p(x)` << 1
+      0xd38b9eccUL, 0x00000001UL, 0xf685d2b8UL, 0x00000001UL,       // x^89088 mod p(x)` << 1, x^89152 mod p(x)` << 1
+      0x8b8d09dcUL, 0x00000001UL, 0xf4ecbed2UL, 0x00000001UL,       // x^88064 mod p(x)` << 1, x^88128 mod p(x)` << 1
+      0xe7bc27d2UL, 0x00000000UL, 0xba16f1a0UL, 0x00000000UL,       // x^87040 mod p(x)` << 1, x^87104 mod p(x)` << 1
+      0x275e1e96UL, 0x00000000UL, 0x15aceac4UL, 0x00000001UL,       // x^86016 mod p(x)` << 1, x^86080 mod p(x)` << 1
+      0xe2e3031eUL, 0x00000000UL, 0xaeff6292UL, 0x00000001UL,       // x^84992 mod p(x)` << 1, x^85056 mod p(x)` << 1
+      0x041c84d8UL, 0x00000001UL, 0x9640124cUL, 0x00000000UL,       // x^83968 mod p(x)` << 1, x^84032 mod p(x)` << 1
+      0x706ce672UL, 0x00000000UL, 0x14f41f02UL, 0x00000001UL,       // x^82944 mod p(x)` << 1, x^83008 mod p(x)` << 1
+      0x5d5070daUL, 0x00000001UL, 0x9c5f3586UL, 0x00000000UL,       // x^81920 mod p(x)` << 1, x^81984 mod p(x)` << 1
+      0x38f9493aUL, 0x00000000UL, 0x878275faUL, 0x00000001UL,       // x^80896 mod p(x)` << 1, x^80960 mod p(x)` << 1
+      0xa3348a76UL, 0x00000000UL, 0xddc42ce8UL, 0x00000000UL,       // x^79872 mod p(x)` << 1, x^79936 mod p(x)` << 1
+      0xad0aab92UL, 0x00000001UL, 0x81d2c73aUL, 0x00000001UL,       // x^78848 mod p(x)` << 1, x^78912 mod p(x)` << 1
+      0x9e85f712UL, 0x00000001UL, 0x41c9320aUL, 0x00000001UL,       // x^77824 mod p(x)` << 1, x^77888 mod p(x)` << 1
+      0x5a871e76UL, 0x00000000UL, 0x5235719aUL, 0x00000001UL,       // x^76800 mod p(x)` << 1, x^76864 mod p(x)` << 1
+      0x7249c662UL, 0x00000001UL, 0xbe27d804UL, 0x00000000UL,       // x^75776 mod p(x)` << 1, x^75840 mod p(x)` << 1
+      0x3a084712UL, 0x00000000UL, 0x6242d45aUL, 0x00000000UL,       // x^74752 mod p(x)` << 1, x^74816 mod p(x)` << 1
+      0xed438478UL, 0x00000000UL, 0x9a53638eUL, 0x00000000UL,       // x^73728 mod p(x)` << 1, x^73792 mod p(x)` << 1
+      0xabac34ccUL, 0x00000000UL, 0x001ecfb6UL, 0x00000001UL,       // x^72704 mod p(x)` << 1, x^72768 mod p(x)` << 1
+      0x5f35ef3eUL, 0x00000000UL, 0x6d7c2d64UL, 0x00000001UL,       // x^71680 mod p(x)` << 1, x^71744 mod p(x)` << 1
+      0x47d6608cUL, 0x00000000UL, 0xd0ce46c0UL, 0x00000001UL,       // x^70656 mod p(x)` << 1, x^70720 mod p(x)` << 1
+      0x2d01470eUL, 0x00000000UL, 0x24c907b4UL, 0x00000001UL,       // x^69632 mod p(x)` << 1, x^69696 mod p(x)` << 1
+      0x58bbc7b0UL, 0x00000001UL, 0x18a555caUL, 0x00000000UL,       // x^68608 mod p(x)` << 1, x^68672 mod p(x)` << 1
+      0xc0a23e8eUL, 0x00000000UL, 0x6b0980bcUL, 0x00000000UL,       // x^67584 mod p(x)` << 1, x^67648 mod p(x)` << 1
+      0xebd85c88UL, 0x00000001UL, 0x8bbba964UL, 0x00000000UL,       // x^66560 mod p(x)` << 1, x^66624 mod p(x)` << 1
+      0x9ee20bb2UL, 0x00000001UL, 0x070a5a1eUL, 0x00000001UL,       // x^65536 mod p(x)` << 1, x^65600 mod p(x)` << 1
+      0xacabf2d6UL, 0x00000001UL, 0x2204322aUL, 0x00000000UL,       // x^64512 mod p(x)` << 1, x^64576 mod p(x)` << 1
+      0xb7963d56UL, 0x00000001UL, 0xa27524d0UL, 0x00000000UL,       // x^63488 mod p(x)` << 1, x^63552 mod p(x)` << 1
+      0x7bffa1feUL, 0x00000001UL, 0x20b1e4baUL, 0x00000000UL,       // x^62464 mod p(x)` << 1, x^62528 mod p(x)` << 1
+      0x1f15333eUL, 0x00000000UL, 0x32cc27fcUL, 0x00000000UL,       // x^61440 mod p(x)` << 1, x^61504 mod p(x)` << 1
+      0x8593129eUL, 0x00000001UL, 0x44dd22b8UL, 0x00000000UL,       // x^60416 mod p(x)` << 1, x^60480 mod p(x)` << 1
+      0x9cb32602UL, 0x00000001UL, 0xdffc9e0aUL, 0x00000000UL,       // x^59392 mod p(x)` << 1, x^59456 mod p(x)` << 1
+      0x42b05cc8UL, 0x00000001UL, 0xb7a0ed14UL, 0x00000001UL,       // x^58368 mod p(x)` << 1, x^58432 mod p(x)` << 1
+      0xbe49e7a4UL, 0x00000001UL, 0xc7842488UL, 0x00000000UL,       // x^57344 mod p(x)` << 1, x^57408 mod p(x)` << 1
+      0x08f69d6cUL, 0x00000001UL, 0xc02a4feeUL, 0x00000001UL,       // x^56320 mod p(x)` << 1, x^56384 mod p(x)` << 1
+      0x6c0971f0UL, 0x00000000UL, 0x3c273778UL, 0x00000000UL,       // x^55296 mod p(x)` << 1, x^55360 mod p(x)` << 1
+      0x5b16467aUL, 0x00000000UL, 0xd63f8894UL, 0x00000001UL,       // x^54272 mod p(x)` << 1, x^54336 mod p(x)` << 1
+      0x551a628eUL, 0x00000001UL, 0x6be557d6UL, 0x00000000UL,       // x^53248 mod p(x)` << 1, x^53312 mod p(x)` << 1
+      0x9e42ea92UL, 0x00000001UL, 0x6a7806eaUL, 0x00000000UL,       // x^52224 mod p(x)` << 1, x^52288 mod p(x)` << 1
+      0x2fa83ff2UL, 0x00000001UL, 0x6155aa0cUL, 0x00000001UL,       // x^51200 mod p(x)` << 1, x^51264 mod p(x)` << 1
+      0x1ca9cde0UL, 0x00000001UL, 0x908650acUL, 0x00000000UL,       // x^50176 mod p(x)` << 1, x^50240 mod p(x)` << 1
+      0xc8e5cd74UL, 0x00000000UL, 0xaa5a8084UL, 0x00000000UL,       // x^49152 mod p(x)` << 1, x^49216 mod p(x)` << 1
+      0x96c27f0cUL, 0x00000000UL, 0x91bb500aUL, 0x00000001UL,       // x^48128 mod p(x)` << 1, x^48192 mod p(x)` << 1
+      0x2baed926UL, 0x00000000UL, 0x64e9bed0UL, 0x00000000UL,       // x^47104 mod p(x)` << 1, x^47168 mod p(x)` << 1
+      0x7c8de8d2UL, 0x00000001UL, 0x9444f302UL, 0x00000000UL,       // x^46080 mod p(x)` << 1, x^46144 mod p(x)` << 1
+      0xd43d6068UL, 0x00000000UL, 0x9db07d3cUL, 0x00000001UL,       // x^45056 mod p(x)` << 1, x^45120 mod p(x)` << 1
+      0xcb2c4b26UL, 0x00000000UL, 0x359e3e6eUL, 0x00000001UL,       // x^44032 mod p(x)` << 1, x^44096 mod p(x)` << 1
+      0x45b8da26UL, 0x00000001UL, 0xe4f10dd2UL, 0x00000001UL,       // x^43008 mod p(x)` << 1, x^43072 mod p(x)` << 1
+      0x8fff4b08UL, 0x00000001UL, 0x24f5735eUL, 0x00000001UL,       // x^41984 mod p(x)` << 1, x^42048 mod p(x)` << 1
+      0x50b58ed0UL, 0x00000001UL, 0x24760a4cUL, 0x00000001UL,       // x^40960 mod p(x)` << 1, x^41024 mod p(x)` << 1
+      0x549f39bcUL, 0x00000001UL, 0x0f1fc186UL, 0x00000000UL,       // x^39936 mod p(x)` << 1, x^40000 mod p(x)` << 1
+      0xef4d2f42UL, 0x00000000UL, 0x150e4cc4UL, 0x00000000UL,       // x^38912 mod p(x)` << 1, x^38976 mod p(x)` << 1
+      0xb1468572UL, 0x00000001UL, 0x2a6204e8UL, 0x00000000UL,       // x^37888 mod p(x)` << 1, x^37952 mod p(x)` << 1
+      0x3d7403b2UL, 0x00000001UL, 0xbeb1d432UL, 0x00000000UL,       // x^36864 mod p(x)` << 1, x^36928 mod p(x)` << 1
+      0xa4681842UL, 0x00000001UL, 0x35f3f1f0UL, 0x00000001UL,       // x^35840 mod p(x)` << 1, x^35904 mod p(x)` << 1
+      0x67714492UL, 0x00000001UL, 0x74fe2232UL, 0x00000000UL,       // x^34816 mod p(x)` << 1, x^34880 mod p(x)` << 1
+      0xe599099aUL, 0x00000001UL, 0x1ac6e2baUL, 0x00000000UL,       // x^33792 mod p(x)` << 1, x^33856 mod p(x)` << 1
+      0xfe128194UL, 0x00000000UL, 0x13fca91eUL, 0x00000000UL,       // x^32768 mod p(x)` << 1, x^32832 mod p(x)` << 1
+      0x77e8b990UL, 0x00000000UL, 0x83f4931eUL, 0x00000001UL,       // x^31744 mod p(x)` << 1, x^31808 mod p(x)` << 1
+      0xa267f63aUL, 0x00000001UL, 0xb6d9b4e4UL, 0x00000000UL,       // x^30720 mod p(x)` << 1, x^30784 mod p(x)` << 1
+      0x945c245aUL, 0x00000001UL, 0xb5188656UL, 0x00000000UL,       // x^29696 mod p(x)` << 1, x^29760 mod p(x)` << 1
+      0x49002e76UL, 0x00000001UL, 0x27a81a84UL, 0x00000000UL,       // x^28672 mod p(x)` << 1, x^28736 mod p(x)` << 1
+      0xbb8310a4UL, 0x00000001UL, 0x25699258UL, 0x00000001UL,       // x^27648 mod p(x)` << 1, x^27712 mod p(x)` << 1
+      0x9ec60bccUL, 0x00000001UL, 0xb23de796UL, 0x00000001UL,       // x^26624 mod p(x)` << 1, x^26688 mod p(x)` << 1
+      0x2d8590aeUL, 0x00000001UL, 0xfe4365dcUL, 0x00000000UL,       // x^25600 mod p(x)` << 1, x^25664 mod p(x)` << 1
+      0x65b00684UL, 0x00000000UL, 0xc68f497aUL, 0x00000000UL,       // x^24576 mod p(x)` << 1, x^24640 mod p(x)` << 1
+      0x5e5aeadcUL, 0x00000001UL, 0xfbf521eeUL, 0x00000000UL,       // x^23552 mod p(x)` << 1, x^23616 mod p(x)` << 1
+      0xb77ff2b0UL, 0x00000000UL, 0x5eac3378UL, 0x00000001UL,       // x^22528 mod p(x)` << 1, x^22592 mod p(x)` << 1
+      0x88da2ff6UL, 0x00000001UL, 0x34914b90UL, 0x00000001UL,       // x^21504 mod p(x)` << 1, x^21568 mod p(x)` << 1
+      0x63da929aUL, 0x00000000UL, 0x16335cfeUL, 0x00000000UL,       // x^20480 mod p(x)` << 1, x^20544 mod p(x)` << 1
+      0x389caa80UL, 0x00000001UL, 0x0372d10cUL, 0x00000001UL,       // x^19456 mod p(x)` << 1, x^19520 mod p(x)` << 1
+      0x3db599d2UL, 0x00000001UL, 0x5097b908UL, 0x00000001UL,       // x^18432 mod p(x)` << 1, x^18496 mod p(x)` << 1
+      0x22505a86UL, 0x00000001UL, 0x227a7572UL, 0x00000001UL,       // x^17408 mod p(x)` << 1, x^17472 mod p(x)` << 1
+      0x6bd72746UL, 0x00000001UL, 0x9a8f75c0UL, 0x00000000UL,       // x^16384 mod p(x)` << 1, x^16448 mod p(x)` << 1
+      0xc3faf1d4UL, 0x00000001UL, 0x682c77a2UL, 0x00000000UL,       // x^15360 mod p(x)` << 1, x^15424 mod p(x)` << 1
+      0x111c826cUL, 0x00000001UL, 0x231f091cUL, 0x00000000UL,       // x^14336 mod p(x)` << 1, x^14400 mod p(x)` << 1
+      0x153e9fb2UL, 0x00000000UL, 0x7d4439f2UL, 0x00000000UL,       // x^13312 mod p(x)` << 1, x^13376 mod p(x)` << 1
+      0x2b1f7b60UL, 0x00000000UL, 0x7e221efcUL, 0x00000001UL,       // x^12288 mod p(x)` << 1, x^12352 mod p(x)` << 1
+      0xb1dba570UL, 0x00000000UL, 0x67457c38UL, 0x00000001UL,       // x^11264 mod p(x)` << 1, x^11328 mod p(x)` << 1
+      0xf6397b76UL, 0x00000001UL, 0xbdf081c4UL, 0x00000000UL,       // x^10240 mod p(x)` << 1, x^10304 mod p(x)` << 1
+      0x56335214UL, 0x00000001UL, 0x6286d6b0UL, 0x00000001UL,       // x^9216 mod p(x)` << 1, x^9280 mod p(x)` << 1
+      0xd70e3986UL, 0x00000001UL, 0xc84f001cUL, 0x00000000UL,       // x^8192 mod p(x)` << 1, x^8256 mod p(x)` << 1
+      0x3701a774UL, 0x00000000UL, 0x64efe7c0UL, 0x00000000UL,       // x^7168 mod p(x)` << 1, x^7232 mod p(x)` << 1
+      0xac81ef72UL, 0x00000000UL, 0x0ac2d904UL, 0x00000000UL,       // x^6144 mod p(x)` << 1, x^6208 mod p(x)` << 1
+      0x33212464UL, 0x00000001UL, 0xfd226d14UL, 0x00000000UL,       // x^5120 mod p(x)` << 1, x^5184 mod p(x)` << 1
+      0xe4e45610UL, 0x00000000UL, 0x1cfd42e0UL, 0x00000001UL,       // x^4096 mod p(x)` << 1, x^4160 mod p(x)` << 1
+      0x0c1bd370UL, 0x00000000UL, 0x6e5a5678UL, 0x00000001UL,       // x^3072 mod p(x)` << 1, x^3136 mod p(x)` << 1
+      0xa7b9e7a6UL, 0x00000001UL, 0xd888fe22UL, 0x00000001UL,       // x^2048 mod p(x)` << 1, x^2112 mod p(x)` << 1
+      0x7d657a10UL, 0x00000000UL, 0xaf77fcd4UL, 0x00000001UL,       // x^1024 mod p(x)` << 1, x^1088 mod p(x)` << 1
+
+      // Reduce final 1024-2048 bits to 64 bits, shifting 32 bits to include the trailing 32 bits of zeros
+      0xec447f11UL, 0x99168a18UL, 0x13e8221eUL, 0xed837b26UL,       // x^2048 mod p(x)`, x^2016 mod p(x)`, x^1984 mod p(x)`, x^1952 mod p(x)`
+      0x8fd2cd3cUL, 0xe23e954eUL, 0x47b9ce5aUL, 0xc8acdd81UL,       // x^1920 mod p(x)`, x^1888 mod p(x)`, x^1856 mod p(x)`, x^1824 mod p(x)`
+      0x6b1d2b53UL, 0x92f8befeUL, 0xd4277e25UL, 0xd9ad6d87UL,       // x^1792 mod p(x)`, x^1760 mod p(x)`, x^1728 mod p(x)`, x^1696 mod p(x)`
+      0x291ea462UL, 0xf38a3556UL, 0x33fbca3bUL, 0xc10ec5e0UL,       // x^1664 mod p(x)`, x^1632 mod p(x)`, x^1600 mod p(x)`, x^1568 mod p(x)`
+      0x62b6ca4bUL, 0x974ac562UL, 0x82e02e2fUL, 0xc0b55b0eUL,       // x^1536 mod p(x)`, x^1504 mod p(x)`, x^1472 mod p(x)`, x^1440 mod p(x)`
+      0x784d2a56UL, 0x855712b3UL, 0xe172334dUL, 0x71aa1df0UL,       // x^1408 mod p(x)`, x^1376 mod p(x)`, x^1344 mod p(x)`, x^1312 mod p(x)`
+      0x0eaee722UL, 0xa5abe9f8UL, 0x3969324dUL, 0xfee3053eUL,       // x^1280 mod p(x)`, x^1248 mod p(x)`, x^1216 mod p(x)`, x^1184 mod p(x)`
+      0xdb54814cUL, 0x1fa0943dUL, 0x3eb2bd08UL, 0xf44779b9UL,       // x^1152 mod p(x)`, x^1120 mod p(x)`, x^1088 mod p(x)`, x^1056 mod p(x)`
+      0xd7bbfe6aUL, 0xa53ff440UL, 0x00cc3374UL, 0xf5449b3fUL,       // x^1024 mod p(x)`, x^992 mod p(x)`,  x^960 mod p(x)`,  x^928 mod p(x)`
+      0x6325605cUL, 0xebe7e356UL, 0xd777606eUL, 0x6f8346e1UL,       // x^896 mod p(x)`,  x^864 mod p(x)`,  x^832 mod p(x)`,  x^800 mod p(x)`
+      0xe5b592b8UL, 0xc65a272cUL, 0xc0b95347UL, 0xe3ab4f2aUL,       // x^768 mod p(x)`,  x^736 mod p(x)`,  x^704 mod p(x)`,  x^672 mod p(x)`
+      0x4721589fUL, 0x5705a9caUL, 0x329ecc11UL, 0xaa2215eaUL,       // x^640 mod p(x)`,  x^608 mod p(x)`,  x^576 mod p(x)`,  x^544 mod p(x)`
+      0x88d14467UL, 0xe3720acbUL, 0xd95efd26UL, 0x1ed8f66eUL,       // x^512 mod p(x)`,  x^480 mod p(x)`,  x^448 mod p(x)`,  x^416 mod p(x)`
+      0x15141c31UL, 0xba1aca03UL, 0xa700e96aUL, 0x78ed02d5UL,       // x^384 mod p(x)`,  x^352 mod p(x)`,  x^320 mod p(x)`,  x^288 mod p(x)`
+      0xed627daeUL, 0xad2a31b3UL, 0x32b39da3UL, 0xba8ccbe8UL,       // x^256 mod p(x)`,  x^224 mod p(x)`,  x^192 mod p(x)`,  x^160 mod p(x)`
+      0xa06a2517UL, 0x6655004fUL, 0xb1e6b092UL, 0xedb88320UL        // x^128 mod p(x)`,  x^96 mod p(x)`,   x^64 mod p(x)`,   x^32 mod p(x)`
+  };
+
+  juint* ptr = (juint*) malloc(sizeof(juint) * CRC32_CONSTANTS_SIZE);
+  guarantee(((intptr_t)ptr & 0xF) == 0, "16-byte alignment needed");
+  guarantee(ptr != NULL, "allocation error of a crc table");
+  memcpy((void*)ptr, constants, sizeof(juint) * CRC32_CONSTANTS_SIZE);
+  return ptr;
+}
+
+juint* StubRoutines::ppc64::generate_crc_barret_constants() {
+  juint barret_constants[CRC32_BARRET_CONSTANTS] = {
+      0xf7011641UL, 0x00000001UL, 0x00000000UL, 0x00000000UL,
+      0xdb710641UL, 0x00000001UL, 0x00000000UL, 0x00000000UL
+  };
+  juint* ptr = (juint*) malloc(sizeof(juint) * CRC32_CONSTANTS_SIZE);
+  guarantee(((intptr_t)ptr & 0xF) == 0, "16-byte alignment needed");
+  guarantee(ptr != NULL, "allocation error of a crc table");
+  memcpy((void*) ptr, barret_constants, sizeof(juint) * CRC32_BARRET_CONSTANTS);
+  return ptr;
+}
+
 // CRC32 Intrinsics.
 /**
  *  crc_table[] from jdk/src/share/native/java/util/zip/zlib-1.2.8/crc32.h
@@ -477,3 +782,7 @@
 #endif
   }
 };
+
+juint* StubRoutines::ppc64::_constants = StubRoutines::ppc64::generate_crc_constants();
+
+juint* StubRoutines::ppc64::_barret_constants = StubRoutines::ppc64::generate_crc_barret_constants();
--- a/hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -1544,6 +1544,12 @@
     __ fence();
   }
 
+  if (CheckJNICalls) {
+    // clear_pending_jni_exception_check
+    __ load_const_optimized(R0, 0L);
+    __ st_ptr(R0, JavaThread::pending_jni_exception_check_fn_offset(), R16_thread);
+  }
+
   __ reset_last_Java_frame();
 
   // Jvmdi/jvmpi support. Whether we've got an exception pending or
--- a/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -230,6 +230,11 @@
     FLAG_SET_DEFAULT(UseGHASHIntrinsics, false);
   }
 
+  if (UseFMA) {
+    warning("FMA instructions are not available on this CPU");
+    FLAG_SET_DEFAULT(UseFMA, false);
+  }
+
   if (UseSHA) {
     warning("SHA instructions are not available on this CPU");
     FLAG_SET_DEFAULT(UseSHA, false);
@@ -274,7 +279,14 @@
     }
     bool os_too_old = true;
 #ifdef AIX
-    if (os::Aix::os_version() >= 0x0701031e) { // at least AIX 7.1.3.30
+    // Actually, this is supported since AIX 7.1.. Unfortunately, this first
+    // contained bugs, so that it can only be enabled after AIX 7.1.3.30.
+    // The Java property os.version, which is used in RTM tests to decide
+    // whether the feature is available, only knows major and minor versions.
+    // We don't want to change this property, as user code might depend on it.
+    // So the tests can not check on subversion 3.30, and we only enable RTM
+    // with AIX 7.2.
+    if (os::Aix::os_version() >= 0x07020000) { // At least AIX 7.2.
       os_too_old = false;
     }
 #endif
--- a/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -147,10 +147,11 @@
 LIR_Address* LIRGenerator::generate_address(LIR_Opr base, LIR_Opr index,
                                             int shift, int disp, BasicType type) {
   assert(base->is_register(), "must be");
+  intx large_disp = disp;
 
   // accumulate fixed displacements
   if (index->is_constant()) {
-    disp += index->as_constant_ptr()->as_jint() << shift;
+    large_disp += (intx)(index->as_constant_ptr()->as_jint()) << shift;
     index = LIR_OprFact::illegalOpr;
   }
 
@@ -161,31 +162,31 @@
       __ shift_left(index, shift, tmp);
       index = tmp;
     }
-    if (disp != 0) {
+    if (large_disp != 0) {
       LIR_Opr tmp = new_pointer_register();
-      if (Assembler::is_simm13(disp)) {
-        __ add(tmp, LIR_OprFact::intptrConst(disp), tmp);
+      if (Assembler::is_simm13(large_disp)) {
+        __ add(tmp, LIR_OprFact::intptrConst(large_disp), tmp);
         index = tmp;
       } else {
-        __ move(LIR_OprFact::intptrConst(disp), tmp);
+        __ move(LIR_OprFact::intptrConst(large_disp), tmp);
         __ add(tmp, index, tmp);
         index = tmp;
       }
-      disp = 0;
+      large_disp = 0;
     }
-  } else if (disp != 0 && !Assembler::is_simm13(disp)) {
+  } else if (large_disp != 0 && !Assembler::is_simm13(large_disp)) {
     // index is illegal so replace it with the displacement loaded into a register
     index = new_pointer_register();
-    __ move(LIR_OprFact::intptrConst(disp), index);
-    disp = 0;
+    __ move(LIR_OprFact::intptrConst(large_disp), index);
+    large_disp = 0;
   }
 
   // at this point we either have base + index or base + displacement
-  if (disp == 0) {
+  if (large_disp == 0) {
     return new LIR_Address(base, index, type);
   } else {
-    assert(Assembler::is_simm13(disp), "must be");
-    return new LIR_Address(base, disp, type);
+    assert(Assembler::is_simm13(large_disp), "must be");
+    return new LIR_Address(base, large_disp, type);
   }
 }
 
@@ -196,11 +197,11 @@
   int shift = exact_log2(elem_size);
 
   LIR_Opr base_opr;
-  int offset = arrayOopDesc::base_offset_in_bytes(type);
+  intx offset = arrayOopDesc::base_offset_in_bytes(type);
 
   if (index_opr->is_constant()) {
-    int i = index_opr->as_constant_ptr()->as_jint();
-    int array_offset = i * elem_size;
+    intx i = index_opr->as_constant_ptr()->as_jint();
+    intx array_offset = i * elem_size;
     if (Assembler::is_simm13(array_offset + offset)) {
       base_opr = array_opr;
       offset = array_offset + offset;
@@ -953,6 +954,10 @@
   }
 }
 
+void LIRGenerator::do_FmaIntrinsic(Intrinsic* x) {
+  fatal("FMA intrinsic is not implemented on this platform");
+}
+
 void LIRGenerator::do_vectorizedMismatch(Intrinsic* x) {
   fatal("vectorizedMismatch intrinsic is not implemented on this platform");
 }
--- a/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -881,20 +881,15 @@
         __ delayed()->st_ptr(tmp, G2_thread, satb_q_index_byte_offset);
 
         __ bind(refill);
-        __ save_frame(0);
 
-        __ mov(pre_val, L0);
-        __ mov(tmp,     L1);
-        __ mov(tmp2,    L2);
+        save_live_registers(sasm);
 
         __ call_VM_leaf(L7_thread_cache,
                         CAST_FROM_FN_PTR(address,
                                          SATBMarkQueueSet::handle_zero_index_for_thread),
                                          G2_thread);
 
-        __ mov(L0, pre_val);
-        __ mov(L1, tmp);
-        __ mov(L2, tmp2);
+        restore_live_registers(sasm);
 
         __ br(Assembler::always, /*annul*/false, Assembler::pt, restart);
         __ delayed()->restore();
@@ -986,20 +981,15 @@
         __ delayed()->st_ptr(tmp3, G2_thread, dirty_card_q_index_byte_offset);
 
         __ bind(refill);
-        __ save_frame(0);
 
-        __ mov(tmp2, L0);
-        __ mov(tmp3, L1);
-        __ mov(tmp4, L2);
+        save_live_registers(sasm);
 
         __ call_VM_leaf(L7_thread_cache,
                         CAST_FROM_FN_PTR(address,
                                          DirtyCardQueueSet::handle_zero_index_for_thread),
                                          G2_thread);
 
-        __ mov(L0, tmp2);
-        __ mov(L1, tmp3);
-        __ mov(L2, tmp4);
+        restore_live_registers(sasm);
 
         __ br(Assembler::always, /*annul*/false, Assembler::pt, restart);
         __ delayed()->restore();
--- a/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -266,6 +266,11 @@
     FLAG_SET_DEFAULT(UseGHASHIntrinsics, false);
   }
 
+  if (UseFMA) {
+    warning("FMA instructions are not available on this CPU");
+    FLAG_SET_DEFAULT(UseFMA, false);
+  }
+
   // SHA1, SHA256, and SHA512 instructions were added to SPARC T-series at different times
   if (has_sha1() || has_sha256() || has_sha512()) {
     if (UseVIS > 0) { // SHA intrinsics use VIS1 instructions
--- a/hotspot/src/cpu/x86/vm/abstractInterpreter_x86.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/x86/vm/abstractInterpreter_x86.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -172,7 +172,9 @@
     case Interpreter::java_lang_math_log10   : // fall thru
     case Interpreter::java_lang_math_sqrt    : // fall thru
     case Interpreter::java_lang_math_pow     : // fall thru
-    case Interpreter::java_lang_math_exp     :
+    case Interpreter::java_lang_math_exp     : // fall thru
+    case Interpreter::java_lang_math_fmaD    : // fall thru
+    case Interpreter::java_lang_math_fmaF    :
       return false;
     default:
       return true;
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -4769,6 +4769,22 @@
   emit_int8((unsigned char)(0xC0 | encode));
 }
 
+void Assembler::vfmadd231sd(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
+  assert(VM_Version::supports_fma(), "");
+  InstructionAttr attributes(AVX_128bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
+  int encode = vex_prefix_and_encode(dst->encoding(), src1->encoding(), src2->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
+  emit_int8((unsigned char)0xB9);
+  emit_int8((unsigned char)(0xC0 | encode));
+}
+
+void Assembler::vfmadd231ss(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
+  assert(VM_Version::supports_fma(), "");
+  InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false);
+  int encode = vex_prefix_and_encode(dst->encoding(), src1->encoding(), src2->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes);
+  emit_int8((unsigned char)0xB9);
+  emit_int8((unsigned char)(0xC0 | encode));
+}
+
 void Assembler::vmulsd(XMMRegister dst, XMMRegister nds, Address src) {
   assert(VM_Version::supports_avx(), "");
   InstructionMark im(this);
--- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -1860,6 +1860,8 @@
   void vdivsd(XMMRegister dst, XMMRegister nds, XMMRegister src);
   void vdivss(XMMRegister dst, XMMRegister nds, Address src);
   void vdivss(XMMRegister dst, XMMRegister nds, XMMRegister src);
+  void vfmadd231sd(XMMRegister dst, XMMRegister nds, XMMRegister src);
+  void vfmadd231ss(XMMRegister dst, XMMRegister nds, XMMRegister src);
   void vmulsd(XMMRegister dst, XMMRegister nds, Address src);
   void vmulsd(XMMRegister dst, XMMRegister nds, XMMRegister src);
   void vmulss(XMMRegister dst, XMMRegister nds, Address src);
--- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -1345,6 +1345,18 @@
                       op->result_opr(),
                       op->info());
       break;
+    case lir_fmad:
+      __ fmad(op->result_opr()->as_xmm_double_reg(),
+              op->in_opr1()->as_xmm_double_reg(),
+              op->in_opr2()->as_xmm_double_reg(),
+              op->in_opr3()->as_xmm_double_reg());
+      break;
+    case lir_fmaf:
+      __ fmaf(op->result_opr()->as_xmm_float_reg(),
+              op->in_opr1()->as_xmm_float_reg(),
+              op->in_opr2()->as_xmm_float_reg(),
+              op->in_opr3()->as_xmm_float_reg());
+      break;
     default:      ShouldNotReachHere(); break;
   }
 }
--- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -152,7 +152,7 @@
   assert(base->is_register(), "must be");
   if (index->is_constant()) {
     return new LIR_Address(base,
-                           (index->as_constant_ptr()->as_jint() << shift) + disp,
+                           ((intx)(index->as_constant_ptr()->as_jint()) << shift) + disp,
                            type);
   } else {
     return new LIR_Address(base, index, (LIR_Address::Scale)shift, disp, type);
@@ -168,7 +168,7 @@
   if (index_opr->is_constant()) {
     int elem_size = type2aelembytes(type);
     addr = new LIR_Address(array_opr,
-                           offset_in_bytes + index_opr->as_jint() * elem_size, type);
+                           offset_in_bytes + (intx)(index_opr->as_jint()) * elem_size, type);
   } else {
 #ifdef _LP64
     if (index_opr->type() == T_INT) {
@@ -806,6 +806,32 @@
   }
 }
 
+void LIRGenerator::do_FmaIntrinsic(Intrinsic* x) {
+  assert(x->number_of_arguments() == 3, "wrong type");
+  assert(UseFMA, "Needs FMA instructions support.");
+  LIRItem value(x->argument_at(0), this);
+  LIRItem value1(x->argument_at(1), this);
+  LIRItem value2(x->argument_at(2), this);
+
+  value2.set_destroys_register();
+
+  value.load_item();
+  value1.load_item();
+  value2.load_item();
+
+  LIR_Opr calc_input = value.result();
+  LIR_Opr calc_input1 = value1.result();
+  LIR_Opr calc_input2 = value2.result();
+  LIR_Opr calc_result = rlock_result(x);
+
+  switch (x->id()) {
+  case vmIntrinsics::_fmaD:   __ fmad(calc_input, calc_input1, calc_input2, calc_result); break;
+  case vmIntrinsics::_fmaF:   __ fmaf(calc_input, calc_input1, calc_input2, calc_result); break;
+  default:                    ShouldNotReachHere();
+  }
+
+}
+
 
 void LIRGenerator::do_MathIntrinsic(Intrinsic* x) {
   assert(x->number_of_arguments() == 1 || (x->number_of_arguments() == 2 && x->id() == vmIntrinsics::_dpow), "wrong type");
--- a/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -100,9 +100,11 @@
 
 inline bool LinearScanWalker::pd_init_regs_for_alloc(Interval* cur) {
   int last_xmm_reg = pd_last_xmm_reg;
+#ifdef _LP64
   if (UseAVX < 3) {
     last_xmm_reg = pd_first_xmm_reg + (pd_nof_xmm_regs_frame_map / 2) - 1;
   }
+#endif
   if (allocator()->gen()->is_vreg_flag_set(cur->reg_num(), LIRGenerator::byte_reg)) {
     assert(cur->type() != T_FLOAT && cur->type() != T_DOUBLE, "cpu regs only");
     _first_reg = pd_first_byte_reg;
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -3147,6 +3147,24 @@
   fpop();
 }
 
+// dst = c = a * b + c
+void MacroAssembler::fmad(XMMRegister dst, XMMRegister a, XMMRegister b, XMMRegister c) {
+  Assembler::vfmadd231sd(c, a, b);
+  if (dst != c) {
+    movdbl(dst, c);
+  }
+}
+
+// dst = c = a * b + c
+void MacroAssembler::fmaf(XMMRegister dst, XMMRegister a, XMMRegister b, XMMRegister c) {
+  Assembler::vfmadd231ss(c, a, b);
+  if (dst != c) {
+    movflt(dst, c);
+  }
+}
+
+
+
 
 void MacroAssembler::incrementl(AddressLiteral dst) {
   if (reachable(dst)) {
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -449,6 +449,10 @@
   // tmp is a temporary register, if none is available use noreg
   void fremr(Register tmp);
 
+  // dst = c = a * b + c
+  void fmad(XMMRegister dst, XMMRegister a, XMMRegister b, XMMRegister c);
+  void fmaf(XMMRegister dst, XMMRegister a, XMMRegister b, XMMRegister c);
+
 
   // same as fcmp2int, but using SSE2
   void cmpss2int(XMMRegister opr1, XMMRegister opr2, Register dst, bool unordered_is_less);
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86_sha.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86_sha.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -720,19 +720,13 @@
 
 enum {
   _XFER_SIZE = 2*64*4, // 2 blocks, 64 rounds, 4 bytes/round
-#ifndef _WIN64
-  _XMM_SAVE_SIZE = 0,
-#else
-  _XMM_SAVE_SIZE = 8*16,
-#endif
   _INP_END_SIZE = 8,
   _INP_SIZE = 8,
   _CTX_SIZE = 8,
   _RSP_SIZE = 8,
 
   _XFER = 0,
-  _XMM_SAVE  = _XFER     + _XFER_SIZE,
-  _INP_END   = _XMM_SAVE + _XMM_SAVE_SIZE,
+  _INP_END   = _XFER     + _XFER_SIZE,
   _INP       = _INP_END  + _INP_END_SIZE,
   _CTX       = _INP      + _INP_SIZE,
   _RSP       = _CTX      + _CTX_SIZE,
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -3236,11 +3236,6 @@
 #ifdef _WIN64
     // on win64, fill len_reg from stack position
     __ movl(len_reg, len_mem);
-    // save the xmm registers which must be preserved 6-15
-    __ subptr(rsp, -rsp_after_call_off * wordSize);
-    for (int i = 6; i <= XMM_REG_NUM_KEY_LAST; i++) {
-      __ movdqu(xmm_save(i), as_XMMRegister(i));
-    }
 #else
     __ push(len_reg); // Save
 #endif
@@ -3281,10 +3276,6 @@
     __ movdqu(Address(rvec, 0), xmm_result);     // final value of r stored in rvec of CipherBlockChaining object
 
 #ifdef _WIN64
-    // restore xmm regs belonging to calling function
-    for (int i = 6; i <= XMM_REG_NUM_KEY_LAST; i++) {
-      __ movdqu(as_XMMRegister(i), xmm_save(i));
-    }
     __ movl(rax, len_mem);
 #else
     __ pop(rax); // return length
@@ -3446,11 +3437,6 @@
 #ifdef _WIN64
     // on win64, fill len_reg from stack position
     __ movl(len_reg, len_mem);
-    // save the xmm registers which must be preserved 6-15
-    __ subptr(rsp, -rsp_after_call_off * wordSize);
-    for (int i = 6; i <= XMM_REG_NUM_KEY_LAST; i++) {
-      __ movdqu(xmm_save(i), as_XMMRegister(i));
-    }
 #else
     __ push(len_reg); // Save
 #endif
@@ -3644,10 +3630,6 @@
     __ movdqu(Address(rvec, 0), xmm_prev_block_cipher);     // final value of r stored in rvec of CipherBlockChaining object
     __ pop(rbx);
 #ifdef _WIN64
-    // restore regs belonging to calling function
-    for (int i = 6; i <= XMM_REG_NUM_KEY_LAST; i++) {
-      __ movdqu(as_XMMRegister(i), xmm_save(i));
-    }
     __ movl(rax, len_mem);
 #else
     __ pop(rax); // return length
@@ -3699,25 +3681,12 @@
 
     __ enter();
 
-#ifdef _WIN64
-    // save the xmm registers which must be preserved 6-7
-    __ subptr(rsp, 4 * wordSize);
-    __ movdqu(Address(rsp, 0), xmm6);
-    __ movdqu(Address(rsp, 2 * wordSize), xmm7);
-#endif
-
     __ subptr(rsp, 4 * wordSize);
 
     __ fast_sha1(abcd, e0, e1, msg0, msg1, msg2, msg3, shuf_mask,
       buf, state, ofs, limit, rsp, multi_block);
 
     __ addptr(rsp, 4 * wordSize);
-#ifdef _WIN64
-    // restore xmm regs belonging to calling function
-    __ movdqu(xmm6, Address(rsp, 0));
-    __ movdqu(xmm7, Address(rsp, 2 * wordSize));
-    __ addptr(rsp, 4 * wordSize);
-#endif
 
     __ leave();
     __ ret(0);
@@ -3775,22 +3744,6 @@
     const XMMRegister shuf_mask = xmm8;
 
     __ enter();
-#ifdef _WIN64
-    // save the xmm registers which must be preserved 6-7
-    __ subptr(rsp, 6 * wordSize);
-    __ movdqu(Address(rsp, 0), xmm6);
-    __ movdqu(Address(rsp, 2 * wordSize), xmm7);
-    __ movdqu(Address(rsp, 4 * wordSize), xmm8);
-
-    if (!VM_Version::supports_sha() && VM_Version::supports_avx2()) {
-      __ subptr(rsp, 10 * wordSize);
-      __ movdqu(Address(rsp, 0), xmm9);
-      __ movdqu(Address(rsp, 2 * wordSize), xmm10);
-      __ movdqu(Address(rsp, 4 * wordSize), xmm11);
-      __ movdqu(Address(rsp, 6 * wordSize), xmm12);
-      __ movdqu(Address(rsp, 8 * wordSize), xmm13);
-    }
-#endif
 
     __ subptr(rsp, 4 * wordSize);
 
@@ -3802,21 +3755,7 @@
         buf, state, ofs, limit, rsp, multi_block, shuf_mask);
     }
     __ addptr(rsp, 4 * wordSize);
-#ifdef _WIN64
-    // restore xmm regs belonging to calling function
-    if (!VM_Version::supports_sha() && VM_Version::supports_avx2()) {
-      __ movdqu(xmm9, Address(rsp, 0));
-      __ movdqu(xmm10, Address(rsp, 2 * wordSize));
-      __ movdqu(xmm11, Address(rsp, 4 * wordSize));
-      __ movdqu(xmm12, Address(rsp, 6 * wordSize));
-      __ movdqu(xmm13, Address(rsp, 8 * wordSize));
-      __ addptr(rsp, 10 * wordSize);
-    }
-    __ movdqu(xmm6, Address(rsp, 0));
-    __ movdqu(xmm7, Address(rsp, 2 * wordSize));
-    __ movdqu(xmm8, Address(rsp, 4 * wordSize));
-    __ addptr(rsp, 6 * wordSize);
-#endif
+
     __ leave();
     __ ret(0);
     return start;
@@ -3917,18 +3856,14 @@
     }
 
 #ifdef _WIN64
-    // save the xmm registers which must be preserved 6-14
-    const int XMM_REG_NUM_KEY_LAST = 14;
-    __ subptr(rsp, -rsp_after_call_off * wordSize);
-    for (int i = 6; i <= XMM_REG_NUM_KEY_LAST; i++) {
-      __ movdqu(xmm_save(i), as_XMMRegister(i));
-    }
-
-    const Address r13_save(rbp, rdi_off * wordSize);
-    const Address r14_save(rbp, rsi_off * wordSize);
-
-    __ movptr(r13_save, r13);
-    __ movptr(r14_save, r14);
+    // allocate spill slots for r13, r14
+    enum {
+        saved_r13_offset,
+        saved_r14_offset
+    };
+    __ subptr(rsp, 2 * wordSize);
+    __ movptr(Address(rsp, saved_r13_offset * wordSize), r13);
+    __ movptr(Address(rsp, saved_r14_offset * wordSize), r14);
 
     // on win64, fill len_reg from stack position
     __ movl(len_reg, len_mem);
@@ -4130,13 +4065,10 @@
     __ movdqu(Address(counter, 0), xmm_curr_counter); //save counter back
     __ pop(rbx); // pop the saved RBX.
 #ifdef _WIN64
-    // restore regs belonging to calling function
-    for (int i = 6; i <= XMM_REG_NUM_KEY_LAST; i++) {
-      __ movdqu(as_XMMRegister(i), xmm_save(i));
-    }
     __ movl(rax, len_mem);
-    __ movptr(r13, r13_save);
-    __ movptr(r14, r14_save);
+    __ movptr(r13, Address(rsp, saved_r13_offset * wordSize));
+    __ movptr(r14, Address(rsp, saved_r14_offset * wordSize));
+    __ addptr(rsp, 2 * wordSize);
 #else
     __ pop(rax); // return 'len'
 #endif
@@ -4177,10 +4109,6 @@
     const Register data         = c_rarg2;
     const Register blocks       = c_rarg3;
 
-#ifdef _WIN64
-    const int XMM_REG_LAST  = 10;
-#endif
-
     const XMMRegister xmm_temp0 = xmm0;
     const XMMRegister xmm_temp1 = xmm1;
     const XMMRegister xmm_temp2 = xmm2;
@@ -4203,14 +4131,6 @@
       __ kmovql(k1, rax);
     }
 
-#ifdef _WIN64
-    // save the xmm registers which must be preserved 6-10
-    __ subptr(rsp, -rsp_after_call_off * wordSize);
-    for (int i = 6; i <= XMM_REG_LAST; i++) {
-      __ movdqu(xmm_save(i), as_XMMRegister(i));
-    }
-#endif
-
     __ movdqu(xmm_temp10, ExternalAddress(StubRoutines::x86::ghash_long_swap_mask_addr()));
 
     __ movdqu(xmm_temp0, Address(state, 0));
@@ -4310,12 +4230,6 @@
     __ pshufb(xmm_temp6, xmm_temp10);          // Byte swap 16-byte result
     __ movdqu(Address(state, 0), xmm_temp6);   // store the result
 
-#ifdef _WIN64
-    // restore xmm regs belonging to calling function
-    for (int i = 6; i <= XMM_REG_LAST; i++) {
-      __ movdqu(as_XMMRegister(i), xmm_save(i));
-    }
-#endif
     __ leave();
     __ ret(0);
     return start;
@@ -4652,21 +4566,8 @@
     BLOCK_COMMENT("Entry:");
     __ enter(); // required for proper stackwalking of RuntimeStub frame
 
-#ifdef _WIN64
-    // save the xmm registers which must be preserved 6-7
-    __ subptr(rsp, 4 * wordSize);
-    __ movdqu(Address(rsp, 0), xmm6);
-    __ movdqu(Address(rsp, 2 * wordSize), xmm7);
-#endif
       __ fast_exp(x0, x1, x2, x3, x4, x5, x6, x7, rax, rcx, rdx, tmp);
 
-#ifdef _WIN64
-    // restore xmm regs belonging to calling function
-      __ movdqu(xmm6, Address(rsp, 0));
-      __ movdqu(xmm7, Address(rsp, 2 * wordSize));
-      __ addptr(rsp, 4 * wordSize);
-#endif
-
     __ leave(); // required for proper stackwalking of RuntimeStub frame
     __ ret(0);
 
@@ -4693,21 +4594,8 @@
     BLOCK_COMMENT("Entry:");
     __ enter(); // required for proper stackwalking of RuntimeStub frame
 
-#ifdef _WIN64
-    // save the xmm registers which must be preserved 6-7
-    __ subptr(rsp, 4 * wordSize);
-    __ movdqu(Address(rsp, 0), xmm6);
-    __ movdqu(Address(rsp, 2 * wordSize), xmm7);
-#endif
     __ fast_log(x0, x1, x2, x3, x4, x5, x6, x7, rax, rcx, rdx, tmp1, tmp2);
 
-#ifdef _WIN64
-    // restore xmm regs belonging to calling function
-    __ movdqu(xmm6, Address(rsp, 0));
-    __ movdqu(xmm7, Address(rsp, 2 * wordSize));
-    __ addptr(rsp, 4 * wordSize);
-#endif
-
     __ leave(); // required for proper stackwalking of RuntimeStub frame
     __ ret(0);
 
@@ -4733,21 +4621,8 @@
     BLOCK_COMMENT("Entry:");
     __ enter(); // required for proper stackwalking of RuntimeStub frame
 
-#ifdef _WIN64
-    // save the xmm registers which must be preserved 6-7
-    __ subptr(rsp, 4 * wordSize);
-    __ movdqu(Address(rsp, 0), xmm6);
-    __ movdqu(Address(rsp, 2 * wordSize), xmm7);
-#endif
     __ fast_log10(x0, x1, x2, x3, x4, x5, x6, x7, rax, rcx, rdx, tmp);
 
-#ifdef _WIN64
-    // restore xmm regs belonging to calling function
-    __ movdqu(xmm6, Address(rsp, 0));
-    __ movdqu(xmm7, Address(rsp, 2 * wordSize));
-    __ addptr(rsp, 4 * wordSize);
-#endif
-
     __ leave(); // required for proper stackwalking of RuntimeStub frame
     __ ret(0);
 
@@ -4776,21 +4651,8 @@
     BLOCK_COMMENT("Entry:");
     __ enter(); // required for proper stackwalking of RuntimeStub frame
 
-#ifdef _WIN64
-    // save the xmm registers which must be preserved 6-7
-    __ subptr(rsp, 4 * wordSize);
-    __ movdqu(Address(rsp, 0), xmm6);
-    __ movdqu(Address(rsp, 2 * wordSize), xmm7);
-#endif
     __ fast_pow(x0, x1, x2, x3, x4, x5, x6, x7, rax, rcx, rdx, tmp1, tmp2, tmp3, tmp4);
 
-#ifdef _WIN64
-    // restore xmm regs belonging to calling function
-    __ movdqu(xmm6, Address(rsp, 0));
-    __ movdqu(xmm7, Address(rsp, 2 * wordSize));
-    __ addptr(rsp, 4 * wordSize);
-#endif
-
     __ leave(); // required for proper stackwalking of RuntimeStub frame
     __ ret(0);
 
@@ -4822,18 +4684,10 @@
 #ifdef _WIN64
     __ push(rsi);
     __ push(rdi);
-    // save the xmm registers which must be preserved 6-7
-    __ subptr(rsp, 4 * wordSize);
-    __ movdqu(Address(rsp, 0), xmm6);
-    __ movdqu(Address(rsp, 2 * wordSize), xmm7);
 #endif
     __ fast_sin(x0, x1, x2, x3, x4, x5, x6, x7, rax, rbx, rcx, rdx, tmp1, tmp2, tmp3, tmp4);
 
 #ifdef _WIN64
-    // restore xmm regs belonging to calling function
-    __ movdqu(xmm6, Address(rsp, 0));
-    __ movdqu(xmm7, Address(rsp, 2 * wordSize));
-    __ addptr(rsp, 4 * wordSize);
     __ pop(rdi);
     __ pop(rsi);
 #endif
@@ -4869,18 +4723,10 @@
 #ifdef _WIN64
     __ push(rsi);
     __ push(rdi);
-    // save the xmm registers which must be preserved 6-7
-    __ subptr(rsp, 4 * wordSize);
-    __ movdqu(Address(rsp, 0), xmm6);
-    __ movdqu(Address(rsp, 2 * wordSize), xmm7);
 #endif
     __ fast_cos(x0, x1, x2, x3, x4, x5, x6, x7, rax, rcx, rdx, tmp1, tmp2, tmp3, tmp4);
 
 #ifdef _WIN64
-    // restore xmm regs belonging to calling function
-    __ movdqu(xmm6, Address(rsp, 0));
-    __ movdqu(xmm7, Address(rsp, 2 * wordSize));
-    __ addptr(rsp, 4 * wordSize);
     __ pop(rdi);
     __ pop(rsi);
 #endif
@@ -4916,18 +4762,10 @@
 #ifdef _WIN64
     __ push(rsi);
     __ push(rdi);
-    // save the xmm registers which must be preserved 6-7
-    __ subptr(rsp, 4 * wordSize);
-    __ movdqu(Address(rsp, 0), xmm6);
-    __ movdqu(Address(rsp, 2 * wordSize), xmm7);
 #endif
     __ fast_tan(x0, x1, x2, x3, x4, x5, x6, x7, rax, rcx, rdx, tmp1, tmp2, tmp3, tmp4);
 
 #ifdef _WIN64
-    // restore xmm regs belonging to calling function
-    __ movdqu(xmm6, Address(rsp, 0));
-    __ movdqu(xmm7, Address(rsp, 2 * wordSize));
-    __ addptr(rsp, 4 * wordSize);
     __ pop(rdi);
     __ pop(rsi);
 #endif
--- a/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -55,7 +55,7 @@
 // Run with +PrintInterpreter to get the VM to print out the size.
 // Max size with JVMTI
 #ifdef AMD64
-int TemplateInterpreter::InterpreterCodeSize = 256 * 1024;
+int TemplateInterpreter::InterpreterCodeSize = JVMCI_ONLY(268) NOT_JVMCI(256) * 1024;
 #else
 int TemplateInterpreter::InterpreterCodeSize = 224 * 1024;
 #endif // AMD64
--- a/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86_32.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86_32.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -341,6 +341,27 @@
   //        [ lo(arg) ]
   //        [ hi(arg) ]
   //
+  if (kind == Interpreter::java_lang_math_fmaD) {
+    __ movdbl(xmm2, Address(rsp, 5 * wordSize));
+    __ movdbl(xmm1, Address(rsp, 3 * wordSize));
+    __ movdbl(xmm0, Address(rsp, 1 * wordSize));
+    __ fmad(xmm0, xmm1, xmm2, xmm0);
+    __ pop(rdi);                               // get return address
+    __ mov(rsp, rsi);                          // set sp to sender sp
+    __ jmp(rdi);
+
+    return entry_point;
+  } else if (kind == Interpreter::java_lang_math_fmaF) {
+    __ movflt(xmm2, Address(rsp, 3 * wordSize));
+    __ movflt(xmm1, Address(rsp, 2 * wordSize));
+    __ movflt(xmm0, Address(rsp, 1 * wordSize));
+    __ fmaf(xmm0, xmm1, xmm2, xmm0);
+    __ pop(rdi);                               // get return address
+    __ mov(rsp, rsi);                          // set sp to sender sp
+    __ jmp(rdi);
+
+    return entry_point;
+ }
 
   __ fld_d(Address(rsp, 1*wordSize));
   switch (kind) {
--- a/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86_64.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86_64.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -369,8 +369,17 @@
   //        [ hi(arg) ]
   //
 
-
-  if (kind == Interpreter::java_lang_math_sqrt) {
+  if (kind == Interpreter::java_lang_math_fmaD) {
+    __ movdbl(xmm0, Address(rsp, wordSize));
+    __ movdbl(xmm1, Address(rsp, 3 * wordSize));
+    __ movdbl(xmm2, Address(rsp, 5 * wordSize));
+    __ fmad(xmm0, xmm1, xmm2, xmm0);
+  } else if (kind == Interpreter::java_lang_math_fmaF) {
+    __ movflt(xmm0, Address(rsp, wordSize));
+    __ movflt(xmm1, Address(rsp, 2 * wordSize));
+    __ movflt(xmm2, Address(rsp, 3 * wordSize));
+    __ fmaf(xmm0, xmm1, xmm2, xmm0);
+  } else if (kind == Interpreter::java_lang_math_sqrt) {
     __ sqrtsd(xmm0, Address(rsp, wordSize));
   } else if (kind == Interpreter::java_lang_math_exp) {
     __ movdbl(xmm0, Address(rsp, wordSize));
--- a/hotspot/src/cpu/x86/vm/vmStructs_x86.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/x86/vm/vmStructs_x86.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -73,6 +73,7 @@
 #define VM_LONG_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) \
   declare_preprocessor_constant("VM_Version::CPU_AVX512BW", CPU_AVX512BW) \
   declare_preprocessor_constant("VM_Version::CPU_AVX512VL", CPU_AVX512VL) \
-  declare_preprocessor_constant("VM_Version::CPU_SHA", CPU_SHA)
+  declare_preprocessor_constant("VM_Version::CPU_SHA", CPU_SHA)           \
+  declare_preprocessor_constant("VM_Version::CPU_FMA", CPU_FMA)
 
 #endif // CPU_X86_VM_VMSTRUCTS_X86_HPP
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -578,7 +578,7 @@
   }
 
   char buf[256];
-  jio_snprintf(buf, sizeof(buf), "(%u cores per cpu, %u threads per core) family %d model %d stepping %d%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
+  jio_snprintf(buf, sizeof(buf), "(%u cores per cpu, %u threads per core) family %d model %d stepping %d%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
                cores_per_cpu(), threads_per_core(),
                cpu_family(), _model, _stepping,
                (supports_cmov() ? ", cmov" : ""),
@@ -610,7 +610,8 @@
                (supports_bmi2() ? ", bmi2" : ""),
                (supports_adx() ? ", adx" : ""),
                (supports_evex() ? ", evex" : ""),
-               (supports_sha() ? ", sha" : ""));
+               (supports_sha() ? ", sha" : ""),
+               (supports_fma() ? ", fma" : ""));
   _features_string = os::strdup(buf);
 
   // UseSSE is set to the smaller of what hardware supports and what
@@ -732,6 +733,15 @@
     FLAG_SET_DEFAULT(UseGHASHIntrinsics, false);
   }
 
+  if (supports_fma() && UseSSE >= 2) {
+    if (FLAG_IS_DEFAULT(UseFMA)) {
+      UseFMA = true;
+    }
+  } else if (UseFMA) {
+    warning("FMA instructions are not available on this CPU");
+    FLAG_SET_DEFAULT(UseFMA, false);
+  }
+
   if (supports_sha() LP64_ONLY(|| supports_avx2() && supports_bmi2())) {
     if (FLAG_IS_DEFAULT(UseSHA)) {
       UseSHA = true;
@@ -773,7 +783,6 @@
     FLAG_SET_DEFAULT(UseAdler32Intrinsics, false);
   }
 
-  // Adjust RTM (Restricted Transactional Memory) flags
   if (!supports_rtm() && UseRTMLocking) {
     // Can't continue because UseRTMLocking affects UseBiasedLocking flag
     // setting during arguments processing. See use_biased_locking().
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -74,7 +74,8 @@
                         : 1,
                ssse3    : 1,
                cid      : 1,
-                        : 2,
+                        : 1,
+               fma      : 1,
                cmpxchg16: 1,
                         : 4,
                dca      : 1,
@@ -289,6 +290,7 @@
 #define CPU_AVX512BW ((uint64_t)UCONST64(0x100000000)) // enums are limited to 31 bit
 #define CPU_AVX512VL ((uint64_t)UCONST64(0x200000000)) // EVEX instructions with smaller vector length
 #define CPU_SHA ((uint64_t)UCONST64(0x400000000))      // SHA instructions
+#define CPU_FMA ((uint64_t)UCONST64(0x800000000))      // FMA instructions
 
   enum Extended_Family {
     // AMD
@@ -522,6 +524,8 @@
         result |= CPU_SHA;
       if(_cpuid_info.ext_cpuid1_ecx.bits.lzcnt_intel != 0)
         result |= CPU_LZCNT;
+      if (_cpuid_info.std_cpuid1_ecx.bits.fma != 0)
+        result |= CPU_FMA;
       // for Intel, ecx.bits.misalignsse bit (bit 8) indicates support for prefetchw
       if (_cpuid_info.ext_cpuid1_ecx.bits.misalignsse != 0) {
         result |= CPU_3DNOW_PREFETCH;
@@ -726,6 +730,7 @@
   static bool supports_avx256only() { return (supports_avx2() && !supports_evex()); }
   static bool supports_avxonly()    { return ((supports_avx2() || supports_avx()) && !supports_evex()); }
   static bool supports_sha()        { return (_features & CPU_SHA) != 0; }
+  static bool supports_fma()        { return (_features & CPU_FMA) != 0; }
   // Intel features
   static bool is_intel_family_core() { return is_intel() &&
                                        extended_cpu_family() == CPU_FAMILY_INTEL_CORE; }
--- a/hotspot/src/cpu/x86/vm/x86.ad	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/x86/vm/x86.ad	Wed Jul 05 22:19:13 2017 +0200
@@ -176,451 +176,6 @@
 reg_def XMM5o( SOC, SOC, Op_RegF, 5, xmm5->as_VMReg()->next(14));
 reg_def XMM5p( SOC, SOC, Op_RegF, 5, xmm5->as_VMReg()->next(15));
 
-#ifdef _WIN64
-
-reg_def XMM6 ( SOC, SOE, Op_RegF, 6, xmm6->as_VMReg());
-reg_def XMM6b( SOC, SOE, Op_RegF, 6, xmm6->as_VMReg()->next(1));
-reg_def XMM6c( SOC, SOE, Op_RegF, 6, xmm6->as_VMReg()->next(2));
-reg_def XMM6d( SOC, SOE, Op_RegF, 6, xmm6->as_VMReg()->next(3));
-reg_def XMM6e( SOC, SOE, Op_RegF, 6, xmm6->as_VMReg()->next(4));
-reg_def XMM6f( SOC, SOE, Op_RegF, 6, xmm6->as_VMReg()->next(5));
-reg_def XMM6g( SOC, SOE, Op_RegF, 6, xmm6->as_VMReg()->next(6));
-reg_def XMM6h( SOC, SOE, Op_RegF, 6, xmm6->as_VMReg()->next(7));
-reg_def XMM6i( SOC, SOE, Op_RegF, 6, xmm6->as_VMReg()->next(8));
-reg_def XMM6j( SOC, SOE, Op_RegF, 6, xmm6->as_VMReg()->next(9));
-reg_def XMM6k( SOC, SOE, Op_RegF, 6, xmm6->as_VMReg()->next(10));
-reg_def XMM6l( SOC, SOE, Op_RegF, 6, xmm6->as_VMReg()->next(11));
-reg_def XMM6m( SOC, SOE, Op_RegF, 6, xmm6->as_VMReg()->next(12));
-reg_def XMM6n( SOC, SOE, Op_RegF, 6, xmm6->as_VMReg()->next(13));
-reg_def XMM6o( SOC, SOE, Op_RegF, 6, xmm6->as_VMReg()->next(14));
-reg_def XMM6p( SOC, SOE, Op_RegF, 6, xmm6->as_VMReg()->next(15));
-
-reg_def XMM7 ( SOC, SOE, Op_RegF, 7, xmm7->as_VMReg());
-reg_def XMM7b( SOC, SOE, Op_RegF, 7, xmm7->as_VMReg()->next(1));
-reg_def XMM7c( SOC, SOE, Op_RegF, 7, xmm7->as_VMReg()->next(2));
-reg_def XMM7d( SOC, SOE, Op_RegF, 7, xmm7->as_VMReg()->next(3));
-reg_def XMM7e( SOC, SOE, Op_RegF, 7, xmm7->as_VMReg()->next(4));
-reg_def XMM7f( SOC, SOE, Op_RegF, 7, xmm7->as_VMReg()->next(5));
-reg_def XMM7g( SOC, SOE, Op_RegF, 7, xmm7->as_VMReg()->next(6));
-reg_def XMM7h( SOC, SOE, Op_RegF, 7, xmm7->as_VMReg()->next(7));
-reg_def XMM7i( SOC, SOE, Op_RegF, 7, xmm7->as_VMReg()->next(8));
-reg_def XMM7j( SOC, SOE, Op_RegF, 7, xmm7->as_VMReg()->next(9));
-reg_def XMM7k( SOC, SOE, Op_RegF, 7, xmm7->as_VMReg()->next(10));
-reg_def XMM7l( SOC, SOE, Op_RegF, 7, xmm7->as_VMReg()->next(11));
-reg_def XMM7m( SOC, SOE, Op_RegF, 7, xmm7->as_VMReg()->next(12));
-reg_def XMM7n( SOC, SOE, Op_RegF, 7, xmm7->as_VMReg()->next(13));
-reg_def XMM7o( SOC, SOE, Op_RegF, 7, xmm7->as_VMReg()->next(14));
-reg_def XMM7p( SOC, SOE, Op_RegF, 7, xmm7->as_VMReg()->next(15));
-
-reg_def XMM8 ( SOC, SOE, Op_RegF, 8, xmm8->as_VMReg());
-reg_def XMM8b( SOC, SOE, Op_RegF, 8, xmm8->as_VMReg()->next(1));
-reg_def XMM8c( SOC, SOE, Op_RegF, 8, xmm8->as_VMReg()->next(2));
-reg_def XMM8d( SOC, SOE, Op_RegF, 8, xmm8->as_VMReg()->next(3));
-reg_def XMM8e( SOC, SOE, Op_RegF, 8, xmm8->as_VMReg()->next(4));
-reg_def XMM8f( SOC, SOE, Op_RegF, 8, xmm8->as_VMReg()->next(5));
-reg_def XMM8g( SOC, SOE, Op_RegF, 8, xmm8->as_VMReg()->next(6));
-reg_def XMM8h( SOC, SOE, Op_RegF, 8, xmm8->as_VMReg()->next(7));
-reg_def XMM8i( SOC, SOE, Op_RegF, 8, xmm8->as_VMReg()->next(8));
-reg_def XMM8j( SOC, SOE, Op_RegF, 8, xmm8->as_VMReg()->next(9));
-reg_def XMM8k( SOC, SOE, Op_RegF, 8, xmm8->as_VMReg()->next(10));
-reg_def XMM8l( SOC, SOE, Op_RegF, 8, xmm8->as_VMReg()->next(11));
-reg_def XMM8m( SOC, SOE, Op_RegF, 8, xmm8->as_VMReg()->next(12));
-reg_def XMM8n( SOC, SOE, Op_RegF, 8, xmm8->as_VMReg()->next(13));
-reg_def XMM8o( SOC, SOE, Op_RegF, 8, xmm8->as_VMReg()->next(14));
-reg_def XMM8p( SOC, SOE, Op_RegF, 8, xmm8->as_VMReg()->next(15));
-
-reg_def XMM9 ( SOC, SOE, Op_RegF, 9, xmm9->as_VMReg());
-reg_def XMM9b( SOC, SOE, Op_RegF, 9, xmm9->as_VMReg()->next(1));
-reg_def XMM9c( SOC, SOE, Op_RegF, 9, xmm9->as_VMReg()->next(2));
-reg_def XMM9d( SOC, SOE, Op_RegF, 9, xmm9->as_VMReg()->next(3));
-reg_def XMM9e( SOC, SOE, Op_RegF, 9, xmm9->as_VMReg()->next(4));
-reg_def XMM9f( SOC, SOE, Op_RegF, 9, xmm9->as_VMReg()->next(5));
-reg_def XMM9g( SOC, SOE, Op_RegF, 9, xmm9->as_VMReg()->next(6));
-reg_def XMM9h( SOC, SOE, Op_RegF, 9, xmm9->as_VMReg()->next(7));
-reg_def XMM9i( SOC, SOE, Op_RegF, 9, xmm9->as_VMReg()->next(8));
-reg_def XMM9j( SOC, SOE, Op_RegF, 9, xmm9->as_VMReg()->next(9));
-reg_def XMM9k( SOC, SOE, Op_RegF, 9, xmm9->as_VMReg()->next(10));
-reg_def XMM9l( SOC, SOE, Op_RegF, 9, xmm9->as_VMReg()->next(11));
-reg_def XMM9m( SOC, SOE, Op_RegF, 9, xmm9->as_VMReg()->next(12));
-reg_def XMM9n( SOC, SOE, Op_RegF, 9, xmm9->as_VMReg()->next(13));
-reg_def XMM9o( SOC, SOE, Op_RegF, 9, xmm9->as_VMReg()->next(14));
-reg_def XMM9p( SOC, SOE, Op_RegF, 9, xmm9->as_VMReg()->next(15));
-
-reg_def XMM10 ( SOC, SOE, Op_RegF, 10, xmm10->as_VMReg());
-reg_def XMM10b( SOC, SOE, Op_RegF, 10, xmm10->as_VMReg()->next(1));
-reg_def XMM10c( SOC, SOE, Op_RegF, 10, xmm10->as_VMReg()->next(2));
-reg_def XMM10d( SOC, SOE, Op_RegF, 10, xmm10->as_VMReg()->next(3));
-reg_def XMM10e( SOC, SOE, Op_RegF, 10, xmm10->as_VMReg()->next(4));
-reg_def XMM10f( SOC, SOE, Op_RegF, 10, xmm10->as_VMReg()->next(5));
-reg_def XMM10g( SOC, SOE, Op_RegF, 10, xmm10->as_VMReg()->next(6));
-reg_def XMM10h( SOC, SOE, Op_RegF, 10, xmm10->as_VMReg()->next(7));
-reg_def XMM10i( SOC, SOE, Op_RegF, 10, xmm10->as_VMReg()->next(8));
-reg_def XMM10j( SOC, SOE, Op_RegF, 10, xmm10->as_VMReg()->next(9));
-reg_def XMM10k( SOC, SOE, Op_RegF, 10, xmm10->as_VMReg()->next(10));
-reg_def XMM10l( SOC, SOE, Op_RegF, 10, xmm10->as_VMReg()->next(11));
-reg_def XMM10m( SOC, SOE, Op_RegF, 10, xmm10->as_VMReg()->next(12));
-reg_def XMM10n( SOC, SOE, Op_RegF, 10, xmm10->as_VMReg()->next(13));
-reg_def XMM10o( SOC, SOE, Op_RegF, 10, xmm10->as_VMReg()->next(14));
-reg_def XMM10p( SOC, SOE, Op_RegF, 10, xmm10->as_VMReg()->next(15));
-
-reg_def XMM11 ( SOC, SOE, Op_RegF, 11, xmm11->as_VMReg());
-reg_def XMM11b( SOC, SOE, Op_RegF, 11, xmm11->as_VMReg()->next(1));
-reg_def XMM11c( SOC, SOE, Op_RegF, 11, xmm11->as_VMReg()->next(2));
-reg_def XMM11d( SOC, SOE, Op_RegF, 11, xmm11->as_VMReg()->next(3));
-reg_def XMM11e( SOC, SOE, Op_RegF, 11, xmm11->as_VMReg()->next(4));
-reg_def XMM11f( SOC, SOE, Op_RegF, 11, xmm11->as_VMReg()->next(5));
-reg_def XMM11g( SOC, SOE, Op_RegF, 11, xmm11->as_VMReg()->next(6));
-reg_def XMM11h( SOC, SOE, Op_RegF, 11, xmm11->as_VMReg()->next(7));
-reg_def XMM11i( SOC, SOE, Op_RegF, 11, xmm11->as_VMReg()->next(8));
-reg_def XMM11j( SOC, SOE, Op_RegF, 11, xmm11->as_VMReg()->next(9));
-reg_def XMM11k( SOC, SOE, Op_RegF, 11, xmm11->as_VMReg()->next(10));
-reg_def XMM11l( SOC, SOE, Op_RegF, 11, xmm11->as_VMReg()->next(11));
-reg_def XMM11m( SOC, SOE, Op_RegF, 11, xmm11->as_VMReg()->next(12));
-reg_def XMM11n( SOC, SOE, Op_RegF, 11, xmm11->as_VMReg()->next(13));
-reg_def XMM11o( SOC, SOE, Op_RegF, 11, xmm11->as_VMReg()->next(14));
-reg_def XMM11p( SOC, SOE, Op_RegF, 11, xmm11->as_VMReg()->next(15));
-
-reg_def XMM12 ( SOC, SOE, Op_RegF, 12, xmm12->as_VMReg());
-reg_def XMM12b( SOC, SOE, Op_RegF, 12, xmm12->as_VMReg()->next(1));
-reg_def XMM12c( SOC, SOE, Op_RegF, 12, xmm12->as_VMReg()->next(2));
-reg_def XMM12d( SOC, SOE, Op_RegF, 12, xmm12->as_VMReg()->next(3));
-reg_def XMM12e( SOC, SOE, Op_RegF, 12, xmm12->as_VMReg()->next(4));
-reg_def XMM12f( SOC, SOE, Op_RegF, 12, xmm12->as_VMReg()->next(5));
-reg_def XMM12g( SOC, SOE, Op_RegF, 12, xmm12->as_VMReg()->next(6));
-reg_def XMM12h( SOC, SOE, Op_RegF, 12, xmm12->as_VMReg()->next(7));
-reg_def XMM12i( SOC, SOE, Op_RegF, 12, xmm12->as_VMReg()->next(8));
-reg_def XMM12j( SOC, SOE, Op_RegF, 12, xmm12->as_VMReg()->next(9));
-reg_def XMM12k( SOC, SOE, Op_RegF, 12, xmm12->as_VMReg()->next(10));
-reg_def XMM12l( SOC, SOE, Op_RegF, 12, xmm12->as_VMReg()->next(11));
-reg_def XMM12m( SOC, SOE, Op_RegF, 12, xmm12->as_VMReg()->next(12));
-reg_def XMM12n( SOC, SOE, Op_RegF, 12, xmm12->as_VMReg()->next(13));
-reg_def XMM12o( SOC, SOE, Op_RegF, 12, xmm12->as_VMReg()->next(14));
-reg_def XMM12p( SOC, SOE, Op_RegF, 12, xmm12->as_VMReg()->next(15));
-
-reg_def XMM13 ( SOC, SOE, Op_RegF, 13, xmm13->as_VMReg());
-reg_def XMM13b( SOC, SOE, Op_RegF, 13, xmm13->as_VMReg()->next(1));
-reg_def XMM13c( SOC, SOE, Op_RegF, 13, xmm13->as_VMReg()->next(2));
-reg_def XMM13d( SOC, SOE, Op_RegF, 13, xmm13->as_VMReg()->next(3));
-reg_def XMM13e( SOC, SOE, Op_RegF, 13, xmm13->as_VMReg()->next(4));
-reg_def XMM13f( SOC, SOE, Op_RegF, 13, xmm13->as_VMReg()->next(5));
-reg_def XMM13g( SOC, SOE, Op_RegF, 13, xmm13->as_VMReg()->next(6));
-reg_def XMM13h( SOC, SOE, Op_RegF, 13, xmm13->as_VMReg()->next(7));
-reg_def XMM13i( SOC, SOE, Op_RegF, 13, xmm13->as_VMReg()->next(8));
-reg_def XMM13j( SOC, SOE, Op_RegF, 13, xmm13->as_VMReg()->next(9));
-reg_def XMM13k( SOC, SOE, Op_RegF, 13, xmm13->as_VMReg()->next(10));
-reg_def XMM13l( SOC, SOE, Op_RegF, 13, xmm13->as_VMReg()->next(11));
-reg_def XMM13m( SOC, SOE, Op_RegF, 13, xmm13->as_VMReg()->next(12));
-reg_def XMM13n( SOC, SOE, Op_RegF, 13, xmm13->as_VMReg()->next(13));
-reg_def XMM13o( SOC, SOE, Op_RegF, 13, xmm13->as_VMReg()->next(14));
-reg_def XMM13p( SOC, SOE, Op_RegF, 13, xmm13->as_VMReg()->next(15));
-
-reg_def XMM14 ( SOC, SOE, Op_RegF, 14, xmm14->as_VMReg());
-reg_def XMM14b( SOC, SOE, Op_RegF, 14, xmm14->as_VMReg()->next(1));
-reg_def XMM14c( SOC, SOE, Op_RegF, 14, xmm14->as_VMReg()->next(2));
-reg_def XMM14d( SOC, SOE, Op_RegF, 14, xmm14->as_VMReg()->next(3));
-reg_def XMM14e( SOC, SOE, Op_RegF, 14, xmm14->as_VMReg()->next(4));
-reg_def XMM14f( SOC, SOE, Op_RegF, 14, xmm14->as_VMReg()->next(5));
-reg_def XMM14g( SOC, SOE, Op_RegF, 14, xmm14->as_VMReg()->next(6));
-reg_def XMM14h( SOC, SOE, Op_RegF, 14, xmm14->as_VMReg()->next(7));
-reg_def XMM14i( SOC, SOE, Op_RegF, 14, xmm14->as_VMReg()->next(8));
-reg_def XMM14j( SOC, SOE, Op_RegF, 14, xmm14->as_VMReg()->next(9));
-reg_def XMM14k( SOC, SOE, Op_RegF, 14, xmm14->as_VMReg()->next(10));
-reg_def XMM14l( SOC, SOE, Op_RegF, 14, xmm14->as_VMReg()->next(11));
-reg_def XMM14m( SOC, SOE, Op_RegF, 14, xmm14->as_VMReg()->next(12));
-reg_def XMM14n( SOC, SOE, Op_RegF, 14, xmm14->as_VMReg()->next(13));
-reg_def XMM14o( SOC, SOE, Op_RegF, 14, xmm14->as_VMReg()->next(14));
-reg_def XMM14p( SOC, SOE, Op_RegF, 14, xmm14->as_VMReg()->next(15));
-
-reg_def XMM15 ( SOC, SOE, Op_RegF, 15, xmm15->as_VMReg());
-reg_def XMM15b( SOC, SOE, Op_RegF, 15, xmm15->as_VMReg()->next(1));
-reg_def XMM15c( SOC, SOE, Op_RegF, 15, xmm15->as_VMReg()->next(2));
-reg_def XMM15d( SOC, SOE, Op_RegF, 15, xmm15->as_VMReg()->next(3));
-reg_def XMM15e( SOC, SOE, Op_RegF, 15, xmm15->as_VMReg()->next(4));
-reg_def XMM15f( SOC, SOE, Op_RegF, 15, xmm15->as_VMReg()->next(5));
-reg_def XMM15g( SOC, SOE, Op_RegF, 15, xmm15->as_VMReg()->next(6));
-reg_def XMM15h( SOC, SOE, Op_RegF, 15, xmm15->as_VMReg()->next(7));
-reg_def XMM15i( SOC, SOE, Op_RegF, 15, xmm15->as_VMReg()->next(8));
-reg_def XMM15j( SOC, SOE, Op_RegF, 15, xmm15->as_VMReg()->next(9));
-reg_def XMM15k( SOC, SOE, Op_RegF, 15, xmm15->as_VMReg()->next(10));
-reg_def XMM15l( SOC, SOE, Op_RegF, 15, xmm15->as_VMReg()->next(11));
-reg_def XMM15m( SOC, SOE, Op_RegF, 15, xmm15->as_VMReg()->next(12));
-reg_def XMM15n( SOC, SOE, Op_RegF, 15, xmm15->as_VMReg()->next(13));
-reg_def XMM15o( SOC, SOE, Op_RegF, 15, xmm15->as_VMReg()->next(14));
-reg_def XMM15p( SOC, SOE, Op_RegF, 15, xmm15->as_VMReg()->next(15));
-
-reg_def XMM16 ( SOC, SOE, Op_RegF, 16, xmm16->as_VMReg());
-reg_def XMM16b( SOC, SOE, Op_RegF, 16, xmm16->as_VMReg()->next(1));
-reg_def XMM16c( SOC, SOE, Op_RegF, 16, xmm16->as_VMReg()->next(2));
-reg_def XMM16d( SOC, SOE, Op_RegF, 16, xmm16->as_VMReg()->next(3));
-reg_def XMM16e( SOC, SOE, Op_RegF, 16, xmm16->as_VMReg()->next(4));
-reg_def XMM16f( SOC, SOE, Op_RegF, 16, xmm16->as_VMReg()->next(5));
-reg_def XMM16g( SOC, SOE, Op_RegF, 16, xmm16->as_VMReg()->next(6));
-reg_def XMM16h( SOC, SOE, Op_RegF, 16, xmm16->as_VMReg()->next(7));
-reg_def XMM16i( SOC, SOE, Op_RegF, 16, xmm15->as_VMReg()->next(8));
-reg_def XMM16j( SOC, SOE, Op_RegF, 16, xmm16->as_VMReg()->next(9));
-reg_def XMM16k( SOC, SOE, Op_RegF, 16, xmm16->as_VMReg()->next(10));
-reg_def XMM16l( SOC, SOE, Op_RegF, 16, xmm16->as_VMReg()->next(11));
-reg_def XMM16m( SOC, SOE, Op_RegF, 16, xmm16->as_VMReg()->next(12));
-reg_def XMM16n( SOC, SOE, Op_RegF, 16, xmm16->as_VMReg()->next(13));
-reg_def XMM16o( SOC, SOE, Op_RegF, 16, xmm16->as_VMReg()->next(14));
-reg_def XMM16p( SOC, SOE, Op_RegF, 16, xmm16->as_VMReg()->next(15));
-
-reg_def XMM17 ( SOC, SOE, Op_RegF, 17, xmm17->as_VMReg());
-reg_def XMM17b( SOC, SOE, Op_RegF, 17, xmm17->as_VMReg()->next(1));
-reg_def XMM17c( SOC, SOE, Op_RegF, 17, xmm17->as_VMReg()->next(2));
-reg_def XMM17d( SOC, SOE, Op_RegF, 17, xmm17->as_VMReg()->next(3));
-reg_def XMM17e( SOC, SOE, Op_RegF, 17, xmm17->as_VMReg()->next(4));
-reg_def XMM17f( SOC, SOE, Op_RegF, 17, xmm17->as_VMReg()->next(5));
-reg_def XMM17g( SOC, SOE, Op_RegF, 17, xmm17->as_VMReg()->next(6));
-reg_def XMM17h( SOC, SOE, Op_RegF, 17, xmm17->as_VMReg()->next(7));
-reg_def XMM17i( SOC, SOE, Op_RegF, 17, xmm17->as_VMReg()->next(8));
-reg_def XMM17j( SOC, SOE, Op_RegF, 17, xmm17->as_VMReg()->next(9));
-reg_def XMM17k( SOC, SOE, Op_RegF, 17, xmm17->as_VMReg()->next(10));
-reg_def XMM17l( SOC, SOE, Op_RegF, 17, xmm17->as_VMReg()->next(11));
-reg_def XMM17m( SOC, SOE, Op_RegF, 17, xmm17->as_VMReg()->next(12));
-reg_def XMM17n( SOC, SOE, Op_RegF, 17, xmm17->as_VMReg()->next(13));
-reg_def XMM17o( SOC, SOE, Op_RegF, 17, xmm17->as_VMReg()->next(14));
-reg_def XMM17p( SOC, SOE, Op_RegF, 17, xmm17->as_VMReg()->next(15));
-
-reg_def XMM18 ( SOC, SOE, Op_RegF, 18, xmm18->as_VMReg());
-reg_def XMM18b( SOC, SOE, Op_RegF, 18, xmm18->as_VMReg()->next(1));
-reg_def XMM18c( SOC, SOE, Op_RegF, 18, xmm18->as_VMReg()->next(2));
-reg_def XMM18d( SOC, SOE, Op_RegF, 18, xmm18->as_VMReg()->next(3));
-reg_def XMM18e( SOC, SOE, Op_RegF, 18, xmm18->as_VMReg()->next(4));
-reg_def XMM18f( SOC, SOE, Op_RegF, 18, xmm18->as_VMReg()->next(5));
-reg_def XMM18g( SOC, SOE, Op_RegF, 18, xmm18->as_VMReg()->next(6));
-reg_def XMM18h( SOC, SOE, Op_RegF, 18, xmm18->as_VMReg()->next(7));
-reg_def XMM18i( SOC, SOE, Op_RegF, 18, xmm18->as_VMReg()->next(8));
-reg_def XMM18j( SOC, SOE, Op_RegF, 18, xmm18->as_VMReg()->next(9));
-reg_def XMM18k( SOC, SOE, Op_RegF, 18, xmm18->as_VMReg()->next(10));
-reg_def XMM18l( SOC, SOE, Op_RegF, 18, xmm18->as_VMReg()->next(11));
-reg_def XMM18m( SOC, SOE, Op_RegF, 18, xmm18->as_VMReg()->next(12));
-reg_def XMM18n( SOC, SOE, Op_RegF, 18, xmm18->as_VMReg()->next(13));
-reg_def XMM18o( SOC, SOE, Op_RegF, 18, xmm18->as_VMReg()->next(14));
-reg_def XMM18p( SOC, SOE, Op_RegF, 18, xmm18->as_VMReg()->next(15));
-
-reg_def XMM19 ( SOC, SOE, Op_RegF, 19, xmm19->as_VMReg());
-reg_def XMM19b( SOC, SOE, Op_RegF, 19, xmm19->as_VMReg()->next(1));
-reg_def XMM19c( SOC, SOE, Op_RegF, 19, xmm19->as_VMReg()->next(2));
-reg_def XMM19d( SOC, SOE, Op_RegF, 19, xmm19->as_VMReg()->next(3));
-reg_def XMM19e( SOC, SOE, Op_RegF, 19, xmm19->as_VMReg()->next(4));
-reg_def XMM19f( SOC, SOE, Op_RegF, 19, xmm19->as_VMReg()->next(5));
-reg_def XMM19g( SOC, SOE, Op_RegF, 19, xmm19->as_VMReg()->next(6));
-reg_def XMM19h( SOC, SOE, Op_RegF, 19, xmm19->as_VMReg()->next(7));
-reg_def XMM19i( SOC, SOE, Op_RegF, 19, xmm19->as_VMReg()->next(8));
-reg_def XMM19j( SOC, SOE, Op_RegF, 19, xmm19->as_VMReg()->next(9));
-reg_def XMM19k( SOC, SOE, Op_RegF, 19, xmm19->as_VMReg()->next(10));
-reg_def XMM19l( SOC, SOE, Op_RegF, 19, xmm19->as_VMReg()->next(11));
-reg_def XMM19m( SOC, SOE, Op_RegF, 19, xmm19->as_VMReg()->next(12));
-reg_def XMM19n( SOC, SOE, Op_RegF, 19, xmm19->as_VMReg()->next(13));
-reg_def XMM19o( SOC, SOE, Op_RegF, 19, xmm19->as_VMReg()->next(14));
-reg_def XMM19p( SOC, SOE, Op_RegF, 19, xmm19->as_VMReg()->next(15));
-
-reg_def XMM20 ( SOC, SOE, Op_RegF, 20, xmm20->as_VMReg());
-reg_def XMM20b( SOC, SOE, Op_RegF, 20, xmm20->as_VMReg()->next(1));
-reg_def XMM20c( SOC, SOE, Op_RegF, 20, xmm20->as_VMReg()->next(2));
-reg_def XMM20d( SOC, SOE, Op_RegF, 20, xmm20->as_VMReg()->next(3));
-reg_def XMM20e( SOC, SOE, Op_RegF, 20, xmm20->as_VMReg()->next(4));
-reg_def XMM20f( SOC, SOE, Op_RegF, 20, xmm20->as_VMReg()->next(5));
-reg_def XMM20g( SOC, SOE, Op_RegF, 20, xmm20->as_VMReg()->next(6));
-reg_def XMM20h( SOC, SOE, Op_RegF, 20, xmm20->as_VMReg()->next(7));
-reg_def XMM20i( SOC, SOE, Op_RegF, 20, xmm20->as_VMReg()->next(8));
-reg_def XMM20j( SOC, SOE, Op_RegF, 20, xmm20->as_VMReg()->next(9));
-reg_def XMM20k( SOC, SOE, Op_RegF, 20, xmm20->as_VMReg()->next(10));
-reg_def XMM20l( SOC, SOE, Op_RegF, 20, xmm20->as_VMReg()->next(11));
-reg_def XMM20m( SOC, SOE, Op_RegF, 20, xmm20->as_VMReg()->next(12));
-reg_def XMM20n( SOC, SOE, Op_RegF, 20, xmm20->as_VMReg()->next(13));
-reg_def XMM20o( SOC, SOE, Op_RegF, 20, xmm20->as_VMReg()->next(14));
-reg_def XMM20p( SOC, SOE, Op_RegF, 20, xmm20->as_VMReg()->next(15));
-
-reg_def XMM21 ( SOC, SOE, Op_RegF, 21, xmm21->as_VMReg());
-reg_def XMM21b( SOC, SOE, Op_RegF, 21, xmm21->as_VMReg()->next(1));
-reg_def XMM21c( SOC, SOE, Op_RegF, 21, xmm21->as_VMReg()->next(2));
-reg_def XMM21d( SOC, SOE, Op_RegF, 21, xmm21->as_VMReg()->next(3));
-reg_def XMM21e( SOC, SOE, Op_RegF, 21, xmm21->as_VMReg()->next(4));
-reg_def XMM21f( SOC, SOE, Op_RegF, 21, xmm21->as_VMReg()->next(5));
-reg_def XMM21g( SOC, SOE, Op_RegF, 21, xmm21->as_VMReg()->next(6));
-reg_def XMM21h( SOC, SOE, Op_RegF, 21, xmm21->as_VMReg()->next(7));
-reg_def XMM21i( SOC, SOE, Op_RegF, 21, xmm21->as_VMReg()->next(8));
-reg_def XMM21j( SOC, SOE, Op_RegF, 21, xmm21->as_VMReg()->next(9));
-reg_def XMM21k( SOC, SOE, Op_RegF, 21, xmm21->as_VMReg()->next(10));
-reg_def XMM21l( SOC, SOE, Op_RegF, 21, xmm21->as_VMReg()->next(11));
-reg_def XMM21m( SOC, SOE, Op_RegF, 21, xmm21->as_VMReg()->next(12));
-reg_def XMM21n( SOC, SOE, Op_RegF, 21, xmm21->as_VMReg()->next(13));
-reg_def XMM21o( SOC, SOE, Op_RegF, 21, xmm21->as_VMReg()->next(14));
-reg_def XMM21p( SOC, SOE, Op_RegF, 21, xmm21->as_VMReg()->next(15));
-
-reg_def XMM22 ( SOC, SOE, Op_RegF, 22, xmm22->as_VMReg());
-reg_def XMM22b( SOC, SOE, Op_RegF, 22, xmm22->as_VMReg()->next(1));
-reg_def XMM22c( SOC, SOE, Op_RegF, 22, xmm22->as_VMReg()->next(2));
-reg_def XMM22d( SOC, SOE, Op_RegF, 22, xmm22->as_VMReg()->next(3));
-reg_def XMM22e( SOC, SOE, Op_RegF, 22, xmm22->as_VMReg()->next(4));
-reg_def XMM22f( SOC, SOE, Op_RegF, 22, xmm22->as_VMReg()->next(5));
-reg_def XMM22g( SOC, SOE, Op_RegF, 22, xmm22->as_VMReg()->next(6));
-reg_def XMM22h( SOC, SOE, Op_RegF, 22, xmm22->as_VMReg()->next(7));
-reg_def XMM22i( SOC, SOE, Op_RegF, 22, xmm22->as_VMReg()->next(8));
-reg_def XMM22j( SOC, SOE, Op_RegF, 22, xmm22->as_VMReg()->next(9));
-reg_def XMM22k( SOC, SOE, Op_RegF, 22, xmm22->as_VMReg()->next(10));
-reg_def XMM22l( SOC, SOE, Op_RegF, 22, xmm22->as_VMReg()->next(11));
-reg_def XMM22m( SOC, SOE, Op_RegF, 22, xmm22->as_VMReg()->next(12));
-reg_def XMM22n( SOC, SOE, Op_RegF, 22, xmm22->as_VMReg()->next(13));
-reg_def XMM22o( SOC, SOE, Op_RegF, 22, xmm22->as_VMReg()->next(14));
-reg_def XMM22p( SOC, SOE, Op_RegF, 22, xmm22->as_VMReg()->next(15));
-
-reg_def XMM23 ( SOC, SOE, Op_RegF, 23, xmm23->as_VMReg());
-reg_def XMM23b( SOC, SOE, Op_RegF, 23, xmm23->as_VMReg()->next(1));
-reg_def XMM23c( SOC, SOE, Op_RegF, 23, xmm23->as_VMReg()->next(2));
-reg_def XMM23d( SOC, SOE, Op_RegF, 23, xmm23->as_VMReg()->next(3));
-reg_def XMM23e( SOC, SOE, Op_RegF, 23, xmm23->as_VMReg()->next(4));
-reg_def XMM23f( SOC, SOE, Op_RegF, 23, xmm23->as_VMReg()->next(5));
-reg_def XMM23g( SOC, SOE, Op_RegF, 23, xmm23->as_VMReg()->next(6));
-reg_def XMM23h( SOC, SOE, Op_RegF, 23, xmm23->as_VMReg()->next(7));
-reg_def XMM23i( SOC, SOE, Op_RegF, 23, xmm23->as_VMReg()->next(8));
-reg_def XMM23j( SOC, SOE, Op_RegF, 23, xmm23->as_VMReg()->next(9));
-reg_def XMM23k( SOC, SOE, Op_RegF, 23, xmm23->as_VMReg()->next(10));
-reg_def XMM23l( SOC, SOE, Op_RegF, 23, xmm23->as_VMReg()->next(11));
-reg_def XMM23m( SOC, SOE, Op_RegF, 23, xmm23->as_VMReg()->next(12));
-reg_def XMM23n( SOC, SOE, Op_RegF, 23, xmm23->as_VMReg()->next(13));
-reg_def XMM23o( SOC, SOE, Op_RegF, 23, xmm23->as_VMReg()->next(14));
-reg_def XMM23p( SOC, SOE, Op_RegF, 23, xmm23->as_VMReg()->next(15));
-
-reg_def XMM24 ( SOC, SOE, Op_RegF, 24, xmm24->as_VMReg());
-reg_def XMM24b( SOC, SOE, Op_RegF, 24, xmm24->as_VMReg()->next(1));
-reg_def XMM24c( SOC, SOE, Op_RegF, 24, xmm24->as_VMReg()->next(2));
-reg_def XMM24d( SOC, SOE, Op_RegF, 24, xmm24->as_VMReg()->next(3));
-reg_def XMM24e( SOC, SOE, Op_RegF, 24, xmm24->as_VMReg()->next(4));
-reg_def XMM24f( SOC, SOE, Op_RegF, 24, xmm24->as_VMReg()->next(5));
-reg_def XMM24g( SOC, SOE, Op_RegF, 24, xmm24->as_VMReg()->next(6));
-reg_def XMM24h( SOC, SOE, Op_RegF, 24, xmm24->as_VMReg()->next(7));
-reg_def XMM24i( SOC, SOE, Op_RegF, 24, xmm24->as_VMReg()->next(8));
-reg_def XMM24j( SOC, SOE, Op_RegF, 24, xmm24->as_VMReg()->next(9));
-reg_def XMM24k( SOC, SOE, Op_RegF, 24, xmm24->as_VMReg()->next(10));
-reg_def XMM24l( SOC, SOE, Op_RegF, 24, xmm24->as_VMReg()->next(11));
-reg_def XMM24m( SOC, SOE, Op_RegF, 24, xmm24->as_VMReg()->next(12));
-reg_def XMM24n( SOC, SOE, Op_RegF, 24, xmm24->as_VMReg()->next(13));
-reg_def XMM24o( SOC, SOE, Op_RegF, 24, xmm24->as_VMReg()->next(14));
-reg_def XMM24p( SOC, SOE, Op_RegF, 24, xmm24->as_VMReg()->next(15));
-
-reg_def XMM25 ( SOC, SOE, Op_RegF, 25, xmm25->as_VMReg());
-reg_def XMM25b( SOC, SOE, Op_RegF, 25, xmm25->as_VMReg()->next(1));
-reg_def XMM25c( SOC, SOE, Op_RegF, 25, xmm25->as_VMReg()->next(2));
-reg_def XMM25d( SOC, SOE, Op_RegF, 25, xmm25->as_VMReg()->next(3));
-reg_def XMM25e( SOC, SOE, Op_RegF, 25, xmm25->as_VMReg()->next(4));
-reg_def XMM25f( SOC, SOE, Op_RegF, 25, xmm25->as_VMReg()->next(5));
-reg_def XMM25g( SOC, SOE, Op_RegF, 25, xmm25->as_VMReg()->next(6));
-reg_def XMM25h( SOC, SOE, Op_RegF, 25, xmm25->as_VMReg()->next(7));
-reg_def XMM25i( SOC, SOE, Op_RegF, 25, xmm25->as_VMReg()->next(8));
-reg_def XMM25j( SOC, SOE, Op_RegF, 25, xmm25->as_VMReg()->next(9));
-reg_def XMM25k( SOC, SOE, Op_RegF, 25, xmm25->as_VMReg()->next(10));
-reg_def XMM25l( SOC, SOE, Op_RegF, 25, xmm25->as_VMReg()->next(11));
-reg_def XMM25m( SOC, SOE, Op_RegF, 25, xmm25->as_VMReg()->next(12));
-reg_def XMM25n( SOC, SOE, Op_RegF, 25, xmm25->as_VMReg()->next(13));
-reg_def XMM25o( SOC, SOE, Op_RegF, 25, xmm25->as_VMReg()->next(14));
-reg_def XMM25p( SOC, SOE, Op_RegF, 25, xmm25->as_VMReg()->next(15));
-
-reg_def XMM26 ( SOC, SOE, Op_RegF, 26, xmm26->as_VMReg());
-reg_def XMM26b( SOC, SOE, Op_RegF, 26, xmm26->as_VMReg()->next(1));
-reg_def XMM26c( SOC, SOE, Op_RegF, 26, xmm26->as_VMReg()->next(2));
-reg_def XMM26d( SOC, SOE, Op_RegF, 26, xmm26->as_VMReg()->next(3));
-reg_def XMM26e( SOC, SOE, Op_RegF, 26, xmm26->as_VMReg()->next(4));
-reg_def XMM26f( SOC, SOE, Op_RegF, 26, xmm26->as_VMReg()->next(5));
-reg_def XMM26g( SOC, SOE, Op_RegF, 26, xmm26->as_VMReg()->next(6));
-reg_def XMM26h( SOC, SOE, Op_RegF, 26, xmm26->as_VMReg()->next(7));
-reg_def XMM26i( SOC, SOE, Op_RegF, 26, xmm26->as_VMReg()->next(8));
-reg_def XMM26j( SOC, SOE, Op_RegF, 26, xmm26->as_VMReg()->next(9));
-reg_def XMM26k( SOC, SOE, Op_RegF, 26, xmm26->as_VMReg()->next(10));
-reg_def XMM26l( SOC, SOE, Op_RegF, 26, xmm26->as_VMReg()->next(11));
-reg_def XMM26m( SOC, SOE, Op_RegF, 26, xmm26->as_VMReg()->next(12));
-reg_def XMM26n( SOC, SOE, Op_RegF, 26, xmm26->as_VMReg()->next(13));
-reg_def XMM26o( SOC, SOE, Op_RegF, 26, xmm26->as_VMReg()->next(14));
-reg_def XMM26p( SOC, SOE, Op_RegF, 26, xmm26->as_VMReg()->next(15));
-
-reg_def XMM27g( SOC, SOE, Op_RegF, 27, xmm27->as_VMReg()->next(1));
-reg_def XMM27c( SOC, SOE, Op_RegF, 27, xmm27->as_VMReg()->next(2));
-reg_def XMM27d( SOC, SOE, Op_RegF, 27, xmm27->as_VMReg()->next(3));
-reg_def XMM27e( SOC, SOE, Op_RegF, 27, xmm27->as_VMReg()->next(4));
-reg_def XMM27f( SOC, SOE, Op_RegF, 27, xmm27->as_VMReg()->next(5));
-reg_def XMM27g( SOC, SOE, Op_RegF, 27, xmm27->as_VMReg()->next(6));
-reg_def XMM27h( SOC, SOE, Op_RegF, 27, xmm27->as_VMReg()->next(7));
-reg_def XMM27i( SOC, SOE, Op_RegF, 27, xmm27->as_VMReg()->next(8));
-reg_def XMM27j( SOC, SOE, Op_RegF, 27, xmm27->as_VMReg()->next(9));
-reg_def XMM27k( SOC, SOE, Op_RegF, 27, xmm27->as_VMReg()->next(10));
-reg_def XMM27l( SOC, SOE, Op_RegF, 27, xmm27->as_VMReg()->next(11));
-reg_def XMM27m( SOC, SOE, Op_RegF, 27, xmm27->as_VMReg()->next(12));
-reg_def XMM27n( SOC, SOE, Op_RegF, 27, xmm27->as_VMReg()->next(13));
-reg_def XMM27o( SOC, SOE, Op_RegF, 27, xmm27->as_VMReg()->next(14));
-reg_def XMM27p( SOC, SOE, Op_RegF, 27, xmm27->as_VMReg()->next(15));
-
-reg_def XMM28 ( SOC, SOE, Op_RegF, 28, xmm28->as_VMReg());
-reg_def XMM28b( SOC, SOE, Op_RegF, 28, xmm28->as_VMReg()->next(1));
-reg_def XMM28c( SOC, SOE, Op_RegF, 28, xmm28->as_VMReg()->next(2));
-reg_def XMM28d( SOC, SOE, Op_RegF, 28, xmm28->as_VMReg()->next(3));
-reg_def XMM28e( SOC, SOE, Op_RegF, 28, xmm28->as_VMReg()->next(4));
-reg_def XMM28f( SOC, SOE, Op_RegF, 28, xmm28->as_VMReg()->next(5));
-reg_def XMM28g( SOC, SOE, Op_RegF, 28, xmm28->as_VMReg()->next(6));
-reg_def XMM28h( SOC, SOE, Op_RegF, 28, xmm28->as_VMReg()->next(7));
-reg_def XMM28i( SOC, SOE, Op_RegF, 28, xmm28->as_VMReg()->next(8));
-reg_def XMM28j( SOC, SOE, Op_RegF, 28, xmm28->as_VMReg()->next(9));
-reg_def XMM28k( SOC, SOE, Op_RegF, 28, xmm28->as_VMReg()->next(10));
-reg_def XMM28l( SOC, SOE, Op_RegF, 28, xmm28->as_VMReg()->next(11));
-reg_def XMM28m( SOC, SOE, Op_RegF, 28, xmm28->as_VMReg()->next(12));
-reg_def XMM28n( SOC, SOE, Op_RegF, 28, xmm28->as_VMReg()->next(13));
-reg_def XMM28o( SOC, SOE, Op_RegF, 28, xmm28->as_VMReg()->next(14));
-reg_def XMM28p( SOC, SOE, Op_RegF, 28, xmm28->as_VMReg()->next(15));
-
-reg_def XMM29 ( SOC, SOE, Op_RegF, 29, xmm29->as_VMReg());
-reg_def XMM29b( SOC, SOE, Op_RegF, 29, xmm29->as_VMReg()->next(1));
-reg_def XMM29c( SOC, SOE, Op_RegF, 29, xmm29->as_VMReg()->next(2));
-reg_def XMM29d( SOC, SOE, Op_RegF, 29, xmm29->as_VMReg()->next(3));
-reg_def XMM29e( SOC, SOE, Op_RegF, 29, xmm29->as_VMReg()->next(4));
-reg_def XMM29f( SOC, SOE, Op_RegF, 29, xmm29->as_VMReg()->next(5));
-reg_def XMM29g( SOC, SOE, Op_RegF, 29, xmm29->as_VMReg()->next(6));
-reg_def XMM29h( SOC, SOE, Op_RegF, 29, xmm29->as_VMReg()->next(7));
-reg_def XMM29i( SOC, SOE, Op_RegF, 29, xmm29->as_VMReg()->next(8));
-reg_def XMM29j( SOC, SOE, Op_RegF, 29, xmm29->as_VMReg()->next(9));
-reg_def XMM29k( SOC, SOE, Op_RegF, 29, xmm29->as_VMReg()->next(10));
-reg_def XMM29l( SOC, SOE, Op_RegF, 29, xmm29->as_VMReg()->next(11));
-reg_def XMM29m( SOC, SOE, Op_RegF, 29, xmm29->as_VMReg()->next(12));
-reg_def XMM29n( SOC, SOE, Op_RegF, 29, xmm29->as_VMReg()->next(13));
-reg_def XMM29o( SOC, SOE, Op_RegF, 29, xmm29->as_VMReg()->next(14));
-reg_def XMM29p( SOC, SOE, Op_RegF, 29, xmm29->as_VMReg()->next(15));
-
-reg_def XMM30 ( SOC, SOE, Op_RegF, 30, xmm30->as_VMReg());
-reg_def XMM30b( SOC, SOE, Op_RegF, 30, xmm30->as_VMReg()->next(1));
-reg_def XMM30c( SOC, SOE, Op_RegF, 30, xmm30->as_VMReg()->next(2));
-reg_def XMM30d( SOC, SOE, Op_RegF, 30, xmm30->as_VMReg()->next(3));
-reg_def XMM30e( SOC, SOE, Op_RegF, 30, xmm30->as_VMReg()->next(4));
-reg_def XMM30f( SOC, SOE, Op_RegF, 30, xmm30->as_VMReg()->next(5));
-reg_def XMM30g( SOC, SOE, Op_RegF, 30, xmm30->as_VMReg()->next(6));
-reg_def XMM30h( SOC, SOE, Op_RegF, 30, xmm30->as_VMReg()->next(7));
-reg_def XMM30i( SOC, SOE, Op_RegF, 30, xmm30->as_VMReg()->next(8));
-reg_def XMM30j( SOC, SOE, Op_RegF, 30, xmm30->as_VMReg()->next(9));
-reg_def XMM30k( SOC, SOE, Op_RegF, 30, xmm30->as_VMReg()->next(10));
-reg_def XMM30l( SOC, SOE, Op_RegF, 30, xmm30->as_VMReg()->next(11));
-reg_def XMM30m( SOC, SOE, Op_RegF, 30, xmm30->as_VMReg()->next(12));
-reg_def XMM30n( SOC, SOE, Op_RegF, 30, xmm30->as_VMReg()->next(13));
-reg_def XMM30o( SOC, SOE, Op_RegF, 30, xmm30->as_VMReg()->next(14));
-reg_def XMM30p( SOC, SOE, Op_RegF, 30, xmm30->as_VMReg()->next(15));
-
-reg_def XMM31 ( SOC, SOE, Op_RegF, 31, xmm31->as_VMReg());
-reg_def XMM31b( SOC, SOE, Op_RegF, 31, xmm31->as_VMReg()->next(1));
-reg_def XMM31c( SOC, SOE, Op_RegF, 31, xmm31->as_VMReg()->next(2));
-reg_def XMM31d( SOC, SOE, Op_RegF, 31, xmm31->as_VMReg()->next(3));
-reg_def XMM31e( SOC, SOE, Op_RegF, 31, xmm31->as_VMReg()->next(4));
-reg_def XMM31f( SOC, SOE, Op_RegF, 31, xmm31->as_VMReg()->next(5));
-reg_def XMM31g( SOC, SOE, Op_RegF, 31, xmm31->as_VMReg()->next(6));
-reg_def XMM31h( SOC, SOE, Op_RegF, 31, xmm31>-as_VMReg()->next(7));
-reg_def XMM31i( SOC, SOE, Op_RegF, 31, xmm31->as_VMReg()->next(8));
-reg_def XMM31j( SOC, SOE, Op_RegF, 31, xmm31->as_VMReg()->next(9));
-reg_def XMM31k( SOC, SOE, Op_RegF, 31, xmm31->as_VMReg()->next(10));
-reg_def XMM31l( SOC, SOE, Op_RegF, 31, xmm31->as_VMReg()->next(11));
-reg_def XMM31m( SOC, SOE, Op_RegF, 31, xmm31->as_VMReg()->next(12));
-reg_def XMM31n( SOC, SOE, Op_RegF, 31, xmm31->as_VMReg()->next(13));
-reg_def XMM31o( SOC, SOE, Op_RegF, 31, xmm31->as_VMReg()->next(14));
-reg_def XMM31p( SOC, SOE, Op_RegF, 31, xmm31->as_VMReg()->next(15));
-
-#else // _WIN64
-
 reg_def XMM6 ( SOC, SOC, Op_RegF, 6, xmm6->as_VMReg());
 reg_def XMM6b( SOC, SOC, Op_RegF, 6, xmm6->as_VMReg()->next(1));
 reg_def XMM6c( SOC, SOC, Op_RegF, 6, xmm6->as_VMReg()->next(2));
@@ -1067,8 +622,6 @@
 
 #endif // _LP64
 
-#endif // _WIN64
-
 #ifdef _LP64
 reg_def RFLAGS(SOC, SOC, 0, 16, VMRegImpl::Bad());
 #else
@@ -3113,6 +2666,30 @@
   ins_pipe(pipe_slow);
 %}
 
+// a * b + c
+instruct fmaD_reg(regD a, regD b, regD c) %{
+  predicate(UseFMA);
+  match(Set c (FmaD  c (Binary a b)));
+  format %{ "fmasd $a,$b,$c\t# $c = $a * $b + $c" %}
+  ins_cost(150);
+  ins_encode %{
+    __ fmad($c$$XMMRegister, $a$$XMMRegister, $b$$XMMRegister, $c$$XMMRegister);
+  %}
+  ins_pipe( pipe_slow );
+%}
+
+// a * b + c
+instruct fmaF_reg(regF a, regF b, regF c) %{
+  predicate(UseFMA);
+  match(Set c (FmaF  c (Binary a b)));
+  format %{ "fmass $a,$b,$c\t# $c = $a * $b + $c" %}
+  ins_cost(150);
+  ins_encode %{
+    __ fmaf($c$$XMMRegister, $a$$XMMRegister, $b$$XMMRegister, $c$$XMMRegister);
+  %}
+  ins_pipe( pipe_slow );
+%}
+
 // ====================VECTOR INSTRUCTIONS=====================================
 
 // Load vectors (4 bytes long)
--- a/hotspot/src/cpu/x86/vm/x86_32.ad	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/cpu/x86/vm/x86_32.ad	Wed Jul 05 22:19:13 2017 +0200
@@ -104,14 +104,14 @@
 //
 // Empty fill registers, which are never used, but supply alignment to xmm regs
 //
-reg_def FILL0( SOC, SOC, Op_RegF, 7, as_FloatRegister(6)->as_VMReg()->next(2));
-reg_def FILL1( SOC, SOC, Op_RegF, 7, as_FloatRegister(6)->as_VMReg()->next(3));
-reg_def FILL2( SOC, SOC, Op_RegF, 7, as_FloatRegister(6)->as_VMReg()->next(4));
-reg_def FILL3( SOC, SOC, Op_RegF, 7, as_FloatRegister(6)->as_VMReg()->next(5));
-reg_def FILL4( SOC, SOC, Op_RegF, 7, as_FloatRegister(6)->as_VMReg()->next(6));
-reg_def FILL5( SOC, SOC, Op_RegF, 7, as_FloatRegister(6)->as_VMReg()->next(7));
-reg_def FILL6( SOC, SOC, Op_RegF, 7, as_FloatRegister(6)->as_VMReg()->next(8));
-reg_def FILL7( SOC, SOC, Op_RegF, 7, as_FloatRegister(6)->as_VMReg()->next(9));
+reg_def FILL0( SOC, SOC, Op_RegF, 8, VMRegImpl::Bad());
+reg_def FILL1( SOC, SOC, Op_RegF, 9, VMRegImpl::Bad());
+reg_def FILL2( SOC, SOC, Op_RegF, 10, VMRegImpl::Bad());
+reg_def FILL3( SOC, SOC, Op_RegF, 11, VMRegImpl::Bad());
+reg_def FILL4( SOC, SOC, Op_RegF, 12, VMRegImpl::Bad());
+reg_def FILL5( SOC, SOC, Op_RegF, 13, VMRegImpl::Bad());
+reg_def FILL6( SOC, SOC, Op_RegF, 14, VMRegImpl::Bad());
+reg_def FILL7( SOC, SOC, Op_RegF, 15, VMRegImpl::Bad());
 
 // Specify priority of register selection within phases of register
 // allocation.  Highest priority is first.  A useful heuristic is to
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.amd64/src/jdk/vm/ci/amd64/AMD64.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.amd64/src/jdk/vm/ci/amd64/AMD64.java	Wed Jul 05 22:19:13 2017 +0200
@@ -205,7 +205,8 @@
         AVX512CD,
         AVX512BW,
         AVX512VL,
-        SHA
+        SHA,
+        FMA
     }
 
     private final EnumSet<CPUFeature> features;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotJVMCIBackendFactory.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotJVMCIBackendFactory.java	Wed Jul 05 22:19:13 2017 +0200
@@ -124,6 +124,9 @@
         if ((config.vmVersionFeatures & config.amd64SHA) != 0) {
             features.add(AMD64.CPUFeature.SHA);
         }
+        if ((config.vmVersionFeatures & config.amd64FMA) != 0) {
+            features.add(AMD64.CPUFeature.FMA);
+        }
         return features;
     }
 
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotVMConfig.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotVMConfig.java	Wed Jul 05 22:19:13 2017 +0200
@@ -78,4 +78,5 @@
     final long amd64AVX512BW = getConstant("VM_Version::CPU_AVX512BW", Long.class);
     final long amd64AVX512VL = getConstant("VM_Version::CPU_AVX512VL", Long.class);
     final long amd64SHA = getConstant("VM_Version::CPU_SHA", Long.class);
+    final long amd64FMA = getConstant("VM_Version::CPU_FMA", Long.class);
 }
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java	Wed Jul 05 22:19:13 2017 +0200
@@ -26,8 +26,7 @@
 import static jdk.vm.ci.common.InitTimer.timer;
 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
 
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
+import java.lang.reflect.Executable;
 
 import jdk.vm.ci.code.BytecodeFrame;
 import jdk.vm.ci.code.InstalledCode;
@@ -385,10 +384,9 @@
     native boolean hasFinalizableSubclass(HotSpotResolvedObjectTypeImpl type);
 
     /**
-     * Gets the method corresponding to {@code holder} and slot number {@code slot} (i.e.
-     * {@link Method#slot} or {@link Constructor#slot}).
+     * Gets the method corresponding to {@code executable}.
      */
-    native HotSpotResolvedJavaMethodImpl getResolvedJavaMethodAtSlot(Class<?> holder, int slot);
+    native HotSpotResolvedJavaMethodImpl asResolvedJavaMethod(Executable executable);
 
     /**
      * Gets the maximum absolute offset of a PC relative call to {@code address} from any position
@@ -616,4 +614,9 @@
      */
     native int interpreterFrameSize(BytecodeFrame frame);
 
+    /**
+     * Invokes non-public method {@code java.lang.invoke.LambdaForm.compileToBytecode()} on
+     * {@code lambdaForm} (which must be a {@code java.lang.invoke.LambdaForm} instance).
+     */
+    native void compileToBytecode(Object lambdaForm);
 }
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java	Wed Jul 05 22:19:13 2017 +0200
@@ -22,7 +22,7 @@
  */
 package jdk.vm.ci.hotspot;
 
-import java.lang.reflect.Field;
+import java.util.Map;
 
 import jdk.vm.ci.code.BailoutException;
 import jdk.vm.ci.code.BytecodeFrame;
@@ -56,16 +56,11 @@
     @Override
     public String getMarkName(Mark mark) {
         int markId = (int) mark.id;
-        Field[] fields = runtime.getConfig().getClass().getDeclaredFields();
-        for (Field f : fields) {
-            if (f.getName().startsWith("MARKID_")) {
-                f.setAccessible(true);
-                try {
-                    if (f.getInt(runtime.getConfig()) == markId) {
-                        return f.getName();
-                    }
-                } catch (Exception e) {
-                }
+        HotSpotVMConfigStore store = runtime.getConfigStore();
+        for (Map.Entry<String, Long> e : store.getConstants().entrySet()) {
+            String name = e.getKey();
+            if (name.startsWith("MARKID_") && e.getValue() == markId) {
+                return name;
             }
         }
         return CodeCacheProvider.super.getMarkName(mark);
@@ -76,17 +71,13 @@
      */
     @Override
     public String getTargetName(Call call) {
-        Field[] fields = runtime.getConfig().getClass().getDeclaredFields();
-        for (Field f : fields) {
-            if (f.getName().endsWith("Stub")) {
-                f.setAccessible(true);
-                Object address;
-                try {
-                    address = f.get(runtime.getConfig());
-                    if (address.equals(call.target)) {
-                        return f.getName() + ":0x" + Long.toHexString((Long) address);
-                    }
-                } catch (IllegalArgumentException | IllegalAccessException e) {
+        if (call.target instanceof HotSpotForeignCallTarget) {
+            long address = ((HotSpotForeignCallTarget) call.target).address;
+            HotSpotVMConfigStore store = runtime.getConfigStore();
+            for (Map.Entry<String, VMField> e : store.getFields().entrySet()) {
+                VMField field = e.getValue();
+                if (field.isStatic() && field.value != null && field.value == address) {
+                    return e.getValue() + ":0x" + Long.toHexString(address);
                 }
             }
         }
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMetaAccessProvider.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMetaAccessProvider.java	Wed Jul 05 22:19:13 2017 +0200
@@ -28,11 +28,10 @@
 import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
 
 import java.lang.reflect.Array;
-import java.lang.reflect.Constructor;
 import java.lang.reflect.Executable;
 import java.lang.reflect.Field;
-import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
+import java.util.Objects;
 
 import jdk.vm.ci.code.CodeUtil;
 import jdk.vm.ci.code.TargetDescription;
@@ -78,35 +77,8 @@
         return new HotSpotSignature(runtime, signature);
     }
 
-    /**
-     * {@link Field} object of {@link Method#slot}.
-     */
-    private Field reflectionMethodSlot = getReflectionSlotField(Method.class);
-
-    /**
-     * {@link Field} object of {@link Constructor#slot}.
-     */
-    private Field reflectionConstructorSlot = getReflectionSlotField(Constructor.class);
-
-    private static Field getReflectionSlotField(Class<?> reflectionClass) {
-        try {
-            Field field = reflectionClass.getDeclaredField("slot");
-            field.setAccessible(true);
-            return field;
-        } catch (NoSuchFieldException | SecurityException e) {
-            throw new JVMCIError(e);
-        }
-    }
-
     public ResolvedJavaMethod lookupJavaMethod(Executable reflectionMethod) {
-        try {
-            Class<?> holder = reflectionMethod.getDeclaringClass();
-            Field slotField = reflectionMethod instanceof Constructor ? reflectionConstructorSlot : reflectionMethodSlot;
-            final int slot = slotField.getInt(reflectionMethod);
-            return runtime.getCompilerToVM().getResolvedJavaMethodAtSlot(holder, slot);
-        } catch (IllegalArgumentException | IllegalAccessException e) {
-            throw new JVMCIError(e);
-        }
+        return runtime.getCompilerToVM().asResolvedJavaMethod(Objects.requireNonNull(reflectionMethod));
     }
 
     public ResolvedJavaField lookupJavaField(Field reflectionField) {
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodHandleAccessProvider.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodHandleAccessProvider.java	Wed Jul 05 22:19:13 2017 +0200
@@ -24,16 +24,17 @@
 
 import static jdk.vm.ci.hotspot.CompilerToVM.compilerToVM;
 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
-import static jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl.fromObjectClass;
+
+import java.lang.invoke.MethodHandle;
+import java.util.Objects;
+
 import jdk.vm.ci.common.JVMCIError;
 import jdk.vm.ci.meta.ConstantReflectionProvider;
 import jdk.vm.ci.meta.JavaConstant;
-import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.MethodHandleAccessProvider;
 import jdk.vm.ci.meta.ResolvedJavaField;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
 import jdk.vm.ci.meta.ResolvedJavaType;
-import jdk.vm.ci.meta.Signature;
 
 public class HotSpotMethodHandleAccessProvider implements MethodHandleAccessProvider {
 
@@ -48,88 +49,46 @@
      * possible after the {@link HotSpotJVMCIRuntime} is fully initialized.
      */
     static class LazyInitialization {
+        static final ResolvedJavaType lambdaFormType;
         static final ResolvedJavaField methodHandleFormField;
         static final ResolvedJavaField lambdaFormVmentryField;
-        static final ResolvedJavaMethod lambdaFormCompileToBytecodeMethod;
         static final HotSpotResolvedJavaField memberNameVmtargetField;
 
-        static final ResolvedJavaType CLASS = fromObjectClass(LazyInitialization.class);
-
         /**
          * Search for an instance field with the given name in a class.
          *
-         * @param className name of the class to search in
+         * @param declaringType the type declaring the field
          * @param fieldName name of the field to be searched
          * @param fieldType resolved Java type of the field
          * @return resolved Java field
-         * @throws ClassNotFoundException
          * @throws NoSuchFieldError
          */
-        private static ResolvedJavaField findFieldInClass(String className, String fieldName, ResolvedJavaType fieldType)
-                throws ClassNotFoundException {
-            Class<?> clazz = Class.forName(className);
-            ResolvedJavaType type = runtime().fromClass(clazz);
-            ResolvedJavaField[] fields = type.getInstanceFields(false);
+        private static ResolvedJavaField findFieldInClass(ResolvedJavaType declaringType, String fieldName, ResolvedJavaType fieldType) {
+            ResolvedJavaField[] fields = declaringType.getInstanceFields(false);
             for (ResolvedJavaField field : fields) {
                 if (field.getName().equals(fieldName) && field.getType().equals(fieldType)) {
                     return field;
                 }
             }
-            throw new NoSuchFieldError(fieldType.getName() + " " + className + "." + fieldName);
+            throw new NoSuchFieldError(fieldType.getName() + " " + declaringType + "." + fieldName);
         }
 
-        private static ResolvedJavaMethod findMethodInClass(String className, String methodName,
-                ResolvedJavaType resultType, ResolvedJavaType[] parameterTypes) throws ClassNotFoundException {
-            Class<?> clazz = Class.forName(className);
-            HotSpotResolvedObjectTypeImpl type = fromObjectClass(clazz);
-            ResolvedJavaMethod result = null;
-            for (ResolvedJavaMethod method : type.getDeclaredMethods()) {
-                if (method.getName().equals(methodName) && signatureMatches(method, resultType, parameterTypes)) {
-                    result = method;
-                }
-            }
-            if (result == null) {
-                StringBuilder sig = new StringBuilder("(");
-                for (ResolvedJavaType t : parameterTypes) {
-                    sig.append(t.getName()).append(",");
-                }
-                if (sig.length() > 1) {
-                    sig.replace(sig.length() - 1, sig.length(), ")");
-                } else {
-                    sig.append(')');
-                }
-                throw new NoSuchMethodError(resultType.getName() + " " + className + "." + methodName + sig.toString());
-            }
-            return result;
+        private static ResolvedJavaType resolveType(Class<?> c) {
+            return runtime().fromClass(c);
         }
 
-        private static boolean signatureMatches(ResolvedJavaMethod m, ResolvedJavaType resultType,
-                ResolvedJavaType[] parameterTypes) {
-            Signature s = m.getSignature();
-            if (!s.getReturnType(CLASS).equals(resultType)) {
-                return false;
-            }
-            if (s.getParameterCount(false) != parameterTypes.length) {
-                return false;
-            }
-            for (int i = 0; i < s.getParameterCount(false); ++i) {
-                if (!s.getParameterType(i, CLASS).equals(parameterTypes[i])) {
-                    return false;
-                }
-            }
-            return true;
+        private static ResolvedJavaType resolveType(String className) throws ClassNotFoundException {
+            return resolveType(Class.forName(className));
         }
 
         static {
             try {
-                methodHandleFormField = findFieldInClass("java.lang.invoke.MethodHandle", "form",
-                    fromObjectClass(Class.forName("java.lang.invoke.LambdaForm")));
-                lambdaFormVmentryField = findFieldInClass("java.lang.invoke.LambdaForm", "vmentry",
-                    fromObjectClass(Class.forName("java.lang.invoke.MemberName")));
-                lambdaFormCompileToBytecodeMethod = findMethodInClass("java.lang.invoke.LambdaForm", "compileToBytecode",
-                    new HotSpotResolvedPrimitiveType(JavaKind.Void), new ResolvedJavaType[]{});
-                memberNameVmtargetField = (HotSpotResolvedJavaField) findFieldInClass("java.lang.invoke.MemberName", "vmtarget",
-                    new HotSpotResolvedPrimitiveType(JavaKind.Long));
+                ResolvedJavaType methodHandleType = resolveType(MethodHandle.class);
+                ResolvedJavaType memberNameType = resolveType("java.lang.invoke.MemberName");
+                lambdaFormType = resolveType("java.lang.invoke.LambdaForm");
+                methodHandleFormField = findFieldInClass(methodHandleType, "form", lambdaFormType);
+                lambdaFormVmentryField = findFieldInClass(lambdaFormType, "vmentry", memberNameType);
+                memberNameVmtargetField = (HotSpotResolvedJavaField) findFieldInClass(memberNameType, "vmtarget", resolveType(long.class));
             } catch (Throwable ex) {
                 throw new JVMCIError(ex);
             }
@@ -173,12 +132,13 @@
             return null;
         }
 
-        if (forceBytecodeGeneration) {
-            /* Invoke non-public method: MemberName LambdaForm.compileToBytecode() */
-            LazyInitialization.lambdaFormCompileToBytecodeMethod.invoke(lambdaForm, new JavaConstant[0]);
+        JavaConstant memberName = constantReflection.readFieldValue(LazyInitialization.lambdaFormVmentryField, lambdaForm);
+        if (memberName.isNull() && forceBytecodeGeneration) {
+            Object lf = ((HotSpotObjectConstant) lambdaForm).asObject(LazyInitialization.lambdaFormType);
+            compilerToVM().compileToBytecode(Objects.requireNonNull(lf));
+            memberName = constantReflection.readFieldValue(LazyInitialization.lambdaFormVmentryField, lambdaForm);
+            assert memberName.isNonNull();
         }
-        /* Load non-public field: MemberName LambdaForm.vmentry */
-        JavaConstant memberName = constantReflection.readFieldValue(LazyInitialization.lambdaFormVmentryField, lambdaForm);
         return getTargetMethod(memberName);
     }
 
@@ -200,4 +160,3 @@
         return compilerToVM().getResolvedJavaMethod(object, LazyInitialization.memberNameVmtargetField.offset());
     }
 }
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotModifiers.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.vm.ci.hotspot;
+
+import static java.lang.reflect.Modifier.ABSTRACT;
+import static java.lang.reflect.Modifier.FINAL;
+import static java.lang.reflect.Modifier.INTERFACE;
+import static java.lang.reflect.Modifier.NATIVE;
+import static java.lang.reflect.Modifier.PRIVATE;
+import static java.lang.reflect.Modifier.PROTECTED;
+import static java.lang.reflect.Modifier.PUBLIC;
+import static java.lang.reflect.Modifier.STATIC;
+import static java.lang.reflect.Modifier.STRICT;
+import static java.lang.reflect.Modifier.SYNCHRONIZED;
+import static java.lang.reflect.Modifier.TRANSIENT;
+import static java.lang.reflect.Modifier.VOLATILE;
+import static jdk.vm.ci.hotspot.HotSpotVMConfig.config;
+
+import java.lang.reflect.Modifier;
+
+/**
+ * The non-public modifiers in {@link Modifier} that need to be retrieved from
+ * {@link HotSpotVMConfig}.
+ */
+public class HotSpotModifiers {
+
+    // @formatter:off
+    public static final int ANNOTATION = config().jvmAccAnnotation;
+    public static final int ENUM       = config().jvmAccEnum;
+    public static final int VARARGS    = config().jvmAccVarargs;
+    public static final int BRIDGE     = config().jvmAccBridge;
+    public static final int SYNTHETIC  = config().jvmAccSynthetic;
+    // @formatter:on
+
+    public static int jvmClassModifiers() {
+        return PUBLIC | FINAL | INTERFACE | ABSTRACT | ANNOTATION | ENUM | SYNTHETIC;
+    }
+
+    public static int jvmMethodModifiers() {
+        return PUBLIC | PRIVATE | PROTECTED | STATIC | FINAL | SYNCHRONIZED | BRIDGE | VARARGS | NATIVE | ABSTRACT | STRICT | SYNTHETIC;
+    }
+
+    public static int jvmFieldModifiers() {
+        return PUBLIC | PRIVATE | PROTECTED | STATIC | FINAL | VOLATILE | TRANSIENT | ENUM | SYNTHETIC;
+    }
+}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaFieldImpl.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaFieldImpl.java	Wed Jul 05 22:19:13 2017 +0200
@@ -22,6 +22,7 @@
  */
 package jdk.vm.ci.hotspot;
 
+import static jdk.vm.ci.hotspot.HotSpotModifiers.jvmFieldModifiers;
 import static jdk.vm.ci.hotspot.HotSpotVMConfig.config;
 
 import java.lang.annotation.Annotation;
@@ -29,7 +30,6 @@
 
 import jdk.internal.vm.annotation.Stable;
 import jdk.vm.ci.meta.JavaType;
-import jdk.vm.ci.meta.ModifiersProvider;
 import jdk.vm.ci.meta.ResolvedJavaType;
 
 /**
@@ -81,7 +81,7 @@
 
     @Override
     public int getModifiers() {
-        return modifiers & ModifiersProvider.jvmFieldModifiers();
+        return modifiers & jvmFieldModifiers();
     }
 
     @Override
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java	Wed Jul 05 22:19:13 2017 +0200
@@ -24,13 +24,15 @@
 
 import static jdk.vm.ci.hotspot.CompilerToVM.compilerToVM;
 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
+import static jdk.vm.ci.hotspot.HotSpotModifiers.BRIDGE;
+import static jdk.vm.ci.hotspot.HotSpotModifiers.SYNTHETIC;
+import static jdk.vm.ci.hotspot.HotSpotModifiers.VARARGS;
+import static jdk.vm.ci.hotspot.HotSpotModifiers.jvmMethodModifiers;
 import static jdk.vm.ci.hotspot.HotSpotVMConfig.config;
 import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Executable;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.lang.reflect.Type;
 import java.util.HashMap;
@@ -42,13 +44,11 @@
 import jdk.vm.ci.meta.ConstantPool;
 import jdk.vm.ci.meta.DefaultProfilingInfo;
 import jdk.vm.ci.meta.ExceptionHandler;
-import jdk.vm.ci.meta.JavaConstant;
 import jdk.vm.ci.meta.JavaMethod;
 import jdk.vm.ci.meta.JavaType;
 import jdk.vm.ci.meta.LineNumberTable;
 import jdk.vm.ci.meta.Local;
 import jdk.vm.ci.meta.LocalVariableTable;
-import jdk.vm.ci.meta.ModifiersProvider;
 import jdk.vm.ci.meta.ProfilingInfo;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
 import jdk.vm.ci.meta.ResolvedJavaType;
@@ -210,7 +210,7 @@
 
     @Override
     public int getModifiers() {
-        return getAllModifiers() & ModifiersProvider.jvmMethodModifiers();
+        return getAllModifiers() & jvmMethodModifiers();
     }
 
     @Override
@@ -490,6 +490,19 @@
         return javaMethod == null ? null : javaMethod.getAnnotation(annotationClass);
     }
 
+    public boolean isBridge() {
+        return (BRIDGE & getModifiers()) != 0;
+    }
+
+    @Override
+    public boolean isSynthetic() {
+        return (SYNTHETIC & getModifiers()) != 0;
+    }
+
+    public boolean isVarArgs() {
+        return (VARARGS & getModifiers()) != 0;
+    }
+
     public boolean isDefault() {
         if (isConstructor()) {
             return false;
@@ -697,27 +710,6 @@
         return (getFlags() & config().methodFlagsIntrinsicCandidate) != 0;
     }
 
-    @Override
-    public JavaConstant invoke(JavaConstant receiver, JavaConstant[] arguments) {
-        assert !isConstructor();
-        Method javaMethod = (Method) toJava();
-        javaMethod.setAccessible(true);
-
-        Object[] objArguments = new Object[arguments.length];
-        for (int i = 0; i < arguments.length; i++) {
-            objArguments[i] = HotSpotObjectConstantImpl.asBoxedValue(arguments[i]);
-        }
-        Object objReceiver = receiver != null && !receiver.isNull() ? ((HotSpotObjectConstantImpl) receiver).object() : null;
-
-        try {
-            Object objResult = javaMethod.invoke(objReceiver, objArguments);
-            return javaMethod.getReturnType() == void.class ? null : HotSpotObjectConstantImpl.forBoxedValue(getSignature().getReturnKind(), objResult);
-
-        } catch (IllegalAccessException | InvocationTargetException ex) {
-            throw new IllegalArgumentException(ex);
-        }
-    }
-
     /**
      * Allocates a compile id for this method by asking the VM for one.
      *
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java	Wed Jul 05 22:19:13 2017 +0200
@@ -26,6 +26,7 @@
 import static jdk.vm.ci.hotspot.CompilerToVM.compilerToVM;
 import static jdk.vm.ci.hotspot.HotSpotConstantPool.isSignaturePolymorphicHolder;
 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
+import static jdk.vm.ci.hotspot.HotSpotModifiers.jvmClassModifiers;
 import static jdk.vm.ci.hotspot.HotSpotVMConfig.config;
 import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
 
@@ -49,7 +50,6 @@
 import jdk.vm.ci.meta.JavaConstant;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.JavaType;
-import jdk.vm.ci.meta.ModifiersProvider;
 import jdk.vm.ci.meta.ResolvedJavaField;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
 import jdk.vm.ci.meta.ResolvedJavaType;
@@ -152,7 +152,7 @@
         if (isArray()) {
             return (getElementalType().getModifiers() & (Modifier.PUBLIC | Modifier.PRIVATE | Modifier.PROTECTED)) | Modifier.FINAL | Modifier.ABSTRACT;
         } else {
-            return getAccessFlags() & ModifiersProvider.jvmClassModifiers();
+            return getAccessFlags() & jvmClassModifiers();
         }
     }
 
@@ -507,7 +507,7 @@
     synchronized HotSpotResolvedJavaField createField(String fieldName, JavaType type, long offset, int rawFlags) {
         HotSpotResolvedJavaField result = null;
 
-        final int flags = rawFlags & ModifiersProvider.jvmFieldModifiers();
+        final int flags = rawFlags & HotSpotModifiers.jvmFieldModifiers();
 
         final long id = offset + ((long) flags << 32);
 
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java	Wed Jul 05 22:19:13 2017 +0200
@@ -117,8 +117,12 @@
     final int jvmAccFieldHasGenericSignature = getConstant("JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE", Integer.class);
     final int jvmAccIsCloneableFast = getConstant("JVM_ACC_IS_CLONEABLE_FAST", Integer.class);
 
-    // Modifier.SYNTHETIC is not public so we get it via vmStructs.
+    // These modifiers are not public in Modifier so we get them via vmStructs.
     final int jvmAccSynthetic = getConstant("JVM_ACC_SYNTHETIC", Integer.class);
+    final int jvmAccAnnotation = getConstant("JVM_ACC_ANNOTATION", Integer.class);
+    final int jvmAccBridge = getConstant("JVM_ACC_BRIDGE", Integer.class);
+    final int jvmAccVarargs = getConstant("JVM_ACC_VARARGS", Integer.class);
+    final int jvmAccEnum = getConstant("JVM_ACC_ENUM", Integer.class);
 
     // This is only valid on AMD64.
     final int runtimeCallStackSize = getConstant("frame::arg_reg_save_area_bytes", Integer.class, osArch.equals("amd64") ? null : 0);
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/UnsafeAccess.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/UnsafeAccess.java	Wed Jul 05 22:19:13 2017 +0200
@@ -22,8 +22,6 @@
  */
 package jdk.vm.ci.hotspot;
 
-import java.lang.reflect.Field;
-
 import jdk.internal.misc.Unsafe;
 
 /**
@@ -31,21 +29,5 @@
  */
 class UnsafeAccess {
 
-    static final Unsafe UNSAFE = initUnsafe();
-
-    private static Unsafe initUnsafe() {
-        try {
-            // Fast path when we are trusted.
-            return Unsafe.getUnsafe();
-        } catch (SecurityException se) {
-            // Slow path when we are not trusted.
-            try {
-                Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
-                theUnsafe.setAccessible(true);
-                return (Unsafe) theUnsafe.get(Unsafe.class);
-            } catch (Exception e) {
-                throw new RuntimeException("exception while trying to get Unsafe", e);
-            }
-        }
-    }
+    static final Unsafe UNSAFE = Unsafe.getUnsafe();
 }
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MetaUtil.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MetaUtil.java	Wed Jul 05 22:19:13 2017 +0200
@@ -22,9 +22,6 @@
  */
 package jdk.vm.ci.meta;
 
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-
 /**
  * Miscellaneous collection of utility methods used by {@code jdk.vm.ci.meta} and its clients.
  */
@@ -226,17 +223,4 @@
         }
         return obj.getClass().getName() + "@" + System.identityHashCode(obj);
     }
-
-    /**
-     * Used to lookup constants from {@link Modifier} that are not public (VARARGS, SYNTHETIC etc.).
-     */
-    static int getNonPublicModifierStaticField(String name) {
-        try {
-            Field field = Modifier.class.getDeclaredField(name);
-            field.setAccessible(true);
-            return field.getInt(null);
-        } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
-            throw new InternalError(e);
-        }
-    }
 }
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ModifiersProvider.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ModifiersProvider.java	Wed Jul 05 22:19:13 2017 +0200
@@ -22,18 +22,9 @@
  */
 package jdk.vm.ci.meta;
 
-import static java.lang.reflect.Modifier.ABSTRACT;
-import static java.lang.reflect.Modifier.FINAL;
-import static java.lang.reflect.Modifier.INTERFACE;
-import static java.lang.reflect.Modifier.NATIVE;
 import static java.lang.reflect.Modifier.PRIVATE;
 import static java.lang.reflect.Modifier.PROTECTED;
 import static java.lang.reflect.Modifier.PUBLIC;
-import static java.lang.reflect.Modifier.STATIC;
-import static java.lang.reflect.Modifier.STRICT;
-import static java.lang.reflect.Modifier.SYNCHRONIZED;
-import static java.lang.reflect.Modifier.TRANSIENT;
-import static java.lang.reflect.Modifier.VOLATILE;
 
 import java.lang.reflect.Modifier;
 
@@ -42,17 +33,9 @@
  * language {@linkplain #getModifiers() modifiers}.
  */
 public interface ModifiersProvider {
-    int BRIDGE = MetaUtil.getNonPublicModifierStaticField("BRIDGE");
-    int VARARGS = MetaUtil.getNonPublicModifierStaticField("VARARGS");
-    int SYNTHETIC = MetaUtil.getNonPublicModifierStaticField("SYNTHETIC");
-    int ANNOTATION = MetaUtil.getNonPublicModifierStaticField("ANNOTATION");
-    int ENUM = MetaUtil.getNonPublicModifierStaticField("ENUM");
-    int MANDATED = MetaUtil.getNonPublicModifierStaticField("MANDATED");
 
     /**
-     * Returns the Java Virtual Machine modifiers for this element. Note that this can differ from
-     * standard Java Reflection modifiers. For example at the JVM level, classes (
-     * {@link ResolvedJavaType}) can not be private or protected.
+     * Returns the modifiers for this element.
      */
     int getModifiers();
 
@@ -161,17 +144,4 @@
     default boolean isConcrete() {
         return !isAbstract();
     }
-
-    static int jvmClassModifiers() {
-        // no SUPER
-        return PUBLIC | FINAL | INTERFACE | ABSTRACT | ANNOTATION | ENUM | SYNTHETIC;
-    }
-
-    static int jvmMethodModifiers() {
-        return PUBLIC | PRIVATE | PROTECTED | STATIC | FINAL | SYNCHRONIZED | BRIDGE | VARARGS | NATIVE | ABSTRACT | STRICT | SYNTHETIC;
-    }
-
-    static int jvmFieldModifiers() {
-        return PUBLIC | PRIVATE | PROTECTED | STATIC | FINAL | VOLATILE | TRANSIENT | ENUM | SYNTHETIC;
-    }
 }
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaMethod.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaMethod.java	Wed Jul 05 22:19:13 2017 +0200
@@ -26,7 +26,6 @@
 import java.lang.reflect.AnnotatedElement;
 import java.lang.reflect.Array;
 import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
 import java.lang.reflect.Type;
 
 /**
@@ -72,14 +71,6 @@
      */
     int getMaxStackSize();
 
-    /**
-     * {@inheritDoc}
-     * <p>
-     * Only the {@linkplain Modifier#methodModifiers() method flags} specified in the JVM
-     * specification will be included in the returned mask.
-     */
-    int getModifiers();
-
     default boolean isFinal() {
         return ModifiersProvider.super.isFinalFlagSet();
     }
@@ -88,9 +79,7 @@
      * Determines if this method is a synthetic method as defined by the Java Language
      * Specification.
      */
-    default boolean isSynthetic() {
-        return (SYNTHETIC & getModifiers()) == SYNTHETIC;
-    }
+    boolean isSynthetic();
 
     /**
      * Checks that the method is a
@@ -99,9 +88,7 @@
      *
      * @return whether the method is a varargs method
      */
-    default boolean isVarArgs() {
-        return (VARARGS & getModifiers()) == VARARGS;
-    }
+    boolean isVarArgs();
 
     /**
      * Checks that the method is a
@@ -110,9 +97,7 @@
      *
      * @return whether the method is a bridge method
      */
-    default boolean isBridge() {
-        return (BRIDGE & getModifiers()) == BRIDGE;
-    }
+    boolean isBridge();
 
     /**
      * Returns {@code true} if this method is a default method; returns {@code false} otherwise.
@@ -228,18 +213,6 @@
     LocalVariableTable getLocalVariableTable();
 
     /**
-     * Invokes the underlying method represented by this object, on the specified object with the
-     * specified parameters. This method is similar to a reflective method invocation by
-     * {@link Method#invoke}.
-     *
-     * @param receiver The receiver for the invocation, or {@code null} if it is a static method.
-     * @param arguments The arguments for the invocation.
-     * @return The value returned by the method invocation, or {@code null} if the return type is
-     *         {@code void}.
-     */
-    JavaConstant invoke(JavaConstant receiver, JavaConstant[] arguments);
-
-    /**
      * Gets the encoding of (that is, a constant representing the value of) this method.
      *
      * @return a constant representing a reference to this method
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaType.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaType.java	Wed Jul 05 22:19:13 2017 +0200
@@ -68,15 +68,6 @@
      */
     boolean isPrimitive();
 
-    /**
-     * {@inheritDoc}
-     * <p>
-     * Only the flags specified in the JVM specification will be included in the returned mask. This
-     * method is identical to {@link Class#getModifiers()} in terms of the value return for this
-     * type.
-     */
-    int getModifiers();
-
     /*
      * The setting of the final bit for types is a bit confusing since arrays are marked as final.
      * This method provides a semantically equivalent test that appropriate for types.
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -2366,7 +2366,9 @@
   if (Interpreter::contains(pc)) {
     *fr = os::fetch_frame_from_context((void*)exceptionInfo->ContextRecord);
     if (!fr->is_first_java_frame()) {
-      assert(fr->safe_for_sender(thread), "Safety check");
+      // get_frame_at_stack_banging_point() is only called when we
+      // have well defined stacks so java_sender() calls do not need
+      // to assert safe_for_sender() first.
       *fr = fr->java_sender();
     }
   } else {
@@ -2383,7 +2385,7 @@
       // has been pushed on the stack
       *fr = frame(fr->sp() + 1, fr->fp(), (address)*(fr->sp()));
       if (!fr->is_java_frame()) {
-        assert(fr->safe_for_sender(thread), "Safety check");
+        // See java_sender() comment above.
         *fr = fr->java_sender();
       }
     }
--- a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -378,7 +378,9 @@
     // method returns the Java sender of the current frame.
     *fr = os::fetch_frame_from_ucontext(thread, uc);
     if (!fr->is_first_java_frame()) {
-      assert(fr->safe_for_sender(thread), "Safety check");
+      // get_frame_at_stack_banging_point() is only called when we
+      // have well defined stacks so java_sender() calls do not need
+      // to assert safe_for_sender() first.
       *fr = fr->java_sender();
     }
   } else {
@@ -395,7 +397,7 @@
       // has been pushed on the stack
       *fr = frame(fr->sp() + 1, fr->fp(), (address)*(fr->sp()));
       if (!fr->is_java_frame()) {
-        assert(fr->safe_for_sender(thread), "Safety check");
+        // See java_sender() comment above.
         *fr = fr->java_sender();
       }
     }
--- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -191,7 +191,9 @@
     // method returns the Java sender of the current frame.
     *fr = os::fetch_frame_from_ucontext(thread, uc);
     if (!fr->is_first_java_frame()) {
-      assert(fr->safe_for_sender(thread), "Safety check");
+      // get_frame_at_stack_banging_point() is only called when we
+      // have well defined stacks so java_sender() calls do not need
+      // to assert safe_for_sender() first.
       *fr = fr->java_sender();
     }
   } else {
@@ -209,8 +211,8 @@
       intptr_t* sp = os::Linux::ucontext_get_sp(uc);
       *fr = frame(sp + 1, fp, (address)*sp);
       if (!fr->is_java_frame()) {
-        assert(fr->safe_for_sender(thread), "Safety check");
         assert(!fr->is_first_frame(), "Safety check");
+        // See java_sender() comment above.
         *fr = fr->java_sender();
       }
     }
--- a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -255,7 +255,9 @@
     // method returns the Java sender of the current frame.
     *fr = os::fetch_frame_from_ucontext(thread, uc);
     if (!fr->is_first_java_frame()) {
-      assert(fr->safe_for_sender(thread), "Safety check");
+      // get_frame_at_stack_banging_point() is only called when we
+      // have well defined stacks so java_sender() calls do not need
+      // to assert safe_for_sender() first.
       *fr = fr->java_sender();
     }
   } else {
@@ -273,7 +275,7 @@
       intptr_t* sp = os::Solaris::ucontext_get_sp(uc);
       *fr = frame(sp + 1, fp, (address)*sp);
       if (!fr->is_java_frame()) {
-        assert(fr->safe_for_sender(thread), "Safety check");
+        // See java_sender() comment above.
         *fr = fr->java_sender();
       }
     }
--- a/hotspot/src/share/vm/adlc/formssel.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/adlc/formssel.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -1245,6 +1245,7 @@
       this != short_branch &&   // Don't match myself
       !is_short_branch() &&     // Don't match another short branch variant
       reduce_result() != NULL &&
+      strstr(_ident, "restoreMask") == NULL && // Don't match side effects
       strcmp(reduce_result(), short_branch->reduce_result()) == 0 &&
       _matrule->equivalent(AD.globalNames(), short_branch->_matrule)) {
     // The instructions are equivalent.
@@ -4037,6 +4038,8 @@
         strcmp(opType,"EncodeP")==0 ||
         strcmp(opType,"EncodePKlass")==0 ||
         strcmp(opType,"DecodeNKlass")==0 ||
+        strcmp(opType,"FmaD") == 0 ||
+        strcmp(opType,"FmaF") == 0 ||
         strcmp(opType,"RoundDouble")==0 ||
         strcmp(opType,"RoundFloat")==0 ||
         strcmp(opType,"ReverseBytesI")==0 ||
--- a/hotspot/src/share/vm/c1/c1_Compiler.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/c1/c1_Compiler.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -162,6 +162,8 @@
   case vmIntrinsics::_dlog10:
   case vmIntrinsics::_dexp:
   case vmIntrinsics::_dpow:
+  case vmIntrinsics::_fmaD:
+  case vmIntrinsics::_fmaF:
   case vmIntrinsics::_getObject:
   case vmIntrinsics::_getBoolean:
   case vmIntrinsics::_getByte:
--- a/hotspot/src/share/vm/c1/c1_LIR.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/c1/c1_LIR.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -666,7 +666,9 @@
 
 // LIR_Op3
     case lir_idiv:
-    case lir_irem: {
+    case lir_irem:
+    case lir_fmad:
+    case lir_fmaf: {
       assert(op->as_Op3() != NULL, "must be");
       LIR_Op3* op3= (LIR_Op3*)op;
 
@@ -1663,6 +1665,8 @@
      // LIR_Op3
      case lir_idiv:                  s = "idiv";          break;
      case lir_irem:                  s = "irem";          break;
+     case lir_fmad:                  s = "fmad";          break;
+     case lir_fmaf:                  s = "fmaf";          break;
      // LIR_OpJavaCall
      case lir_static_call:           s = "static";        break;
      case lir_optvirtual_call:       s = "optvirtual";    break;
--- a/hotspot/src/share/vm/c1/c1_LIR.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/c1/c1_LIR.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -956,6 +956,8 @@
   , begin_op3
       , lir_idiv
       , lir_irem
+      , lir_fmad
+      , lir_fmaf
   , end_op3
   , begin_opJavaCall
       , lir_static_call
@@ -2149,6 +2151,8 @@
 
   void abs (LIR_Opr from, LIR_Opr to, LIR_Opr tmp)                { append(new LIR_Op2(lir_abs , from, tmp, to)); }
   void sqrt(LIR_Opr from, LIR_Opr to, LIR_Opr tmp)                { append(new LIR_Op2(lir_sqrt, from, tmp, to)); }
+  void fmad(LIR_Opr from, LIR_Opr from1, LIR_Opr from2, LIR_Opr to) { append(new LIR_Op3(lir_fmad, from, from1, from2, to)); }
+  void fmaf(LIR_Opr from, LIR_Opr from1, LIR_Opr from2, LIR_Opr to) { append(new LIR_Op3(lir_fmaf, from, from1, from2, to)); }
   void log10 (LIR_Opr from, LIR_Opr to, LIR_Opr tmp)              { append(new LIR_Op2(lir_log10, from, LIR_OprFact::illegalOpr, to, tmp)); }
   void tan (LIR_Opr from, LIR_Opr to, LIR_Opr tmp1, LIR_Opr tmp2) { append(new LIR_Op2(lir_tan , from, tmp1, to, tmp2)); }
 
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -3181,6 +3181,9 @@
   case vmIntrinsics::_dpow :          do_MathIntrinsic(x); break;
   case vmIntrinsics::_arraycopy:      do_ArrayCopy(x);     break;
 
+  case vmIntrinsics::_fmaD:           do_FmaIntrinsic(x); break;
+  case vmIntrinsics::_fmaF:           do_FmaIntrinsic(x); break;
+
   // java.nio.Buffer.checkIndex
   case vmIntrinsics::_checkIndex:     do_NIOCheckIndex(x); break;
 
@@ -3244,14 +3247,14 @@
       Bytecodes::Code bc = x->method()->java_code_at_bci(bci);
       int start = 0;
       int stop = data->is_CallTypeData() ? ((ciCallTypeData*)data)->number_of_arguments() : ((ciVirtualCallTypeData*)data)->number_of_arguments();
-      if (x->inlined() && x->callee()->is_static() && Bytecodes::has_receiver(bc)) {
+      if (x->callee()->is_loaded() && x->callee()->is_static() && Bytecodes::has_receiver(bc)) {
         // first argument is not profiled at call (method handle invoke)
         assert(x->method()->raw_code_at_bci(bci) == Bytecodes::_invokehandle, "invokehandle expected");
         start = 1;
       }
       ciSignature* callee_signature = x->callee()->signature();
       // method handle call to virtual method
-      bool has_receiver = x->inlined() && !x->callee()->is_static() && !Bytecodes::has_receiver(bc);
+      bool has_receiver = x->callee()->is_loaded() && !x->callee()->is_static() && !Bytecodes::has_receiver(bc);
       ciSignatureStream callee_signature_stream(callee_signature, has_receiver ? x->callee()->holder() : NULL);
 
       bool ignored_will_link;
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -245,6 +245,7 @@
   void do_isPrimitive(Intrinsic* x);
   void do_getClass(Intrinsic* x);
   void do_currentThread(Intrinsic* x);
+  void do_FmaIntrinsic(Intrinsic* x);
   void do_MathIntrinsic(Intrinsic* x);
   void do_LibmIntrinsic(Intrinsic* x);
   void do_ArrayCopy(Intrinsic* x);
--- a/hotspot/src/share/vm/classfile/classLoader.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -85,6 +85,7 @@
 typedef jzentry* (JNICALL *GetNextEntry_t)(jzfile *zip, jint n);
 typedef jboolean (JNICALL *ZipInflateFully_t)(void *inBuf, jlong inLen, void *outBuf, jlong outLen, char **pmsg);
 typedef jint     (JNICALL *Crc32_t)(jint crc, const jbyte *buf, jint len);
+typedef void     (JNICALL *FreeEntry_t)(jzfile *zip, jzentry *entry);
 
 static ZipOpen_t         ZipOpen            = NULL;
 static ZipClose_t        ZipClose           = NULL;
@@ -95,6 +96,7 @@
 static canonicalize_fn_t CanonicalizeEntry  = NULL;
 static ZipInflateFully_t ZipInflateFully    = NULL;
 static Crc32_t           Crc32              = NULL;
+static FreeEntry_t       FreeEntry          = NULL;
 
 // Entry points for jimage.dll for loading jimage file entries
 
@@ -150,6 +152,7 @@
 GrowableArray<char*>* ClassLoader::_boot_modules_array = NULL;
 GrowableArray<char*>* ClassLoader::_platform_modules_array = NULL;
 SharedPathsMiscInfo* ClassLoader::_shared_paths_misc_info = NULL;
+int  ClassLoader::_num_patch_mod_prefixes = 0;
 #endif
 
 // helper routines
@@ -319,6 +322,20 @@
   FREE_C_HEAP_ARRAY(char, _zip_name);
 }
 
+bool ClassPathZipEntry::stream_exists(const char* name) {
+  // enable call to C land
+  JavaThread* thread = JavaThread::current();
+  ThreadToNativeFromVM ttn(thread);
+  // check whether zip archive contains name
+  jint name_len, filesize;
+  jzentry* entry = (*FindEntry)(_zip, name, &filesize, &name_len);
+  if (entry != NULL) {
+    (*FreeEntry)(_zip, entry);
+    return true;
+  }
+  return false;
+}
+
 u1* ClassPathZipEntry::open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS) {
     // enable call to C land
   JavaThread* thread = JavaThread::current();
@@ -640,7 +657,7 @@
 
   struct stat st;
   if (os::stat(path, &st) == 0) {
-    if ((st.st_mode & S_IFREG) != S_IFREG) { // is directory
+    if ((st.st_mode & S_IFMT) != S_IFREG) { // is not a regular file
       if (!os::dir_is_empty(path)) {
         tty->print_cr("Error: non-empty directory '%s'", path);
         exit_with_path_failure("CDS allows only empty directories in archived classpaths", NULL);
@@ -693,8 +710,6 @@
   GrowableArray<ModulePatchPath*>* patch_mod_args = Arguments::get_patch_mod_prefix();
   int num_of_entries = patch_mod_args->length();
 
-  assert(!DumpSharedSpaces, "DumpSharedSpaces not supported with --patch-module");
-  assert(!UseSharedSpaces, "UseSharedSpaces not supported with --patch-module");
 
   // Set up the boot loader's _patch_mod_entries list
   _patch_mod_entries = new (ResourceObj::C_HEAP, mtModule) GrowableArray<ModuleClassPathList*>(num_of_entries, true);
@@ -851,7 +866,7 @@
                                                      bool is_boot_append, TRAPS) {
   JavaThread* thread = JavaThread::current();
   ClassPathEntry* new_entry = NULL;
-  if ((st->st_mode & S_IFREG) == S_IFREG) {
+  if ((st->st_mode & S_IFMT) == S_IFREG) {
     ResourceMark rm(thread);
     // Regular file, should be a zip or jimage file
     // Canonicalized filename
@@ -914,7 +929,7 @@
   // check for a regular file
   struct stat st;
   if (os::stat(path, &st) == 0) {
-    if ((st.st_mode & S_IFREG) == S_IFREG) {
+    if ((st.st_mode & S_IFMT) == S_IFREG) {
       char canonical_path[JVM_MAXPATHLEN];
       if (get_canonical_path(path, canonical_path, JVM_MAXPATHLEN)) {
         char* error_msg = NULL;
@@ -1068,6 +1083,7 @@
   GetNextEntry = CAST_TO_FN_PTR(GetNextEntry_t, os::dll_lookup(handle, "ZIP_GetNextEntry"));
   ZipInflateFully = CAST_TO_FN_PTR(ZipInflateFully_t, os::dll_lookup(handle, "ZIP_InflateFully"));
   Crc32        = CAST_TO_FN_PTR(Crc32_t, os::dll_lookup(handle, "ZIP_CRC32"));
+  FreeEntry    = CAST_TO_FN_PTR(FreeEntry_t, os::dll_lookup(handle, "ZIP_FreeEntry"));
 
   // ZIP_Close is not exported on Windows in JDK5.0 so don't abort if ZIP_Close is NULL
   if (ZipOpen == NULL || FindEntry == NULL || ReadEntry == NULL ||
@@ -1395,6 +1411,57 @@
   return NULL;
 }
 
+#if INCLUDE_CDS
+// The following function is only used during CDS dump time.
+// It checks if a class can be found in the jar entries of the _patch_mod_entries.
+// It does not support non-jar entries.
+bool ClassLoader::is_in_patch_module(const char* const file_name) {
+  assert(DumpSharedSpaces, "dump time only");
+  if (_patch_mod_entries == NULL) {
+    return false;
+  }
+
+  int num_of_entries = _patch_mod_entries->length();
+  char* class_module_name = NULL;
+  ResourceMark rm;
+  const char *pkg_name = package_from_name(file_name);
+  // Using the jimage to obtain the class' module name.
+  // The ModuleEntryTable cannot be used at this point during dump time
+  // because the module system hasn't been initialized yet.
+  if (pkg_name != NULL) {
+    JImageFile *jimage = _jrt_entry->jimage();
+    class_module_name = (char*)(*JImagePackageToModule)(jimage, pkg_name);
+  }
+
+  if (class_module_name == NULL) {
+    return false;
+  }
+
+  // Loop through all the patch module entries looking for module
+  for (int i = 0; i < num_of_entries; i++) {
+    ModuleClassPathList* module_cpl = _patch_mod_entries->at(i);
+    Symbol* module_cpl_name = module_cpl->module_name();
+
+    if (strcmp(module_cpl_name->as_C_string(), class_module_name) == 0) {
+      // Class' module has been located, attempt to locate
+      // the class from the module's ClassPathEntry list.
+      ClassPathEntry* e = module_cpl->module_first_entry();
+      while (e != NULL) {
+        if (e->is_jar_file()) {
+          if (e->stream_exists(file_name)) {
+            return true;
+          } else {
+            e = e->next();
+          }
+        }
+      }
+    }
+  }
+
+  return false;
+}
+#endif // INCLUDE_CDS
+
 instanceKlassHandle ClassLoader::load_class(Symbol* name, bool search_append_only, TRAPS) {
   assert(name != NULL, "invariant");
   assert(THREAD->is_Java_thread(), "must be a JavaThread");
@@ -1420,8 +1487,8 @@
 
   // If DumpSharedSpaces is true boot loader visibility boundaries are set to:
   //   - [jimage] + [_first_append_entry to _last_append_entry] (all path entries).
-  // No --patch-module entries or exploded module builds are included since CDS
-  // is not supported if --patch-module or exploded module builds are used.
+  // If a class is found in the --patch-module entries, the class will not be included in the
+  // CDS archive. Also, CDS is not supported if exploded module builds are used.
   //
   // If search_append_only is true, boot loader visibility boundaries are
   // set to be _first_append_entry to the end. This includes:
@@ -1444,8 +1511,17 @@
   // found within its module specification, the search should continue to Load Attempt #2.
   // Note: The --patch-module entries are never searched if the boot loader's
   //       visibility boundary is limited to only searching the append entries.
-  if (_patch_mod_entries != NULL && !search_append_only && !DumpSharedSpaces) {
-    stream = search_module_entries(_patch_mod_entries, class_name, file_name, CHECK_NULL);
+  if (_patch_mod_entries != NULL && !search_append_only) {
+    if (!DumpSharedSpaces) {
+      stream = search_module_entries(_patch_mod_entries, class_name, file_name, CHECK_NULL);
+    } else {
+#if INCLUDE_CDS
+      if (is_in_patch_module(file_name)) {
+        tty->print_cr("Preload Warning: Skip archiving class %s found in --patch-module entry", class_name);
+        return NULL;
+      }
+#endif
+    }
   }
 
   // Load Attempt #2: [jimage | exploded build]
@@ -1596,8 +1672,57 @@
 }
 
 #if INCLUDE_CDS
+// Capture all the --patch-module entries specified during CDS dump time.
+// It also captures the non-existing path(s) and the required file(s) during inspecting
+// the entries.
+void ClassLoader::setup_patch_mod_path() {
+  assert(DumpSharedSpaces, "only used with -Xshare:dump");
+  ResourceMark rm;
+  GrowableArray<ModulePatchPath*>* patch_mod_args = Arguments::get_patch_mod_prefix();
+  if (patch_mod_args != NULL) {
+    int num_of_entries = patch_mod_args->length();
+    for (int i = 0; i < num_of_entries; i++) {
+      const char* module_name = (patch_mod_args->at(i))->module_name();
+      const char* module_path = (patch_mod_args->at(i))->path_string();
+      int path_len = (int)strlen(module_path);
+      int name_len = (int)strlen(module_name);
+      int buf_len = name_len + path_len + 2; // add 2 for the '=' and NULL terminator
+      int end = 0;
+      char* buf = NEW_C_HEAP_ARRAY(char, buf_len, mtInternal);
+      // Iterate over the module's class path entries
+      for (int start = 0; start < path_len; start = end) {
+        while (module_path[end] && module_path[end] != os::path_separator()[0]) {
+          end++;
+        }
+        strncpy(buf, &module_path[start], end - start);
+        buf[end - start] = '\0';
+        struct stat st;
+        if (os::stat(buf, &st) != 0) {
+          // File not found
+          _shared_paths_misc_info->add_nonexist_path(buf);
+        } else {
+          if ((st.st_mode & S_IFMT) != S_IFREG) { // is not a regular file
+            vm_exit_during_initialization(
+              "--patch-module requires a regular file during dumping", buf);
+          } else {
+            _shared_paths_misc_info->add_required_file(buf);
+          }
+        }
+        while (module_path[end] == os::path_separator()[0]) {
+          end++;
+        }
+      };
+      jio_snprintf(buf, buf_len, "%s=%s", module_name, module_path);
+      _shared_paths_misc_info->add_patch_mod_classpath((const char*)buf);
+      _num_patch_mod_prefixes++;
+      FREE_C_HEAP_ARRAY(char, buf);
+    }
+  }
+}
+
 void ClassLoader::initialize_shared_path() {
   if (DumpSharedSpaces) {
+    setup_patch_mod_path();
     ClassLoaderExt::setup_search_paths();
     _shared_paths_misc_info->write_jint(0); // see comments in SharedPathsMiscInfo::check()
   }
--- a/hotspot/src/share/vm/classfile/classLoader.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/classfile/classLoader.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -69,6 +69,7 @@
   // Attempt to locate file_name through this class path entry.
   // Returns a class file parsing stream if successfull.
   virtual ClassFileStream* open_stream(const char* name, TRAPS) = 0;
+  virtual bool stream_exists(const char* name) = 0;
   // Debugging
   NOT_PRODUCT(virtual void compile_the_world(Handle loader, TRAPS) = 0;)
 };
@@ -83,6 +84,7 @@
   JImageFile* jimage() const { return NULL; }
   ClassPathDirEntry(const char* dir);
   ClassFileStream* open_stream(const char* name, TRAPS);
+  bool stream_exists(const char* name) { return false; }
   // Debugging
   NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
 };
@@ -126,6 +128,7 @@
   ClassFileStream* open_stream(const char* name, TRAPS);
   void contents_do(void f(const char* name, void* context), void* context);
   bool is_multiple_versioned(TRAPS) NOT_CDS_RETURN_(false);
+  bool stream_exists(const char* name);
   // Debugging
   NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
 };
@@ -145,6 +148,7 @@
   ClassPathImageEntry(JImageFile* jimage, const char* name);
   ~ClassPathImageEntry();
   ClassFileStream* open_stream(const char* name, TRAPS);
+  bool stream_exists(const char* name) { return false; }
 
   // Debugging
   NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
@@ -255,6 +259,7 @@
 
   // Info used by CDS
   CDS_ONLY(static SharedPathsMiscInfo * _shared_paths_misc_info;)
+  CDS_ONLY(static int _num_patch_mod_prefixes;)
 
   // Initialization:
   //   - setup the boot loader's system class path
@@ -427,6 +432,9 @@
   static void initialize_module_loader_map(JImageFile* jimage);
   static s2 classloader_type(Symbol* class_name, ClassPathEntry* e,
                              int classpath_index, TRAPS);
+  static bool is_in_patch_module(const char* const file_name);
+  static void setup_patch_mod_path(); // Only when -Xshare:dump
+  static int num_patch_mod_prefixes() { return _num_patch_mod_prefixes; }
 #endif
 
   static void  trace_class_path(const char* msg, const char* name = NULL);
--- a/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -86,6 +86,9 @@
   case REQUIRED:
     out->print("Expecting that file %s must exist and is not altered", path);
     break;
+  case PATCH_MOD:
+    out->print("Expecting --patch-module=%s", path);
+    break;
   default:
     ShouldNotReachHere();
   }
@@ -146,6 +149,9 @@
           // But we want it to not exist -> fail
           return fail("File must not exist");
         }
+        if ((st.st_mode & S_IFMT) != S_IFREG) {
+          return fail("Did not get a regular file as expected.");
+        }
         time_t    timestamp;
         long      filesize;
 
@@ -161,7 +167,26 @@
       }
     }
     break;
-
+  case PATCH_MOD:
+    {
+      GrowableArray<ModulePatchPath*>* patch_mod_args = Arguments::get_patch_mod_prefix();
+      if (patch_mod_args != NULL) {
+        int num_of_entries = patch_mod_args->length();
+        for (int i = 0; i < num_of_entries; i++) {
+          const char* module_name = (patch_mod_args->at(i))->module_name();
+          const char* path_string = (patch_mod_args->at(i))->path_string();
+          size_t n = strlen(module_name);
+          // path contains the module name, followed by '=', and one or more entries.
+          // E.g.: "java.base=foo" or "java.naming=dir1:dir2:dir3"
+          if ((strncmp(module_name, path, n) != 0) ||
+              (path[n] != '=') ||
+              (strcmp(path + n + 1, path_string) != 0)) {
+            return fail("--patch-module mismatch, path not found in run time: ", path);
+          }
+        }
+      }
+    }
+    break;
   default:
     return fail("Corrupted archive file header");
   }
--- a/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -104,10 +104,28 @@
     add_path(path, NON_EXIST);
   }
 
+  // The path must exist and have required size and modification time
+  void add_required_file(const char* path) {
+    add_path(path, REQUIRED);
+
+    struct stat st;
+    if (os::stat(path, &st) != 0) {
+      assert(0, "sanity");
+#if INCLUDE_CDS
+      ClassLoader::exit_with_path_failure("failed to os::stat(%s)", path); // should not happen
+#endif
+    }
+    write_time(st.st_mtime);
+    write_long(st.st_size);
+  }
+
   // The path must exist, and must contain exactly <num_entries> files/dirs
   void add_boot_classpath(const char* path) {
     add_path(path, BOOT);
   }
+  void add_patch_mod_classpath(const char* path) {
+    add_path(path, PATCH_MOD);
+  }
   int write_jint(jint num) {
     write(&num, sizeof(num));
     return 0;
@@ -129,7 +147,8 @@
   enum {
     BOOT      = 1,
     NON_EXIST = 2,
-    REQUIRED  = 3
+    REQUIRED  = 3,
+    PATCH_MOD = 4
   };
 
   virtual const char* type_name(int type) {
@@ -137,6 +156,7 @@
     case BOOT:      return "BOOT";
     case NON_EXIST: return "NON_EXIST";
     case REQUIRED:  return "REQUIRED";
+    case PATCH_MOD: return "PATCH_MOD";
     default:        ShouldNotReachHere(); return "?";
     }
   }
--- a/hotspot/src/share/vm/classfile/symbolTable.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/classfile/symbolTable.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -710,53 +710,3 @@
     return 0;
   }
 }
-
-#ifndef PRODUCT
-// Internal test of TempNewSymbol
-void Test_TempNewSymbol() {
-  // Assert messages assume these symbols are unique, and the refcounts start at
-  // one, but code does not rely on this.
-  Thread* THREAD = Thread::current();
-  Symbol* abc = SymbolTable::new_symbol("abc", CATCH);
-  int abccount = abc->refcount();
-  TempNewSymbol ss = abc;
-  assert(ss->refcount() == abccount, "only one abc");
-  assert(ss->refcount() == abc->refcount(), "should match TempNewSymbol");
-
-  Symbol* efg = SymbolTable::new_symbol("efg", CATCH);
-  Symbol* hij = SymbolTable::new_symbol("hij", CATCH);
-  int efgcount = efg->refcount();
-  int hijcount = hij->refcount();
-
-  TempNewSymbol s1 = efg;
-  TempNewSymbol s2 = hij;
-  assert(s1->refcount() == efgcount, "one efg");
-  assert(s2->refcount() == hijcount, "one hij");
-
-  // Assignment operator
-  s1 = s2;
-  assert(hij->refcount() == hijcount + 1, "should be two hij");
-  assert(efg->refcount() == efgcount - 1, "should be no efg");
-
-  s1 = ss;  // s1 is abc
-  assert(s1->refcount() == abccount + 1, "should be two abc (s1 and ss)");
-  assert(hij->refcount() == hijcount, "should only have one hij now (s2)");
-
-  s1 = s1; // self assignment
-  assert(s1->refcount() == abccount + 1, "should still be two abc (s1 and ss)");
-
-  TempNewSymbol s3;
-  Symbol* klm = SymbolTable::new_symbol("klm", CATCH);
-  int klmcount = klm->refcount();
-  s3 = klm;   // assignment
-  assert(s3->refcount() == klmcount, "only one klm now");
-
-  Symbol* xyz = SymbolTable::new_symbol("xyz", CATCH);
-  int xyzcount = xyz->refcount();
-  { // inner scope
-     TempNewSymbol s_inner = xyz;
-  }
-  assert(xyz->refcount() == (xyzcount - 1),
-         "Should have been decremented by dtor in inner scope");
-}
-#endif // PRODUCT
--- a/hotspot/src/share/vm/classfile/vmSymbols.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/classfile/vmSymbols.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -355,6 +355,8 @@
   case vmIntrinsics::_updateBytesCRC32:
   case vmIntrinsics::_updateByteBufferCRC32:
   case vmIntrinsics::_vectorizedMismatch:
+  case vmIntrinsics::_fmaD:
+  case vmIntrinsics::_fmaF:
     return true;
   default:
     return false;
@@ -388,6 +390,8 @@
   case vmIntrinsics::_updateBytesCRC32:
   case vmIntrinsics::_updateByteBufferCRC32:
   case vmIntrinsics::_vectorizedMismatch:
+  case vmIntrinsics::_fmaD:
+  case vmIntrinsics::_fmaF:
     return false;
   default:
     return true;
@@ -536,6 +540,10 @@
   case vmIntrinsics::_doubleToLongBits:
     if (!InlineMathNatives) return true;
     break;
+  case vmIntrinsics::_fmaD:
+  case vmIntrinsics::_fmaF:
+    if (!InlineMathNatives || !UseFMA) return true;
+    break;
   case vmIntrinsics::_arraycopy:
     if (!InlineArrayCopy) return true;
     break;
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -755,8 +755,10 @@
   do_class(java_lang_Math,                "java/lang/Math")                                                             \
   do_class(java_lang_StrictMath,          "java/lang/StrictMath")                                                       \
   do_signature(double2_double_signature,  "(DD)D")                                                                      \
+  do_signature(double3_double_signature,  "(DDD)D")                                                                     \
+  do_signature(float3_float_signature,    "(FFF)F")                                                                     \
   do_signature(int2_int_signature,        "(II)I")                                                                      \
-  do_signature(long2_long_signature,      "(JJ)J")                                                                         \
+  do_signature(long2_long_signature,      "(JJ)J")                                                                      \
                                                                                                                         \
   /* here are the math names, all together: */                                                                          \
   do_name(abs_name,"abs")       do_name(sin_name,"sin")         do_name(cos_name,"cos")                                 \
@@ -770,6 +772,7 @@
   do_name(multiplyExact_name,"multiplyExact")                                                                           \
   do_name(negateExact_name,"negateExact")                                                                               \
   do_name(subtractExact_name,"subtractExact")                                                                           \
+  do_name(fma_name, "fma")                                                                                              \
                                                                                                                         \
   do_intrinsic(_dabs,                     java_lang_Math,         abs_name,   double_double_signature,           F_S)   \
   do_intrinsic(_dsin,                     java_lang_Math,         sin_name,   double_double_signature,           F_S)   \
@@ -795,6 +798,8 @@
   do_intrinsic(_negateExactL,             java_lang_Math,         negateExact_name, long_long_signature,         F_S)   \
   do_intrinsic(_subtractExactI,           java_lang_Math,         subtractExact_name, int2_int_signature,        F_S)   \
   do_intrinsic(_subtractExactL,           java_lang_Math,         subtractExact_name, long2_long_signature,      F_S)   \
+  do_intrinsic(_fmaD,                     java_lang_Math,         fma_name,           double3_double_signature,  F_S)   \
+  do_intrinsic(_fmaF,                     java_lang_Math,         fma_name,           float3_float_signature,    F_S)   \
                                                                                                                         \
   do_intrinsic(_floatToRawIntBits,        java_lang_Float,        floatToRawIntBits_name,   float_int_signature, F_S)   \
    do_name(     floatToRawIntBits_name,                          "floatToRawIntBits")                                   \
--- a/hotspot/src/share/vm/gc/cms/cmsOopClosures.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/cms/cmsOopClosures.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -258,16 +258,15 @@
 // the closure ParMarkFromRootsClosure.
 class ParPushOrMarkClosure: public MetadataAwareOopClosure {
  private:
-  CMSCollector*    _collector;
-  MemRegion        _whole_span;
-  MemRegion        _span;        // local chunk
-  CMSBitMap*       _bit_map;
-  OopTaskQueue*    _work_queue;
-  CMSMarkStack*    _overflow_stack;
-  HeapWord*  const _finger;
-  HeapWord** const _global_finger_addr;
-  ParMarkFromRootsClosure* const
-                   _parent;
+  CMSCollector*                  _collector;
+  MemRegion                      _whole_span;
+  MemRegion                      _span;       // local chunk
+  CMSBitMap*                     _bit_map;
+  OopTaskQueue*                  _work_queue;
+  CMSMarkStack*                  _overflow_stack;
+  HeapWord*  const               _finger;
+  HeapWord* volatile* const      _global_finger_addr;
+  ParMarkFromRootsClosure* const _parent;
  protected:
   DO_OOP_WORK_DEFN
  public:
@@ -277,7 +276,7 @@
                        OopTaskQueue* work_queue,
                        CMSMarkStack* mark_stack,
                        HeapWord* finger,
-                       HeapWord** global_finger_addr,
+                       HeapWord* volatile* global_finger_addr,
                        ParMarkFromRootsClosure* parent);
   virtual void do_oop(oop* p);
   virtual void do_oop(narrowOop* p);
--- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -3025,14 +3025,14 @@
 
 // MT Concurrent Marking Task
 class CMSConcMarkingTask: public YieldingFlexibleGangTask {
-  CMSCollector* _collector;
-  uint          _n_workers;       // requested/desired # workers
-  bool          _result;
-  CompactibleFreeListSpace*  _cms_space;
-  char          _pad_front[64];   // padding to ...
-  HeapWord*     _global_finger;   // ... avoid sharing cache line
-  char          _pad_back[64];
-  HeapWord*     _restart_addr;
+  CMSCollector*             _collector;
+  uint                      _n_workers;      // requested/desired # workers
+  bool                      _result;
+  CompactibleFreeListSpace* _cms_space;
+  char                      _pad_front[64];   // padding to ...
+  HeapWord* volatile        _global_finger;   // ... avoid sharing cache line
+  char                      _pad_back[64];
+  HeapWord*                 _restart_addr;
 
   //  Exposed here for yielding support
   Mutex* const _bit_map_lock;
@@ -3068,7 +3068,7 @@
 
   OopTaskQueue* work_queue(int i) { return task_queues()->queue(i); }
 
-  HeapWord** global_finger_addr() { return &_global_finger; }
+  HeapWord* volatile* global_finger_addr() { return &_global_finger; }
 
   CMSConcMarkingTerminator* terminator() { return &_term; }
 
@@ -6554,7 +6554,7 @@
 
   // Note: the local finger doesn't advance while we drain
   // the stack below, but the global finger sure can and will.
-  HeapWord** gfa = _task->global_finger_addr();
+  HeapWord* volatile* gfa = _task->global_finger_addr();
   ParPushOrMarkClosure pushOrMarkClosure(_collector,
                                          _span, _bit_map,
                                          _work_queue,
@@ -6721,7 +6721,7 @@
                                            OopTaskQueue* work_queue,
                                            CMSMarkStack*  overflow_stack,
                                            HeapWord* finger,
-                                           HeapWord** global_finger_addr,
+                                           HeapWord* volatile* global_finger_addr,
                                            ParMarkFromRootsClosure* parent) :
   MetadataAwareOopClosure(collector->ref_processor()),
   _collector(collector),
--- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -540,7 +540,7 @@
 
   // Overflow list of grey objects, threaded through mark-word
   // Manipulated with CAS in the parallel/multi-threaded case.
-  oop _overflow_list;
+  oopDesc* volatile _overflow_list;
   // The following array-pair keeps track of mark words
   // displaced for accommodating overflow list above.
   // This code will likely be revisited under RFE#4922830.
@@ -724,12 +724,12 @@
   // Support for parallelizing young gen rescan in CMS remark phase
   ParNewGeneration* _young_gen;
 
-  HeapWord** _top_addr;    // ... Top of Eden
-  HeapWord** _end_addr;    // ... End of Eden
-  Mutex*     _eden_chunk_lock;
-  HeapWord** _eden_chunk_array; // ... Eden partitioning array
-  size_t     _eden_chunk_index; // ... top (exclusive) of array
-  size_t     _eden_chunk_capacity;  // ... max entries in array
+  HeapWord* volatile* _top_addr;    // ... Top of Eden
+  HeapWord**          _end_addr;    // ... End of Eden
+  Mutex*              _eden_chunk_lock;
+  HeapWord**          _eden_chunk_array; // ... Eden partitioning array
+  size_t              _eden_chunk_index; // ... top (exclusive) of array
+  size_t              _eden_chunk_capacity;  // ... max entries in array
 
   // Support for parallelizing survivor space rescan
   HeapWord** _survivor_chunk_array;
--- a/hotspot/src/share/vm/gc/cms/parNewGeneration.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/cms/parNewGeneration.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -323,7 +323,7 @@
   // A list of from-space images of to-be-scanned objects, threaded through
   // klass-pointers (klass information already copied to the forwarded
   // image.)  Manipulated with CAS.
-  oop _overflow_list;
+  oopDesc* volatile _overflow_list;
   NOT_PRODUCT(ssize_t _num_par_pushes;)
 
   // This closure is used by the reference processor to filter out
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -2474,8 +2474,16 @@
 }
 
 jlong G1CollectedHeap::millis_since_last_gc() {
-  // assert(false, "NYI");
-  return 0;
+  // See the notes in GenCollectedHeap::millis_since_last_gc()
+  // for more information about the implementation.
+  jlong ret_val = (os::javaTimeNanos() / NANOSECS_PER_MILLISEC) -
+    _g1_policy->collection_pause_end_millis();
+  if (ret_val < 0) {
+    log_warning(gc)("millis_since_last_gc() would return : " JLONG_FORMAT
+      ". returning zero instead.", ret_val);
+    return 0;
+  }
+  return ret_val;
 }
 
 void G1CollectedHeap::prepare_for_verify() {
--- a/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -66,7 +66,8 @@
   _phase_times(new G1GCPhaseTimes(ParallelGCThreads)),
   _tenuring_threshold(MaxTenuringThreshold),
   _max_survivor_regions(0),
-  _survivors_age_table(true) { }
+  _survivors_age_table(true),
+  _collection_pause_end_millis(os::javaTimeNanos() / NANOSECS_PER_MILLISEC) { }
 
 G1DefaultPolicy::~G1DefaultPolicy() {
   delete _ihop_control;
@@ -575,6 +576,8 @@
 
   record_pause(young_gc_pause_kind(), end_time_sec - pause_time_ms / 1000.0, end_time_sec);
 
+  _collection_pause_end_millis = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
+
   last_pause_included_initial_mark = collector_state()->during_initial_mark_pause();
   if (last_pause_included_initial_mark) {
     record_concurrent_mark_init_end(0.0);
--- a/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -64,6 +64,8 @@
 
   double _full_collection_start_sec;
 
+  jlong _collection_pause_end_millis;
+
   uint _young_list_target_length;
   uint _young_list_fixed_length;
 
@@ -237,6 +239,8 @@
 
   double reclaimable_bytes_perc(size_t reclaimable_bytes) const;
 
+  jlong collection_pause_end_millis() { return _collection_pause_end_millis; }
+
 private:
   // Sets up marking if proper conditions are met.
   void maybe_start_marking();
--- a/hotspot/src/share/vm/gc/g1/g1IHOPControl.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/g1/g1IHOPControl.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -81,47 +81,6 @@
   _last_marking_length_s(0.0) {
 }
 
-#ifndef PRODUCT
-static void test_update(G1IHOPControl* ctrl, double alloc_time, size_t alloc_amount, size_t young_size, double mark_time) {
-  for (int i = 0; i < 100; i++) {
-    ctrl->update_allocation_info(alloc_time, alloc_amount, young_size);
-    ctrl->update_marking_length(mark_time);
-  }
-}
-
-void G1StaticIHOPControl::test() {
-  size_t const initial_ihop = 45;
-
-  G1StaticIHOPControl ctrl(initial_ihop);
-  ctrl.update_target_occupancy(100);
-
-  size_t threshold = ctrl.get_conc_mark_start_threshold();
-  assert(threshold == initial_ihop,
-         "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
-
-  ctrl.update_allocation_info(100.0, 100, 100);
-  threshold = ctrl.get_conc_mark_start_threshold();
-  assert(threshold == initial_ihop,
-         "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
-
-  ctrl.update_marking_length(1000.0);
-  threshold = ctrl.get_conc_mark_start_threshold();
-  assert(threshold == initial_ihop,
-         "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
-
-  // Whatever we pass, the IHOP value must stay the same.
-  test_update(&ctrl, 2, 10, 10, 3);
-  threshold = ctrl.get_conc_mark_start_threshold();
-  assert(threshold == initial_ihop,
-         "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
-
-  test_update(&ctrl, 12, 10, 10, 3);
-  threshold = ctrl.get_conc_mark_start_threshold();
-  assert(threshold == initial_ihop,
-         "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
-}
-#endif
-
 G1AdaptiveIHOPControl::G1AdaptiveIHOPControl(double ihop_percent,
                                              G1Predictions const* predictor,
                                              size_t heap_reserve_percent,
@@ -224,79 +183,3 @@
                                           _predictor->get_new_prediction(&_marking_times_s),
                                           have_enough_data_for_prediction());
 }
-
-#ifndef PRODUCT
-void G1AdaptiveIHOPControl::test() {
-  size_t const initial_threshold = 45;
-  size_t const young_size = 10;
-  size_t const target_size = 100;
-
-  // The final IHOP value is always
-  // target_size - (young_size + alloc_amount/alloc_time * marking_time)
-
-  G1Predictions pred(0.95);
-  G1AdaptiveIHOPControl ctrl(initial_threshold, &pred, 0, 0);
-  ctrl.update_target_occupancy(target_size);
-
-  // First "load".
-  size_t const alloc_time1 = 2;
-  size_t const alloc_amount1 = 10;
-  size_t const marking_time1 = 2;
-  size_t const settled_ihop1 = target_size - (young_size + alloc_amount1/alloc_time1 * marking_time1);
-
-  size_t threshold;
-  threshold = ctrl.get_conc_mark_start_threshold();
-  assert(threshold == initial_threshold,
-         "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_threshold, threshold);
-  for (size_t i = 0; i < G1AdaptiveIHOPNumInitialSamples - 1; i++) {
-    ctrl.update_allocation_info(alloc_time1, alloc_amount1, young_size);
-    ctrl.update_marking_length(marking_time1);
-    // Not enough data yet.
-    threshold = ctrl.get_conc_mark_start_threshold();
-    assert(threshold == initial_threshold,
-           "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_threshold, threshold);
-  }
-
-  test_update(&ctrl, alloc_time1, alloc_amount1, young_size, marking_time1);
-
-  threshold = ctrl.get_conc_mark_start_threshold();
-  assert(threshold == settled_ihop1,
-         "Expected IHOP threshold to settle at " SIZE_FORMAT " but is " SIZE_FORMAT, settled_ihop1, threshold);
-
-  // Second "load". A bit higher allocation rate.
-  size_t const alloc_time2 = 2;
-  size_t const alloc_amount2 = 30;
-  size_t const marking_time2 = 2;
-  size_t const settled_ihop2 = target_size - (young_size + alloc_amount2/alloc_time2 * marking_time2);
-
-  test_update(&ctrl, alloc_time2, alloc_amount2, young_size, marking_time2);
-
-  threshold = ctrl.get_conc_mark_start_threshold();
-  assert(threshold < settled_ihop1,
-         "Expected IHOP threshold to settle at a value lower than " SIZE_FORMAT " but is " SIZE_FORMAT, settled_ihop1, threshold);
-
-  // Third "load". Very high (impossible) allocation rate.
-  size_t const alloc_time3 = 1;
-  size_t const alloc_amount3 = 50;
-  size_t const marking_time3 = 2;
-  size_t const settled_ihop3 = 0;
-
-  test_update(&ctrl, alloc_time3, alloc_amount3, young_size, marking_time3);
-  threshold = ctrl.get_conc_mark_start_threshold();
-
-  assert(threshold == settled_ihop3,
-         "Expected IHOP threshold to settle at " SIZE_FORMAT " but is " SIZE_FORMAT, settled_ihop3, threshold);
-
-  // And back to some arbitrary value.
-  test_update(&ctrl, alloc_time2, alloc_amount2, young_size, marking_time2);
-
-  threshold = ctrl.get_conc_mark_start_threshold();
-  assert(threshold > settled_ihop3,
-         "Expected IHOP threshold to settle at value larger than " SIZE_FORMAT " but is " SIZE_FORMAT, settled_ihop3, threshold);
-}
-
-void IHOP_test() {
-  G1StaticIHOPControl::test();
-  G1AdaptiveIHOPControl::test();
-}
-#endif
--- a/hotspot/src/share/vm/gc/g1/g1IHOPControl.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/g1/g1IHOPControl.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -99,10 +99,6 @@
    assert(marking_length_s > 0.0, "Marking length must be larger than zero but is %.3f", marking_length_s);
     _last_marking_length_s = marking_length_s;
   }
-
-#ifndef PRODUCT
-  static void test();
-#endif
 };
 
 // This algorithm tries to return a concurrent mark starting occupancy value that
@@ -148,9 +144,6 @@
 
   virtual void print();
   virtual void send_trace_event(G1NewTracer* tracer);
-#ifndef PRODUCT
-  static void test();
-#endif
 };
 
 #endif // SHARE_VM_GC_G1_G1IHOPCONTROL_HPP
--- a/hotspot/src/share/vm/gc/g1/g1Policy.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/g1/g1Policy.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -119,6 +119,8 @@
   virtual void record_full_collection_start() = 0;
   virtual void record_full_collection_end() = 0;
 
+  virtual jlong collection_pause_end_millis() = 0;
+
   // Must currently be called while the world is stopped.
   virtual void record_concurrent_mark_init_end(double mark_init_elapsed_time_ms) = 0;
 
--- a/hotspot/src/share/vm/gc/g1/g1RemSet.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/g1/g1RemSet.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -668,20 +668,18 @@
   // fail arbitrarily). We tell the iteration code to perform this
   // filtering when it has been determined that there has been an actual
   // allocation in this region and making it safe to check the young type.
-  bool filter_young = true;
 
-  HeapWord* stop_point =
+  bool card_processed =
     r->oops_on_card_seq_iterate_careful(dirtyRegion,
                                         &filter_then_update_rs_oop_cl,
-                                        filter_young,
                                         card_ptr);
 
-  // If stop_point is non-null, then we encountered an unallocated region
-  // (perhaps the unfilled portion of a TLAB.)  For now, we'll dirty the
-  // card and re-enqueue: if we put off the card until a GC pause, then the
-  // unallocated portion will be filled in.  Alternatively, we might try
-  // the full complexity of the technique used in "regular" precleaning.
-  if (stop_point != NULL) {
+  // If unable to process the card then we encountered an unparsable
+  // part of the heap (e.g. a partially allocated object).  Redirty
+  // and re-enqueue: if we put off the card until a GC pause, then the
+  // allocation will have completed.
+  if (!card_processed) {
+    assert(!_g1->is_gc_active(), "Unparsable heap during GC");
     // The card might have gotten re-dirtied and re-enqueued while we
     // worked.  (In fact, it's pretty likely.)
     if (*card_ptr != CardTableModRefBS::dirty_card_val()) {
--- a/hotspot/src/share/vm/gc/g1/heapRegion.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/g1/heapRegion.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -352,19 +352,10 @@
   _prev_marked_bytes = marked_bytes;
 }
 
-HeapWord*
-HeapRegion::
-oops_on_card_seq_iterate_careful(MemRegion mr,
-                                 FilterOutOfRegionClosure* cl,
-                                 bool filter_young,
-                                 jbyte* card_ptr) {
-  // Currently, we should only have to clean the card if filter_young
-  // is true and vice versa.
-  if (filter_young) {
-    assert(card_ptr != NULL, "pre-condition");
-  } else {
-    assert(card_ptr == NULL, "pre-condition");
-  }
+bool HeapRegion::oops_on_card_seq_iterate_careful(MemRegion mr,
+                                                  FilterOutOfRegionClosure* cl,
+                                                  jbyte* card_ptr) {
+  assert(card_ptr != NULL, "pre-condition");
   G1CollectedHeap* g1h = G1CollectedHeap::heap();
 
   // If we're within a stop-world GC, then we might look at a card in a
@@ -375,7 +366,9 @@
   } else {
     mr = mr.intersection(used_region());
   }
-  if (mr.is_empty()) return NULL;
+  if (mr.is_empty()) {
+    return true;
+  }
   // Otherwise, find the obj that extends onto mr.start().
 
   // The intersection of the incoming mr (for the card) and the
@@ -384,27 +377,21 @@
   // G1CollectedHeap.cpp that allocates a new region sets the
   // is_young tag on the region before allocating. Thus we
   // safely know if this region is young.
-  if (is_young() && filter_young) {
-    return NULL;
+  if (is_young()) {
+    return true;
   }
 
-  assert(!is_young(), "check value of filter_young");
-
   // We can only clean the card here, after we make the decision that
-  // the card is not young. And we only clean the card if we have been
-  // asked to (i.e., card_ptr != NULL).
-  if (card_ptr != NULL) {
-    *card_ptr = CardTableModRefBS::clean_card_val();
-    // We must complete this write before we do any of the reads below.
-    OrderAccess::storeload();
-  }
+  // the card is not young.
+  *card_ptr = CardTableModRefBS::clean_card_val();
+  // We must complete this write before we do any of the reads below.
+  OrderAccess::storeload();
 
   // Cache the boundaries of the memory region in some const locals
   HeapWord* const start = mr.start();
   HeapWord* const end = mr.end();
 
-  // We used to use "block_start_careful" here.  But we're actually happy
-  // to update the BOT while we do this...
+  // Update BOT as needed while finding start of (potential) object.
   HeapWord* cur = block_start(start);
   assert(cur <= start, "Postcondition");
 
@@ -416,7 +403,9 @@
     obj = oop(cur);
     if (obj->klass_or_null() == NULL) {
       // Ran into an unparseable point.
-      return cur;
+      assert(!g1h->is_gc_active(),
+             "Unparsable heap during GC at " PTR_FORMAT, p2i(cur));
+      return false;
     }
     // Otherwise...
     next = cur + block_size(cur);
@@ -433,7 +422,9 @@
     assert((cur + block_size(cur)) > (HeapWord*)obj, "Loop invariant");
     if (obj->klass_or_null() == NULL) {
       // Ran into an unparseable point.
-      return cur;
+      assert(!g1h->is_gc_active(),
+             "Unparsable heap during GC at " PTR_FORMAT, p2i(cur));
+      return false;
     }
 
     // Advance the current pointer. "obj" still points to the object to iterate.
@@ -452,7 +443,7 @@
     }
   } while (cur < end);
 
-  return NULL;
+  return true;
 }
 
 // Code roots support
--- a/hotspot/src/share/vm/gc/g1/heapRegion.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/g1/heapRegion.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -653,16 +653,17 @@
     }
   }
 
-  // filter_young: if true and the region is a young region then we
-  // skip the iteration.
-  // card_ptr: if not NULL, and we decide that the card is not young
-  // and we iterate over it, we'll clean the card before we start the
-  // iteration.
-  HeapWord*
-  oops_on_card_seq_iterate_careful(MemRegion mr,
-                                   FilterOutOfRegionClosure* cl,
-                                   bool filter_young,
-                                   jbyte* card_ptr);
+  // Iterate over the card in the card designated by card_ptr,
+  // applying cl to all references in the region.
+  // mr: the memory region covered by the card.
+  // card_ptr: if we decide that the card is not young and we iterate
+  // over it, we'll clean the card before we start the iteration.
+  // Returns true if card was successfully processed, false if an
+  // unparsable part of the heap was encountered, which should only
+  // happen when invoked concurrently with the mutator.
+  bool oops_on_card_seq_iterate_careful(MemRegion mr,
+                                        FilterOutOfRegionClosure* cl,
+                                        jbyte* card_ptr);
 
   size_t recorded_rs_length() const        { return _recorded_rs_length; }
   double predicted_elapsed_time_ms() const { return _predicted_elapsed_time_ms; }
--- a/hotspot/src/share/vm/gc/g1/heapRegionManager.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/g1/heapRegionManager.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -482,8 +482,9 @@
 HeapRegionClaimer::HeapRegionClaimer(uint n_workers) :
     _n_workers(n_workers), _n_regions(G1CollectedHeap::heap()->_hrm._allocated_heapregions_length), _claims(NULL) {
   assert(n_workers > 0, "Need at least one worker.");
-  _claims = NEW_C_HEAP_ARRAY(uint, _n_regions, mtGC);
-  memset(_claims, Unclaimed, sizeof(*_claims) * _n_regions);
+  uint* new_claims = NEW_C_HEAP_ARRAY(uint, _n_regions, mtGC);
+  memset(new_claims, Unclaimed, sizeof(*_claims) * _n_regions);
+  _claims = new_claims;
 }
 
 HeapRegionClaimer::~HeapRegionClaimer() {
--- a/hotspot/src/share/vm/gc/g1/heapRegionManager.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/g1/heapRegionManager.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -259,9 +259,9 @@
 // The HeapRegionClaimer is used during parallel iteration over heap regions,
 // allowing workers to claim heap regions, gaining exclusive rights to these regions.
 class HeapRegionClaimer : public StackObj {
-  uint  _n_workers;
-  uint  _n_regions;
-  uint* _claims;
+  uint           _n_workers;
+  uint           _n_regions;
+  volatile uint* _claims;
 
   static const uint Unclaimed = 0;
   static const uint Claimed   = 1;
@@ -285,4 +285,3 @@
   bool claim_region(uint region_index);
 };
 #endif // SHARE_VM_GC_G1_HEAPREGIONMANAGER_HPP
-
--- a/hotspot/src/share/vm/gc/g1/heapRegionRemSet.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/g1/heapRegionRemSet.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -56,7 +56,7 @@
   PerRegionTable * _collision_list_next;
 
   // Global free list of PRTs
-  static PerRegionTable* _free_list;
+  static PerRegionTable* volatile _free_list;
 
 protected:
   // We need access in order to union things into the base table.
@@ -249,7 +249,7 @@
   static void test_fl_mem_size();
 };
 
-PerRegionTable* PerRegionTable::_free_list = NULL;
+PerRegionTable* volatile PerRegionTable::_free_list = NULL;
 
 size_t OtherRegionsTable::_max_fine_entries = 0;
 size_t OtherRegionsTable::_mod_max_fine_entries_mask = 0;
--- a/hotspot/src/share/vm/gc/g1/sparsePRT.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/g1/sparsePRT.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -283,7 +283,7 @@
 
 // ----------------------------------------------------------------------
 
-SparsePRT* SparsePRT::_head_expanded_list = NULL;
+SparsePRT* volatile SparsePRT::_head_expanded_list = NULL;
 
 void SparsePRT::add_to_expanded_list(SparsePRT* sprt) {
   // We could expand multiple times in a pause -- only put on list once.
--- a/hotspot/src/share/vm/gc/g1/sparsePRT.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/g1/sparsePRT.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -250,7 +250,7 @@
 
   bool should_be_on_expanded_list();
 
-  static SparsePRT* _head_expanded_list;
+  static SparsePRT* volatile _head_expanded_list;
 
 public:
   SparsePRT(HeapRegion* hr);
--- a/hotspot/src/share/vm/gc/parallel/mutableSpace.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/parallel/mutableSpace.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,7 @@
   MemRegion _last_setup_region;
   size_t _alignment;
  protected:
-  HeapWord* _top;
+  HeapWord* volatile _top;
 
   MutableSpaceMangler* mangler() { return _mangler; }
 
@@ -69,7 +69,7 @@
   HeapWord* top() const                    { return _top;    }
   virtual void set_top(HeapWord* value)    { _top = value;   }
 
-  HeapWord** top_addr()                    { return &_top; }
+  HeapWord* volatile* top_addr()           { return &_top; }
   HeapWord** end_addr()                    { return &_end; }
 
   virtual void set_bottom(HeapWord* value) { _bottom = value; }
--- a/hotspot/src/share/vm/gc/parallel/parallelScavengeHeap.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/parallel/parallelScavengeHeap.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -175,7 +175,7 @@
 
   bool supports_inline_contig_alloc() const { return !UseNUMA; }
 
-  HeapWord** top_addr() const { return !UseNUMA ? young_gen()->top_addr() : (HeapWord**)-1; }
+  HeapWord* volatile* top_addr() const { return !UseNUMA ? young_gen()->top_addr() : (HeapWord* volatile*)-1; }
   HeapWord** end_addr() const { return !UseNUMA ? young_gen()->end_addr() : (HeapWord**)-1; }
 
   void ensure_parsability(bool retire_tlabs);
--- a/hotspot/src/share/vm/gc/parallel/psYoungGen.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/parallel/psYoungGen.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -162,7 +162,7 @@
     return result;
   }
 
-  HeapWord** top_addr() const   { return eden_space()->top_addr(); }
+  HeapWord* volatile* top_addr() const   { return eden_space()->top_addr(); }
   HeapWord** end_addr() const   { return eden_space()->end_addr(); }
 
   // Iteration.
--- a/hotspot/src/share/vm/gc/parallel/vmStructs_parallelgc.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/parallel/vmStructs_parallelgc.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,8 @@
 #define SHARE_VM_GC_PARALLEL_VMSTRUCTS_PARALLELGC_HPP
 
 #define VM_STRUCTS_PARALLELGC(nonstatic_field, \
-                   static_field) \
+                              volatile_nonstatic_field, \
+                              static_field) \
                                                                                                                                      \
   /**********************/                                                                                                           \
   /* Parallel GC fields */                                                                                                           \
@@ -40,7 +41,7 @@
   nonstatic_field(ImmutableSpace,              _bottom,                                       HeapWord*)                             \
   nonstatic_field(ImmutableSpace,              _end,                                          HeapWord*)                             \
                                                                                                                                      \
-  nonstatic_field(MutableSpace,                _top,                                          HeapWord*)                             \
+  volatile_nonstatic_field(MutableSpace,       _top,                                          HeapWord*)                             \
                                                                                                                                      \
   nonstatic_field(PSYoungGen,                  _reserved,                                     MemRegion)                             \
   nonstatic_field(PSYoungGen,                  _virtual_space,                                PSVirtualSpace*)                       \
--- a/hotspot/src/share/vm/gc/serial/defNewGeneration.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/serial/defNewGeneration.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -512,7 +512,7 @@
 }
 
 
-HeapWord** DefNewGeneration::top_addr() const { return eden()->top_addr(); }
+HeapWord* volatile* DefNewGeneration::top_addr() const { return eden()->top_addr(); }
 HeapWord** DefNewGeneration::end_addr() const { return eden()->end_addr(); }
 
 void DefNewGeneration::object_iterate(ObjectClosure* blk) {
--- a/hotspot/src/share/vm/gc/serial/defNewGeneration.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/serial/defNewGeneration.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -225,7 +225,7 @@
   size_t max_survivor_size() const          { return _max_survivor_size; }
 
   bool supports_inline_contig_alloc() const { return true; }
-  HeapWord** top_addr() const;
+  HeapWord* volatile* top_addr() const;
   HeapWord** end_addr() const;
 
   // Thread-local allocation buffers
--- a/hotspot/src/share/vm/gc/shared/collectedHeap.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/shared/collectedHeap.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -350,7 +350,7 @@
   // These functions return the addresses of the fields that define the
   // boundaries of the contiguous allocation area.  (These fields should be
   // physically near to one another.)
-  virtual HeapWord** top_addr() const {
+  virtual HeapWord* volatile* top_addr() const {
     guarantee(false, "inline contiguous allocation not supported");
     return NULL;
   }
--- a/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -721,7 +721,7 @@
   return _young_gen->supports_inline_contig_alloc();
 }
 
-HeapWord** GenCollectedHeap::top_addr() const {
+HeapWord* volatile* GenCollectedHeap::top_addr() const {
   return _young_gen->top_addr();
 }
 
@@ -1256,21 +1256,20 @@
 };
 
 jlong GenCollectedHeap::millis_since_last_gc() {
-  // We need a monotonically non-decreasing time in ms but
-  // os::javaTimeMillis() does not guarantee monotonicity.
+  // javaTimeNanos() is guaranteed to be monotonically non-decreasing
+  // provided the underlying platform provides such a time source
+  // (and it is bug free). So we still have to guard against getting
+  // back a time later than 'now'.
   jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
   GenTimeOfLastGCClosure tolgc_cl(now);
   // iterate over generations getting the oldest
   // time that a generation was collected
   generation_iterate(&tolgc_cl, false);
 
-  // javaTimeNanos() is guaranteed to be monotonically non-decreasing
-  // provided the underlying platform provides such a time source
-  // (and it is bug free). So we still have to guard against getting
-  // back a time later than 'now'.
   jlong retVal = now - tolgc_cl.time();
   if (retVal < 0) {
-    NOT_PRODUCT(log_warning(gc)("time warp: " JLONG_FORMAT, retVal);)
+    log_warning(gc)("millis_since_last_gc() would return : " JLONG_FORMAT
+       ". returning zero instead.", retVal);
     return 0;
   }
   return retVal;
--- a/hotspot/src/share/vm/gc/shared/genCollectedHeap.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/shared/genCollectedHeap.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -184,7 +184,7 @@
   // We may support a shared contiguous allocation area, if the youngest
   // generation does.
   bool supports_inline_contig_alloc() const;
-  HeapWord** top_addr() const;
+  HeapWord* volatile* top_addr() const;
   HeapWord** end_addr() const;
 
   // Perform a full collection of the heap; intended for use in implementing
--- a/hotspot/src/share/vm/gc/shared/generation.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/shared/generation.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -263,7 +263,7 @@
   // These functions return the addresses of the fields that define the
   // boundaries of the contiguous allocation area.  (These fields should be
   // physically near to one another.)
-  virtual HeapWord** top_addr() const { return NULL; }
+  virtual HeapWord* volatile* top_addr() const { return NULL; }
   virtual HeapWord** end_addr() const { return NULL; }
 
   // Thread-local allocation buffers
--- a/hotspot/src/share/vm/gc/shared/workgroup.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/shared/workgroup.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -472,23 +472,21 @@
 }
 
 bool SequentialSubTasksDone::is_task_claimed(uint& t) {
-  uint* n_claimed_ptr = &_n_claimed;
-  t = *n_claimed_ptr;
+  t = _n_claimed;
   while (t < _n_tasks) {
-    jint res = Atomic::cmpxchg(t+1, n_claimed_ptr, t);
+    jint res = Atomic::cmpxchg(t+1, &_n_claimed, t);
     if (res == (jint)t) {
       return false;
     }
-    t = *n_claimed_ptr;
+    t = res;
   }
   return true;
 }
 
 bool SequentialSubTasksDone::all_tasks_completed() {
-  uint* n_completed_ptr = &_n_completed;
-  uint  complete        = *n_completed_ptr;
+  uint complete = _n_completed;
   while (true) {
-    uint res = Atomic::cmpxchg(complete+1, n_completed_ptr, complete);
+    uint res = Atomic::cmpxchg(complete+1, &_n_completed, complete);
     if (res == complete) {
       break;
     }
--- a/hotspot/src/share/vm/gc/shared/workgroup.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/gc/shared/workgroup.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -318,9 +318,9 @@
 // enumeration type.
 
 class SubTasksDone: public CHeapObj<mtInternal> {
-  uint* _tasks;
+  volatile uint* _tasks;
   uint _n_tasks;
-  uint _threads_completed;
+  volatile uint _threads_completed;
 #ifdef ASSERT
   volatile uint _claimed;
 #endif
@@ -363,11 +363,11 @@
 class SequentialSubTasksDone : public StackObj {
 protected:
   uint _n_tasks;     // Total number of tasks available.
-  uint _n_claimed;   // Number of tasks claimed.
+  volatile uint _n_claimed;   // Number of tasks claimed.
   // _n_threads is used to determine when a sub task is done.
   // See comments on SubTasksDone::_n_threads
   uint _n_threads;   // Total number of parallel threads.
-  uint _n_completed; // Number of completed threads.
+  volatile uint _n_completed; // Number of completed threads.
 
   void clear();
 
--- a/hotspot/src/share/vm/interpreter/abstractInterpreter.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/interpreter/abstractInterpreter.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -194,6 +194,13 @@
                                 return java_lang_ref_reference_get;
   }
 
+  if (UseFMA) {
+    switch (m->intrinsic_id()) {
+      case vmIntrinsics::_fmaD: return java_lang_math_fmaD;
+      case vmIntrinsics::_fmaF: return java_lang_math_fmaF;
+    }
+  }
+
   // Accessor method?
   if (m->is_getter()) {
     // TODO: We should have used ::is_accessor above, but fast accessors in Zero expect only getters.
@@ -281,6 +288,8 @@
     case java_lang_math_sqrt    : tty->print("java_lang_math_sqrt"    ); break;
     case java_lang_math_log     : tty->print("java_lang_math_log"     ); break;
     case java_lang_math_log10   : tty->print("java_lang_math_log10"   ); break;
+    case java_lang_math_fmaD    : tty->print("java_lang_math_fmaD"    ); break;
+    case java_lang_math_fmaF    : tty->print("java_lang_math_fmaF"    ); break;
     case java_util_zip_CRC32_update           : tty->print("java_util_zip_CRC32_update"); break;
     case java_util_zip_CRC32_updateBytes      : tty->print("java_util_zip_CRC32_updateBytes"); break;
     case java_util_zip_CRC32_updateByteBuffer : tty->print("java_util_zip_CRC32_updateByteBuffer"); break;
--- a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -76,6 +76,8 @@
     java_lang_math_log10,                                       // implementation of java.lang.Math.log10 (x)
     java_lang_math_pow,                                         // implementation of java.lang.Math.pow   (x,y)
     java_lang_math_exp,                                         // implementation of java.lang.Math.exp   (x)
+    java_lang_math_fmaF,                                        // implementation of java.lang.Math.fma   (x, y, z)
+    java_lang_math_fmaD,                                        // implementation of java.lang.Math.fma   (x, y, z)
     java_lang_ref_reference_get,                                // implementation of java.lang.ref.Reference.get()
     java_util_zip_CRC32_update,                                 // implementation of java.util.zip.CRC32.update()
     java_util_zip_CRC32_updateBytes,                            // implementation of java.util.zip.CRC32.updateBytes()
--- a/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -239,6 +239,10 @@
       method_entry(java_lang_math_log10)
       method_entry(java_lang_math_exp  )
       method_entry(java_lang_math_pow  )
+      if (UseFMA) {
+        method_entry(java_lang_math_fmaF)
+        method_entry(java_lang_math_fmaD)
+      }
       method_entry(java_lang_ref_reference_get)
 
       AbstractInterpreter::initialize_method_handle_entries();
@@ -445,7 +449,9 @@
   case Interpreter::java_lang_math_log10   : // fall thru
   case Interpreter::java_lang_math_sqrt    : // fall thru
   case Interpreter::java_lang_math_pow     : // fall thru
-  case Interpreter::java_lang_math_exp     : entry_point = generate_math_entry(kind);      break;
+  case Interpreter::java_lang_math_exp     : // fall thru
+  case Interpreter::java_lang_math_fmaD    : // fall thru
+  case Interpreter::java_lang_math_fmaF     : entry_point = generate_math_entry(kind);      break;
   case Interpreter::java_lang_ref_reference_get
                                            : entry_point = generate_Reference_get_entry(); break;
   case Interpreter::java_util_zip_CRC32_update
--- a/hotspot/src/share/vm/jvmci/jvmciCompiler.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/jvmci/jvmciCompiler.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -114,11 +114,11 @@
   JVMCIRuntime::bootstrap_finished(CHECK);
 }
 
-#define CHECK_ABORT THREAD); \
+#define CHECK_EXIT THREAD); \
 if (HAS_PENDING_EXCEPTION) { \
   char buf[256]; \
   jio_snprintf(buf, 256, "Uncaught exception at %s:%d", __FILE__, __LINE__); \
-  JVMCICompiler::abort_on_pending_exception(PENDING_EXCEPTION, buf); \
+  JVMCICompiler::exit_on_pending_exception(PENDING_EXCEPTION, buf); \
   return; \
 } \
 (void)(0
@@ -133,10 +133,10 @@
       return;
   }
 
-  JVMCIRuntime::initialize_well_known_classes(CHECK_ABORT);
+  JVMCIRuntime::initialize_well_known_classes(CHECK_EXIT);
 
   HandleMark hm;
-  Handle receiver = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK_ABORT);
+  Handle receiver = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK_EXIT);
 
   JavaValue method_result(T_OBJECT);
   JavaCallArguments args;
@@ -202,23 +202,22 @@
   return level;
 }
 
-/**
- * Aborts the VM due to an unexpected exception.
- */
-void JVMCICompiler::abort_on_pending_exception(Handle exception, const char* message, bool dump_core) {
-  Thread* THREAD = Thread::current();
+void JVMCICompiler::exit_on_pending_exception(Handle exception, const char* message) {
+  JavaThread* THREAD = JavaThread::current();
   CLEAR_PENDING_EXCEPTION;
 
-  java_lang_Throwable::java_printStackTrace(exception, THREAD);
+  static volatile int report_error = 0;
+  if (!report_error && Atomic::cmpxchg(1, &report_error, 0) == 0) {
+    // Only report an error once
+    tty->print_raw_cr(message);
+    java_lang_Throwable::java_printStackTrace(exception, THREAD);
+  } else {
+    // Allow error reporting thread to print the stack trace.
+    os::sleep(THREAD, 200, false);
+  }
 
-  // Give other aborting threads to also print their stack traces.
-  // This can be very useful when debugging class initialization
-  // failures.
-  assert(THREAD->is_Java_thread(), "compiler threads should be Java threads");
-  const bool interruptible = true;
-  os::sleep(THREAD, 200, interruptible);
-
-  vm_abort(dump_core);
+  before_exit(THREAD);
+  vm_exit(-1);
 }
 
 // Compilation entry point for methods
--- a/hotspot/src/share/vm/jvmci/jvmciCompiler.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/jvmci/jvmciCompiler.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -47,7 +47,10 @@
 
   static elapsedTimer _codeInstallTimer;
 
-  static void abort_on_pending_exception(Handle exception, const char* message, bool dump_core = false);
+  /**
+   * Exits the VM due to an unexpected exception.
+   */
+  static void exit_on_pending_exception(Handle exception, const char* message);
 
 public:
   JVMCICompiler();
--- a/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -112,7 +112,7 @@
 
 bool       CompilerToVM::Data::_supports_inline_contig_alloc;
 HeapWord** CompilerToVM::Data::_heap_end_addr;
-HeapWord** CompilerToVM::Data::_heap_top_addr;
+HeapWord* volatile* CompilerToVM::Data::_heap_top_addr;
 int CompilerToVM::Data::_max_oop_map_stack_offset;
 
 jbyte* CompilerToVM::Data::cardtable_start_address;
@@ -153,7 +153,7 @@
 
   _supports_inline_contig_alloc = Universe::heap()->supports_inline_contig_alloc();
   _heap_end_addr = _supports_inline_contig_alloc ? Universe::heap()->end_addr() : (HeapWord**) -1;
-  _heap_top_addr = _supports_inline_contig_alloc ? Universe::heap()->top_addr() : (HeapWord**) -1;
+  _heap_top_addr = _supports_inline_contig_alloc ? Universe::heap()->top_addr() : (HeapWord* volatile*) -1;
 
   _max_oop_map_stack_offset = (OopMapValue::register_mask - VMRegImpl::stack2reg(0)->value()) * VMRegImpl::stack_slot_size;
   int max_oop_map_stack_index = _max_oop_map_stack_offset / VMRegImpl::stack_slot_size;
@@ -473,9 +473,20 @@
   return (jlong) (address) method->exception_table_start();
 C2V_END
 
-C2V_VMENTRY(jobject, getResolvedJavaMethodAtSlot, (JNIEnv *, jobject, jclass holder_handle, jint slot))
-  oop java_class = JNIHandles::resolve(holder_handle);
-  Klass* holder = java_lang_Class::as_Klass(java_class);
+C2V_VMENTRY(jobject, asResolvedJavaMethod, (JNIEnv *, jobject, jobject executable_handle))
+  oop executable = JNIHandles::resolve(executable_handle);
+  oop mirror = NULL;
+  int slot = 0;
+
+  if (executable->klass() == SystemDictionary::reflect_Constructor_klass()) {
+    mirror = java_lang_reflect_Constructor::clazz(executable);
+    slot = java_lang_reflect_Constructor::slot(executable);
+  } else {
+    assert(executable->klass() == SystemDictionary::reflect_Method_klass(), "wrong type");
+    mirror = java_lang_reflect_Method::clazz(executable);
+    slot = java_lang_reflect_Method::slot(executable);
+  }
+  Klass* holder = java_lang_Class::as_Klass(mirror);
   methodHandle method = InstanceKlass::cast(holder)->method_with_idnum(slot);
   oop result = CompilerToVM::get_jvmci_method(method, CHECK_NULL);
   return JNIHandles::make_local(THREAD, result);
@@ -1518,6 +1529,17 @@
   return size + Deoptimization::last_frame_adjust(0, callee_locals) * BytesPerWord;
 C2V_END
 
+C2V_VMENTRY(void, compileToBytecode, (JNIEnv*, jobject, jobject lambda_form_handle))
+  Handle lambda_form = JNIHandles::resolve_non_null(lambda_form_handle);
+  if (lambda_form->is_a(SystemDictionary::LambdaForm_klass())) {
+    TempNewSymbol compileToBytecode = SymbolTable::new_symbol("compileToBytecode", CHECK);
+    JavaValue result(T_VOID);
+    JavaCalls::call_special(&result, lambda_form, SystemDictionary::LambdaForm_klass(), compileToBytecode, vmSymbols::void_method_signature(), CHECK);
+  } else {
+    THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
+                err_msg("Unexpected type: %s", lambda_form->klass()->external_name()));
+  }
+C2V_END
 
 #define CC (char*)  /*cast a literal from (const char*)*/
 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(c2v_ ## f))
@@ -1525,6 +1547,7 @@
 #define STRING                "Ljava/lang/String;"
 #define OBJECT                "Ljava/lang/Object;"
 #define CLASS                 "Ljava/lang/Class;"
+#define EXECUTABLE            "Ljava/lang/reflect/Executable;"
 #define STACK_TRACE_ELEMENT   "Ljava/lang/StackTraceElement;"
 #define INSTALLED_CODE        "Ljdk/vm/ci/code/InstalledCode;"
 #define TARGET_DESCRIPTION    "Ljdk/vm/ci/code/TargetDescription;"
@@ -1572,7 +1595,7 @@
   {CC "getClassInitializer",                          CC "(" HS_RESOLVED_KLASS ")" HS_RESOLVED_METHOD,                                      FN_PTR(getClassInitializer)},
   {CC "hasFinalizableSubclass",                       CC "(" HS_RESOLVED_KLASS ")Z",                                                        FN_PTR(hasFinalizableSubclass)},
   {CC "getMaxCallTargetOffset",                       CC "(J)J",                                                                            FN_PTR(getMaxCallTargetOffset)},
-  {CC "getResolvedJavaMethodAtSlot",                  CC "(" CLASS "I)" HS_RESOLVED_METHOD,                                                 FN_PTR(getResolvedJavaMethodAtSlot)},
+  {CC "asResolvedJavaMethod",                         CC "(" EXECUTABLE ")" HS_RESOLVED_METHOD,                                             FN_PTR(asResolvedJavaMethod)},
   {CC "getResolvedJavaMethod",                        CC "(Ljava/lang/Object;J)" HS_RESOLVED_METHOD,                                        FN_PTR(getResolvedJavaMethod)},
   {CC "getConstantPool",                              CC "(Ljava/lang/Object;)" HS_CONSTANT_POOL,                                           FN_PTR(getConstantPool)},
   {CC "getResolvedJavaType",                          CC "(Ljava/lang/Object;JZ)" HS_RESOLVED_KLASS,                                        FN_PTR(getResolvedJavaType)},
@@ -1599,9 +1622,9 @@
   {CC "flushDebugOutput",                             CC "()V",                                                                             FN_PTR(flushDebugOutput)},
   {CC "methodDataProfileDataSize",                    CC "(JI)I",                                                                           FN_PTR(methodDataProfileDataSize)},
   {CC "interpreterFrameSize",                         CC "(" BYTECODE_FRAME ")I",                                                           FN_PTR(interpreterFrameSize)},
+  {CC "compileToBytecode",                            CC "(" OBJECT ")V",                                                                   FN_PTR(compileToBytecode)},
 };
 
 int CompilerToVM::methods_count() {
   return sizeof(methods) / sizeof(JNINativeMethod);
 }
-
--- a/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -58,7 +58,7 @@
 
     static bool _supports_inline_contig_alloc;
     static HeapWord** _heap_end_addr;
-    static HeapWord** _heap_top_addr;
+    static HeapWord* volatile* _heap_top_addr;
     static int _max_oop_map_stack_offset;
 
     static jbyte* cardtable_start_address;
--- a/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -817,16 +817,6 @@
   }
 JVM_END
 
-#define CHECK_WARN_ABORT_(message) THREAD); \
-  if (HAS_PENDING_EXCEPTION) { \
-    warning(message); \
-    char buf[512]; \
-    jio_snprintf(buf, 512, "Uncaught exception at %s:%d", __FILE__, __LINE__); \
-    JVMCIRuntime::abort_on_pending_exception(PENDING_EXCEPTION, buf); \
-    return; \
-  } \
-  (void)(0
-
 void JVMCIRuntime::shutdown(TRAPS) {
   if (_HotSpotJVMCIRuntime_instance != NULL) {
     _shutdown_called = true;
--- a/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -69,7 +69,7 @@
                                                                                                                                      \
   static_field(CompilerToVM::Data,             _supports_inline_contig_alloc,          bool)                                         \
   static_field(CompilerToVM::Data,             _heap_end_addr,                         HeapWord**)                                   \
-  static_field(CompilerToVM::Data,             _heap_top_addr,                         HeapWord**)                                   \
+  static_field(CompilerToVM::Data,             _heap_top_addr,                         HeapWord* volatile*)                          \
                                                                                                                                      \
   static_field(CompilerToVM::Data,             _max_oop_map_stack_offset,              int)                                          \
                                                                                                                                      \
@@ -327,8 +327,11 @@
   declare_constant(JVM_ACC_FIELD_INTERNAL)                                \
   declare_constant(JVM_ACC_FIELD_STABLE)                                  \
   declare_constant(JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE)                   \
+  declare_preprocessor_constant("JVM_ACC_VARARGS", JVM_ACC_VARARGS)       \
+  declare_preprocessor_constant("JVM_ACC_BRIDGE", JVM_ACC_BRIDGE)         \
+  declare_preprocessor_constant("JVM_ACC_ANNOTATION", JVM_ACC_ANNOTATION) \
+  declare_preprocessor_constant("JVM_ACC_ENUM", JVM_ACC_ENUM)             \
   declare_preprocessor_constant("JVM_ACC_SYNTHETIC", JVM_ACC_SYNTHETIC)   \
-  declare_preprocessor_constant("JVM_RECOGNIZED_FIELD_MODIFIERS", JVM_RECOGNIZED_FIELD_MODIFIERS) \
                                                                           \
   declare_constant(JVM_CONSTANT_Utf8)                                     \
   declare_constant(JVM_CONSTANT_Unicode)                                  \
@@ -660,7 +663,8 @@
 #define VM_LONG_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) \
   declare_preprocessor_constant("VM_Version::CPU_AVX512BW", CPU_AVX512BW) \
   declare_preprocessor_constant("VM_Version::CPU_AVX512VL", CPU_AVX512VL) \
-  declare_preprocessor_constant("VM_Version::CPU_SHA", CPU_SHA)
+  declare_preprocessor_constant("VM_Version::CPU_SHA", CPU_SHA)           \
+  declare_preprocessor_constant("VM_Version::CPU_FMA", CPU_FMA)
 
 #endif
 
--- a/hotspot/src/share/vm/memory/filemap.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/memory/filemap.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -179,6 +179,7 @@
   _classpath_entry_table_size = mapinfo->_classpath_entry_table_size;
   _classpath_entry_table = mapinfo->_classpath_entry_table;
   _classpath_entry_size = mapinfo->_classpath_entry_size;
+  _num_patch_mod_prefixes = ClassLoader::num_patch_mod_prefixes();
 
   // The following fields are for sanity checks for whether this archive
   // will function correctly with this JVM and the bootclasspath it's
@@ -911,11 +912,6 @@
     return false;
   }
 
-  if (Arguments::get_patch_mod_prefix() != NULL) {
-    FileMapInfo::fail_continue("The shared archive file cannot be used with --patch-module.");
-    return false;
-  }
-
   if (!Arguments::has_jimage()) {
     FileMapInfo::fail_continue("The shared archive file cannot be used with an exploded module build.");
     return false;
@@ -952,6 +948,23 @@
     return false;
   }
 
+  // Check if there is a mismatch in --patch-module entry counts between dump time and run time.
+  // More checks will be performed on individual --patch-module entry in the
+  // SharedPathsMiscInfo::check() function.
+  GrowableArray<ModulePatchPath*>* patch_mod_args = Arguments::get_patch_mod_prefix();
+  if (patch_mod_args != NULL) {
+    if (_num_patch_mod_prefixes == 0) {
+      FileMapInfo::fail_stop("--patch-module found in run time but none was specified in dump time");
+    }
+    if (patch_mod_args->length() != _num_patch_mod_prefixes) {
+      FileMapInfo::fail_stop("mismatched --patch-module entry counts between dump time and run time");
+    }
+  } else {
+    if (_num_patch_mod_prefixes > 0) {
+      FileMapInfo::fail_stop("--patch-module specified in dump time but none was specified in run time");
+    }
+  }
+
   return true;
 }
 
--- a/hotspot/src/share/vm/memory/filemap.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/memory/filemap.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -155,6 +155,7 @@
     // loading failures during runtime.
     int _classpath_entry_table_size;
     size_t _classpath_entry_size;
+    int    _num_patch_mod_prefixes;   // number of --patch-module entries
     SharedClassPathEntry* _classpath_entry_table;
 
     char* region_addr(int idx);
--- a/hotspot/src/share/vm/oops/arrayOop.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- * 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"
-
-/////////////// Unit tests ///////////////
-
-#ifndef PRODUCT
-
-#include "oops/arrayOop.hpp"
-#include "oops/oop.inline.hpp"
-#include "utilities/globalDefinitions.hpp"
-
-bool arrayOopDesc::check_max_length_overflow(BasicType type) {
-  julong length = max_array_length(type);
-  julong bytes_per_element = type2aelembytes(type);
-  julong bytes = length * bytes_per_element + header_size_in_bytes();
-  return (julong)(size_t)bytes == bytes;
-}
-
-static void test_max_array_length() {
-  assert(arrayOopDesc::check_max_length_overflow(T_BOOLEAN), "size_t overflow for boolean array");
-  assert(arrayOopDesc::check_max_length_overflow(T_CHAR), "size_t overflow for char array");
-  assert(arrayOopDesc::check_max_length_overflow(T_FLOAT), "size_t overflow for float array");
-  assert(arrayOopDesc::check_max_length_overflow(T_DOUBLE), "size_t overflow for double array");
-  assert(arrayOopDesc::check_max_length_overflow(T_BYTE), "size_t overflow for byte array");
-  assert(arrayOopDesc::check_max_length_overflow(T_SHORT), "size_t overflow for short array");
-  assert(arrayOopDesc::check_max_length_overflow(T_INT), "size_t overflow for int array");
-  assert(arrayOopDesc::check_max_length_overflow(T_LONG), "size_t overflow for long array");
-  assert(arrayOopDesc::check_max_length_overflow(T_OBJECT), "size_t overflow for object array");
-  assert(arrayOopDesc::check_max_length_overflow(T_ARRAY), "size_t overflow for array array");
-  assert(arrayOopDesc::check_max_length_overflow(T_NARROWOOP), "size_t overflow for narrowOop array");
-
-  // T_VOID and T_ADDRESS are not supported by max_array_length()
-}
-
-void arrayOopDesc_test() {
-  test_max_array_length();
-}
-
-#endif //PRODUCT
--- a/hotspot/src/share/vm/oops/arrayOop.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/oops/arrayOop.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,6 +41,7 @@
 
 class arrayOopDesc : public oopDesc {
   friend class VMStructs;
+  friend class arrayOopDescTest;
 
   // Interpreter/Compiler offsets
 
@@ -124,10 +125,6 @@
     return (int32_t)max_elements_per_size_t;
   }
 
-// for unit testing
-#ifndef PRODUCT
-  static bool check_max_length_overflow(BasicType type);
-#endif
 };
 
 #endif // SHARE_VM_OOPS_ARRAYOOP_HPP
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -517,7 +517,11 @@
 
 bool InstanceKlass::link_class_impl(
     instanceKlassHandle this_k, bool throw_verifyerror, TRAPS) {
-  // check for error state
+  // check for error state.
+  // This is checking for the wrong state.  If the state is initialization_error,
+  // then this class *was* linked.  The CDS code does a try_link_class and uses
+  // initialization_error to mark classes to not include in the archive during
+  // DumpSharedSpaces.  This should be removed when the CDS bug is fixed.
   if (this_k->is_in_error_state()) {
     ResourceMark rm(THREAD);
     THROW_MSG_(vmSymbols::java_lang_NoClassDefFoundError(),
@@ -670,36 +674,21 @@
 
 // Eagerly initialize superinterfaces that declare default methods (concrete instance: any access)
 void InstanceKlass::initialize_super_interfaces(instanceKlassHandle this_k, TRAPS) {
-  if (this_k->has_default_methods()) {
-    for (int i = 0; i < this_k->local_interfaces()->length(); ++i) {
-      Klass* iface = this_k->local_interfaces()->at(i);
-      InstanceKlass* ik = InstanceKlass::cast(iface);
-      if (ik->should_be_initialized()) {
-        if (ik->has_default_methods()) {
-          ik->initialize_super_interfaces(ik, THREAD);
-        }
-        // Only initialize() interfaces that "declare" concrete methods.
-        // has_default_methods drives searching superinterfaces since it
-        // means has_default_methods in its superinterface hierarchy
-        if (!HAS_PENDING_EXCEPTION && ik->declares_default_methods()) {
-          ik->initialize(THREAD);
-        }
-        if (HAS_PENDING_EXCEPTION) {
-          Handle e(THREAD, PENDING_EXCEPTION);
-          CLEAR_PENDING_EXCEPTION;
-          {
-            EXCEPTION_MARK;
-            // Locks object, set state, and notify all waiting threads
-            this_k->set_initialization_state_and_notify(
-                initialization_error, THREAD);
-
-            // ignore any exception thrown, superclass initialization error is
-            // thrown below
-            CLEAR_PENDING_EXCEPTION;
-          }
-          THROW_OOP(e());
-        }
-      }
+  assert (this_k->has_default_methods(), "caller should have checked this");
+  for (int i = 0; i < this_k->local_interfaces()->length(); ++i) {
+    Klass* iface = this_k->local_interfaces()->at(i);
+    InstanceKlass* ik = InstanceKlass::cast(iface);
+
+    // Initialization is depth first search ie. we start with top of the inheritance tree
+    // has_default_methods drives searching superinterfaces since it
+    // means has_default_methods in its superinterface hierarchy
+    if (ik->has_default_methods()) {
+      ik->initialize_super_interfaces(ik, CHECK);
+    }
+
+    // Only initialize() interfaces that "declare" concrete methods.
+    if (ik->should_be_initialized() && ik->declares_default_methods()) {
+      ik->initialize(CHECK);
     }
   }
 }
@@ -765,32 +754,36 @@
   }
 
   // Step 7
-  Klass* super_klass = this_k->super();
-  if (super_klass != NULL && !this_k->is_interface() && super_klass->should_be_initialized()) {
-    super_klass->initialize(THREAD);
-
+  // Next, if C is a class rather than an interface, initialize it's super class and super
+  // interfaces.
+  if (!this_k->is_interface()) {
+    Klass* super_klass = this_k->super();
+    if (super_klass != NULL && super_klass->should_be_initialized()) {
+      super_klass->initialize(THREAD);
+    }
+    // If C implements any interfaces that declares a non-abstract, non-static method,
+    // the initialization of C triggers initialization of its super interfaces.
+    // Only need to recurse if has_default_methods which includes declaring and
+    // inheriting default methods
+    if (!HAS_PENDING_EXCEPTION && this_k->has_default_methods()) {
+      this_k->initialize_super_interfaces(this_k, THREAD);
+    }
+
+    // If any exceptions, complete abruptly, throwing the same exception as above.
     if (HAS_PENDING_EXCEPTION) {
       Handle e(THREAD, PENDING_EXCEPTION);
       CLEAR_PENDING_EXCEPTION;
       {
         EXCEPTION_MARK;
-        this_k->set_initialization_state_and_notify(initialization_error, THREAD); // Locks object, set state, and notify all waiting threads
-        CLEAR_PENDING_EXCEPTION;   // ignore any exception thrown, superclass initialization error is thrown below
+        // Locks object, set state, and notify all waiting threads
+        this_k->set_initialization_state_and_notify(initialization_error, THREAD);
+        CLEAR_PENDING_EXCEPTION;
       }
       DTRACE_CLASSINIT_PROBE_WAIT(super__failed, this_k(), -1,wait);
       THROW_OOP(e());
     }
   }
 
-  // If C is an interface that declares a non-abstract, non-static method,
-  // the initialization of a class (not an interface) that implements C directly or
-  // indirectly.
-  // Recursively initialize any superinterfaces that declare default methods
-  // Only need to recurse if has_default_methods which includes declaring and
-  // inheriting default methods
-  if (!this_k->is_interface() && this_k->has_default_methods()) {
-    this_k->initialize_super_interfaces(this_k, CHECK);
-  }
 
   // Step 8
   {
@@ -852,10 +845,15 @@
 
 void InstanceKlass::set_initialization_state_and_notify_impl(instanceKlassHandle this_k, ClassState state, TRAPS) {
   oop init_lock = this_k->init_lock();
-  ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
-  this_k->set_init_state(state);
-  this_k->fence_and_clear_init_lock();
-  ol.notify_all(CHECK);
+  if (init_lock != NULL) {
+    ObjectLocker ol(init_lock, THREAD);
+    this_k->set_init_state(state);
+    this_k->fence_and_clear_init_lock();
+    ol.notify_all(CHECK);
+  } else {
+    assert(init_lock != NULL, "The initialization state should never be set twice");
+    this_k->set_init_state(state);
+  }
 }
 
 // The embedded _implementor field can only record one implementor.
--- a/hotspot/src/share/vm/oops/klass.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/oops/klass.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -734,27 +734,3 @@
 }
 
 #endif
-
-/////////////// Unit tests ///////////////
-
-#ifndef PRODUCT
-
-class TestKlass {
- public:
-  static void test_oop_is_instanceClassLoader() {
-    Klass* klass = SystemDictionary::ClassLoader_klass();
-    guarantee(klass->is_instance_klass(), "assert");
-    guarantee(InstanceKlass::cast(klass)->is_class_loader_instance_klass(), "test failed");
-
-    klass = SystemDictionary::String_klass();
-    guarantee(!klass->is_instance_klass() ||
-              !InstanceKlass::cast(klass)->is_class_loader_instance_klass(),
-              "test failed");
-  }
-};
-
-void TestKlass_test() {
-  TestKlass::test_oop_is_instanceClassLoader();
-}
-
-#endif  // PRODUCT
--- a/hotspot/src/share/vm/oops/oop.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/oops/oop.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -83,6 +83,7 @@
 
   inline Klass* klass() const;
   inline Klass* klass_or_null() const volatile;
+  inline Klass* klass_or_null_acquire() const volatile;
   inline Klass** klass_addr();
   inline narrowKlass* compressed_klass_addr();
 
--- a/hotspot/src/share/vm/oops/oop.inline.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/oops/oop.inline.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -109,7 +109,6 @@
 }
 
 Klass* oopDesc::klass_or_null() const volatile {
-  // can be NULL in CMS
   if (UseCompressedClassPointers) {
     return Klass::decode_klass(_metadata._compressed_klass);
   } else {
@@ -117,6 +116,17 @@
   }
 }
 
+Klass* oopDesc::klass_or_null_acquire() const volatile {
+  if (UseCompressedClassPointers) {
+    // Workaround for non-const load_acquire parameter.
+    const volatile narrowKlass* addr = &_metadata._compressed_klass;
+    volatile narrowKlass* xaddr = const_cast<volatile narrowKlass*>(addr);
+    return Klass::decode_klass(OrderAccess::load_acquire(xaddr));
+  } else {
+    return (Klass*)OrderAccess::load_ptr_acquire(&_metadata._klass);
+  }
+}
+
 Klass** oopDesc::klass_addr() {
   // Only used internally and with CMS and will not work with
   // UseCompressedOops
--- a/hotspot/src/share/vm/opto/c2compiler.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/opto/c2compiler.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -416,6 +416,12 @@
   case vmIntrinsics::_onSpinWait:
     if (!Matcher::match_rule_supported(Op_OnSpinWait)) return false;
     break;
+  case vmIntrinsics::_fmaD:
+    if (!UseFMA || !Matcher::match_rule_supported(Op_FmaD)) return false;
+    break;
+  case vmIntrinsics::_fmaF:
+    if (!UseFMA || !Matcher::match_rule_supported(Op_FmaF)) return false;
+    break;
   case vmIntrinsics::_hashCode:
   case vmIntrinsics::_identityHashCode:
   case vmIntrinsics::_getClass:
--- a/hotspot/src/share/vm/opto/classes.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/opto/classes.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -151,6 +151,8 @@
 macro(EncodePKlass)
 macro(FastLock)
 macro(FastUnlock)
+macro(FmaD)
+macro(FmaF)
 macro(Goto)
 macro(Halt)
 macro(HasNegatives)
--- a/hotspot/src/share/vm/opto/library_call.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -320,6 +320,7 @@
   bool inline_montgomeryMultiply();
   bool inline_montgomerySquare();
   bool inline_vectorizedMismatch();
+  bool inline_fma(vmIntrinsics::ID id);
 
   bool inline_profileBoolean();
   bool inline_isCompileConstant();
@@ -829,6 +830,10 @@
   case vmIntrinsics::_hasNegatives:
     return inline_hasNegatives();
 
+  case vmIntrinsics::_fmaD:
+  case vmIntrinsics::_fmaF:
+    return inline_fma(intrinsic_id());
+
   default:
     // If you get here, it may be that someone has added a new intrinsic
     // to the list in vmSymbols.hpp without implementing it here.
@@ -6698,6 +6703,35 @@
   return instof_false;  // even if it is NULL
 }
 
+//-------------inline_fma-----------------------------------
+bool LibraryCallKit::inline_fma(vmIntrinsics::ID id) {
+  Node *a = NULL;
+  Node *b = NULL;
+  Node *c = NULL;
+  Node* result = NULL;
+  switch (id) {
+  case vmIntrinsics::_fmaD:
+    assert(callee()->signature()->size() == 6, "fma has 3 parameters of size 2 each.");
+    // no receiver since it is static method
+    a = round_double_node(argument(0));
+    b = round_double_node(argument(2));
+    c = round_double_node(argument(4));
+    result = _gvn.transform(new FmaDNode(control(), a, b, c));
+    break;
+  case vmIntrinsics::_fmaF:
+    assert(callee()->signature()->size() == 3, "fma has 3 parameters of size 1 each.");
+    a = argument(0);
+    b = argument(1);
+    c = argument(2);
+    result = _gvn.transform(new FmaFNode(control(), a, b, c));
+    break;
+  default:
+    fatal_unexpected_iid(id);  break;
+  }
+  set_result(result);
+  return true;
+}
+
 bool LibraryCallKit::inline_profileBoolean() {
   Node* counts = argument(1);
   const TypeAryPtr* ary = NULL;
--- a/hotspot/src/share/vm/opto/matcher.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/opto/matcher.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -2117,6 +2117,8 @@
       case Op_StrInflatedCopy:
       case Op_StrCompressedCopy:
       case Op_EncodeISOArray:
+      case Op_FmaD:
+      case Op_FmaF:
         set_shared(n); // Force result into register (it will be anyways)
         break;
       case Op_ConP: {  // Convert pointers above the centerline to NUL
@@ -2305,6 +2307,15 @@
         n->del_req(4);
         break;
       }
+      case Op_FmaD:
+      case Op_FmaF: {
+        // Restructure into a binary tree for Matching.
+        Node* pair = new BinaryNode(n->in(1), n->in(2));
+        n->set_req(2, pair);
+        n->set_req(1, n->in(3));
+        n->del_req(3);
+        break;
+      }
       default:
         break;
       }
--- a/hotspot/src/share/vm/opto/mulnode.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/opto/mulnode.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -1343,3 +1343,47 @@
 
   return TypeLong::LONG;                // Give up
 }
+
+//=============================================================================
+//------------------------------Value------------------------------------------
+const Type* FmaDNode::Value(PhaseGVN* phase) const {
+  const Type *t1 = phase->type(in(1));
+  if (t1 == Type::TOP) return Type::TOP;
+  if (t1->base() != Type::DoubleCon) return Type::DOUBLE;
+  const Type *t2 = phase->type(in(2));
+  if (t2 == Type::TOP) return Type::TOP;
+  if (t2->base() != Type::DoubleCon) return Type::DOUBLE;
+  const Type *t3 = phase->type(in(3));
+  if (t3 == Type::TOP) return Type::TOP;
+  if (t3->base() != Type::DoubleCon) return Type::DOUBLE;
+#ifndef __STDC_IEC_559__
+  return Type::DOUBLE;
+#else
+  double d1 = t1->getd();
+  double d2 = t2->getd();
+  double d3 = t3->getd();
+  return TypeD::make(fma(d1, d2, d3));
+#endif
+}
+
+//=============================================================================
+//------------------------------Value------------------------------------------
+const Type* FmaFNode::Value(PhaseGVN* phase) const {
+  const Type *t1 = phase->type(in(1));
+  if (t1 == Type::TOP) return Type::TOP;
+  if (t1->base() != Type::FloatCon) return Type::FLOAT;
+  const Type *t2 = phase->type(in(2));
+  if (t2 == Type::TOP) return Type::TOP;
+  if (t2->base() != Type::FloatCon) return Type::FLOAT;
+  const Type *t3 = phase->type(in(3));
+  if (t3 == Type::TOP) return Type::TOP;
+  if (t3->base() != Type::FloatCon) return Type::FLOAT;
+#ifndef __STDC_IEC_559__
+  return Type::FLOAT;
+#else
+  float f1 = t1->getf();
+  float f2 = t2->getf();
+  float f3 = t3->getf();
+  return TypeF::make(fma(f1, f2, f3));
+#endif
+}
--- a/hotspot/src/share/vm/opto/mulnode.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/opto/mulnode.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -263,4 +263,26 @@
   virtual uint ideal_reg() const { return Op_RegL; }
 };
 
+//------------------------------FmaDNode--------------------------------------
+// fused-multiply-add double
+class FmaDNode : public Node {
+public:
+  FmaDNode(Node *c, Node *in1, Node *in2, Node *in3) : Node(c, in1, in2, in3) {}
+  virtual int Opcode() const;
+  const Type *bottom_type() const { return Type::DOUBLE; }
+  virtual uint ideal_reg() const { return Op_RegD; }
+  virtual const Type* Value(PhaseGVN* phase) const;
+};
+
+//------------------------------FmaFNode--------------------------------------
+// fused-multiply-add float
+class FmaFNode : public Node {
+public:
+  FmaFNode(Node *c, Node *in1, Node *in2, Node *in3) : Node(c, in1, in2, in3) {}
+  virtual int Opcode() const;
+  const Type *bottom_type() const { return Type::FLOAT; }
+  virtual uint ideal_reg() const { return Op_RegF; }
+  virtual const Type* Value(PhaseGVN* phase) const;
+};
+
 #endif // SHARE_VM_OPTO_MULNODE_HPP
--- a/hotspot/src/share/vm/prims/jvm.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -562,8 +562,8 @@
   }
 
   Handle stackStream_h(THREAD, JNIHandles::resolve_non_null(stackStream));
-  return StackWalk::moreFrames(stackStream_h, mode, anchor, frame_count,
-                               start_index, frames_array_h, THREAD);
+  return StackWalk::fetchNextBatch(stackStream_h, mode, anchor, frame_count,
+                                   start_index, frames_array_h, THREAD);
 JVM_END
 
 JVM_ENTRY(void, JVM_ToStackTraceElement(JNIEnv *env, jobject frame, jobject stack))
--- a/hotspot/src/share/vm/prims/jvmti.xml	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/prims/jvmti.xml	Wed Jul 05 22:19:13 2017 +0200
@@ -21,7 +21,6 @@
  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  or visit www.oracle.com if you need additional information or have any
  questions.
-
 -->
 
 <!DOCTYPE specification [
--- a/hotspot/src/share/vm/prims/jvmtiEnter.xsl	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/prims/jvmtiEnter.xsl	Wed Jul 05 22:19:13 2017 +0200
@@ -487,8 +487,8 @@
 </xsl:text>
     <xsl:if test="$trace='Trace'">
       <xsl:text>    if (trace_flags) {
-          log_trace(jvmti)("[-] %s %s",  func_name, 
-                    JvmtiUtil::error_name(JVMTI_ERROR_WRONG_PHASE));
+          log_trace(jvmti)("[-] %s %s(%d)", func_name,
+                    JvmtiUtil::error_name(JVMTI_ERROR_WRONG_PHASE), JvmtiEnv::get_phase());
     }
 </xsl:text>
     </xsl:if>
--- a/hotspot/src/share/vm/prims/jvmtiH.xsl	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/prims/jvmtiH.xsl	Wed Jul 05 22:19:13 2017 +0200
@@ -95,7 +95,7 @@
   </xsl:template>
 
   <xsl:template name="intro">
-  <xsl:call-template name="includeHeader"/>
+  <xsl:call-template name="include_GPL_CP_Header"/>
   <xsl:text>
     /* Include file for the Java(tm) Virtual Machine Tool Interface */
 
--- a/hotspot/src/share/vm/prims/jvmtiLib.xsl	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/prims/jvmtiLib.xsl	Wed Jul 05 22:19:13 2017 +0200
@@ -43,13 +43,56 @@
     <xsl:call-template name="microversion"/>
   </xsl:template>
 
+  <xsl:variable name="GPL_header">
+    <!-- The Copyright comment from jvmti.xml -->
+    <xsl:value-of select="/comment()[position()=1]"/>
+  </xsl:variable>
+
+  <xsl:variable name="GPL_CP_header_body">
+    <xsl:text> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.&#xA;</xsl:text>
+    <xsl:text> *&#xA;</xsl:text>
+    <xsl:text> * This code is free software; you can redistribute it and/or modify it&#xA;</xsl:text>
+    <xsl:text> * under the terms of the GNU General Public License version 2 only, as&#xA;</xsl:text>
+    <xsl:text> * published by the Free Software Foundation.  Oracle designates this&#xA;</xsl:text>
+    <xsl:text> * particular file as subject to the "Classpath" exception as provided&#xA;</xsl:text>
+    <xsl:text> * by Oracle in the LICENSE file that accompanied this code.&#xA;</xsl:text>
+    <xsl:text> *&#xA;</xsl:text>
+    <xsl:text> * This code is distributed in the hope that it will be useful, but WITHOUT&#xA;</xsl:text>
+    <xsl:text> * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or&#xA;</xsl:text>
+    <xsl:text> * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License&#xA;</xsl:text>
+    <xsl:text> * version 2 for more details (a copy is included in the LICENSE file that&#xA;</xsl:text>
+    <xsl:text> * accompanied this code).&#xA;</xsl:text>
+    <xsl:text> *&#xA;</xsl:text>
+    <xsl:text> * You should have received a copy of the GNU General Public License version&#xA;</xsl:text>
+    <xsl:text> * 2 along with this work; if not, write to the Free Software Foundation,&#xA;</xsl:text>
+    <xsl:text> * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.&#xA;</xsl:text>
+    <xsl:text> *&#xA;</xsl:text>
+    <xsl:text> * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA&#xA;</xsl:text>
+    <xsl:text> * or visit www.oracle.com if you need additional information or have any&#xA;</xsl:text>
+    <xsl:text> * questions.&#xA;</xsl:text>
+  </xsl:variable>
+
   <xsl:template name="copyrightComment">
     <xsl:text>/*</xsl:text>
-    <!-- Copy the Copyright comment from jvmti.xml -->
-    <xsl:value-of select="/comment()[position()=1]"/>
+    <!-- The Copyright comment from jvmti.xml -->
+    <xsl:value-of select="$GPL_header"/>
     <xsl:text> */&#xA;&#xA;</xsl:text>
   </xsl:template>
 
+  <xsl:template name="GPL_CP_copyrightComment">
+    <xsl:text>/*&#xA; *</xsl:text>
+    <!-- The Copyright year from jvmti.xml -->
+    <xsl:value-of select="substring-after(substring-before($GPL_header, ' DO NOT ALTER'), '&#xA;')"/>
+    <!-- The GPL+CP Copyright header body -->
+    <xsl:value-of select="$GPL_CP_header_body"/>
+    <xsl:text> */&#xA;&#xA;</xsl:text>
+  </xsl:template>
+
+  <xsl:template name="include_GPL_CP_Header">
+    <xsl:call-template name="GPL_CP_copyrightComment"/>
+    <xsl:text> /* AUTOMATICALLY GENERATED FILE - DO NOT EDIT */&#xA;</xsl:text>    
+  </xsl:template>
+
   <xsl:template name="includeHeader">
     <xsl:call-template name="copyrightComment"/>
     <xsl:text> /* AUTOMATICALLY GENERATED FILE - DO NOT EDIT */&#xA;</xsl:text>    
--- a/hotspot/src/share/vm/prims/stackwalk.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/prims/stackwalk.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -37,42 +37,47 @@
 #include "utilities/globalDefinitions.hpp"
 
 // setup and cleanup actions
-void JavaFrameStream::setup_magic_on_entry(objArrayHandle frames_array) {
+void BaseFrameStream::setup_magic_on_entry(objArrayHandle frames_array) {
   frames_array->obj_at_put(magic_pos, _thread->threadObj());
   _anchor = address_value();
   assert(check_magic(frames_array), "invalid magic");
 }
 
-bool JavaFrameStream::check_magic(objArrayHandle frames_array) {
+bool BaseFrameStream::check_magic(objArrayHandle frames_array) {
   oop   m1 = frames_array->obj_at(magic_pos);
   jlong m2 = _anchor;
   if (m1 == _thread->threadObj() && m2 == address_value())  return true;
   return false;
 }
 
-bool JavaFrameStream::cleanup_magic_on_exit(objArrayHandle frames_array) {
+bool BaseFrameStream::cleanup_magic_on_exit(objArrayHandle frames_array) {
   bool ok = check_magic(frames_array);
   frames_array->obj_at_put(magic_pos, NULL);
   _anchor = 0L;
   return ok;
 }
 
-// Returns JavaFrameStream for the current stack being traversed.
+JavaFrameStream::JavaFrameStream(JavaThread* thread, int mode)
+  : BaseFrameStream(thread), _vfst(thread) {
+  _need_method_info = StackWalk::need_method_info(mode);
+}
+
+// Returns the BaseFrameStream for the current stack being traversed.
 //
 // Parameters:
 //  thread         Current Java thread.
 //  magic          Magic value used for each stack walking
 //  frames_array   User-supplied buffers.  The 0th element is reserved
-//                 to this JavaFrameStream to use
+//                 for this BaseFrameStream to use
 //
-JavaFrameStream* JavaFrameStream::from_current(JavaThread* thread, jlong magic,
+BaseFrameStream* BaseFrameStream::from_current(JavaThread* thread, jlong magic,
                                                objArrayHandle frames_array)
 {
   assert(thread != NULL && thread->is_Java_thread(), "");
   oop m1 = frames_array->obj_at(magic_pos);
   if (m1 != thread->threadObj())      return NULL;
   if (magic == 0L)                    return NULL;
-  JavaFrameStream* stream = (JavaFrameStream*) (intptr_t) magic;
+  BaseFrameStream* stream = (BaseFrameStream*) (intptr_t) magic;
   if (!stream->is_valid_in(thread, frames_array))   return NULL;
   return stream;
 }
@@ -85,7 +90,7 @@
 //
 // Parameters:
 //   mode             Restrict which frames to be decoded.
-//   JavaFrameStream  stream of javaVFrames
+//   BaseFrameStream  stream of frames
 //   max_nframes      Maximum number of frames to be filled.
 //   start_index      Start index to the user-supplied buffers.
 //   frames_array     Buffer to store Class or StackFrame in, starting at start_index.
@@ -96,7 +101,7 @@
 //
 // Returns the number of frames whose information was transferred into the buffers.
 //
-int StackWalk::fill_in_frames(jlong mode, JavaFrameStream& stream,
+int StackWalk::fill_in_frames(jlong mode, BaseFrameStream& stream,
                               int max_nframes, int start_index,
                               objArrayHandle  frames_array,
                               int& end_index, TRAPS) {
@@ -110,7 +115,6 @@
   int frames_decoded = 0;
   for (; !stream.at_end(); stream.next()) {
     Method* method = stream.method();
-    int bci = stream.bci();
 
     if (method == NULL) continue;
 
@@ -129,35 +133,42 @@
     int index = end_index++;
     if (TraceStackWalk) {
       tty->print("  %d: frame method: ", index); method->print_short_name();
-      tty->print_cr(" bci=%d", bci);
+      tty->print_cr(" bci=%d", stream.bci());
     }
 
+    if (!need_method_info(mode) && get_caller_class(mode) &&
+          index == start_index && method->caller_sensitive()) {
+      ResourceMark rm(THREAD);
+      THROW_MSG_0(vmSymbols::java_lang_UnsupportedOperationException(),
+        err_msg("StackWalker::getCallerClass called from @CallerSensitive %s method",
+                method->name_and_sig_as_C_string()));
+    }
     // fill in StackFrameInfo and initialize MemberName
-    if (live_frame_info(mode)) {
-      assert (use_frames_array(mode), "Bad mode for get live frame");
-      Handle stackFrame(frames_array->obj_at(index));
-      fill_live_stackframe(stackFrame, method, bci, stream.java_frame(), CHECK_0);
-    } else if (need_method_info(mode)) {
-      assert (use_frames_array(mode), "Bad mode for get stack frame");
-      Handle stackFrame(frames_array->obj_at(index));
-      fill_stackframe(stackFrame, method, bci);
-    } else {
-      assert (use_frames_array(mode) == false, "Bad mode for filling in Class object");
-      if (get_caller_class(mode) && index == start_index && method->caller_sensitive()) {
-        ResourceMark rm(THREAD);
-        THROW_MSG_0(vmSymbols::java_lang_UnsupportedOperationException(),
-          err_msg("StackWalker::getCallerClass called from @CallerSensitive %s method",
-                  method->name_and_sig_as_C_string()));
-      }
-
-      frames_array->obj_at_put(index, method->method_holder()->java_mirror());
-    }
+    stream.fill_frame(index, frames_array, method, CHECK_0);
     if (++frames_decoded >= max_nframes)  break;
   }
   return frames_decoded;
 }
 
-static oop create_primitive_value_instance(StackValueCollection* values, int i, TRAPS) {
+// Fill in the LiveStackFrameInfo at the given index in frames_array
+void LiveFrameStream::fill_frame(int index, objArrayHandle  frames_array,
+                                 const methodHandle& method, TRAPS) {
+  Handle stackFrame(THREAD, frames_array->obj_at(index));
+  fill_live_stackframe(stackFrame, method, CHECK);
+}
+
+// Fill in the StackFrameInfo at the given index in frames_array
+void JavaFrameStream::fill_frame(int index, objArrayHandle  frames_array,
+                                 const methodHandle& method, TRAPS) {
+  if (_need_method_info) {
+    Handle stackFrame(THREAD, frames_array->obj_at(index));
+    fill_stackframe(stackFrame, method);
+  } else {
+    frames_array->obj_at_put(index, method->method_holder()->java_mirror());
+  }
+}
+
+oop LiveFrameStream::create_primitive_value_instance(StackValueCollection* values, int i, TRAPS) {
   Klass* k = SystemDictionary::resolve_or_null(vmSymbols::java_lang_LiveStackFrameInfo(), CHECK_NULL);
   instanceKlassHandle ik (THREAD, k);
 
@@ -228,7 +239,7 @@
   return (instanceOop) result.get_jobject();
 }
 
-static objArrayHandle values_to_object_array(StackValueCollection* values, TRAPS) {
+objArrayHandle LiveFrameStream::values_to_object_array(StackValueCollection* values, TRAPS) {
   objArrayHandle empty;
   int length = values->size();
   objArrayOop array_oop = oopFactory::new_objArray(SystemDictionary::Object_klass(),
@@ -243,7 +254,7 @@
   return array_h;
 }
 
-static objArrayHandle monitors_to_object_array(GrowableArray<MonitorInfo*>* monitors, TRAPS) {
+objArrayHandle LiveFrameStream::monitors_to_object_array(GrowableArray<MonitorInfo*>* monitors, TRAPS) {
   int length = monitors->length();
   objArrayOop array_oop = oopFactory::new_objArray(SystemDictionary::Object_klass(),
                                                    length, CHECK_(objArrayHandle()));
@@ -256,19 +267,19 @@
 }
 
 // Fill StackFrameInfo with declaringClass and bci and initialize memberName
-void StackWalk::fill_stackframe(Handle stackFrame, const methodHandle& method, int bci) {
+void BaseFrameStream::fill_stackframe(Handle stackFrame, const methodHandle& method) {
   java_lang_StackFrameInfo::set_declaringClass(stackFrame(), method->method_holder()->java_mirror());
-  java_lang_StackFrameInfo::set_method_and_bci(stackFrame(), method, bci);
+  java_lang_StackFrameInfo::set_method_and_bci(stackFrame(), method, bci());
 }
 
 // Fill LiveStackFrameInfo with locals, monitors, and expressions
-void StackWalk::fill_live_stackframe(Handle stackFrame, const methodHandle& method,
-                                     int bci, javaVFrame* jvf, TRAPS) {
-  fill_stackframe(stackFrame, method, bci);
-  if (jvf != NULL) {
-    StackValueCollection* locals = jvf->locals();
-    StackValueCollection* expressions = jvf->expressions();
-    GrowableArray<MonitorInfo*>* monitors = jvf->monitors();
+void LiveFrameStream::fill_live_stackframe(Handle stackFrame,
+                                           const methodHandle& method, TRAPS) {
+  fill_stackframe(stackFrame, method);
+  if (_jvf != NULL) {
+    StackValueCollection* locals = _jvf->locals();
+    StackValueCollection* expressions = _jvf->expressions();
+    GrowableArray<MonitorInfo*>* monitors = _jvf->monitors();
 
     if (!locals->is_empty()) {
       objArrayHandle locals_h = values_to_object_array(locals, CHECK);
@@ -315,15 +326,28 @@
     THROW_MSG_(vmSymbols::java_lang_NullPointerException(), "frames_array is NULL", NULL);
   }
 
-  Klass* stackWalker_klass = SystemDictionary::StackWalker_klass();
-  Klass* abstractStackWalker_klass = SystemDictionary::AbstractStackWalker_klass();
+  // Setup traversal onto my stack.
+  if (live_frame_info(mode)) {
+    assert (use_frames_array(mode), "Bad mode for get live frame");
+    RegisterMap regMap(jt, true);
+    LiveFrameStream stream(jt, &regMap);
+    return fetchFirstBatch(stream, stackStream, mode, skip_frames, frame_count,
+                           start_index, frames_array, THREAD);
+  } else {
+    JavaFrameStream stream(jt, mode);
+    return fetchFirstBatch(stream, stackStream, mode, skip_frames, frame_count,
+                           start_index, frames_array, THREAD);
+  }
+}
 
+oop StackWalk::fetchFirstBatch(BaseFrameStream& stream, Handle stackStream,
+                               jlong mode, int skip_frames, int frame_count,
+                               int start_index, objArrayHandle frames_array, TRAPS) {
   methodHandle m_doStackWalk(THREAD, Universe::do_stack_walk_method());
 
-  // Setup traversal onto my stack.
-  RegisterMap regMap(jt, true);
-  JavaFrameStream stream(jt, &regMap);
   {
+    Klass* stackWalker_klass = SystemDictionary::StackWalker_klass();
+    Klass* abstractStackWalker_klass = SystemDictionary::AbstractStackWalker_klass();
     while (!stream.at_end()) {
       InstanceKlass* ik = stream.method()->method_holder();
       if (ik != stackWalker_klass &&
@@ -341,10 +365,7 @@
     // from the stack frame at depth == skip_frames.
     for (int n=0; n < skip_frames && !stream.at_end(); stream.next(), n++) {
       if (TraceStackWalk) {
-        tty->print("  skip "); stream.method()->print_short_name();
-        tty->print_cr(" frame id: " PTR_FORMAT " pc: " PTR_FORMAT,
-                      p2i(stream.java_frame()->fr().id()),
-                      p2i(stream.java_frame()->fr().pc()));
+        tty->print("  skip "); stream.method()->print_short_name(); tty->cr();
       }
     }
   }
@@ -402,13 +423,13 @@
 //
 // Returns the end index of frame filled in the buffer.
 //
-jint StackWalk::moreFrames(Handle stackStream, jlong mode, jlong magic,
-                           int frame_count, int start_index,
-                           objArrayHandle frames_array,
-                           TRAPS)
+jint StackWalk::fetchNextBatch(Handle stackStream, jlong mode, jlong magic,
+                               int frame_count, int start_index,
+                               objArrayHandle frames_array,
+                               TRAPS)
 {
   JavaThread* jt = (JavaThread*)THREAD;
-  JavaFrameStream* existing_stream = JavaFrameStream::from_current(jt, magic, frames_array);
+  BaseFrameStream* existing_stream = BaseFrameStream::from_current(jt, magic, frames_array);
   if (existing_stream == NULL) {
     THROW_MSG_(vmSymbols::java_lang_InternalError(), "doStackWalk: corrupted buffers", 0L);
   }
@@ -418,7 +439,7 @@
   }
 
   if (TraceStackWalk) {
-    tty->print_cr("StackWalk::moreFrames frame_count %d existing_stream " PTR_FORMAT " start %d frames %d",
+    tty->print_cr("StackWalk::fetchNextBatch frame_count %d existing_stream " PTR_FORMAT " start %d frames %d",
                   frame_count, p2i(existing_stream), start_index, frames_array->length());
   }
   int end_index = start_index;
@@ -429,7 +450,7 @@
   int count = frame_count + start_index;
   assert (frames_array->length() >= count, "not enough space in buffers");
 
-  JavaFrameStream& stream = (*existing_stream);
+  BaseFrameStream& stream = (*existing_stream);
   if (!stream.at_end()) {
     stream.next(); // advance past the last frame decoded in previous batch
     if (!stream.at_end()) {
--- a/hotspot/src/share/vm/prims/stackwalk.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/prims/stackwalk.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -29,31 +29,34 @@
 #include "oops/oop.hpp"
 #include "runtime/vframe.hpp"
 
-//
-// JavaFrameStream is used by StackWalker to iterate through Java stack frames
-// on the given JavaThread.
-//
-class JavaFrameStream : public StackObj {
+// BaseFrameStream is an abstract base class for encapsulating the VM-side
+// implementation of the StackWalker API.  There are two concrete subclasses:
+// - JavaFrameStream:
+//     -based on vframeStream; used in most instances
+// - LiveFrameStream:
+//     -based on javaVFrame; used for retrieving locals/monitors/operands for
+//      LiveStackFrame
+class BaseFrameStream : public StackObj {
 private:
   enum {
     magic_pos = 0
   };
 
   JavaThread*           _thread;
-  javaVFrame*           _jvf;
   jlong                 _anchor;
+protected:
+  void fill_stackframe(Handle stackFrame, const methodHandle& method);
 public:
-  JavaFrameStream(JavaThread* thread, RegisterMap* rm)
-    : _thread(thread), _anchor(0L) {
-    _jvf = _thread->last_java_vframe(rm);
-  }
+  BaseFrameStream(JavaThread* thread) : _thread(thread), _anchor(0L) {}
+
+  virtual void    next()=0;
+  virtual bool    at_end()=0;
 
-  javaVFrame*     java_frame()        { return _jvf; }
-  void            next()              { _jvf = _jvf->java_sender(); }
-  bool            at_end()            { return _jvf == NULL; }
+  virtual Method* method()=0;
+  virtual int     bci()=0;
 
-  Method* method()                    { return _jvf->method(); }
-  int bci()                           { return _jvf->bci(); }
+  virtual void    fill_frame(int index, objArrayHandle  frames_array,
+                             const methodHandle& method, TRAPS)=0;
 
   void setup_magic_on_entry(objArrayHandle frames_array);
   bool check_magic(objArrayHandle frames_array);
@@ -67,35 +70,72 @@
     return (jlong) castable_address(this);
   }
 
-  static JavaFrameStream* from_current(JavaThread* thread, jlong magic, objArrayHandle frames_array);
+  static BaseFrameStream* from_current(JavaThread* thread, jlong magic, objArrayHandle frames_array);
+};
+
+class JavaFrameStream : public BaseFrameStream {
+private:
+  vframeStream          _vfst;
+  bool                  _need_method_info;
+public:
+  JavaFrameStream(JavaThread* thread, int mode);
+
+  void next()      { _vfst.next();}
+  bool at_end()    { return _vfst.at_end(); }
+
+  Method* method() { return _vfst.method(); }
+  int bci()        { return _vfst.bci(); }
+
+  void fill_frame(int index, objArrayHandle  frames_array,
+                  const methodHandle& method, TRAPS);
+};
+
+class LiveFrameStream : public BaseFrameStream {
+private:
+  javaVFrame*           _jvf;
+
+  void fill_live_stackframe(Handle stackFrame, const methodHandle& method, TRAPS);
+  static oop create_primitive_value_instance(StackValueCollection* values,
+                                             int i, TRAPS);
+  static objArrayHandle monitors_to_object_array(GrowableArray<MonitorInfo*>* monitors,
+                                                 TRAPS);
+  static objArrayHandle values_to_object_array(StackValueCollection* values, TRAPS);
+public:
+  LiveFrameStream(JavaThread* thread, RegisterMap* rm) : BaseFrameStream(thread) {
+    _jvf = thread->last_java_vframe(rm);
+  }
+
+  void next()      { _jvf = _jvf->java_sender(); }
+  bool at_end()    { return _jvf == NULL; }
+
+  Method* method() { return _jvf->method(); }
+  int bci()        { return _jvf->bci(); }
+
+  void fill_frame(int index, objArrayHandle  frames_array,
+                  const methodHandle& method, TRAPS);
 };
 
 class StackWalk : public AllStatic {
 private:
-  static int fill_in_frames(jlong mode, JavaFrameStream& stream,
+  static int fill_in_frames(jlong mode, BaseFrameStream& stream,
                             int max_nframes, int start_index,
                             objArrayHandle frames_array,
                             int& end_index, TRAPS);
 
-  static void fill_stackframe(Handle stackFrame, const methodHandle& method, int bci);
-
-  static void fill_live_stackframe(Handle stackFrame, const methodHandle& method, int bci,
-                                   javaVFrame* jvf, TRAPS);
-
   static inline bool get_caller_class(int mode) {
     return (mode & JVM_STACKWALK_GET_CALLER_CLASS) != 0;
   }
   static inline bool skip_hidden_frames(int mode) {
     return (mode & JVM_STACKWALK_SHOW_HIDDEN_FRAMES) == 0;
   }
-  static inline bool need_method_info(int mode) {
-    return (mode & JVM_STACKWALK_FILL_CLASS_REFS_ONLY) == 0;
-  }
   static inline bool live_frame_info(int mode) {
     return (mode & JVM_STACKWALK_FILL_LIVE_STACK_FRAMES) != 0;
   }
 
 public:
+  static inline bool need_method_info(int mode) {
+    return (mode & JVM_STACKWALK_FILL_CLASS_REFS_ONLY) == 0;
+  }
   static inline bool use_frames_array(int mode) {
     return (mode & JVM_STACKWALK_FILL_CLASS_REFS_ONLY) == 0;
   }
@@ -104,9 +144,12 @@
                   objArrayHandle frames_array,
                   TRAPS);
 
-  static jint moreFrames(Handle stackStream, jlong mode, jlong magic,
-                         int frame_count, int start_index,
-                         objArrayHandle frames_array,
-                         TRAPS);
+  static oop fetchFirstBatch(BaseFrameStream& stream, Handle stackStream,
+                             jlong mode, int skip_frames, int frame_count,
+                             int start_index, objArrayHandle frames_array, TRAPS);
+
+  static jint fetchNextBatch(Handle stackStream, jlong mode, jlong magic,
+                             int frame_count, int start_index,
+                             objArrayHandle frames_array, TRAPS);
 };
 #endif // SHARE_VM_PRIMS_STACKWALK_HPP
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -3897,10 +3897,6 @@
 
 void Arguments::set_shared_spaces_flags() {
   if (DumpSharedSpaces) {
-    if (Arguments::get_patch_mod_prefix() != NULL) {
-      vm_exit_during_initialization(
-        "Cannot use the following option when dumping the shared archive: --patch-module");
-    }
 
     if (RequireSharedSpaces) {
       warning("Cannot dump shared archive while using shared archive");
--- a/hotspot/src/share/vm/runtime/globals.hpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Wed Jul 05 22:19:13 2017 +0200
@@ -659,6 +659,9 @@
   product(bool, UseAES, false,                                              \
           "Control whether AES instructions can be used on x86/x64")        \
                                                                             \
+  product(bool, UseFMA, false,                                              \
+          "Control whether FMA instructions can be used")                   \
+                                                                            \
   product(bool, UseSHA, false,                                              \
           "Control whether SHA instructions can be used "                   \
           "on SPARC, on ARM and on x86")                                    \
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -2103,6 +2103,8 @@
   declare_c2_type(OverflowAddLNode, OverflowLNode)                        \
   declare_c2_type(OverflowSubLNode, OverflowLNode)                        \
   declare_c2_type(OverflowMulLNode, OverflowLNode)                        \
+  declare_c2_type(FmaDNode, Node)                                         \
+  declare_c2_type(FmaFNode, Node)                                         \
                                                                           \
   /*********************/                                                 \
   /* Adapter Blob Entries */                                              \
@@ -2970,6 +2972,7 @@
 
 #if INCLUDE_ALL_GCS
   VM_STRUCTS_PARALLELGC(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
+                        GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
                         GENERATE_STATIC_VM_STRUCT_ENTRY)
 
   VM_STRUCTS_CMS(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
@@ -2982,7 +2985,7 @@
 
 #if INCLUDE_TRACE
   VM_STRUCTS_TRACE(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
-                GENERATE_STATIC_VM_STRUCT_ENTRY)
+                   GENERATE_STATIC_VM_STRUCT_ENTRY)
 #endif
 
   VM_STRUCTS_EXT(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
@@ -3168,11 +3171,12 @@
 
 #if INCLUDE_ALL_GCS
   VM_STRUCTS_PARALLELGC(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
-             CHECK_STATIC_VM_STRUCT_ENTRY);
+                        CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY,
+                        CHECK_STATIC_VM_STRUCT_ENTRY);
 
   VM_STRUCTS_CMS(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
-             CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY,
-             CHECK_STATIC_VM_STRUCT_ENTRY);
+                 CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY,
+                 CHECK_STATIC_VM_STRUCT_ENTRY);
 
   VM_STRUCTS_G1(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
                 CHECK_STATIC_VM_STRUCT_ENTRY);
@@ -3181,7 +3185,7 @@
 
 #if INCLUDE_TRACE
   VM_STRUCTS_TRACE(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
-                CHECK_STATIC_VM_STRUCT_ENTRY);
+                   CHECK_STATIC_VM_STRUCT_ENTRY);
 #endif
 
   VM_STRUCTS_EXT(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
@@ -3293,6 +3297,7 @@
                         CHECK_NO_OP));
 #if INCLUDE_ALL_GCS
   debug_only(VM_STRUCTS_PARALLELGC(ENSURE_FIELD_TYPE_PRESENT,
+                                   ENSURE_FIELD_TYPE_PRESENT,
                                    ENSURE_FIELD_TYPE_PRESENT));
   debug_only(VM_STRUCTS_CMS(ENSURE_FIELD_TYPE_PRESENT,
                             ENSURE_FIELD_TYPE_PRESENT,
--- a/hotspot/src/share/vm/utilities/chunkedList.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-#include "utilities/chunkedList.hpp"
-#include "utilities/debug.hpp"
-
-/////////////// Unit tests ///////////////
-
-#ifndef PRODUCT
-
-template <typename T>
-class TestChunkedList {
-  typedef ChunkedList<T, mtOther> ChunkedListT;
-
- public:
-  static void testEmpty() {
-    ChunkedListT buffer;
-    assert(buffer.size() == 0, "assert");
-  }
-
-  static void testFull() {
-    ChunkedListT buffer;
-    for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) {
-      buffer.push((T)i);
-    }
-    assert(buffer.size() == ChunkedListT::BufferSize, "assert");
-    assert(buffer.is_full(), "assert");
-  }
-
-  static void testSize() {
-    ChunkedListT buffer;
-    for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) {
-      assert(buffer.size() == i, "assert");
-      buffer.push((T)i);
-      assert(buffer.size() == i + 1, "assert");
-    }
-  }
-
-  static void testClear() {
-    ChunkedListT buffer;
-
-    buffer.clear();
-    assert(buffer.size() == 0, "assert");
-
-    for (uintptr_t i = 0; i < ChunkedListT::BufferSize / 2; i++) {
-      buffer.push((T)i);
-    }
-    buffer.clear();
-    assert(buffer.size() == 0, "assert");
-
-    for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) {
-      buffer.push((T)i);
-    }
-    buffer.clear();
-    assert(buffer.size() == 0, "assert");
-  }
-
-  static void testAt() {
-    ChunkedListT buffer;
-
-    for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) {
-      buffer.push((T)i);
-      assert(buffer.at(i) == (T)i, "assert");
-    }
-
-    for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) {
-      assert(buffer.at(i) == (T)i, "assert");
-    }
-  }
-
-  static void test() {
-    testEmpty();
-    testFull();
-    testSize();
-    testClear();
-    testAt();
-  }
-};
-
-class Metadata;
-
-void TestChunkedList_test() {
-  TestChunkedList<Metadata*>::test();
-  TestChunkedList<size_t>::test();
-}
-
-#endif
--- a/hotspot/src/share/vm/utilities/internalVMTests.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/utilities/internalVMTests.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -52,19 +52,14 @@
   run_unit_test(TestVirtualSpaceNode_test);
   run_unit_test(TestGlobalDefinitions_test);
   run_unit_test(GCTimer_test);
-  run_unit_test(arrayOopDesc_test);
   run_unit_test(CollectedHeap_test);
   run_unit_test(QuickSort_test);
   run_unit_test(GuardedMemory_test);
   run_unit_test(TestNewSize_test);
   run_unit_test(TestOldSize_test);
-  run_unit_test(TestKlass_test);
   run_unit_test(TestBitMap_test);
   run_unit_test(TestResourcehash_test);
   run_unit_test(ObjectMonitor_test);
-  run_unit_test(Test_linked_list);
-  run_unit_test(TestChunkedList_test);
-  run_unit_test(JSON_test);
   run_unit_test(Test_log_tag_combinations_limit);
   run_unit_test(Test_logtarget);
   run_unit_test(Test_logstream);
@@ -82,7 +77,6 @@
   run_unit_test(Test_invalid_log_file);
   run_unit_test(Test_multiline_logging);
   run_unit_test(DirectivesParser_test);
-  run_unit_test(Test_TempNewSymbol);
 #if INCLUDE_VM_STRUCTS
   run_unit_test(VMStructs_test);
 #endif
@@ -91,7 +85,6 @@
   run_unit_test(TestBufferingOopClosure_test);
   if (UseG1GC) {
     run_unit_test(FreeRegionList_test);
-    run_unit_test(IHOP_test);
   }
   run_unit_test(WorkerDataArray_test);
   run_unit_test(ParallelCompact_test);
--- a/hotspot/src/share/vm/utilities/json.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/src/share/vm/utilities/json.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -686,286 +686,3 @@
   }
 }
 
-#ifndef PRODUCT
-class JSONTest : public JSON {
- public:
-  static void test();
-
- private:
-  JSONTest(const char* text);
-  static void test(const char* json, bool valid);
-
-  void log(uint level, const char* format, ...) ATTRIBUTE_PRINTF(3, 4);
-
-  bool callback(JSON_TYPE t, JSON_VAL* v, uint level);
-  JSON_TYPE prev;
-};
-
-void JSON_test() {
-  JSONTest::test();
-}
-
-void JSONTest::test(const char* text, bool should_pass) {
-  JSONTest json(text);
-  if (should_pass) {
-    assert(json.valid() == true, "failed on a valid json string");
-    if (VerboseInternalVMTests) {
-      tty->print_cr("-- json test passed as expected --");
-    }
-  } else {
-    assert(json.valid() == false, "succeeded on an invalid json string");
-    if (VerboseInternalVMTests) {
-      tty->print_cr("-- json test failed as expected --");
-    }
-  }
-}
-
-JSONTest::JSONTest(const char* text) : JSON(text, !VerboseInternalVMTests, tty) {
-  prev = JSON_NONE;
-  parse();
-}
-
-void JSONTest::test() {
-  JSONTest::test("{}", true);
-  JSONTest::test("[]", true);
-  JSONTest::test("  {  }  ", true);
-  JSONTest::test("  [  ]  ", true);
-
-  JSONTest::test("\"error\"", false);
-  JSONTest::test("error", false);
-  JSONTest::test("1", false);
-  JSONTest::test("1.2", false);
-  JSONTest::test("true", false);
-  JSONTest::test("false", false);
-  JSONTest::test("null", false);
-
-  JSONTest::test("[ 1 ]", true);
-  JSONTest::test("[ 1, ]", true);
-  JSONTest::test("[ true ]", true);
-  JSONTest::test("[ true, ]", true);
-  JSONTest::test("[ false ]", true);
-  JSONTest::test("[ false, ]", true);
-  JSONTest::test("[ null ]", true);
-  JSONTest::test("[ null, ]", true);
-  JSONTest::test("[ \"\" ]", true);
-  JSONTest::test("[ \"\", ]", true);
-  JSONTest::test("[ \"elem1\" ]", true);
-  JSONTest::test("[ \"elem1\", ]", true);
-  JSONTest::test("[ \"elem1\", ]", true);
-  JSONTest::test("[ \"elem1\" ]", true);
-  JSONTest::test("[ \"elem1\", \"elem2\" ]", true);
-  JSONTest::test("[ \"elem1\", \"elem2\", ]", true);
-
-
-  JSONTest::test("[ \"elem1\" ] { }", false);
-  JSONTest::test("[ elem1, \"elem2\" ]", false);
-  JSONTest::test("[ \"elem1\"", false);
-  JSONTest::test("[ \"elem1 ]", false);
-  JSONTest::test("[ \"elem1\", \"elem2\"", false);
-  JSONTest::test("[ truefoo ]", false);
-  JSONTest::test("[ falsefoo ]", false);
-  JSONTest::test("[ nullfoo ]", false);
-
-  JSONTest::test("{ key : 1 }", true);
-  JSONTest::test("{ key : 1, }", true);
-  JSONTest::test("{ key : true }", true);
-  JSONTest::test("{ key : true, }", true);
-  JSONTest::test("{ key : false }", true);
-  JSONTest::test("{ key : false, }", true);
-  JSONTest::test("{ key : null }", true);
-  JSONTest::test("{ key : null, }", true);
-  JSONTest::test("{ \"\" : \"\" }", true);
-  JSONTest::test("{ \"\" : \"\", }", true);
-  JSONTest::test("{ \"key1\" : \"val1\" }", true);
-  JSONTest::test("{ \"key1\" : \"val1\", }", true);
-  JSONTest::test("{ \"key1\" : \"val1\", \"key2\" : \"val2\" }", true);
-  JSONTest::test("{ \"key1\" : \"val1\", \"key2\" : \"val2\", }", true);
-
-  JSONTest::test("{ \"key\" : \"val\" } [ \"error\" ]", false);
-  JSONTest::test("{ \"key\" : \"val\" ", false);
-
-  JSONTest::test("/**/ { }", true);
-  JSONTest::test("/* */ { }", true);
-  JSONTest::test("/*foo*/ { }", true);
-  JSONTest::test("/* *foo */ { }", true);
-  JSONTest::test("/* *foo* */ { }", true);
-  JSONTest::test("/* /*foo */ { }", true);
-  JSONTest::test("{ } /* foo */", true);
-  JSONTest::test("{ } /* foo */ ", true);
-  JSONTest::test("{ } //", true);
-  JSONTest::test("{ } // ", true);
-  JSONTest::test("{ } // foo", true);
-
-  JSONTest::test("/* * / { }", false);
-  JSONTest::test("/ * */ { }", false);
-  JSONTest::test("// { }", false);
-  JSONTest::test("/* { } */", false);
-  JSONTest::test("/* { } */ ", false);
-  JSONTest::test("/* { } ", false);
-  JSONTest::test("{ } /* ", false);
-  JSONTest::test("/* { } *", false);
-  JSONTest::test("{ /* } */", false);
-  JSONTest::test("[ /* ] */", false);
-  JSONTest::test("{ key : \"val\", /* } */", false);
-  JSONTest::test("[ \"val\", /* ] */", false);
-
-  JSONTest::test("/* comment */{ key1 : { \"key2\" : { \"key3\" : [ \"elem1\", \"elem2\", { \"key4\" : null }, 3 , 2 , 1 , 0 , -1 , -2 , -3 , true, false, null, ] }, \"key5\" : true }, \"key6\" : [ \"☃\" ], key7 : \"val\",}", true);
-  JSONTest::test("/* comment */ { \"key1\" : { \"key2\" : { \"key3\" : [ \"elem1\", \"elem2\", { \"key4\" : null }, 3 , 2 , 1 , 0 , -1 , -2 , -3 , true, false, null, ] }, \"key5\" : true }, \"key6\" : [ \"☃\" ], key7 : \"val\",}", true);
-  JSONTest::test("/*comment*/{\"ff1 fsd\":{\"☃\":{\"☃\":[\"☃\",\"☃\"]},\"☃\":true},\"☃\":[\"☃\"],\"foo\":\"☃\",}", true);
-  JSONTest::test("/* comment */ { key1 error : { \"☃\" : { \"☃\" : [ \"☃\", \"☃\" ] }, \"☃\" : true }, \"baz\" : [ \"☃\" ], foo : \"☃\",}", false); // first key needs to be quoted since it contains a space
-
-
-  JSONTest::test("[\n]", true);
-
-  JSONTest::test(
-      "[" "\n"
-      "   {"
-      "         // pattern to match against class+method+signature" "\n"
-      "         // leading and trailing wildcard (*) allowed" "\n"
-      "         match: \"foo.bar.*\"," "\n"
-      " " "\n"
-      "         // override defaults for specified compiler" "\n"
-      "         // we may differentiate between levels too. TBD." "\n"
-      "         c1:  {" "\n"
-      "           //override c1 presets " "\n"
-      "           array_bounds_check_removal: false" "\n"
-      "         }," "\n"
-      "" "\n"
-      "         c2: {" "\n"
-      "           // control inlining of method" "\n"
-      "           // + force inline, - dont inline" "\n"
-      "           inline : [ \"+java.util.*\", \"-com.sun.*\"]," "\n"
-      "         }," "\n"
-      "" "\n"
-      "         // directives outside a specific preset applies to all compilers" "\n"
-      "         inline : [ \"+java.util.*\", \"-com.sun.*\"]," "\n"
-      "         print_assembly: true," "\n"
-      "         verify_oopmaps: true," "\n"
-      "         max_loop_unrolling: 5" "\n"
-      "   }," "\n"
-      "   {" "\n"
-      "         // matching several patterns require an array" "\n"
-      "         match: [\"baz.*\",\"frob*\"]," "\n"
-      "" "\n"
-      "         // only enable c1 for this directive" "\n"
-      "         // all enabled by default. Command disables all not listed" "\n"
-      "         enable: \"c1\"," "\n"
-      "" "\n"
-      "         // applies to all compilers" "\n"
-      "         // + force inline, - dont inline" "\n"
-      "         inline : [ \"+java.util.*\", \"-com.sun.*\"]," "\n"
-      "         print_inlining: true," "\n"
-      "" "\n"
-      "         // force matching compiles to be blocking/syncronous" "\n"
-      "         blocking_compile: true" "\n"
-      "   }," "\n"
-      "]" "\n", true);
-}
-
-void JSONTest::log(uint indent, const char* format, ...) {
-  if (VerboseInternalVMTests) {
-    if (prev != JSON_KEY) {
-      for (uint i = 0; i < indent; i++) {
-        _st->print("  ");
-      }
-    }
-    va_list args;
-    va_start(args, format);
-    _st->vprint(format, args);
-    va_end(args);
-  }
-}
-
-bool JSONTest::callback(JSON_TYPE t, JSON_VAL* v, uint rlevel) {
-  switch (t) {
-  case JSON_OBJECT_BEGIN:
-    log(rlevel, "{\n");
-    prev = JSON_NONE; // Only care about JSON_KEY, to indent correctly
-    return true;
-
-  case JSON_OBJECT_END:
-    log(rlevel, "},\n");
-    prev = JSON_NONE;
-    return true;
-
-  case JSON_ARRAY_BEGIN:
-    log(rlevel, "[\n");
-    prev = JSON_NONE;
-    return true;
-
-  case JSON_ARRAY_END:
-    log(rlevel, "],\n");
-    prev = JSON_NONE;
-    return true;
-
-  case JSON_KEY:
-    if (VerboseInternalVMTests) {
-      for (uint i = 0; i < rlevel; i++) {
-        _st->print("  ");
-      }
-      _st->print("<key>");
-      for (size_t i = 0; i < v->str.length; i++) {
-        u_char c = v->str.start[i];
-        assert(c != 0, "string overrun");
-        if (c == 0) {
-          return false;
-        }
-        _st->print("%c", c);
-      }
-      _st->print(" : ");
-    }
-    prev = JSON_KEY;
-    return true;
-
-  case JSON_STRING:
-    if (VerboseInternalVMTests) {
-      if (prev != JSON_KEY) {
-        for (uint i = 0; i < rlevel; i++) {
-          _st->print("  ");
-        }
-      }
-      _st->print("<str>");
-      for (size_t i = 0; i < v->str.length; i++) {
-        u_char c = v->str.start[i];
-        assert(c != 0, "string overrun");
-        if (c == 0) {
-          return false;
-        }
-        _st->print("%c", c);
-      }
-      _st->print(",\n");
-    }
-    prev = JSON_NONE;
-    return true;
-
-  case JSON_NUMBER_INT:
-    log(rlevel, "<int>%" PRId64 ",\n", v->int_value);
-    prev = JSON_NONE;
-    return true;
-
-  case JSON_NUMBER_FLOAT:
-    log(rlevel, "<double>%lf,\n", v->double_value);
-    prev = JSON_NONE;
-    return true;
-
-  case JSON_TRUE:
-    log(rlevel, "<true>,\n");
-    prev = JSON_NONE;
-    return true;
-
-  case JSON_FALSE:
-    log(rlevel, "<false>,\n");
-    prev = JSON_NONE;
-    return true;
-
-  case JSON_NULL:
-    log(rlevel, "<null>,\n");
-    prev = JSON_NONE;
-    return true;
-
-  default:
-    error(INTERNAL_ERROR, "unknown JSON type");
-    return false;
-  }
-}
-#endif
--- a/hotspot/src/share/vm/utilities/linkedlist.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
- * 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"
-
-/////////////// Unit tests ///////////////
-
-#ifndef PRODUCT
-
-#include "runtime/os.hpp"
-#include "utilities/linkedlist.hpp"
-#include "memory/allocation.hpp"
-#include "memory/allocation.inline.hpp"
-
-class Integer : public StackObj {
- private:
-  int  _value;
- public:
-  Integer(int i) : _value(i) { }
-
-  int   value() const { return _value; }
-  bool  equals(const Integer& i) const {
-   return _value == i.value();
-  }
-};
-
-int compare_Integer(const Integer& i1, const Integer& i2) {
-  return i1.value() - i2.value();
-}
-
-void check_list_values(const int* expected, const LinkedList<Integer>* list) {
-  LinkedListNode<Integer>* head = list->head();
-  int index = 0;
-  while (head != NULL) {
-    assert(head->peek()->value() == expected[index], "Unexpected value");
-    head = head->next();
-    index ++;
-  }
-}
-
-void Test_linked_list() {
-  LinkedListImpl<Integer, ResourceObj::C_HEAP, mtTest>  ll;
-
-
-  // Test regular linked list
-  assert(ll.is_empty(), "Start with empty list");
-  Integer one(1), two(2), three(3), four(4), five(5), six(6);
-
-  ll.add(six);
-  assert(!ll.is_empty(), "Should not be empty");
-
-  Integer* i = ll.find(six);
-  assert(i != NULL, "Should find it");
-
-  i = ll.find(three);
-  assert(i == NULL, "Not in the list");
-
-  LinkedListNode<Integer>* node = ll.find_node(six);
-  assert(node != NULL, "6 is in the list");
-
-  ll.insert_after(three, node);
-  ll.insert_before(one, node);
-  int expected[3] = {1, 6, 3};
-  check_list_values(expected, &ll);
-
-  ll.add(two);
-  ll.add(four);
-  ll.add(five);
-
-  // Test sorted linked list
-  SortedLinkedList<Integer, compare_Integer, ResourceObj::C_HEAP, mtTest> sl;
-  assert(sl.is_empty(), "Start with empty list");
-
-  size_t ll_size = ll.size();
-  sl.move(&ll);
-  size_t sl_size = sl.size();
-
-  assert(ll_size == sl_size, "Should be the same size");
-  assert(ll.is_empty(), "No more entires");
-
-  // sorted result
-  int sorted_result[] = {1, 2, 3, 4, 5, 6};
-  check_list_values(sorted_result, &sl);
-
-  node = sl.find_node(four);
-  assert(node != NULL, "4 is in the list");
-  sl.remove_before(node);
-  sl.remove_after(node);
-  int remains[] = {1, 2, 4, 6};
-  check_list_values(remains, &sl);
-}
-#endif // PRODUCT
-
--- a/hotspot/test/TEST.groups	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/TEST.groups	Wed Jul 05 22:19:13 2017 +0200
@@ -351,16 +351,29 @@
 
 hotspot_fast_runtime = \
   runtime/ \
+ -runtime/6626217/Test6626217.sh \
+ -runtime/7100935 \
+ -runtime/7158988/FieldMonitor.java \
+ -runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java \
+ -runtime/CommandLine/PrintGCApplicationConcurrentTime.java \
+ -runtime/ConstantPool/IntfMethod.java \
+ -runtime/ErrorHandling/CreateCoredumpOnCrash.java \
  -runtime/ErrorHandling/ErrorHandler.java \
- -runtime/RedefineObject/TestRedefineObject.java \
- -runtime/MirrorFrame/Test8003720.java \
+ -runtime/logging/MonitorMismatchTest.java \
+ -runtime/memory/ReserveMemory.java \
+ -runtime/memory/RunUnitTestsConcurrently.java \
  -runtime/Metaspace/FragmentMetaspace.java \
  -runtime/Metaspace/FragmentMetaspaceSimple.java \
- -runtime/Thread/TestThreadDumpMonitorContention.java \
- -runtime/SharedArchiveFile/SharedBaseAddress.java \
- -runtime/memory/ReserveMemory.java \
- -runtime/memory/RunUnitTestsConcurrently.java \
- -runtime/Unsafe/RangeCheck.java \
+ -runtime/MirrorFrame/Test8003720.java \
+ -runtime/modules/LoadUnloadModuleStress.java \
+ -runtime/modules/ModuleStress/ExportModuleStressTest.java \
+ -runtime/modules/ModuleStress/ModuleStressGC.java \
+ -runtime/NMT \
+ -runtime/RedefineObject/TestRedefineObject.java \
+ -runtime/RedefineTests/RedefinePreviousVersions.java \
+ -runtime/RedefineTests/RedefineRunningMethods.java \
+ -runtime/RedefineTests/RedefineRunningMethodsWithBacktrace.java \
+ -runtime/ReservedStack \
  -runtime/SelectionResolution/AbstractMethodErrorTest.java \
  -runtime/SelectionResolution/IllegalAccessErrorTest.java \
  -runtime/SelectionResolution/InvokeInterfaceICCE.java \
@@ -372,14 +385,14 @@
  -runtime/SelectionResolution/InvokeVirtualSuccessTest.java \
  -runtime/SharedArchiveFile/CdsSameObjectAlignment.java \
  -runtime/SharedArchiveFile/DefaultUseWithClient.java \
+ -runtime/SharedArchiveFile/SharedBaseAddress.java \
  -runtime/Thread/CancellableThreadTest.java \
- -runtime/7158988/FieldMonitor.java \
- -runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java \
+ -runtime/Thread/TestThreadDumpMonitorContention.java \
+ -runtime/Unsafe/RangeCheck.java \
   sanity/ \
   testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java
 
 hotspot_fast_serviceability = \
-  sanity/ExecuteInternalVMTests.java \
   serviceability/dcmd/compiler \
   serviceability/logging
 
@@ -398,6 +411,8 @@
 hotspot_runtime_tier2 = \
   runtime/ \
   serviceability/ \
+ -runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java \
+ -runtime/Thread/TestThreadDumpMonitorContention.java \
  -:hotspot_fast_runtime \
  -:hotspot_fast_serviceability \
  -:hotspot_runtime_tier2_platform_agnostic
@@ -405,6 +420,14 @@
 hotspot_runtime_tier2_platform_agnostic = \
   runtime/SelectionResolution \
  -:hotspot_fast_runtime
+ 
+hotspot_runtime_tier3 = \
+  runtime/ \
+  serviceability/ \
+ -:hotspot_fast_runtime \
+ -:hotspot_fast_serviceability \
+ -:hotspot_runtime_tier2_platform_agnostic \
+ -:hotspot_runtime_tier2
 
 hotspot_runtime_minimalvm = \
   runtime/MinimalVM \
--- a/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -29,7 +29,7 @@
  * @modules java.base/jdk.internal.misc
  *          java.management
  *
- * @ignore 8071905
+ * @ignore 8166554
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/compilercontrol/share/processors/LogProcessor.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/compilercontrol/share/processors/LogProcessor.java	Wed Jul 05 22:19:13 2017 +0200
@@ -74,7 +74,7 @@
         if (loggedMethods.isEmpty()) {
             return;
         }
-        matchTasks(getScanner());
+        matchTasks();
     }
 
     /*
@@ -95,19 +95,21 @@
      * Parses for &lt;task method='java.lang.String indexOf (I)I' &gt;
      * and finds if there is a compilation log for this task
      */
-    private void matchTasks(Scanner scanner) {
-        String task = scanner.findWithinHorizon(TASK_ELEMENT, 0);
-        while (task != null) {
-            String element = scanner.findWithinHorizon(ANY_ELEMENT, 0);
-            if (Pattern.matches(TASK_DONE_ELEMENT, element)
-                    || Pattern.matches(TASK_END_ELEMENT, element)) {
-                /* If there is nothing between <task> and </task>
-                   except <task done /> then compilation log is empty.
-                   Check the method in this task should not be logged */
-                Asserts.assertFalse(matchMethod(task), "Compilation log "
-                        + "expected. Met: " + element);
-            }
-            task = scanner.findWithinHorizon(TASK_ELEMENT, 0);
+    private void matchTasks() {
+        try (Scanner scanner = getScanner()) {
+          String task = scanner.findWithinHorizon(TASK_ELEMENT, 0);
+          while (task != null) {
+              String element = scanner.findWithinHorizon(ANY_ELEMENT, 0);
+              if (Pattern.matches(TASK_DONE_ELEMENT, element)
+                      || Pattern.matches(TASK_END_ELEMENT, element)) {
+                  /* If there is nothing between <task> and </task>
+                     except <task done /> then compilation log is empty.
+                     Check the method in this task should not be logged */
+                  Asserts.assertFalse(matchMethod(task), "Compilation log "
+                          + "expected. Met: " + element);
+              }
+              task = scanner.findWithinHorizon(TASK_ELEMENT, 0);
+          }
         }
     }
 
--- a/hotspot/test/compiler/jsr292/NullConstantReceiver.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/jsr292/NullConstantReceiver.java	Wed Jul 05 22:19:13 2017 +0200
@@ -23,10 +23,11 @@
 
 /**
  * @test
- * @bug 8059556 8158639
+ * @bug 8059556 8158639 8164508
  *
  * @run main/othervm -Xbatch compiler.jsr292.NullConstantReceiver
  * @run main/othervm -Xbatch -XX:CompileCommand=exclude,*::run compiler.jsr292.NullConstantReceiver
+ * @run main/othervm -Xbatch -XX:CompileCommand=compileonly,*::run compiler.jsr292.NullConstantReceiver
  */
 
 package compiler.jsr292;
--- a/hotspot/test/compiler/jvmci/common/CTVMUtilities.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/jvmci/common/CTVMUtilities.java	Wed Jul 05 22:19:13 2017 +0200
@@ -57,18 +57,7 @@
         if (!(method instanceof Method || method instanceof Constructor)) {
             throw new Error("wrong executable type " + method.getClass());
         }
-        Field slotField;
-        int slot;
-        try {
-            slotField = method.getClass().getDeclaredField("slot");
-            boolean old = slotField.isAccessible();
-            slotField.setAccessible(true);
-            slot = slotField.getInt(method);
-            slotField.setAccessible(old);
-        } catch (ReflectiveOperationException e) {
-            throw new Error("TEST BUG: Can't get slot field", e);
-        }
-        return CompilerToVMHelper.getResolvedJavaMethodAtSlot(cls, slot);
+        return CompilerToVMHelper.asResolvedJavaMethod(method);
     }
 
     public static HotSpotResolvedJavaMethod getResolvedMethod(
--- a/hotspot/test/compiler/jvmci/common/patches/jdk.vm.ci/jdk/vm/ci/hotspot/CompilerToVMHelper.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/jvmci/common/patches/jdk.vm.ci/jdk/vm/ci/hotspot/CompilerToVMHelper.java	Wed Jul 05 22:19:13 2017 +0200
@@ -28,6 +28,7 @@
 import jdk.vm.ci.code.TargetDescription;
 import jdk.vm.ci.meta.ConstantPool;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
+import java.lang.reflect.Executable;
 
 /**
  * A simple "proxy" class to get test access to CompilerToVM package-private methods
@@ -171,9 +172,9 @@
         return CTVM.hasFinalizableSubclass((HotSpotResolvedObjectTypeImpl) type);
     }
 
-    public static HotSpotResolvedJavaMethodImpl getResolvedJavaMethodAtSlot(
-            Class<?> holder, int slot) {
-        return CTVM.getResolvedJavaMethodAtSlot(holder, slot);
+    public static HotSpotResolvedJavaMethodImpl asResolvedJavaMethod(
+            Executable executable) {
+        return CTVM.asResolvedJavaMethod(executable);
     }
 
     public static long getMaxCallTargetOffset(long address) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/jvmci/compilerToVM/AsResolvedJavaMethodTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 8136421
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
+ * @library /test/lib /
+ * @library ../common/patches
+ * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.org.objectweb.asm
+ *          java.base/jdk.internal.org.objectweb.asm.tree
+ *          jdk.vm.ci/jdk.vm.ci.hotspot
+ *          jdk.vm.ci/jdk.vm.ci.code
+ *          jdk.vm.ci/jdk.vm.ci.meta
+ * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
+ *                   compiler.jvmci.compilerToVM.AsResolvedJavaMethodTest
+ */
+
+package compiler.jvmci.compilerToVM;
+
+import jdk.test.lib.Asserts;
+import jdk.vm.ci.hotspot.CompilerToVMHelper;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+
+import java.lang.reflect.Executable;
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.List;
+
+public class AsResolvedJavaMethodTest {
+
+    private static class A {
+        {
+            System.out.println("Dummy");
+        }
+        public void f1() {}
+        public int f2() { return 0; }
+        public String f3() { return ""; }
+    }
+
+
+    private static class S {
+        static {
+            System.out.println("Dummy static");
+        }
+        public S() {}
+        public void f1() {}
+        public int f2() { return 0; }
+        public String f3() { return ""; }
+    }
+
+    private class B extends A {
+        public void f4() {}
+    }
+
+    private interface I {
+        void f1();
+        int f2();
+        String f3();
+    }
+
+    public static void main(String[] args) {
+        List<Class<?>> testCases = getTestCases();
+        testCases.forEach(AsResolvedJavaMethodTest::test);
+    }
+
+    private static List<Class<?>> getTestCases() {
+        List<Class<?>> testCases = new ArrayList<>();
+        testCases.add(A.class);
+        testCases.add(S.class);
+        testCases.add(I.class);
+        testCases.add(B.class);
+        return testCases;
+    }
+
+    private static void test(Class<?> aClass) {
+        testCorrectMethods(aClass);
+    }
+
+    private static void testCorrectMethods(Class<?> holder) {
+        List<Executable> executables = new ArrayList<>();
+        executables.addAll(Arrays.asList(holder.getDeclaredMethods()));
+        executables.addAll(Arrays.asList(holder.getDeclaredConstructors()));
+        for (Executable executable : executables) {
+            HotSpotResolvedJavaMethod method = CompilerToVMHelper
+                    .asResolvedJavaMethod(executable);
+            Asserts.assertNotNull(method, "could not convert " + method);
+        }
+    }
+}
--- a/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -74,45 +74,37 @@
     private static Set<TestCase> createTestCases() {
         Set<TestCase> result = new HashSet<>();
         // a public method
-        result.add(new TestCase(true, SingleSubclass.class,
-                SingleSubclass.class, "usualMethod"));
+        result.add(new TestCase(true, SingleSubclass.class, "usualMethod"));
         // overriden method
-        result.add(new TestCase(true, SingleSubclass.class,
-                SingleSubclass.class, "overridenMethod"));
+        result.add(new TestCase(true, SingleSubclass.class, "overridenMethod"));
         // private method
-        result.add(new TestCase(true, SingleSubclass.class,
-                SingleSubclass.class, "privateMethod"));
+        result.add(new TestCase(true, SingleSubclass.class, "privateMethod"));
         // protected method
-        result.add(new TestCase(true, SingleSubclass.class,
-                SingleSubclass.class, "protectedMethod"));
+        result.add(new TestCase(true, SingleSubclass.class, "protectedMethod"));
         // default(package-private) method
-        result.add(new TestCase(true, SingleSubclass.class,
-                SingleSubclass.class, "defaultAccessMethod"));
+        result.add(new TestCase(true, SingleSubclass.class, "defaultAccessMethod"));
         // default interface method redefined in implementer
-        result.add(new TestCase(true, MultipleImplementer1.class,
-                MultipleImplementer1.class, "defaultMethod"));
+        result.add(new TestCase(true, MultipleImplementer1.class, "defaultMethod"));
         // interface method
-        result.add(new TestCase(true, MultipleImplementer1.class,
-                MultipleImplementer1.class, "testMethod"));
+        result.add(new TestCase(true, MultipleImplementer1.class, "testMethod"));
         // default interface method not redefined in implementer
-        result.add(new TestCase(true, SingleImplementer.class,
-                SingleImplementerInterface.class, "defaultMethod"));
+        // result.add(new TestCase(true, SingleImplementer.class,
+        //                         SingleImplementerInterface.class, "defaultMethod"));
         // static method
-        result.add(new TestCase(false, SingleSubclass.class,
-                SingleSubclass.class, "staticMethod"));
+        result.add(new TestCase(false, SingleSubclass.class, "staticMethod"));
         // interface method
         result.add(new TestCase(false, MultipleSuperImplementers.class,
-                                DuplicateSimpleSingleImplementerInterface.class, "interfaceMethod", false));
+                                DuplicateSimpleSingleImplementerInterface.class, "interfaceMethod"));
         result.add(new TestCase(false, MultipleSuperImplementers.class,
-                                SimpleSingleImplementerInterface.class, "interfaceMethod", false));
+                                SimpleSingleImplementerInterface.class, "interfaceMethod"));
         return result;
     }
 
     private void runTest(TestCase tcase) throws NoSuchMethodException {
         System.out.println(tcase);
         Method method = tcase.holder.getDeclaredMethod(tcase.methodName);
-        HotSpotResolvedJavaMethod testMethod = CTVMUtilities
-            .getResolvedMethod(tcase.methodFromReceiver ? tcase.receiver : tcase.holder, method);
+        HotSpotResolvedJavaMethod testMethod = CTVMUtilities.getResolvedMethod(method);
+
         HotSpotResolvedObjectType resolvedType = CompilerToVMHelper
                 .lookupType(Utils.toJVMTypeSignature(tcase.receiver), getClass(),
                 /* resolve = */ true);
@@ -127,25 +119,23 @@
         public final Class<?> holder;
         public final String methodName;
         public final boolean isPositive;
-        public final boolean methodFromReceiver;
 
         public TestCase(boolean isPositive, Class<?> clazz, Class<?> holder,
-                        String methodName, boolean methodFromReceiver) {
+                        String methodName) {
             this.receiver = clazz;
             this.methodName = methodName;
             this.isPositive = isPositive;
             this.holder = holder;
-            this.methodFromReceiver = methodFromReceiver;
         }
 
-        public TestCase(boolean isPositive, Class<?> clazz, Class<?> holder, String methodName) {
-            this(isPositive, clazz, holder, methodName, true);
+        public TestCase(boolean isPositive, Class<?> clazz, String methodName) {
+            this(isPositive, clazz, clazz, methodName);
         }
 
         @Override
         public String toString() {
-            return String.format("CASE: receiver=%s, holder=%s, method=%s, isPositive=%s, methodFromReceiver=%s",
-                                 receiver.getName(), holder.getName(), methodName, isPositive, methodFromReceiver);
+            return String.format("CASE: receiver=%s, holder=%s, method=%s, isPositive=%s",
+                                 receiver.getName(), holder.getName(), methodName, isPositive);
         }
     }
 }
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodAtSlotTest.java	Fri Oct 07 21:28:20 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
- * 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 8136421
- * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
- * @library /test/lib /
- * @library ../common/patches
- * @modules java.base/jdk.internal.misc
- * @modules java.base/jdk.internal.org.objectweb.asm
- *          java.base/jdk.internal.org.objectweb.asm.tree
- *          jdk.vm.ci/jdk.vm.ci.hotspot
- *          jdk.vm.ci/jdk.vm.ci.code
- *          jdk.vm.ci/jdk.vm.ci.meta
- * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
- *                   compiler.jvmci.compilerToVM.GetResolvedJavaMethodAtSlotTest
- */
-
-package compiler.jvmci.compilerToVM;
-
-import jdk.test.lib.Asserts;
-import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class GetResolvedJavaMethodAtSlotTest {
-
-    private static class A {
-        {
-            System.out.println("Dummy");
-        }
-        public void f1() {}
-        public int f2() { return 0; }
-        public String f3() { return ""; }
-    }
-
-
-    private static class S {
-        static {
-            System.out.println("Dummy static");
-        }
-        public S() {}
-        public void f1() {}
-        public int f2() { return 0; }
-        public String f3() { return ""; }
-    }
-
-    private class B extends A {
-        public void f4() {}
-    }
-
-    private interface I {
-        void f1();
-        int f2();
-        String f3();
-    }
-
-    public static void main(String[] args) {
-        Map<Class<?>, Integer> testCases = getTestCases();
-        testCases.forEach(GetResolvedJavaMethodAtSlotTest::test);
-    }
-
-    private static Map<Class<?>, Integer> getTestCases() {
-        Map<Class<?>, Integer> testCases = new HashMap<>();
-        testCases.put(A.class, 5); // ctor, init, f1, f2, f3
-        testCases.put(S.class, 5); // ctor, cinit, f1, f2, f3
-        testCases.put(I.class, 3); // f1, f2, f3
-        testCases.put(B.class, 2); // ctor, f4
-        return testCases;
-    }
-
-    private static void test(Class<?> aClass, int methodNumber) {
-        testSlotBigger(aClass);
-        testCorrectMethods(aClass, methodNumber);
-    }
-
-    private static void testSlotBigger(Class<?> holder) {
-        HotSpotResolvedJavaMethod method
-                = CompilerToVMHelper.getResolvedJavaMethodAtSlot(holder, 50);
-        Asserts.assertNull(method, "Got method for non existing slot 50 in "
-                + holder);
-    }
-
-    private static void testCorrectMethods(Class<?> holder, int methodsNumber) {
-        for (int i = 0; i < methodsNumber; i++) {
-            String caseName = String.format("slot %d in %s",
-                    i, holder.getCanonicalName());
-            HotSpotResolvedJavaMethod method = CompilerToVMHelper
-                    .getResolvedJavaMethodAtSlot(holder, i);
-            Asserts.assertNotNull(method, caseName + " did not got method");
-            Asserts.assertEQ(holder,
-                    CompilerToVMHelper.getMirror(method.getDeclaringClass()),
-                    caseName + " : unexpected declaring class");
-        }
-    }
-}
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -51,6 +51,7 @@
 import sun.hotspot.WhiteBox;
 
 import java.lang.reflect.Field;
+import java.lang.reflect.Method;
 
 public class GetResolvedJavaMethodTest {
     private static enum TestCase {
@@ -64,9 +65,7 @@
         JAVA_METHOD_BASE {
             @Override
             HotSpotResolvedJavaMethod getResolvedJavaMethod() {
-                HotSpotResolvedJavaMethod methodInstance
-                        = CompilerToVMHelper.getResolvedJavaMethodAtSlot(
-                                TEST_CLASS, 0);
+                HotSpotResolvedJavaMethod methodInstance = TEST_METHOD;
                 try {
                     METASPACE_METHOD_FIELD.set(methodInstance,
                             getPtrToMethod());
@@ -81,9 +80,7 @@
             @Override
             HotSpotResolvedJavaMethod getResolvedJavaMethod() {
                 long ptr = getPtrToMethod();
-                HotSpotResolvedJavaMethod methodInstance
-                        = CompilerToVMHelper.getResolvedJavaMethodAtSlot(
-                        TEST_CLASS, 0);
+                HotSpotResolvedJavaMethod methodInstance = TEST_METHOD;
                 try {
                     METASPACE_METHOD_FIELD.set(methodInstance, ptr / 2L);
                 } catch (ReflectiveOperationException e) {
@@ -97,9 +94,7 @@
             @Override
             HotSpotResolvedJavaMethod getResolvedJavaMethod() {
                 long ptr = getPtrToMethod();
-                HotSpotResolvedJavaMethod methodInstance
-                        = CompilerToVMHelper.getResolvedJavaMethodAtSlot(
-                        TEST_CLASS, 0);
+                HotSpotResolvedJavaMethod methodInstance = TEST_METHOD;
                 try {
                     METASPACE_METHOD_FIELD.set(methodInstance, 0L);
                 } catch (ReflectiveOperationException e) {
@@ -117,16 +112,21 @@
     private static final WhiteBox WB = WhiteBox.getWhiteBox();
     private static final Field METASPACE_METHOD_FIELD;
     private static final Class<?> TEST_CLASS = GetResolvedJavaMethodTest.class;
+    private static final HotSpotResolvedJavaMethod TEST_METHOD;
     private static final long PTR;
     static  {
-        HotSpotResolvedJavaMethod method
-                = CompilerToVMHelper.getResolvedJavaMethodAtSlot(TEST_CLASS, 0);
+        try {
+            Method method = TEST_CLASS.getDeclaredMethod("test", TestCase.class);
+            TEST_METHOD = CompilerToVMHelper.asResolvedJavaMethod(method);
+        } catch (NoSuchMethodException e) {
+            throw new Error("TESTBUG : " + e, e);
+        }
         try {
             // jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl.metaspaceMethod
-            METASPACE_METHOD_FIELD = method.getClass()
+            METASPACE_METHOD_FIELD = TEST_METHOD.getClass()
                     .getDeclaredField("metaspaceMethod");
             METASPACE_METHOD_FIELD.setAccessible(true);
-            PTR = (long) METASPACE_METHOD_FIELD.get(method);
+            PTR = (long) METASPACE_METHOD_FIELD.get(TEST_METHOD);
         } catch (ReflectiveOperationException e) {
             throw new Error("TESTBUG : " + e, e);
         }
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderData.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderData.java	Wed Jul 05 22:19:13 2017 +0200
@@ -23,6 +23,10 @@
 
 package jdk.vm.ci.hotspot.test;
 
+import java.lang.reflect.Field;
+
+import org.testng.annotations.DataProvider;
+
 import jdk.internal.misc.Unsafe;
 import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider;
 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider;
@@ -32,27 +36,14 @@
 import jdk.vm.ci.meta.JavaConstant;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.runtime.JVMCI;
-import org.testng.annotations.DataProvider;
-
-import java.lang.reflect.Field;
 
 public class MemoryAccessProviderData {
-    private static final Unsafe UNSAFE = getUnsafe();
+    private static final Unsafe UNSAFE = Unsafe.getUnsafe();
     private static final HotSpotConstantReflectionProvider CONSTANT_REFLECTION = (HotSpotConstantReflectionProvider) JVMCI.getRuntime().getHostJVMCIBackend().getConstantReflection();
     private static final TestClass TEST_OBJECT = new TestClass();
     private static final JavaConstant TEST_CONSTANT = CONSTANT_REFLECTION.forObject(TEST_OBJECT);
     private static final JavaConstant TEST_CLASS_CONSTANT = CONSTANT_REFLECTION.forObject(TestClass.class);
 
-    private static Unsafe getUnsafe() {
-        try {
-            Field f = Unsafe.class.getDeclaredField("theUnsafe");
-            f.setAccessible(true);
-            return (Unsafe) f.get(null);
-        } catch (NoSuchFieldException | IllegalAccessException e) {
-            throw new RuntimeException("Unable to get Unsafe instance.", e);
-        }
-    }
-
     @DataProvider(name = "positiveObject")
     public static Object[][] getPositiveObjectJavaKind() {
         HotSpotJVMCIRuntimeProvider runtime = (HotSpotJVMCIRuntimeProvider) JVMCI.getRuntime();
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java	Wed Jul 05 22:19:13 2017 +0200
@@ -438,7 +438,6 @@
 
     // @formatter:off
     private static final String[] untestedApiMethods = {
-        "invoke",
         "newInstance",
         "getDeclaringClass",
         "getEncoding",
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java	Wed Jul 05 22:19:13 2017 +0200
@@ -35,16 +35,18 @@
 
 package jdk.vm.ci.runtime.test;
 
-import jdk.internal.reflect.ConstantPool;
-import jdk.vm.ci.common.JVMCIError;
-import jdk.vm.ci.meta.Assumptions.AssumptionResult;
-import jdk.vm.ci.meta.JavaConstant;
-import jdk.vm.ci.meta.JavaKind;
-import jdk.vm.ci.meta.ModifiersProvider;
-import jdk.vm.ci.meta.ResolvedJavaField;
-import jdk.vm.ci.meta.ResolvedJavaMethod;
-import jdk.vm.ci.meta.ResolvedJavaType;
-import org.junit.Test;
+import static java.lang.reflect.Modifier.isAbstract;
+import static java.lang.reflect.Modifier.isFinal;
+import static java.lang.reflect.Modifier.isPrivate;
+import static java.lang.reflect.Modifier.isProtected;
+import static java.lang.reflect.Modifier.isPublic;
+import static java.lang.reflect.Modifier.isStatic;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
@@ -57,18 +59,16 @@
 import java.util.Map;
 import java.util.Set;
 
-import static java.lang.reflect.Modifier.isAbstract;
-import static java.lang.reflect.Modifier.isFinal;
-import static java.lang.reflect.Modifier.isPrivate;
-import static java.lang.reflect.Modifier.isProtected;
-import static java.lang.reflect.Modifier.isPublic;
-import static java.lang.reflect.Modifier.isStatic;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import org.junit.Test;
+
+import jdk.internal.reflect.ConstantPool;
+import jdk.vm.ci.common.JVMCIError;
+import jdk.vm.ci.meta.Assumptions.AssumptionResult;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.ResolvedJavaField;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaType;
 
 /**
  * Tests for {@link ResolvedJavaType}.
@@ -146,8 +146,9 @@
     public void getModifiersTest() {
         for (Class<?> c : classes) {
             ResolvedJavaType type = metaAccess.lookupJavaType(c);
-            int expected = c.getModifiers() & ModifiersProvider.jvmClassModifiers();
-            int actual = type.getModifiers() & ModifiersProvider.jvmClassModifiers();
+            int mask = Modifier.classModifiers() & ~Modifier.STATIC;
+            int expected = c.getModifiers() & mask;
+            int actual = type.getModifiers() & mask;
             Class<?> elementalType = c;
             while (elementalType.isArray()) {
                 elementalType = elementalType.getComponentType();
--- a/hotspot/test/compiler/rtm/cli/RTMLockingAwareTest.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/cli/RTMLockingAwareTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -25,6 +25,7 @@
 package compiler.rtm.cli;
 
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.process.ExitCode;
 import jdk.test.lib.cli.CommandLineOptionTest;
@@ -66,7 +67,7 @@
             boolean isExperimental, String defaultValue,
             String[] correctValues, String[] incorrectValues,
             String warningMessage) {
-        super(new AndPredicate(new SupportedCPU(), new SupportedVM()),
+        super(new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM()),
                 optionName, isBoolean, isExperimental, defaultValue);
         this.correctValues = correctValues;
         this.incorrectValues = incorrectValues;
--- a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java	Wed Jul 05 22:19:13 2017 +0200
@@ -42,6 +42,7 @@
 package compiler.rtm.cli;
 
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.cli.CommandLineOptionTest;
 import jdk.test.lib.cli.predicate.AndPredicate;
@@ -49,7 +50,7 @@
 public class TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig
         extends TestPrintPreciseRTMLockingStatisticsBase {
     private TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig() {
-        super(new AndPredicate(new SupportedVM(), new SupportedCPU()));
+        super(new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM()));
     }
 
     @Override
--- a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java	Wed Jul 05 22:19:13 2017 +0200
@@ -42,6 +42,7 @@
 package compiler.rtm.cli;
 
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.cli.predicate.AndPredicate;
 import jdk.test.lib.cli.predicate.NotPredicate;
@@ -49,8 +50,8 @@
 public class TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig
         extends TestPrintPreciseRTMLockingStatisticsBase {
     private TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig() {
-        super(new NotPredicate(new AndPredicate(new SupportedCPU(),
-                new SupportedVM())));
+        super(new NotPredicate(
+                new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM())));
     }
 
     public static void main(String args[]) throws Throwable {
--- a/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java	Wed Jul 05 22:19:13 2017 +0200
@@ -42,6 +42,7 @@
 package compiler.rtm.cli;
 
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.cli.predicate.AndPredicate;
 import jdk.test.lib.cli.predicate.NotPredicate;
@@ -51,8 +52,8 @@
     private static final String DEFAULT_VALUE = "50";
 
     private TestRTMAbortRatioOptionOnUnsupportedConfig() {
-        super(new NotPredicate(new AndPredicate(new SupportedVM(),
-                        new SupportedCPU())),
+        super(new NotPredicate(
+                new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM())),
                 "RTMAbortRatio", false, true,
                 TestRTMAbortRatioOptionOnUnsupportedConfig.DEFAULT_VALUE,
                 "0", "10", "100", "200");
--- a/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java	Wed Jul 05 22:19:13 2017 +0200
@@ -42,6 +42,7 @@
 package compiler.rtm.cli;
 
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.cli.predicate.AndPredicate;
 import jdk.test.lib.cli.predicate.NotPredicate;
@@ -51,8 +52,8 @@
     private static final String DEFAULT_VALUE = "64";
 
     private TestRTMTotalCountIncrRateOptionOnUnsupportedConfig() {
-        super(new NotPredicate(new AndPredicate(new SupportedCPU(),
-                        new SupportedVM())),
+        super(new NotPredicate(
+                new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM())),
                 "RTMTotalCountIncrRate", false, true,
                 TestRTMTotalCountIncrRateOptionOnUnsupportedConfig
                         .DEFAULT_VALUE,
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java	Wed Jul 05 22:19:13 2017 +0200
@@ -42,6 +42,7 @@
 package compiler.rtm.cli;
 
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.process.ExitCode;
 import jdk.test.lib.cli.CommandLineOptionTest;
@@ -52,7 +53,7 @@
     private static final String DEFAULT_VALUE = "false";
 
     private TestUseRTMDeoptOptionOnSupportedConfig() {
-        super(new AndPredicate(new SupportedVM(), new SupportedCPU()));
+        super(new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM()));
     }
 
     @Override
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java	Wed Jul 05 22:19:13 2017 +0200
@@ -42,6 +42,7 @@
 package compiler.rtm.cli;
 
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.cli.CommandLineOptionTest;
 import jdk.test.lib.cli.predicate.AndPredicate;
@@ -52,8 +53,8 @@
     private static final String DEFAULT_VALUE = "false";
 
     private TestUseRTMDeoptOptionOnUnsupportedConfig() {
-        super(new NotPredicate(new AndPredicate(new SupportedCPU(),
-                        new SupportedVM())),
+        super(new NotPredicate(
+                new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM())),
                 "UseRTMDeopt", true, false,
                 TestUseRTMDeoptOptionOnUnsupportedConfig.DEFAULT_VALUE,
                 "true");
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java	Wed Jul 05 22:19:13 2017 +0200
@@ -42,6 +42,7 @@
 package compiler.rtm.cli;
 
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.process.ExitCode;
 import jdk.test.lib.cli.CommandLineOptionTest;
@@ -52,7 +53,7 @@
     private static final String DEFAULT_VALUE = "false";
 
     private TestUseRTMForStackLocksOptionOnSupportedConfig() {
-        super(new AndPredicate(new SupportedVM(), new SupportedCPU()));
+        super(new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM()));
     }
 
     @Override
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java	Wed Jul 05 22:19:13 2017 +0200
@@ -42,6 +42,7 @@
 package compiler.rtm.cli;
 
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.process.ExitCode;
 import jdk.test.lib.cli.CommandLineOptionTest;
@@ -53,8 +54,8 @@
     private static final String DEFAULT_VALUE = "false";
 
     private TestUseRTMForStackLocksOptionOnUnsupportedConfig() {
-        super(new NotPredicate(new AndPredicate(new SupportedCPU(),
-                        new SupportedVM())),
+        super(new NotPredicate(
+                new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM())),
                 "UseRTMForStackLocks", true, true,
                 TestUseRTMForStackLocksOptionOnUnsupportedConfig.DEFAULT_VALUE,
                 "true");
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java	Wed Jul 05 22:19:13 2017 +0200
@@ -42,6 +42,7 @@
 package compiler.rtm.cli;
 
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.process.ExitCode;
 import jdk.test.lib.cli.CommandLineOptionTest;
@@ -52,7 +53,7 @@
     private static final String DEFAULT_VALUE = "false";
 
     private TestUseRTMLockingOptionOnSupportedConfig() {
-        super(new AndPredicate(new SupportedVM(), new SupportedCPU()));
+        super(new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM()));
     }
 
     @Override
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java	Wed Jul 05 22:19:13 2017 +0200
@@ -42,6 +42,7 @@
 package compiler.rtm.cli;
 
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.process.ExitCode;
 import jdk.test.lib.cli.CommandLineOptionTest;
@@ -50,7 +51,7 @@
 public class TestUseRTMLockingOptionWithBiasedLocking
         extends CommandLineOptionTest {
     private TestUseRTMLockingOptionWithBiasedLocking() {
-        super(new AndPredicate(new SupportedCPU(), new SupportedVM()));
+        super(new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM()));
     }
 
     @Override
--- a/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java	Wed Jul 05 22:19:13 2017 +0200
@@ -45,6 +45,7 @@
 import compiler.testlibrary.rtm.RTMLockingStatistics;
 import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
@@ -60,7 +61,7 @@
  */
 public class TestRTMAbortRatio extends CommandLineOptionTest {
     private TestRTMAbortRatio() {
-        super(new AndPredicate(new SupportedCPU(), new SupportedVM()));
+        super(new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM()));
     }
 
     @Override
--- a/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java	Wed Jul 05 22:19:13 2017 +0200
@@ -45,6 +45,7 @@
 import compiler.testlibrary.rtm.RTMLockingStatistics;
 import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
@@ -59,7 +60,7 @@
  */
 public class TestRTMAbortThreshold extends CommandLineOptionTest {
     private TestRTMAbortThreshold() {
-        super(new AndPredicate(new SupportedCPU(), new SupportedVM()));
+        super(new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM()));
     }
 
     @Override
--- a/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java	Wed Jul 05 22:19:13 2017 +0200
@@ -47,6 +47,7 @@
 import compiler.testlibrary.rtm.RTMLockingStatistics;
 import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
@@ -86,7 +87,7 @@
     private static final String RANGE_CHECK = "range_check";
 
     private TestRTMAfterNonRTMDeopt() {
-        super(new AndPredicate(new SupportedCPU(), new SupportedVM()));
+        super(new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM()));
     }
 
     @Override
--- a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java	Wed Jul 05 22:19:13 2017 +0200
@@ -45,6 +45,7 @@
 import compiler.testlibrary.rtm.RTMLockingStatistics;
 import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
@@ -66,7 +67,7 @@
             = AbortProvoker.DEFAULT_ITERATIONS / 2L;
 
     private TestRTMDeoptOnHighAbortRatio() {
-        super(new AndPredicate(new SupportedCPU(), new SupportedVM()));
+        super(new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM()));
     }
 
     @Override
--- a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java	Wed Jul 05 22:19:13 2017 +0200
@@ -44,6 +44,7 @@
 import compiler.testlibrary.rtm.RTMLockingStatistics;
 import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
@@ -66,7 +67,7 @@
     private static final long ABORT_THRESHOLD = LOCKING_THRESHOLD / 2L;
 
     private TestRTMDeoptOnLowAbortRatio() {
-        super(new AndPredicate(new SupportedCPU(), new SupportedVM()));
+        super(new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM()));
     }
 
     @Override
--- a/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java	Wed Jul 05 22:19:13 2017 +0200
@@ -44,6 +44,7 @@
 import compiler.testlibrary.rtm.AbortType;
 import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
@@ -58,7 +59,7 @@
     private static final boolean INFLATE_MONITOR = true;
 
     private TestRTMLockingCalculationDelay() {
-        super(new AndPredicate(new SupportedCPU(), new SupportedVM()));
+        super(new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM()));
     }
 
     @Override
--- a/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java	Wed Jul 05 22:19:13 2017 +0200
@@ -45,6 +45,7 @@
 import compiler.testlibrary.rtm.RTMLockingStatistics;
 import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
@@ -60,7 +61,7 @@
  */
 public class TestRTMLockingThreshold extends CommandLineOptionTest {
     private TestRTMLockingThreshold() {
-        super(new AndPredicate(new SupportedVM(), new SupportedCPU()));
+        super(new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM()));
     }
 
     /**
--- a/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java	Wed Jul 05 22:19:13 2017 +0200
@@ -44,6 +44,7 @@
 import compiler.testlibrary.rtm.RTMLockingStatistics;
 import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
@@ -64,7 +65,7 @@
     private static final boolean INFLATE_MONITOR = true;
 
     private TestRTMRetryCount() {
-        super(new AndPredicate(new SupportedCPU(), new SupportedVM()));
+        super(new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM()));
     }
 
     @Override
--- a/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java	Wed Jul 05 22:19:13 2017 +0200
@@ -45,6 +45,7 @@
 import compiler.testlibrary.rtm.RTMLockingStatistics;
 import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
@@ -66,7 +67,7 @@
             = new int[] { 0, 100, 1_000, 1_000_000, 10_000_000 };
 
     private TestRTMSpinLoopCount() {
-        super(new AndPredicate(new SupportedVM(), new SupportedCPU()));
+        super(new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM()));
     }
 
     @Override
--- a/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java	Wed Jul 05 22:19:13 2017 +0200
@@ -45,6 +45,7 @@
 import compiler.testlibrary.rtm.RTMLockingStatistics;
 import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
@@ -64,7 +65,7 @@
  */
 public class TestRTMTotalCountIncrRate extends CommandLineOptionTest {
     private TestRTMTotalCountIncrRate() {
-        super(new AndPredicate(new SupportedCPU(), new SupportedVM()));
+        super(new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM()));
     }
 
     @Override
--- a/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java	Wed Jul 05 22:19:13 2017 +0200
@@ -45,6 +45,7 @@
 import compiler.testlibrary.rtm.RTMLockingStatistics;
 import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
@@ -73,7 +74,7 @@
             = 2L * AbortProvoker.DEFAULT_ITERATIONS;
 
     private TestUseRTMAfterLockInflation() {
-        super(new AndPredicate(new SupportedVM(), new SupportedCPU()));
+        super(new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM()));
     }
 
     @Override
--- a/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java	Wed Jul 05 22:19:13 2017 +0200
@@ -44,6 +44,7 @@
 import compiler.testlibrary.rtm.AbortType;
 import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
@@ -56,7 +57,7 @@
  */
 public class TestUseRTMDeopt extends CommandLineOptionTest {
     private TestUseRTMDeopt() {
-        super(new AndPredicate(new SupportedVM(), new SupportedCPU()));
+        super(new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM()));
     }
 
     @Override
--- a/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java	Wed Jul 05 22:19:13 2017 +0200
@@ -43,6 +43,7 @@
 import compiler.testlibrary.rtm.RTMLockingStatistics;
 import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
@@ -63,7 +64,7 @@
  */
 public class TestUseRTMForInflatedLocks extends CommandLineOptionTest {
     private TestUseRTMForInflatedLocks() {
-        super(new AndPredicate(new SupportedCPU(), new SupportedVM()));
+        super(new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM()));
     }
 
     @Override
--- a/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java	Wed Jul 05 22:19:13 2017 +0200
@@ -44,6 +44,7 @@
 import compiler.testlibrary.rtm.RTMLockingStatistics;
 import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
@@ -66,7 +67,7 @@
     private static final boolean INFLATE_MONITOR = false;
 
     private TestUseRTMForStackLocks() {
-        super(new AndPredicate(new SupportedCPU(), new SupportedVM()));
+        super(new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM()));
     }
 
     @Override
--- a/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java	Wed Jul 05 22:19:13 2017 +0200
@@ -46,6 +46,7 @@
 import compiler.testlibrary.rtm.RTMLockingStatistics;
 import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
@@ -62,7 +63,7 @@
     private final static int LOCKING_TIME = 5000;
 
     private TestUseRTMXendForLockBusy() {
-        super(new AndPredicate(new SupportedVM(), new SupportedCPU()));
+        super(new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM()));
     }
 
     @Override
--- a/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java	Wed Jul 05 22:19:13 2017 +0200
@@ -45,6 +45,7 @@
 import compiler.testlibrary.rtm.RTMLockingStatistics;
 import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
@@ -62,7 +63,7 @@
  */
 public class TestNoRTMLockElidingOption extends CommandLineOptionTest {
     private TestNoRTMLockElidingOption() {
-        super(new AndPredicate(new SupportedCPU(), new SupportedVM()));
+        super(new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM()));
     }
 
     @Override
--- a/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java	Wed Jul 05 22:19:13 2017 +0200
@@ -46,6 +46,7 @@
 import compiler.testlibrary.rtm.RTMLockingStatistics;
 import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
@@ -68,7 +69,7 @@
  */
 public class TestUseRTMLockElidingOption extends CommandLineOptionTest {
     private TestUseRTMLockElidingOption() {
-        super(new AndPredicate(new SupportedCPU(), new SupportedVM()));
+        super(new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM()));
     }
 
     @Override
--- a/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java	Wed Jul 05 22:19:13 2017 +0200
@@ -48,6 +48,7 @@
 import compiler.testlibrary.rtm.RTMLockingStatistics;
 import compiler.testlibrary.rtm.RTMTestBase;
 import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedOS;
 import compiler.testlibrary.rtm.predicate.SupportedVM;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
@@ -67,7 +68,7 @@
 public class TestPrintPreciseRTMLockingStatistics
         extends CommandLineOptionTest {
     private TestPrintPreciseRTMLockingStatistics() {
-        super(new AndPredicate(new SupportedCPU(), new SupportedVM()));
+        super(new AndPredicate(new SupportedCPU(), new SupportedOS(), new SupportedVM()));
     }
 
     @Override
--- a/hotspot/test/compiler/stringopts/TestStringObjectInitialization.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/stringopts/TestStringObjectInitialization.java	Wed Jul 05 22:19:13 2017 +0200
@@ -67,6 +67,11 @@
         add(s + Arrays.toString(sArray) + " const ");
     }
 
+    public void reset() {
+        // Reset string to avoid OOMEs
+        myString = "";
+    }
+
     private static class Runner implements Runnable {
         private TestStringObjectInitialization test;
 
@@ -76,8 +81,9 @@
 
         public void run() {
             String[] array = {"a", "b", "c"};
-            for (int i = 0; i < 10000; ++i) {
+            for (int i = 0; i < 100_000; ++i) {
                 test.run("a", array);
+                test.reset();
             }
         }
     }
--- a/hotspot/test/compiler/testlibrary/rtm/RTMTestBase.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/compiler/testlibrary/rtm/RTMTestBase.java	Wed Jul 05 22:19:13 2017 +0200
@@ -241,7 +241,8 @@
                 "-XX:-TieredCompilation", "-XX:+UseRTMLocking",
                 CommandLineOptionTest.UNLOCK_DIAGNOSTIC_VM_OPTIONS,
                 CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
-                "-Xbootclasspath/a:.", "-XX:+WhiteBoxAPI");
+                "-Xbootclasspath/a:.", "-XX:+WhiteBoxAPI",
+                "-XaddExports:java.base/jdk.internal.misc=ALL-UNNAMED");
 
         if (test != null) {
             for (String method : test.getMethodsToCompileNames()) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedOS.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package compiler.testlibrary.rtm.predicate;
+
+import jdk.test.lib.Platform;
+
+import java.util.function.BooleanSupplier;
+
+public class SupportedOS implements BooleanSupplier {
+    @Override
+    public boolean getAsBoolean() {
+        if (Platform.isAix()) {
+            // Actually, this works since AIX 7.1.3.30, but os.version property
+            // is set to 7.1.
+            return (Platform.getOsVersionMajor()  > 7) ||
+                   (Platform.getOsVersionMajor() == 7 && Platform.getOsVersionMinor() > 1);
+
+        } else if (Platform.isLinux()) {
+            if (Platform.isPPC()) {
+                return (Platform.getOsVersionMajor()  > 4) ||
+                       (Platform.getOsVersionMajor() == 4 && Platform.getOsVersionMinor() > 1);
+            }
+        }
+        return true;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/classfile/test_symbolTable.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 "runtime/interfaceSupport.hpp"
+#include "classfile/symbolTable.hpp"
+#include "unittest.hpp"
+
+TEST(SymbolTable, temp_new_symbol) {
+  // Assert messages assume these symbols are unique, and the refcounts start at
+  // one, but code does not rely on this.
+  JavaThread* THREAD = JavaThread::current();
+  // the thread should be in vm to use locks
+  ThreadInVMfromNative ThreadInVMfromNative(THREAD);
+
+  Symbol* abc = SymbolTable::new_symbol("abc", CATCH);
+  int abccount = abc->refcount();
+  TempNewSymbol ss = abc;
+  ASSERT_EQ(ss->refcount(), abccount) << "only one abc";
+  ASSERT_EQ(ss->refcount(), abc->refcount()) << "should match TempNewSymbol";
+
+  Symbol* efg = SymbolTable::new_symbol("efg", CATCH);
+  Symbol* hij = SymbolTable::new_symbol("hij", CATCH);
+  int efgcount = efg->refcount();
+  int hijcount = hij->refcount();
+
+  TempNewSymbol s1 = efg;
+  TempNewSymbol s2 = hij;
+  ASSERT_EQ(s1->refcount(), efgcount) << "one efg";
+  ASSERT_EQ(s2->refcount(), hijcount) << "one hij";
+
+  // Assignment operator
+  s1 = s2;
+  ASSERT_EQ(hij->refcount(), hijcount + 1) << "should be two hij";
+  ASSERT_EQ(efg->refcount(), efgcount - 1) << "should be no efg";
+
+  s1 = ss; // s1 is abc
+  ASSERT_EQ(s1->refcount(), abccount + 1) << "should be two abc (s1 and ss)";
+  ASSERT_EQ(hij->refcount(), hijcount) << "should only have one hij now (s2)";
+
+  s1 = s1; // self assignment
+  ASSERT_EQ(s1->refcount(), abccount + 1) << "should still be two abc (s1 and ss)";
+
+  TempNewSymbol s3;
+  Symbol* klm = SymbolTable::new_symbol("klm", CATCH);
+  int klmcount = klm->refcount();
+  s3 = klm; // assignment
+  ASSERT_EQ(s3->refcount(), klmcount) << "only one klm now";
+
+  Symbol* xyz = SymbolTable::new_symbol("xyz", CATCH);
+  int xyzcount = xyz->refcount();
+  { // inner scope
+    TempNewSymbol s_inner = xyz;
+  }
+  ASSERT_EQ(xyz->refcount(), xyzcount - 1)
+          << "Should have been decremented by dtor in inner scope";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/gc/g1/test_g1IHOPControl.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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/g1/g1CollectedHeap.inline.hpp"
+#include "gc/g1/g1IHOPControl.hpp"
+#include "gc/g1/g1Predictions.hpp"
+#include "unittest.hpp"
+
+static void test_update(G1IHOPControl* ctrl, double alloc_time,
+                        size_t alloc_amount, size_t young_size,
+                        double mark_time) {
+  for (int i = 0; i < 100; i++) {
+    ctrl->update_allocation_info(alloc_time, alloc_amount, young_size);
+    ctrl->update_marking_length(mark_time);
+  }
+}
+
+// @requires UseG1GC
+TEST_VM(G1StaticIHOPControl, simple) {
+  // Test requires G1
+  if (!UseG1GC) {
+    return;
+  }
+
+  const size_t initial_ihop = 45;
+
+  G1StaticIHOPControl ctrl(initial_ihop);
+  ctrl.update_target_occupancy(100);
+
+  size_t threshold = ctrl.get_conc_mark_start_threshold();
+  EXPECT_EQ(initial_ihop, threshold);
+
+  ctrl.update_allocation_info(100.0, 100, 100);
+  threshold = ctrl.get_conc_mark_start_threshold();
+  EXPECT_EQ(initial_ihop, threshold);
+
+  ctrl.update_marking_length(1000.0);
+  threshold = ctrl.get_conc_mark_start_threshold();
+  EXPECT_EQ(initial_ihop, threshold);
+
+  // Whatever we pass, the IHOP value must stay the same.
+  test_update(&ctrl, 2, 10, 10, 3);
+  threshold = ctrl.get_conc_mark_start_threshold();
+
+  EXPECT_EQ(initial_ihop, threshold);
+
+  test_update(&ctrl, 12, 10, 10, 3);
+  threshold = ctrl.get_conc_mark_start_threshold();
+
+  EXPECT_EQ(initial_ihop, threshold);
+}
+
+// @requires UseG1GC
+TEST_VM(G1AdaptiveIHOPControl, simple) {
+  // Test requires G1
+  if (!UseG1GC) {
+    return;
+  }
+
+  const size_t initial_threshold = 45;
+  const size_t young_size = 10;
+  const size_t target_size = 100;
+
+  // The final IHOP value is always
+  // target_size - (young_size + alloc_amount/alloc_time * marking_time)
+
+  G1Predictions pred(0.95);
+  G1AdaptiveIHOPControl ctrl(initial_threshold, &pred, 0, 0);
+  ctrl.update_target_occupancy(target_size);
+
+  // First "load".
+  const size_t alloc_time1 = 2;
+  const size_t alloc_amount1 = 10;
+  const size_t marking_time1 = 2;
+  const size_t settled_ihop1 = target_size
+          - (young_size + alloc_amount1 / alloc_time1 * marking_time1);
+
+  size_t threshold;
+  threshold = ctrl.get_conc_mark_start_threshold();
+
+  EXPECT_EQ(initial_threshold, threshold);
+
+  for (size_t i = 0; i < G1AdaptiveIHOPNumInitialSamples - 1; i++) {
+    ctrl.update_allocation_info(alloc_time1, alloc_amount1, young_size);
+    ctrl.update_marking_length(marking_time1);
+    // Not enough data yet.
+    threshold = ctrl.get_conc_mark_start_threshold();
+
+    ASSERT_EQ(initial_threshold, threshold) << "on step " << i;
+  }
+
+  test_update(&ctrl, alloc_time1, alloc_amount1, young_size, marking_time1);
+
+  threshold = ctrl.get_conc_mark_start_threshold();
+
+  EXPECT_EQ(settled_ihop1, threshold);
+
+  // Second "load". A bit higher allocation rate.
+  const size_t alloc_time2 = 2;
+  const size_t alloc_amount2 = 30;
+  const size_t marking_time2 = 2;
+  const size_t settled_ihop2 = target_size
+          - (young_size + alloc_amount2 / alloc_time2 * marking_time2);
+
+  test_update(&ctrl, alloc_time2, alloc_amount2, young_size, marking_time2);
+
+  threshold = ctrl.get_conc_mark_start_threshold();
+
+  EXPECT_LT(threshold, settled_ihop1);
+
+  // Third "load". Very high (impossible) allocation rate.
+  const size_t alloc_time3 = 1;
+  const size_t alloc_amount3 = 50;
+  const size_t marking_time3 = 2;
+  const size_t settled_ihop3 = 0;
+
+  test_update(&ctrl, alloc_time3, alloc_amount3, young_size, marking_time3);
+  threshold = ctrl.get_conc_mark_start_threshold();
+
+  EXPECT_EQ(settled_ihop3, threshold);
+
+  // And back to some arbitrary value.
+  test_update(&ctrl, alloc_time2, alloc_amount2, young_size, marking_time2);
+
+  threshold = ctrl.get_conc_mark_start_threshold();
+
+  EXPECT_GT(threshold, settled_ihop3);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/oops/test_arrayOop.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 "oops/arrayOop.hpp"
+#include "oops/oop.inline.hpp"
+#include "unittest.hpp"
+#include "utilities/globalDefinitions.hpp"
+
+class arrayOopDescTest {
+ public:
+
+  static int header_size_in_bytes() {
+    return arrayOopDesc::header_size_in_bytes();
+  }
+};
+
+static bool check_max_length_overflow(BasicType type) {
+  julong length = arrayOopDesc::max_array_length(type);
+  julong bytes_per_element = type2aelembytes(type);
+  julong bytes = length * bytes_per_element
+          + arrayOopDescTest::header_size_in_bytes();
+  return (julong) (size_t) bytes == bytes;
+}
+
+TEST(arrayOopDesc, boolean) {
+  ASSERT_PRED1(check_max_length_overflow, T_BOOLEAN);
+}
+
+TEST(arrayOopDesc, char) {
+  ASSERT_PRED1(check_max_length_overflow, T_CHAR);
+}
+
+TEST(arrayOopDesc, float) {
+  ASSERT_PRED1(check_max_length_overflow, T_FLOAT);
+}
+
+TEST(arrayOopDesc, double) {
+  ASSERT_PRED1(check_max_length_overflow, T_DOUBLE);
+}
+
+TEST(arrayOopDesc, byte) {
+  ASSERT_PRED1(check_max_length_overflow, T_BYTE);
+}
+
+TEST(arrayOopDesc, short) {
+  ASSERT_PRED1(check_max_length_overflow, T_SHORT);
+}
+
+TEST(arrayOopDesc, int) {
+  ASSERT_PRED1(check_max_length_overflow, T_INT);
+}
+
+TEST(arrayOopDesc, long) {
+  ASSERT_PRED1(check_max_length_overflow, T_LONG);
+}
+
+TEST(arrayOopDesc, object) {
+  ASSERT_PRED1(check_max_length_overflow, T_OBJECT);
+}
+
+TEST(arrayOopDesc, array) {
+  ASSERT_PRED1(check_max_length_overflow, T_ARRAY);
+}
+
+TEST(arrayOopDesc, narrowOop) {
+  ASSERT_PRED1(check_max_length_overflow, T_NARROWOOP);
+}
+// T_VOID and T_ADDRESS are not supported by max_array_length()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/oops/test_instanceKlass.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include "precompiled.hpp"
+#include "classfile/symbolTable.hpp"
+#include "classfile/systemDictionary.hpp"
+#include "memory/resourceArea.hpp"
+#include "oops/instanceKlass.hpp"
+#include "unittest.hpp"
+
+// Tests InstanceKlass::package_from_name()
+TEST_VM(InstanceKlass, null_symbol) {
+  ResourceMark rm;
+  TempNewSymbol package_sym = InstanceKlass::package_from_name(NULL, NULL);
+  ASSERT_TRUE(package_sym == NULL) << "Wrong package for NULL symbol";
+}
+
+// Tests for InstanceKlass::is_class_loader_instance_klass() function
+TEST_VM(InstanceKlass, class_loader_class) {
+  InstanceKlass* klass = SystemDictionary::ClassLoader_klass();
+  ASSERT_TRUE(klass->is_class_loader_instance_klass());
+}
+
+TEST_VM(InstanceKlass, string_klass) {
+  InstanceKlass* klass = SystemDictionary::String_klass();
+  ASSERT_TRUE(!klass->is_class_loader_instance_klass());
+}
--- a/hotspot/test/native/runtime/test_instanceKlass.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-#include "classfile/symbolTable.hpp"
-#include "memory/resourceArea.hpp"
-#include "oops/instanceKlass.hpp"
-#include "unittest.hpp"
-
-// Tests InstanceKlass::package_from_name()
-TEST_VM(instanceKlass, null_symbol) {
-  ResourceMark rm;
-  TempNewSymbol package_sym = InstanceKlass::package_from_name(NULL, NULL);
-  ASSERT_TRUE(package_sym == NULL) << "Wrong package for NULL symbol";
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/utilities/test_chunkedList.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 "unittest.hpp"
+#include "utilities/chunkedList.hpp"
+
+class Metadata;
+
+template <typename T>
+class TestChunkedList {
+  typedef ChunkedList<T, mtOther> ChunkedListT;
+
+ public:
+
+  static void testEmpty() {
+    ChunkedListT buffer;
+    ASSERT_EQ((size_t) 0, buffer.size());
+  }
+
+  static void testFull() {
+    ChunkedListT buffer;
+    for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) {
+      buffer.push((T) i);
+    }
+    ASSERT_EQ((size_t) ChunkedListT::BufferSize, buffer.size());
+    ASSERT_TRUE(buffer.is_full());
+  }
+
+  static void testSize() {
+    ChunkedListT buffer;
+    for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) {
+      ASSERT_EQ((size_t) i, buffer.size());
+      buffer.push((T) i);
+      ASSERT_EQ((size_t) (i + 1), buffer.size());
+    }
+  }
+
+  static void testClear() {
+    ChunkedListT buffer;
+
+    buffer.clear();
+    ASSERT_EQ((size_t) 0, buffer.size());
+
+    for (uintptr_t i = 0; i < ChunkedListT::BufferSize / 2; i++) {
+      buffer.push((T) i);
+    }
+    buffer.clear();
+    ASSERT_EQ((size_t) 0, buffer.size());
+
+    for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) {
+      buffer.push((T) i);
+    }
+    buffer.clear();
+    ASSERT_EQ((size_t) 0, buffer.size());
+  }
+
+  static void testAt() {
+    ChunkedListT buffer;
+
+    for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) {
+      buffer.push((T) i);
+      ASSERT_EQ((T) i, buffer.at(i));
+    }
+
+    for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) {
+      ASSERT_EQ((T) i, buffer.at(i));
+    }
+  }
+};
+
+TEST(ChunkedList, metadata_empty) {
+  TestChunkedList<Metadata*>::testEmpty();
+}
+
+TEST(ChunkedList, metadata_full) {
+  TestChunkedList<Metadata*>::testFull();
+}
+
+TEST(ChunkedList, metadata_size) {
+  TestChunkedList<Metadata*>::testSize();
+}
+
+TEST(ChunkedList, metadata_clear) {
+  TestChunkedList<Metadata*>::testSize();
+}
+
+TEST(ChunkedList, metadata_at) {
+  TestChunkedList<Metadata*>::testAt();
+}
+
+TEST(ChunkedList, size_t_empty) {
+  TestChunkedList<size_t>::testEmpty();
+}
+
+TEST(ChunkedList, size_t_full) {
+  TestChunkedList<size_t>::testFull();
+}
+
+TEST(ChunkedList, size_t_size) {
+  TestChunkedList<size_t>::testSize();
+}
+
+TEST(ChunkedList, size_t_clear) {
+  TestChunkedList<size_t>::testSize();
+}
+
+TEST(ChunkedList, size_t_at) {
+  TestChunkedList<size_t>::testAt();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/utilities/test_json.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,515 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 "prims/jvm.h"
+#include "utilities/json.hpp"
+#include "unittest.hpp"
+
+class JSON_GTest : public JSON {
+public:
+    static void test(const char* json, bool valid);
+
+private:
+    JSON_GTest(const char* text);
+
+    void log(uint level, const char* format, ...) ATTRIBUTE_PRINTF(3, 4);
+
+    bool callback(JSON_TYPE t, JSON_VAL* v, uint level);
+    JSON_TYPE prev;
+};
+
+void JSON_GTest::test(const char* text, bool should_pass) {
+    JSON_GTest json(text);
+    if (should_pass) {
+        ASSERT_TRUE(json.valid()) << "failed on a valid json string";
+    } else {
+        ASSERT_FALSE(json.valid()) << "succeeded on an invalid json string";
+    }
+}
+
+JSON_GTest::JSON_GTest(const char* text) : JSON(text, false, tty) {
+    prev = JSON_NONE;
+    parse();
+}
+
+TEST(utilities, json_curly_braces) {
+    JSON_GTest::test("{}", true);
+}
+
+TEST(utilities, json_brackets) {
+    JSON_GTest::test("[]", true);
+}
+
+TEST(utilities, json_space_braces) {
+    JSON_GTest::test("  {  }  ", true);
+}
+
+TEST(utilities, json_space_bracketes) {
+    JSON_GTest::test("  [  ]  ", true);
+}
+
+TEST(utilities, json_quoted_error) {
+    JSON_GTest::test("\"error\"", false);
+}
+
+TEST(utilities, json_error_string) {
+    JSON_GTest::test("error", false);
+}
+
+TEST(utilities, json_simple_integer) {
+    JSON_GTest::test("1", false);
+}
+
+TEST(utilities, json_siple_float) {
+    JSON_GTest::test("1.2", false);
+}
+
+TEST(utilities, json_simple_boolean_true) {
+    JSON_GTest::test("true", false);
+}
+
+TEST(utilities, json_simple_boolean_false) {
+    JSON_GTest::test("false", false);
+}
+
+TEST(utilities, json_simple_null) {
+    JSON_GTest::test("null", false);
+}
+
+TEST(utilities, json_one_element_int_array) {
+    JSON_GTest::test("[ 1 ]", true);
+}
+
+TEST(utilities, json_int_array) {
+    JSON_GTest::test("[ 1, ]", true);
+}
+
+TEST(utilities, json_one_element_bool_array) {
+    JSON_GTest::test("[ true ]", true);
+}
+
+TEST(utilities, json_bool_array) {
+    JSON_GTest::test("[ true, ]", true);
+}
+
+TEST(utilities, json_one_element_false_array) {
+    JSON_GTest::test("[ false ]", true);
+}
+
+TEST(utilities, json_false_bool_array) {
+    JSON_GTest::test("[ false, ]", true);
+}
+
+TEST(utilities, json_one_null_array) {
+    JSON_GTest::test("[ null ]", true);
+}
+
+TEST(utilities, json_null_array) {
+    JSON_GTest::test("[ null, ]", true);
+}
+
+TEST(utilities, json_one_empty_string_array) {
+    JSON_GTest::test("[ \"\" ]", true);
+}
+
+TEST(utilities, json_empty_string_array) {
+    JSON_GTest::test("[ \"\", ]", true);
+}
+
+TEST(utilities, json_single_string_array) {
+    JSON_GTest::test("[ \"elem1\" ]", true);
+}
+
+TEST(utilities, json_string_comma_arrray) {
+    JSON_GTest::test("[ \"elem1\", ]", true);
+}
+
+TEST(utilities, json_two_strings_array) {
+    JSON_GTest::test("[ \"elem1\", \"elem2\" ]", true);
+}
+
+TEST(utilities, json_two_strings_comma_array) {
+    JSON_GTest::test("[ \"elem1\", \"elem2\", ]", true);
+}
+
+TEST(utilities, json_curly_braces_outside) {
+    JSON_GTest::test("[ \"elem1\" ] { }", false);
+}
+
+TEST(utilities, json_element_in_array) {
+    JSON_GTest::test("[ elem1, \"elem2\" ]", false);
+}
+
+TEST(utilities, json_incorrect_end_array) {
+    JSON_GTest::test("[ \"elem1\"", false);
+}
+
+TEST(utilities, json_incorrect_string_end) {
+    JSON_GTest::test("[ \"elem1 ]", false);
+}
+
+TEST(utilities, json_incorrect_end_of_two_elements_array) {
+    JSON_GTest::test("[ \"elem1\", \"elem2\"", false);
+}
+
+TEST(utilities, json_incorrect_bool_true_array) {
+    JSON_GTest::test("[ truefoo ]", false);
+}
+
+TEST(utilities, json_incorrect_bool_false_array) {
+    JSON_GTest::test("[ falsefoo ]", false);
+}
+
+TEST(utilities, json_incorrect_null_array) {
+    JSON_GTest::test("[ nullfoo ]", false);
+}
+
+TEST(utilities, json_key_pair) {
+    JSON_GTest::test("{ key : 1 }", true);
+}
+
+TEST(utilities, json_key_pair_comma) {
+    JSON_GTest::test("{ key : 1, }", true);
+}
+
+TEST(utilities, json_bool_true_key) {
+    JSON_GTest::test("{ key : true }", true);
+}
+
+TEST(utilities, json_bool_true_key_comma) {
+    JSON_GTest::test("{ key : true, }", true);
+}
+
+TEST(utilities, json_bool_false_key) {
+    JSON_GTest::test("{ key : false }", true);
+}
+
+TEST(utilities, json_bool_false_key_comma) {
+    JSON_GTest::test("{ key : false, }", true);
+}
+
+TEST(utilities, json_null_key) {
+    JSON_GTest::test("{ key : null }", true);
+}
+
+TEST(utilities, json_null_key_comma) {
+    JSON_GTest::test("{ key : null, }", true);
+}
+
+TEST(utilities, json_pair_of_empty_strings) {
+    JSON_GTest::test("{ \"\" : \"\" }", true);
+}
+
+TEST(utilities, json_pair_of_empty_strings_comma) {
+    JSON_GTest::test("{ \"\" : \"\", }", true);
+}
+
+TEST(utilities, json_pair_of_strings) {
+    JSON_GTest::test("{ \"key1\" : \"val1\" }", true);
+}
+
+TEST(utilities, json_pair_of_strings_comma) {
+    JSON_GTest::test("{ \"key1\" : \"val1\", }", true);
+}
+
+TEST(utilities, json_two_pairs_of_strings) {
+    JSON_GTest::test("{ \"key1\" : \"val1\", \"key2\" : \"val2\" }", true);
+}
+
+TEST(utilities, json_two_pairs_of_strings_comma) {
+    JSON_GTest::test("{ \"key1\" : \"val1\", \"key2\" : \"val2\", }", true);
+}
+
+TEST(utilities, json_array_outside) {
+    JSON_GTest::test("{ \"key\" : \"val\" } [ \"error\" ]", false);
+}
+
+TEST(utilities, json_incorrect_object_end) {
+    JSON_GTest::test("{ \"key\" : \"val\" ", false);
+}
+
+TEST(utilities, json_empty_comment) {
+    JSON_GTest::test("/**/ { }", true);
+}
+
+TEST(utilities, json_space_comment) {
+    JSON_GTest::test("/* */ { }", true);
+}
+
+TEST(utilities, json_comment) {
+    JSON_GTest::test("/*foo*/ { }", true);
+}
+
+TEST(utilities, json_star_comment) {
+    JSON_GTest::test("/* *foo */ { }", true);
+}
+
+TEST(utilities, json_stars_comment) {
+    JSON_GTest::test("/* *foo* */ { }", true);
+}
+
+TEST(utilities, json_special_comment) {
+    JSON_GTest::test("/* /*foo */ { }", true);
+}
+
+TEST(utilities, json_comment_after) {
+    JSON_GTest::test("{ } /* foo */", true);
+}
+
+TEST(utilities, json_comment_after_and_space) {
+    JSON_GTest::test("{ } /* foo */ ", true);
+}
+
+TEST(utilities, json_one_line_empty_comment_after) {
+    JSON_GTest::test("{ } //", true);
+}
+
+TEST(utilities, json_one_line_space_comment_after) {
+    JSON_GTest::test("{ } // ", true);
+}
+
+TEST(utilities, json_one_line_comment_after) {
+    JSON_GTest::test("{ } // foo", true);
+}
+
+TEST(utilities, json_incorrect_multiline_comment) {
+    JSON_GTest::test("/* * / { }", false);
+}
+
+TEST(utilities, json_incorrect_multiline_comment_begin) {
+    JSON_GTest::test("/ * */ { }", false);
+}
+
+TEST(utilities, json_oneline_comment_only) {
+    JSON_GTest::test("// { }", false);
+}
+
+TEST(utilities, json_multiline_comment_only) {
+    JSON_GTest::test("/* { } */", false);
+}
+
+TEST(utilities, json_multiline_comment_2) {
+    JSON_GTest::test("/* { } */ ", false);
+}
+
+TEST(utilities, json_incorrectly_commented_object) {
+    JSON_GTest::test("/* { } ", false);
+}
+
+TEST(utilities, json_missing_multiline_end) {
+    JSON_GTest::test("{ } /* ", false);
+}
+
+TEST(utilities, json_missing_multiline_slash) {
+    JSON_GTest::test("/* { } *", false);
+}
+
+TEST(utilities, json_commented_object_end) {
+    JSON_GTest::test("{ /* } */", false);
+}
+
+TEST(utilities, json_commented_array_end) {
+    JSON_GTest::test("[ /* ] */", false);
+}
+
+TEST(utilities, json_missing_object_end) {
+    JSON_GTest::test("{ key : \"val\", /* } */", false);
+}
+
+TEST(utilities, json_missing_array_end) {
+    JSON_GTest::test("[ \"val\", /* ] */", false);
+}
+
+TEST(utilities, json_key_values_1) {
+    JSON_GTest::test("/* comment */{ key1 : { \"key2\" : { \"key3\" : [ \"elem1\", \"elem2\","
+            "{ \"key4\" : null }, 3 , 2 , 1 , 0 , -1 , -2 , -3 , true, false, null, ] }, \"key5\""
+            " : true }, \"key6\" : [ \"☃\" ], key7 : \"val\",}", true);
+}
+
+TEST(utilities, json_key_values_2) {
+    JSON_GTest::test("/* comment */ { \"key1\" : { \"key2\" : { \"key3\" : [ \"elem1\", \"elem2\","
+            "{ \"key4\" : null }, 3 , 2 , 1 , 0 , -1 , -2 , -3 , true, false, null, ] }, \"key5\""
+            " : true }, \"key6\" : [ \"☃\" ], key7 : \"val\",}", true);
+}
+
+TEST(utilities, json_quoted_symbols) {
+    JSON_GTest::test("/*comment*/{\"ff1 fsd\":{\"☃\":{\"☃\":[\"☃\",\"☃\"]},"
+            "\"☃\":true},\"☃\":[\"☃\"],\"foo\":\"☃\",}", true);
+}
+
+TEST(utilities, json_incorrect_key) {
+    JSON_GTest::test("/* comment */ { key1 error : { \"☃\" : { \"☃\" : [ \"☃\","
+            " \"☃\" ] }, \"☃\" : true }, \"baz\" : [ \"☃\" ], foo : \"☃\",}",
+            false); // first key needs to be quoted since it contains a space
+}
+
+TEST(utilities, json_array_with_newline) {
+    JSON_GTest::test("[\n]", true);
+}
+
+TEST(utilities, json_directives_file) {
+    JSON_GTest::test(
+            "[" "\n"
+            "   {"
+            "         // pattern to match against class+method+signature" "\n"
+            "         // leading and trailing wildcard (*) allowed" "\n"
+            "         match: \"foo.bar.*\"," "\n"
+            " " "\n"
+            "         // override defaults for specified compiler" "\n"
+            "         // we may differentiate between levels too. TBD." "\n"
+            "         c1:  {" "\n"
+            "           //override c1 presets " "\n"
+            "           array_bounds_check_removal: false" "\n"
+            "         }," "\n"
+            "" "\n"
+            "         c2: {" "\n"
+            "           // control inlining of method" "\n"
+            "           // + force inline, - dont inline" "\n"
+            "           inline : [ \"+java.util.*\", \"-com.sun.*\"]," "\n"
+            "         }," "\n"
+            "" "\n"
+            "         // directives outside a specific preset applies to all compilers" "\n"
+            "         inline : [ \"+java.util.*\", \"-com.sun.*\"]," "\n"
+            "         print_assembly: true," "\n"
+            "         verify_oopmaps: true," "\n"
+            "         max_loop_unrolling: 5" "\n"
+            "   }," "\n"
+            "   {" "\n"
+            "         // matching several patterns require an array" "\n"
+            "         match: [\"baz.*\",\"frob*\"]," "\n"
+            "" "\n"
+            "         // only enable c1 for this directive" "\n"
+            "         // all enabled by default. Command disables all not listed" "\n"
+            "         enable: \"c1\"," "\n"
+            "" "\n"
+            "         // applies to all compilers" "\n"
+            "         // + force inline, - dont inline" "\n"
+            "         inline : [ \"+java.util.*\", \"-com.sun.*\"]," "\n"
+            "         print_inlining: true," "\n"
+            "" "\n"
+            "         // force matching compiles to be blocking/syncronous" "\n"
+            "         blocking_compile: true" "\n"
+            "   }," "\n"
+            "]" "\n", true);
+}
+
+void JSON_GTest::log(uint indent, const char* format, ...) {
+    if (prev != JSON_KEY) {
+        for (uint i = 0; i < indent; i++) {
+            _st->print("  ");
+        }
+    }
+    va_list args;
+    va_start(args, format);
+    _st->vprint(format, args);
+    va_end(args);
+}
+
+bool JSON_GTest::callback(JSON_TYPE t, JSON_VAL* v, uint rlevel) {
+    switch (t) {
+        case JSON_OBJECT_BEGIN:
+            log(rlevel, "{\n");
+            prev = JSON_NONE; // Only care about JSON_KEY, to indent correctly
+            return true;
+
+        case JSON_OBJECT_END:
+            log(rlevel, "},\n");
+            prev = JSON_NONE;
+            return true;
+
+        case JSON_ARRAY_BEGIN:
+            log(rlevel, "[\n");
+            prev = JSON_NONE;
+            return true;
+
+        case JSON_ARRAY_END:
+            log(rlevel, "],\n");
+            prev = JSON_NONE;
+            return true;
+
+        case JSON_KEY:
+            for (uint i = 0; i < rlevel; i++) {
+                _st->print("  ");
+            }
+            _st->print("<key>");
+            for (size_t i = 0; i < v->str.length; i++) {
+                u_char c = v->str.start[i];
+                if (c == 0) {
+                    return false;
+                }
+                _st->print("%c", c);
+            }
+            _st->print(" : ");
+            prev = JSON_KEY;
+            return true;
+
+        case JSON_STRING:
+            if (prev != JSON_KEY) {
+                for (uint i = 0; i < rlevel; i++) {
+                    _st->print("  ");
+                }
+            }
+            _st->print("<str>");
+            for (size_t i = 0; i < v->str.length; i++) {
+                u_char c = v->str.start[i];
+                if (c == 0) {
+                    return false;
+                }
+                _st->print("%c", c);
+            }
+            _st->print(",\n");
+            prev = JSON_NONE;
+            return true;
+
+        case JSON_NUMBER_INT:
+            log(rlevel, "<int>%" PRId64 ",\n", v->int_value);
+            prev = JSON_NONE;
+            return true;
+
+        case JSON_NUMBER_FLOAT:
+            log(rlevel, "<double>%lf,\n", v->double_value);
+            prev = JSON_NONE;
+            return true;
+
+        case JSON_TRUE:
+            log(rlevel, "<true>,\n");
+            prev = JSON_NONE;
+            return true;
+
+        case JSON_FALSE:
+            log(rlevel, "<false>,\n");
+            prev = JSON_NONE;
+            return true;
+
+        case JSON_NULL:
+            log(rlevel, "<null>,\n");
+            prev = JSON_NONE;
+            return true;
+
+        default:
+            error(INTERNAL_ERROR, "unknown JSON type");
+            return false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/utilities/test_linkedlist.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 "unittest.hpp"
+#include "utilities/linkedlist.hpp"
+
+class Integer : public StackObj {
+ private:
+  int _value;
+ public:
+
+  Integer(int i) : _value(i) {
+  }
+
+  int value() const {
+    return _value;
+  }
+
+  bool equals(const Integer& i) const {
+    return _value == i.value();
+  }
+
+  static int compare(const Integer& i1, const Integer& i2) {
+    return i1.value() - i2.value();
+  }
+};
+
+static void check_list_values(const int* expected, const LinkedList<Integer>* list) {
+  LinkedListNode<Integer>* head = list->head();
+  int index = 0;
+  while (head != NULL) {
+    ASSERT_EQ(expected[index], head->peek()->value())
+            << "Unexpected value at index " << index;
+    head = head->next();
+    index++;
+  }
+}
+
+const Integer one(1), two(2), three(3), four(4), five(5), six(6);
+
+// Test regular linked list
+TEST(LinkedList, simple) {
+  LinkedListImpl<Integer, ResourceObj::C_HEAP, mtTest> ll;
+
+  ASSERT_TRUE(ll.is_empty()) << "Start with empty list";
+
+  ll.add(six);
+  ASSERT_TRUE(!ll.is_empty()) << "Should not be empty";
+
+  Integer* i = ll.find(six);
+  ASSERT_TRUE(i != NULL) << "Should find it";
+  ASSERT_EQ(six.value(), i->value()) << "Should be 6";
+
+  i = ll.find(three);
+  ASSERT_EQ(NULL, i) << "Not in the list";
+
+  LinkedListNode<Integer>* node = ll.find_node(six);
+  ASSERT_TRUE(node != NULL) << "6 is in the list";
+
+  ll.insert_after(three, node);
+  ll.insert_before(one, node);
+  int expected[3] = {1, 6, 3};
+  check_list_values(expected, &ll);
+}
+
+// Test sorted linked list
+TEST(SortedLinkedList, simple) {
+  LinkedListImpl<Integer, ResourceObj::C_HEAP, mtTest> ll;
+  ll.add(one);
+  ll.add(six);
+  ll.add(three);
+  ll.add(two);
+  ll.add(four);
+  ll.add(five);
+
+  SortedLinkedList<Integer, Integer::compare, ResourceObj::C_HEAP, mtTest> sl;
+  ASSERT_TRUE(sl.is_empty()) << "Start with empty list";
+
+  size_t ll_size = ll.size();
+  sl.move(&ll);
+  size_t sl_size = sl.size();
+
+  ASSERT_EQ(ll_size, sl_size) << "Should be the same size";
+  ASSERT_TRUE(ll.is_empty()) << "No more entries";
+
+  // sorted result
+  int sorted_result[] = {1, 2, 3, 4, 5, 6};
+  check_list_values(sorted_result, &sl);
+  if (HasFatalFailure()) {
+    return;
+  }
+
+  LinkedListNode<Integer>* node = sl.find_node(four);
+  ASSERT_TRUE(node != NULL) << "4 is in the list";
+  sl.remove_before(node);
+  sl.remove_after(node);
+  int remains[] = {1, 2, 4, 6};
+  check_list_values(remains, &sl);
+}
--- a/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTest.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -34,14 +34,17 @@
  *          jdk.hotspot.agent/sun.jvm.hotspot.runtime
  *          jdk.hotspot.agent/sun.jvm.hotspot.tools
  *          java.management
- * @build SASymbolTableTestAgent SASymbolTableTestAttachee
+ * @build SASymbolTableTestAgent
  * @run main SASymbolTableTest
  */
 
+import java.util.Arrays;
+import java.util.List;
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.JDKToolFinder;
 import jdk.test.lib.Platform;
+import jdk.test.lib.apps.LingeredApp;
 
 /*
  * The purpose of this test is to validate that we can use SA to
@@ -53,6 +56,7 @@
  */
 public class SASymbolTableTest {
     static String jsaName = "./SASymbolTableTest.jsa";
+    private static LingeredApp theApp = null;
 
     public static void main(String[] args) throws Exception {
         if (!Platform.shouldSAAttach()) {
@@ -78,50 +82,44 @@
     private static void run(boolean useArchive) throws Exception {
         String flag = useArchive ? "auto" : "off";
 
-        // (1) Launch the attachee process
-        ProcessBuilder attachee = ProcessTools.createJavaProcessBuilder(
-            "-XX:+UnlockDiagnosticVMOptions",
-            "-XX:SharedArchiveFile=" + jsaName,
-            "-Xshare:" + flag,
-            "-showversion",                // so we can see "sharing" in the output
-            "SASymbolTableTestAttachee");
+        try {
+            // (1) Launch the attachee process
+            System.out.println("Starting LingeredApp");
+            List<String> vmOpts = Arrays.asList(
+                    "-XX:+UnlockDiagnosticVMOptions",
+                    "-XX:SharedArchiveFile=" + jsaName,
+                    "-Xshare:" + flag,
+                    "-showversion");                // so we can see "sharing" in the output
 
-        final Process p = attachee.start();
+            theApp = LingeredApp.startApp(vmOpts);
 
-        // (2) Launch the agent process
-        long pid = p.getPid();
-        System.out.println("Attaching agent " + pid);
-        ProcessBuilder tool = ProcessTools.createJavaProcessBuilder(
-            "--add-modules=jdk.hotspot.agent",
-            "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED",
-            "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.memory=ALL-UNNAMED",
-            "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.runtime=ALL-UNNAMED",
-            "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.tools=ALL-UNNAMED",
-            "SASymbolTableTestAgent",
-            Long.toString(pid));
-        OutputAnalyzer output = ProcessTools.executeProcess(tool);
-        System.out.println(output.getOutput());
-        output.shouldHaveExitValue(0);
-
-        Thread t = new Thread() {
-                public void run() {
-                    try {
-                        OutputAnalyzer output = new OutputAnalyzer(p);
-                        System.out.println("STDOUT[");
-                        System.out.print(output.getStdout());
-                        System.out.println("]");
-                        System.out.println("STDERR[");
-                        System.out.print(output.getStderr());
-                        System.out.println("]");
-                    } catch (Throwable t) {
-                        t.printStackTrace();
-                    }
-                }
-            };
-        t.start();
-
-        Thread.sleep(2 * 1000);
-        p.destroy();
-        t.join();
+            // (2) Launch the agent process
+            long pid = theApp.getPid();
+            System.out.println("Attaching agent to " + pid );
+            ProcessBuilder tool = ProcessTools.createJavaProcessBuilder(
+                    "--add-modules=jdk.hotspot.agent",
+                    "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED",
+                    "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.memory=ALL-UNNAMED",
+                    "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.runtime=ALL-UNNAMED",
+                    "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.tools=ALL-UNNAMED",
+                    "SASymbolTableTestAgent",
+                    Long.toString(pid));
+            OutputAnalyzer output = ProcessTools.executeProcess(tool);
+            System.out.println("STDOUT[");
+            System.out.println(output.getOutput());
+            if (output.getStdout().contains("connected too early")) {
+                System.out.println("SymbolTable not created by VM - test skipped");
+                return;
+            }
+            System.out.println("]");
+            System.out.println("STDERR[");
+            System.out.print(output.getStderr());
+            System.out.println("]");
+            output.shouldHaveExitValue(0);
+        } catch (Exception ex) {
+            throw new RuntimeException("Test ERROR " + ex, ex);
+        } finally {
+            LingeredApp.stopApp(theApp);
+        }
     }
 }
--- a/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTestAgent.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTestAgent.java	Wed Jul 05 22:19:13 2017 +0200
@@ -112,31 +112,35 @@
 
     public void run() {
         System.out.println("SASymbolTableTestAgent: starting");
-        VM vm = VM.getVM();
-        SymbolTable table = vm.getSymbolTable();
+        try {
+            VM vm = VM.getVM();
+            SymbolTable table = vm.getSymbolTable();
 
-        // (a) These are names that are likely to exist in the symbol table
-        //     of a JVM after start-up. They were taken from vmSymbols.hpp
-        //     during the middle of JDK9 development.
-        //
-        //     The purpose is not to check that each name must exist (a future
-        //     version of JDK may not preload some of the classes).
-        //
-        //     The purpose of this loops is to ensure that we check a lot of symbols,
-        //     so we will (most likely) hit on both VALUE_ONLY_BUCKET_TYPE and normal bucket type
-        //     in CompactHashTable.probe().
-        for (String n : commonNames) {
-            Symbol s = table.probe(n);
-            System.out.format("%-40s = %s\n", n, s);
-        }
+            // (a) These are names that are likely to exist in the symbol table
+            //     of a JVM after start-up. They were taken from vmSymbols.hpp
+            //     during the middle of JDK9 development.
+            //
+            //     The purpose is not to check that each name must exist (a future
+            //     version of JDK may not preload some of the classes).
+            //
+            //     The purpose of this loops is to ensure that we check a lot of symbols,
+            //     so we will (most likely) hit on both VALUE_ONLY_BUCKET_TYPE and normal bucket type
+            //     in CompactHashTable.probe().
+            for (String n : commonNames) {
+                Symbol s = table.probe(n);
+                System.out.format("%-40s = %s\n", n, s);
+            }
 
-        System.out.println("======================================================================");
+            System.out.println("======================================================================");
 
-        // (b) Also test a few strings that are known to not exist in the table. This will
-        //     both the compact table (if it exists) and the regular table to be walked.
-        for (String n : badNames) {
-            Symbol s = table.probe(n);
-            System.out.format("%-40s = %s\n", n, s);
+            // (b) Also test a few strings that are known to not exist in the table. This will
+            //     both the compact table (if it exists) and the regular table to be walked.
+            for (String n : badNames) {
+                Symbol s = table.probe(n);
+                System.out.format("%-40s = %s\n", n, s);
+            }
+        } catch (NullPointerException e) {
+            System.out.println("connected too early -- please try again");
         }
     }
 }
--- a/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTestAttachee.java	Fri Oct 07 21:28:20 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * This class is launched in a sub-process by the main test,
- * SASymbolTableTest.java.
- *
- * This class does nothing in particular. It just sleeps for 120
- * seconds so SASymbolTableTestAgent can have a chance to examine its
- * SymbolTable. This process should be killed by the parent process
- * after SASymbolTableTestAgent has completed testing.
- */
-public class SASymbolTableTestAttachee {
-    public static void main(String args[]) throws Throwable {
-        System.out.println("SASymbolTableTestAttachee: sleeping to wait for SA tool to attach ...");
-        Thread.sleep(120 * 1000);
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/lambda-features/CyclicInterfaceInit.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 8163969
+ * @summary Interface initialization was crashing on this because the wrong class was getting
+ * initialization error.
+ * @run main CyclicInterfaceInit
+ */
+/**
+ * This snippet crashes with
+ * - Java(TM) SE Runtime Environment (8.0_101-b13) (build 1.8.0_101-b13)
+ */
+public class CyclicInterfaceInit {
+
+    interface Base {
+        static final Object CONST = new Target(){}.someMethod();
+
+        default void important() {
+            // Super interfaces with default methods get initialized (JLS 12.4.1)
+        }
+    }
+
+   static boolean out(String c) {
+       System.out.println("initializing " + c);
+       return true;
+    }
+
+    interface Target extends Base {
+        boolean v = CyclicInterfaceInit.out("Target");
+        default Object someMethod() {
+            throw new RuntimeException();
+        }
+        // Target can be fully initialized before initializating Base because Target doesn't
+        // initiate the initialization of Base.
+    }
+
+    static class InnerBad implements Target {}
+
+    public static void main(String[] args) {
+        try {
+          new Target() {};  // Creates inner class that causes initialization of super interfaces
+        } catch (ExceptionInInitializerError e) {
+          System.out.println("ExceptionInInitializerError thrown as expected");
+        }
+        // Try again, InnerBad instantiation should throw NoClassdefFoundError
+        // because Base is marked erroneous due to previous exception during initialization
+        try {
+          InnerBad ig = new InnerBad();
+          throw new RuntimeException("FAILED- initialization of InnerBad should throw NCDFE");
+        } catch (NoClassDefFoundError e) {
+          System.out.println("NoClassDefFoundError thrown as expected");
+        }
+        // Target is already initialized.
+        System.out.println("Target.v is " + Target.v);
+        // shouldn't throw any exceptions.
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/lambda-features/InterfaceInitializationStates.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 8163969
+ * @summary Test interface initialization states and when certain interfaces are initialized
+ * in the presence of initialization errors.
+ * @run main InterfaceInitializationStates
+ */
+
+import java.util.List;
+import java.util.Arrays;
+import java.util.ArrayList;
+
+public class InterfaceInitializationStates {
+
+    static List<Class<?>> cInitOrder = new ArrayList<>();
+
+    // K interface with a default method has an initialization error
+    interface K {
+        boolean v = InterfaceInitializationStates.out(K.class);
+        static final Object CONST = InterfaceInitializationStates.someMethod();
+        default int method() { return 2; }
+    }
+
+    // I is initialized when CONST is used, and doesn't trigger initialization of K,
+    // I also doesn't get an initialization error just because K has an initialization error.
+    interface I extends K {
+        boolean v = InterfaceInitializationStates.out(I.class);
+        static final Object CONST = InterfaceInitializationStates.someMethod();
+    }
+
+    // L can be fully initialized even though it extends an interface that has an
+    // initialization error
+    interface L extends K {
+        boolean v = InterfaceInitializationStates.out(L.class);
+        default void lx() {}
+        static void func() {
+            System.out.println("Calling function on interface with bad super interface.");
+        }
+    }
+
+    // Another interface needing initialization.
+    // Initialization of this interface does not occur with ClassLIM because K throws
+    // an initialization error, so the interface initialization is abandoned
+    interface M {
+        boolean v = InterfaceInitializationStates.out(M.class);
+        default void mx() {}
+    }
+
+    static class ClassLIM implements L, I, M {
+        boolean v = InterfaceInitializationStates.out(ClassLIM.class);
+        int callMethodInK() { return method(); }
+        static {
+            // Since interface initialization of K fails, this should never be called
+            System.out.println("Initializing C, but L is still good");
+            L.func();
+        }
+    }
+
+    // Finally initialize M
+    static class ClassM implements M {
+        boolean v = InterfaceInitializationStates.out(ClassM.class);
+    }
+
+    // Iunlinked is testing initialization like interface I, except interface I is linked when
+    // ClassLIM is linked.
+    // Iunlinked is not linked already when K gets an initialization error.  Linking Iunlinked
+    // should succeed and not get NoClassDefFoundError because it does not depend on the
+    // initialization state of K for linking.  There's bug now where it gets this error.
+    // See: https://bugs.openjdk.java.net/browse/JDK-8166203.
+    interface Iunlinked extends K {
+        boolean v = InterfaceInitializationStates.out(Iunlinked.class);
+    }
+
+    // More tests.  What happens if we use K for parameters and return types?
+    // K is a symbolic reference in the constant pool and the initialization error only
+    // matters when it's used.
+    interface Iparams {
+        boolean v = InterfaceInitializationStates.out(Iparams.class);
+        K the_k = null;
+        K m(K k); // abstract
+        default K method() { return new K(){}; }
+    }
+
+    static class ClassIparams implements Iparams {
+        boolean v = InterfaceInitializationStates.out(ClassIparams.class);
+        public K m(K k) { return k; }
+    }
+
+    public static void main(java.lang.String[] unused) {
+        // The rule this tests is the last sentence of JLS 12.4.1:
+
+        // When a class is initialized, its superclasses are initialized (if they have not
+        // been previously initialized), as well as any superinterfaces (s8.1.5) that declare any
+        // default methods (s9.4.3) (if they have not been previously initialized). Initialization
+        // of an interface does not, of itself, cause initialization of any of its superinterfaces.
+
+        // Trigger initialization.
+        // Now L is fully_initialized even though K should
+        // throw an error during initialization.
+        boolean v = L.v;
+        L.func();
+
+        try {
+            ClassLIM c  = new ClassLIM();  // is K initialized, with a perfectly good L in the middle
+            // was bug: this used to succeed and be able to callMethodInK().
+            throw new RuntimeException("FAIL exception not thrown for class");
+        } catch (ExceptionInInitializerError e) {
+            System.out.println("ExceptionInInitializerError thrown as expected");
+        }
+
+        // Test that K already has initialization error so gets ClassNotFoundException because
+        // initialization was attempted with ClassLIM.
+        try {
+            Class.forName("InterfaceInitializationStates$K", true, InterfaceInitializationStates.class.getClassLoader());
+            throw new RuntimeException("FAIL exception not thrown for forName(K)");
+        } catch(ClassNotFoundException e) {
+            throw new RuntimeException("ClassNotFoundException should not be thrown");
+        } catch(NoClassDefFoundError e) {
+            System.out.println("NoClassDefFoundError thrown as expected");
+        }
+
+        new ClassM();
+
+        // Initialize I, which doesn't cause K (super interface) to be initialized.
+        // Since the initialization of I does _not_ cause K to be initialized, it does
+        // not get NoClassDefFoundError because K is erroneous.
+        // But the initialization of I throws RuntimeException, so we expect
+        // ExceptionInInitializerError.
+        try {
+            Object ii = I.CONST;
+            throw new RuntimeException("FAIL exception not thrown for I's initialization");
+        } catch (ExceptionInInitializerError e) {
+            System.out.println("ExceptionInInitializerError as expected");
+        }
+
+        // Initialize Iunlinked. This should not get NoClassDefFoundError because K
+        // (its super interface) is in initialization_error state.
+        // This is a bug.  It does now.
+        try {
+            boolean bb = Iunlinked.v;
+            throw new RuntimeException("FAIL exception not thrown for Iunlinked initialization");
+        } catch(NoClassDefFoundError e) {
+            System.out.println("NoClassDefFoundError thrown because of bug");
+        }
+
+        // This should be okay
+        boolean value = Iparams.v;
+        System.out.println("value is " + value);
+
+        ClassIparams p = new ClassIparams();
+        try {
+            // Now we get an error because K got an initialization_error
+            K kk = p.method();
+            throw new RuntimeException("FAIL exception not thrown for calling method for K");
+        } catch(NoClassDefFoundError e) {
+            System.out.println("NoClassDefFoundError thrown as expected");
+        }
+
+         // Check expected class initialization order
+        List<Class<?>> expectedCInitOrder = Arrays.asList(L.class, K.class, M.class, ClassM.class,
+                                                          I.class, Iparams.class,
+                                                          ClassIparams.class);
+        if (!cInitOrder.equals(expectedCInitOrder)) {
+            throw new RuntimeException(
+                String.format("Class initialization array %s not equal to expected array %s",
+                              cInitOrder, expectedCInitOrder));
+        }
+    }
+
+    static boolean out(Class c) {
+        System.out.println("#: initializing " + c.getName());
+        cInitOrder.add(c);
+        return true;
+    }
+    static Object someMethod() {
+        throw new RuntimeException();
+    }
+}
--- a/hotspot/test/runtime/modules/PatchModule/PatchModuleCDS.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/hotspot/test/runtime/modules/PatchModule/PatchModuleCDS.java	Wed Jul 05 22:19:13 2017 +0200
@@ -23,41 +23,83 @@
 
 /*
  * @test
+ * @summary test that --patch-module works with CDS
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
+ *          jdk.jartool/sun.tools.jar
+ * @build PatchModuleMain
  * @run main PatchModuleCDS
  */
 
 import java.io.File;
+import jdk.test.lib.InMemoryJavaCompiler;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 
 public class PatchModuleCDS {
 
     public static void main(String args[]) throws Throwable {
-        System.out.println("Test that --patch-module and -Xshare:dump are incompatibable");
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("--patch-module=java.naming=mods/java.naming", "-Xshare:dump");
-        OutputAnalyzer output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Cannot use the following option when dumping the shared archive: --patch-module");
 
-        System.out.println("Test that --patch-module and -Xshare:on are incompatibable");
+        // Case 1: Test that --patch-module and -Xshare:dump are compatible
         String filename = "patch_module.jsa";
-        pb = ProcessTools.createJavaProcessBuilder(
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
             "-XX:+UnlockDiagnosticVMOptions",
             "-XX:SharedArchiveFile=" + filename,
-            "-Xshare:dump");
-        output = new OutputAnalyzer(pb.start());
-        output.shouldContain("ro space:"); // Make sure archive got created.
+            "-Xshare:dump",
+            "--patch-module=java.naming=no/such/directory",
+            "-Xlog:class+path=info",
+            "-version");
+        new OutputAnalyzer(pb.start())
+            .shouldContain("ro space:"); // Make sure archive got created.
+
+       // Case 2: Test that only jar file in --patch-module is supported for CDS dumping
+        // Create a class file in the module java.base.
+        String source = "package javax.naming.spi; "                +
+                        "public class NamingManager { "             +
+                        "    static { "                             +
+                        "        System.out.println(\"I pass!\"); " +
+                        "    } "                                    +
+                        "}";
+
+        ClassFileInstaller.writeClassToDisk("javax/naming/spi/NamingManager",
+             InMemoryJavaCompiler.compile("javax.naming.spi.NamingManager", source, "-Xmodule:java.naming"),
+             System.getProperty("test.classes"));
 
         pb = ProcessTools.createJavaProcessBuilder(
             "-XX:+UnlockDiagnosticVMOptions",
             "-XX:SharedArchiveFile=" + filename,
-            "-Xshare:on",
-            "--patch-module=java.naming=mods/java.naming",
+            "-Xshare:dump",
+            "--patch-module=java.base=" + System.getProperty("test.classes"),
+            "-Xlog:class+path=info",
             "-version");
-        output = new OutputAnalyzer(pb.start());
-        output.shouldContain("The shared archive file cannot be used with --patch-module");
+        new OutputAnalyzer(pb.start())
+            .shouldContain("--patch-module requires a regular file during dumping");
 
-        output.shouldHaveExitValue(1);
+        // Case 3a: Test CDS dumping with jar file in --patch-module
+        BasicJarBuilder.build("javanaming", "javax/naming/spi/NamingManager");
+        String moduleJar = BasicJarBuilder.getTestJar("javanaming.jar");
+        pb = ProcessTools.createJavaProcessBuilder(
+            "-XX:+UnlockDiagnosticVMOptions",
+            "-XX:SharedArchiveFile=" + filename,
+            "-Xshare:dump",
+            "--patch-module=java.naming=" + moduleJar,
+            "-Xlog:class+load",
+            "-Xlog:class+path=info",
+            "PatchModuleMain", "javax.naming.spi.NamingManager");
+        new OutputAnalyzer(pb.start())
+            .shouldContain("ro space:"); // Make sure archive got created.
+
+        // Case 3b: Test CDS run with jar file in --patch-module
+        pb = ProcessTools.createJavaProcessBuilder(
+            "-XX:+UnlockDiagnosticVMOptions",
+            "-XX:SharedArchiveFile=" + filename,
+            "-Xshare:auto",
+            "--patch-module=java.naming=" + moduleJar,
+            "-Xlog:class+load",
+            "-Xlog:class+path=info",
+            "PatchModuleMain", "javax.naming.spi.NamingManager");
+        new OutputAnalyzer(pb.start())
+            .shouldContain("I pass!")
+            .shouldHaveExitValue(0);
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/serviceability/jvmti/ModuleAwareAgents/ClassFileLoadHook/MAAClassFileLoadHook.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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
+ * @run main/othervm/native -agentlib:MAAClassFileLoadHook MAAClassFileLoadHook
+ * @run main/othervm/native -agentlib:MAAClassFileLoadHook=with_early_vmstart MAAClassFileLoadHook
+ * @run main/othervm/native -agentlib:MAAClassFileLoadHook=with_early_class_hook MAAClassFileLoadHook
+ * @run main/othervm/native -agentlib:MAAClassFileLoadHook=with_early_vmstart,with_early_class_hook MAAClassFileLoadHook
+ */
+
+public class MAAClassFileLoadHook {
+
+    static {
+        try {
+            System.loadLibrary("MAAClassFileLoadHook");
+        } catch (UnsatisfiedLinkError ule) {
+            System.err.println("Could not load MAAClassFileLoadHook library");
+            System.err.println("java.library.path: "
+                + System.getProperty("java.library.path"));
+            throw ule;
+        }
+    }
+
+    native static int check();
+
+    public static void main(String args[]) {
+        int status = check();
+        if (status != 0) {
+            throw new RuntimeException("Non-zero status returned from the agent: " + status);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/serviceability/jvmti/ModuleAwareAgents/ClassFileLoadHook/libMAAClassFileLoadHook.c	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,278 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 <stdio.h>
+#include <string.h>
+#include "jvmti.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef JNI_ENV_ARG
+
+#ifdef __cplusplus
+#define JNI_ENV_ARG(x, y) y
+#define JNI_ENV_PTR(x) x
+#else
+#define JNI_ENV_ARG(x,y) x, y
+#define JNI_ENV_PTR(x) (*x)
+#endif
+
+#endif
+
+#define TranslateError(err) "JVMTI error"
+
+#define PASSED 0
+#define FAILED 2
+
+static const char *EXPECTED_NAME = "java/util/Collections";
+static const char *EXC_CNAME = "java/lang/Exception";
+
+static jvmtiEnv *jvmti = NULL;
+static jint result = PASSED;
+static jboolean printdump = JNI_FALSE;
+
+static jboolean with_early_vm_start_capability = JNI_FALSE;
+static jboolean with_early_class_hook_capability = JNI_FALSE;
+
+static jboolean found_class_in_vm_start = JNI_FALSE;
+static jboolean found_class_in_primordial = JNI_FALSE;
+static jboolean found_class_in_cflh_events = JNI_FALSE;
+
+static int cflh_events_primordial_count = 0;
+static int cflh_events_vm_start_count = 0;
+
+static jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved);
+
+JNIEXPORT
+jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
+    return Agent_Initialize(jvm, options, reserved);
+}
+
+JNIEXPORT
+jint JNICALL Agent_OnAttach(JavaVM *jvm, char *options, void *reserved) {
+    return Agent_Initialize(jvm, options, reserved);
+}
+
+JNIEXPORT
+jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) {
+    return JNI_VERSION_9;
+}
+
+static
+jint throw_exc(JNIEnv *env, char *msg) {
+    jclass exc_class = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, EXC_CNAME));
+
+    if (exc_class == NULL) {
+        printf("throw_exc: Error in FindClass(env, %s)\n", EXC_CNAME);
+        return -1;
+    }
+    return JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG(env, exc_class), msg);
+}
+
+static void JNICALL
+Callback_ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *env,
+                           jclass class_being_redefined,
+                           jobject loader, const char* name, jobject protection_domain,
+                           jint class_data_len, const unsigned char* class_data,
+                           jint *new_class_data_len, unsigned char** new_class_data) {
+    jvmtiPhase phase;
+    jvmtiError err;
+
+    err = (*jvmti)->GetPhase(jvmti_env, &phase);
+    if (err != JVMTI_ERROR_NONE) {
+        printf("ClassFileLoadHook event: GetPhase error: %s (%d)\n", TranslateError(err), err);
+        result = FAILED;
+        return;
+    }
+
+    if (phase == JVMTI_PHASE_PRIMORDIAL || phase == JVMTI_PHASE_START) {
+        if (phase == JVMTI_PHASE_START) {
+            cflh_events_vm_start_count++;
+            if(strcmp(name, EXPECTED_NAME) == 0) {
+                found_class_in_vm_start = JNI_TRUE;
+            }
+        } else {
+            cflh_events_primordial_count++;
+            if(strcmp(name, EXPECTED_NAME) == 0) {
+                found_class_in_primordial = JNI_TRUE;
+            }
+        }
+    }
+
+    if(strcmp(name, EXPECTED_NAME) == 0) {
+        found_class_in_cflh_events = JNI_TRUE;
+    }
+
+    if (printdump == JNI_TRUE) {
+        printf(">>>    ClassFileLoadHook event: phase(%d), class name %s\n", phase, name);
+    }
+}
+
+static
+jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
+    jint res, size;
+    jvmtiCapabilities caps;
+    jvmtiEventCallbacks callbacks;
+    jvmtiError err;
+
+    if (options != NULL) {
+        if (strstr(options, "with_early_vmstart") != NULL) {
+            with_early_vm_start_capability = JNI_TRUE;
+        }
+        if (strstr(options, "with_early_class_hook") != NULL) {
+            with_early_class_hook_capability = JNI_TRUE;
+        }
+        if (strstr(options, "printdump") != NULL) {
+            printdump = JNI_TRUE;
+        }
+    }
+
+    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
+        JVMTI_VERSION_9);
+    if (res != JNI_OK || jvmti == NULL) {
+        printf("    Error: wrong result of a valid call to GetEnv!\n");
+        return JNI_ERR;
+    }
+
+    printf("Enabling following capabilities: can_generate_all_class_hook_events");
+    memset(&caps, 0, sizeof(caps));
+    caps.can_generate_all_class_hook_events = 1;
+    if (with_early_vm_start_capability == JNI_TRUE) {
+        printf(", can_generate_early_vmstart");
+        caps.can_generate_early_vmstart = 1;
+    }
+    if (with_early_class_hook_capability == JNI_TRUE) {
+        printf(", can_generate_early_class_hook_events");
+        caps.can_generate_early_class_hook_events = 1;
+    }
+    printf("\n");
+
+    err = (*jvmti)->AddCapabilities(jvmti, &caps);
+    if (err != JVMTI_ERROR_NONE) {
+        printf("    Error in AddCapabilites: %s (%d)\n", TranslateError(err), err);
+        return JNI_ERR;
+    }
+
+    size = (jint)sizeof(callbacks);
+
+    memset(&callbacks, 0, sizeof(callbacks));
+    callbacks.ClassFileLoadHook = Callback_ClassFileLoadHook;
+
+    err = (*jvmti)->SetEventCallbacks(jvmti, &callbacks, size);
+    if (err != JVMTI_ERROR_NONE) {
+        printf("    Error in SetEventCallbacks: %s (%d)\n", TranslateError(err), err);
+        return JNI_ERR;
+    }
+
+    err = (*jvmti)->SetEventNotificationMode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL);
+    if (err != JVMTI_ERROR_NONE) {
+        printf("    Error in SetEventNotificationMode: %s (%d)\n", TranslateError(err), err);
+        return JNI_ERR;
+    }
+
+    return JNI_OK;
+}
+
+JNIEXPORT jint JNICALL
+Java_MAAClassFileLoadHook_check(JNIEnv *env, jclass cls) {
+    jobject loader = NULL;
+
+    if (jvmti == NULL) {
+        throw_exc(env, "JVMTI client was not properly loaded!\n");
+        return FAILED;
+    }
+
+    /*
+     * Expecting that we always get ClassFileLoadHook events in the VM Start phase.
+     */
+    if (cflh_events_vm_start_count == 0) {
+        throw_exc(env, "Didn't get ClassFileLoadHook events in start phase!\n");
+        return FAILED;
+    }
+
+    if (with_early_class_hook_capability == JNI_TRUE) {
+       /*
+        * Expecting that we get ClassFileLoadHook events in the Primordial phase
+        * when can_generate_all_class_hook_events and can_generate_early_class_hook_events
+        * capabilities are enabled.
+        */
+        if (cflh_events_primordial_count == 0) {
+            throw_exc(env, "Didn't get ClassFileLoadHook events in primordial phase!\n");
+            return FAILED;
+        }
+    } else {
+       /*
+        * Expecting that we don't get ClassFileLoadHook events in the Primordial phase
+        * when can_generate_early_class_hook_events capability is disabled.
+        */
+        if (cflh_events_primordial_count != 0) {
+            throw_exc(env, "Get ClassFileLoadHook events in primordial phase!\n");
+            return FAILED;
+        }
+    }
+
+
+    if (with_early_vm_start_capability == JNI_TRUE) {
+        /*
+         * Expecting that "java/util/Collections" class from java.base module is present in the
+         * ClassFileLoadHook events during VM Start phase when can_generate_early_vmstart
+         * capability is enabled.
+         */
+        printf("Expecting to find '%s' class in ClassFileLoadHook events during VM early start phase.\n", EXPECTED_NAME);
+        if (found_class_in_vm_start == JNI_FALSE) {
+            throw_exc(env, "Unable to find expected class in ClassLoad events during VM early start phase!\n");
+            return FAILED;
+        }
+    } else if (with_early_class_hook_capability == JNI_TRUE) {
+        /*
+         * Expecting that "java/util/Collections" class from java.base module is present in the
+         * ClassFileLoadHook events during Primordial phase when can_generate_all_class_hook_events
+         * and can_generate_early_class_hook_events capabilities are enabled and can_generate_early_vmstart
+         * capability is disabled.
+         */
+        printf("Expecting to find '%s' class in ClassFileLoadHook events during VM primordial phase.\n", EXPECTED_NAME);
+        if (found_class_in_primordial == JNI_FALSE) {
+            throw_exc(env, "Unable to find expected class in ClassFileLoadHook events during primordial phase!\n");
+            return FAILED;
+        }
+    } else {
+        /*
+         * Expecting that "java/util/Collections" class from java.base module is not present in the
+         * ClassFileLoadHook events when can_generate_all_class_hook_events, can_generate_early_class_hook_events
+         * and can_generate_early_vmstart capabilities are disabled.
+         */
+        printf("Expecting that '%s' class is absent in ClassLoadHook events.\n", EXPECTED_NAME);
+        if (found_class_in_cflh_events == JNI_TRUE) {
+            throw_exc(env, "Class is found in ClassFileLoadHook events!\n");
+            return FAILED;
+        }
+    }
+
+    return result;
+}
+
+#ifdef __cplusplus
+}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/serviceability/jvmti/ModuleAwareAgents/ClassLoadPrepare/MAAClassLoadPrepare.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 8165681
+ * @summary Verify ClassLoad and ClassPrepare JVMTI event with
+ * and without can_generate_early_vmstart capability
+ * @run main/othervm/native -agentlib:MAAClassLoadPrepare MAAClassLoadPrepare
+ * @run main/othervm/native -agentlib:MAAClassLoadPrepare=with_early_vmstart MAAClassLoadPrepare
+ */
+
+public class MAAClassLoadPrepare {
+
+    static {
+        try {
+            System.loadLibrary("MAAClassLoadPrepare");
+        } catch (UnsatisfiedLinkError ule) {
+            System.err.println("Could not load MAAClassLoadPrepare library");
+            System.err.println("java.library.path: "
+                + System.getProperty("java.library.path"));
+            throw ule;
+        }
+    }
+
+    native static int check();
+
+    public static void main(String args[]) {
+        int status = check();
+        if (status != 0) {
+            throw new RuntimeException("Non-zero status returned from the agent: " + status);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/serviceability/jvmti/ModuleAwareAgents/ClassLoadPrepare/libMAAClassLoadPrepare.c	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,319 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 <stdio.h>
+#include <string.h>
+#include "jvmti.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef JNI_ENV_ARG
+
+#ifdef __cplusplus
+#define JNI_ENV_ARG(x, y) y
+#define JNI_ENV_PTR(x) x
+#else
+#define JNI_ENV_ARG(x,y) x, y
+#define JNI_ENV_PTR(x) (*x)
+#endif
+
+#endif
+
+#define TranslateError(err) "JVMTI error"
+
+#define PASSED 0
+#define FAILED 2
+
+static const char *EXPECTED_SIGNATURE = "Ljava/util/Collections;";
+static const char *EXC_CNAME = "java/lang/Exception";
+
+static jvmtiEnv *jvmti = NULL;
+static jint result = PASSED;
+static jboolean printdump = JNI_FALSE;
+
+static jboolean with_early_vm_start_capability = JNI_FALSE;
+
+static jboolean class_in_class_load_events_vm_start = JNI_FALSE;
+static jboolean class_in_class_load_events_vm_live = JNI_FALSE;
+static jboolean class_in_class_prepare_events_vm_start = JNI_FALSE;
+static jboolean class_in_class_prepare_events_vm_live = JNI_FALSE;
+
+static int class_load_events_vm_start_count = 0;
+static int class_prepare_events_vm_start_count = 0;
+
+static jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved);
+
+JNIEXPORT
+jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
+    return Agent_Initialize(jvm, options, reserved);
+}
+
+JNIEXPORT
+jint JNICALL Agent_OnAttach(JavaVM *jvm, char *options, void *reserved) {
+    return Agent_Initialize(jvm, options, reserved);
+}
+
+JNIEXPORT
+jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) {
+    return JNI_VERSION_9;
+}
+
+static
+jint throw_exc(JNIEnv *env, char *msg) {
+    jclass exc_class = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, EXC_CNAME));
+
+    if (exc_class == NULL) {
+        printf("throw_exc: Error in FindClass(env, %s)\n", EXC_CNAME);
+        return -1;
+    }
+    return JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG(env, exc_class), msg);
+}
+
+static void JNICALL
+Callback_ClassFileLoad(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread, jclass klass) {
+    jvmtiPhase phase;
+    char *sig, *generic;
+    jvmtiError err;
+
+    err = (*jvmti)->GetPhase(jvmti_env,&phase);
+    if (err != JVMTI_ERROR_NONE) {
+        printf("ClassLoad event: GetPhase error: %s (%d)\n", TranslateError(err), err);
+        result = FAILED;
+        return;
+    }
+
+    if (phase == JVMTI_PHASE_START || phase == JVMTI_PHASE_LIVE) {
+
+        err = (*jvmti)->GetClassSignature(jvmti_env, klass, &sig, &generic);
+
+        if (err != JVMTI_ERROR_NONE) {
+            printf("ClassLoad event: GetClassSignature error: %s (%d)\n", TranslateError(err), err);
+            result = FAILED;
+            return;
+        }
+
+        if (phase == JVMTI_PHASE_START) {
+            class_load_events_vm_start_count++;
+            if(strcmp(sig, EXPECTED_SIGNATURE) == 0) {
+                class_in_class_load_events_vm_start = JNI_TRUE;
+            }
+        } else {
+            if(strcmp(sig, EXPECTED_SIGNATURE) == 0) {
+                class_in_class_load_events_vm_live = JNI_TRUE;
+            }
+        }
+
+        if (printdump == JNI_TRUE) {
+            printf(">>>    ClassLoad event: phase(%d), class signature %s\n", phase, sig == NULL ? "null": sig);
+        }
+    } else {
+        printf("ClassLoad event: get event in unexpected phase(%d)\n", phase);
+        result = FAILED;
+    }
+}
+
+static void JNICALL
+Callback_ClassFilePrepare(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread, jclass klass) {
+    jvmtiPhase phase;
+    char *sig, *generic;
+    jvmtiError err;
+
+    err = (*jvmti)->GetPhase(jvmti_env,&phase);
+    if (err != JVMTI_ERROR_NONE) {
+        printf("ClassPrepare event: GetPhase error: %s (%d)\n", TranslateError(err), err);
+        result = FAILED;
+        return;
+    }
+
+    if (phase == JVMTI_PHASE_START || phase == JVMTI_PHASE_LIVE) {
+
+        err = (*jvmti)->GetClassSignature(jvmti_env, klass, &sig, &generic);
+
+        if (err != JVMTI_ERROR_NONE) {
+            printf("ClassPrepare event: GetClassSignature error: %s (%d)\n", TranslateError(err), err);
+            result = FAILED;
+            return;
+        }
+
+        if (phase == JVMTI_PHASE_START) {
+            class_prepare_events_vm_start_count++;
+            if(strcmp(sig, EXPECTED_SIGNATURE) == 0) {
+                class_in_class_prepare_events_vm_start = JNI_TRUE;
+            }
+        } else {
+            if(strcmp(sig, EXPECTED_SIGNATURE) == 0) {
+                class_in_class_prepare_events_vm_live = JNI_TRUE;
+            }
+        }
+
+        if (printdump == JNI_TRUE) {
+            printf(">>>    ClassPrepare event: phase(%d), class signature %s\n", phase, sig == NULL ? "null": sig);
+        }
+    } else {
+        printf("ClassPrepare event: get event in unexpected phase(%d)\n", phase);
+        result = FAILED;
+    }
+}
+
+static
+jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
+    jint res, size;
+    jvmtiCapabilities caps;
+    jvmtiEventCallbacks callbacks;
+    jvmtiError err;
+
+    if (options != NULL) {
+        if (strstr(options, "with_early_vmstart") != NULL) {
+            with_early_vm_start_capability = JNI_TRUE;
+        }
+        if (strstr(options, "printdump") != NULL) {
+            printdump = JNI_TRUE;
+        }
+    }
+
+    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
+        JVMTI_VERSION_9);
+    if (res != JNI_OK || jvmti == NULL) {
+        printf("    Error: wrong result of a valid call to GetEnv!\n");
+        return JNI_ERR;
+    }
+
+    if (with_early_vm_start_capability == JNI_TRUE) {
+        printf("Enabling following capability: can_generate_early_vmstart\n");
+        memset(&caps, 0, sizeof(caps));
+        caps.can_generate_early_vmstart = 1;
+
+        err = (*jvmti)->AddCapabilities(jvmti, &caps);
+        if (err != JVMTI_ERROR_NONE) {
+            printf("    Error in AddCapabilites: %s (%d)\n", TranslateError(err), err);
+            return JNI_ERR;
+        }
+    }
+
+    size = (jint)sizeof(callbacks);
+
+    memset(&callbacks, 0, sizeof(callbacks));
+    callbacks.ClassLoad = Callback_ClassFileLoad;
+    callbacks.ClassPrepare = Callback_ClassFilePrepare;
+
+    err = (*jvmti)->SetEventCallbacks(jvmti, &callbacks, size);
+    if (err != JVMTI_ERROR_NONE) {
+        printf("    Error in SetEventCallbacks: %s (%d)\n", TranslateError(err), err);
+        return JNI_ERR;
+    }
+
+    err = (*jvmti)->SetEventNotificationMode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL);
+    if (err != JVMTI_ERROR_NONE) {
+        printf("    Error in SetEventNotificationMode: %s (%d)\n", TranslateError(err), err);
+        return JNI_ERR;
+    }
+
+    err = (*jvmti)->SetEventNotificationMode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, NULL);
+
+    if (err != JVMTI_ERROR_NONE) {
+        printf("    Error in SetEventNotificationMode: %s (%d)\n", TranslateError(err), err);
+        return JNI_ERR;
+    }
+
+    return JNI_OK;
+}
+
+JNIEXPORT jint JNICALL
+Java_MAAClassLoadPrepare_check(JNIEnv *env, jclass cls) {
+    jobject loader = NULL;
+
+    if (jvmti == NULL) {
+        throw_exc(env, "JVMTI client was not properly loaded!\n");
+        return FAILED;
+    }
+
+    if (with_early_vm_start_capability == JNI_TRUE) {
+        /*
+         * Expecting that "java/util/Collections" class from java.base module is present in the
+         * ClassLoad and ClassPrepare events during VM Start phase when can_generate_early_vmstart
+         * capability is enabled.
+         * Expecting that ClassLoad and ClassPrepare events are sent in the VM early start phase
+         * when can_generate_early_vmstart is enabled(JDK-8165681).
+         */
+        if (class_load_events_vm_start_count == 0) {
+            throw_exc(env, "Didn't get ClassLoad events in start phase!\n");
+            return FAILED;
+        }
+
+        printf("Expecting to find '%s' class in ClassLoad events during VM early start phase.\n", EXPECTED_SIGNATURE);
+        if (class_in_class_load_events_vm_start == JNI_FALSE) {
+            throw_exc(env, "Unable to find expected class in ClassLoad events during early start phase!\n");
+            return FAILED;
+        }
+
+        if (class_prepare_events_vm_start_count == 0) {
+            throw_exc(env, "Didn't get ClassPrepare events in start phase!\n");
+            return FAILED;
+        }
+
+        printf("Expecting to find '%s' class in ClassPrepare events during VM early start phase.\n", EXPECTED_SIGNATURE);
+        if (class_in_class_prepare_events_vm_start == JNI_FALSE) {
+            throw_exc(env, "Unable to find expected class in ClassPrepare events during early start phase!\n");
+            return FAILED;
+        }
+    } else {
+        /*
+         * Expecting that "java/util/Collections" class from java.base module is not present in the
+         * ClassLoad and ClassPrepare events during VM Start phase when can_generate_early_vmstart
+         * capability is disabled.
+         */
+        printf("Expecting that '%s' class is absent in ClassLoad events during normal VM start phase.\n", EXPECTED_SIGNATURE);
+        if (class_in_class_prepare_events_vm_start == JNI_TRUE) {
+            throw_exc(env, "Class is found in ClassLoad events during normal VM start phase!\n");
+            return FAILED;
+        }
+
+        printf("Expecting that '%s' class is absent in ClassPrepare events during normal VM start phase.\n", EXPECTED_SIGNATURE);
+        if (class_in_class_prepare_events_vm_start == JNI_TRUE) {
+            throw_exc(env, "Class is found in ClassPrepare events during normal VM start phase!\n");
+            return FAILED;
+        }
+    }
+
+    /*
+     * In any case, we not expect to see "java/util/Collections" class from java.base module
+     * in the ClassLoad and ClassPrepare events during VM Live phase.
+     */
+    if (class_in_class_prepare_events_vm_live == JNI_TRUE) {
+        throw_exc(env, "Class is found in ClassLoad events during VM Live phase!\n");
+        return FAILED;
+    }
+
+    if (class_in_class_prepare_events_vm_live == JNI_TRUE) {
+        throw_exc(env, "Class is found in ClassPrepare events during VM Live phase!\n");
+        return FAILED;
+    }
+
+    return result;
+}
+
+#ifdef __cplusplus
+}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/serviceability/jvmti/ModuleAwareAgents/ThreadStart/MAAThreadStart.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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
+ * @summary Verify ThreadStart JVMTI event with can_generate_early_vmstart capability
+ * @run main/othervm/native -agentlib:MAAThreadStart MAAThreadStart
+ */
+
+public class MAAThreadStart {
+
+    static {
+        try {
+            System.loadLibrary("MAAThreadStart");
+        } catch (UnsatisfiedLinkError ule) {
+            System.err.println("Could not load MAAThreadStart library");
+            System.err.println("java.library.path: "
+                + System.getProperty("java.library.path"));
+            throw ule;
+        }
+    }
+
+    native static int check();
+
+    public static void main(String args[]) {
+        int status = check();
+        if (status != 0) {
+            throw new RuntimeException("Non-zero status returned from the agent: " + status);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/serviceability/jvmti/ModuleAwareAgents/ThreadStart/libMAAThreadStart.c	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 <stdio.h>
+#include <string.h>
+#include "jvmti.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef JNI_ENV_ARG
+
+#ifdef __cplusplus
+#define JNI_ENV_ARG(x, y) y
+#define JNI_ENV_PTR(x) x
+#else
+#define JNI_ENV_ARG(x,y) x, y
+#define JNI_ENV_PTR(x) (*x)
+#endif
+
+#endif
+
+#define TranslateError(err) "JVMTI error"
+
+#define PASSED 0
+#define FAILED 2
+
+static const char *EXC_CNAME = "java/lang/Exception";
+
+static jvmtiEnv *jvmti = NULL;
+static jint result = PASSED;
+static jboolean printdump = JNI_FALSE;
+
+static int thread_start_events_vm_start = 0;
+
+static jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved);
+
+JNIEXPORT
+jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
+    return Agent_Initialize(jvm, options, reserved);
+}
+
+JNIEXPORT
+jint JNICALL Agent_OnAttach(JavaVM *jvm, char *options, void *reserved) {
+    return Agent_Initialize(jvm, options, reserved);
+}
+
+JNIEXPORT
+jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) {
+    return JNI_VERSION_9;
+}
+
+static
+jint throw_exc(JNIEnv *env, char *msg) {
+    jclass exc_class = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, EXC_CNAME));
+
+    if (exc_class == NULL) {
+        printf("throw_exc: Error in FindClass(env, %s)\n", EXC_CNAME);
+        return -1;
+    }
+    return JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG(env, exc_class), msg);
+}
+
+
+void JNICALL Callback_ThreadStart(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread) {
+    jvmtiError err;
+    jvmtiPhase phase;
+
+    err = (*jvmti)->GetPhase(jvmti_env,&phase);
+    if (err != JVMTI_ERROR_NONE) {
+        printf("ThreadStart event: GetPhase error: %s (%d)\n", TranslateError(err), err);
+        result = FAILED;
+        return;
+    }
+
+    if (phase == JVMTI_PHASE_START) {
+        thread_start_events_vm_start++;
+    }
+
+    if (printdump == JNI_TRUE) {
+        printf(">>>    ThreadStart event: phase(%d)\n", phase);
+    }
+}
+
+static
+jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
+    jint res, size;
+    jvmtiCapabilities caps;
+    jvmtiEventCallbacks callbacks;
+    jvmtiError err;
+
+    if (options != NULL && strcmp(options, "printdump") == 0) {
+        printdump = JNI_TRUE;
+    }
+
+    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
+        JVMTI_VERSION_9);
+    if (res != JNI_OK || jvmti == NULL) {
+        printf("    Error: wrong result of a valid call to GetEnv!\n");
+        return JNI_ERR;
+    }
+
+    printf("Enabling following capability: can_generate_early_vmstart\n");
+    memset(&caps, 0, sizeof(caps));
+    caps.can_generate_early_vmstart = 1;
+
+    err = (*jvmti)->AddCapabilities(jvmti, &caps);
+    if (err != JVMTI_ERROR_NONE) {
+        printf("    Error in AddCapabilites: %s (%d)\n", TranslateError(err), err);
+        return JNI_ERR;
+    }
+
+    size = (jint)sizeof(callbacks);
+
+    memset(&callbacks, 0, sizeof(callbacks));
+    callbacks.ThreadStart = Callback_ThreadStart;
+
+    err = (*jvmti)->SetEventCallbacks(jvmti, &callbacks, size);
+    if (err != JVMTI_ERROR_NONE) {
+        printf("    Error in SetEventCallbacks: %s (%d)\n", TranslateError(err), err);
+        return JNI_ERR;
+    }
+
+    err = (*jvmti)->SetEventNotificationMode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL);
+    if (err != JVMTI_ERROR_NONE) {
+        printf("    Error in SetEventNotificationMode: %s (%d)\n", TranslateError(err), err);
+        return JNI_ERR;
+    }
+
+    return JNI_OK;
+}
+
+JNIEXPORT jint JNICALL
+Java_MAAThreadStart_check(JNIEnv *env, jclass cls) {
+    jobject loader = NULL;
+
+    if (jvmti == NULL) {
+        throw_exc(env, "JVMTI client was not properly loaded!\n");
+        return FAILED;
+    }
+
+    /*
+     * Expecting that ThreadStart events are sent during VM Start phase when
+     * can_generate_early_vmstart capability is enabled.
+     */
+    if (thread_start_events_vm_start == 0) {
+        throw_exc(env, "Didn't get ThreadStart events in VM early start phase!\n");
+        return FAILED;
+    }
+
+    return result;
+}
+
+#ifdef __cplusplus
+}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/serviceability/sa/LingeredAppWithDefaultMethods.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.test.lib.apps.LingeredApp;
+
+interface Language {
+    static final long nbrOfWords = 99999;
+    public abstract long getNbrOfWords();
+    default boolean hasScript() {
+        return true;
+    }
+}
+
+class ParselTongue implements Language {
+    public long getNbrOfWords() {
+        return nbrOfWords * 4;
+    }
+}
+
+class SlytherinSpeak extends ParselTongue {
+    public boolean hasScript() {
+        return false;
+    }
+}
+
+public class LingeredAppWithDefaultMethods extends LingeredApp {
+
+    public static void main(String args[]) {
+        ParselTongue lang = new ParselTongue();
+        SlytherinSpeak slang = new SlytherinSpeak();
+        System.out.println(lang.hasScript() || slang.hasScript());
+
+        LingeredApp.main(args);
+    }
+ }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/serviceability/sa/TestDefaultMethods.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import sun.jvm.hotspot.HotSpotAgent;
+import sun.jvm.hotspot.utilities.SystemDictionaryHelper;
+import sun.jvm.hotspot.oops.InstanceKlass;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.oops.Method;
+import sun.jvm.hotspot.utilities.MethodArray;
+
+import jdk.test.lib.apps.LingeredApp;
+import jdk.test.lib.JDKToolLauncher;
+import jdk.test.lib.JDKToolFinder;
+import jdk.test.lib.Platform;
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.Utils;
+import jdk.test.lib.Asserts;
+
+/*
+ * @test
+ * @library /test/lib
+ * @requires os.family != "mac"
+ * @modules java.base/jdk.internal.misc
+ *          jdk.hotspot.agent/sun.jvm.hotspot
+ *          jdk.hotspot.agent/sun.jvm.hotspot.utilities
+ *          jdk.hotspot.agent/sun.jvm.hotspot.oops
+ *          jdk.hotspot.agent/sun.jvm.hotspot.debugger
+ * @run main/othervm TestDefaultMethods
+ */
+
+public class TestDefaultMethods {
+
+    private static LingeredAppWithDefaultMethods theApp = null;
+
+    private static void printDefaultMethods(String pid,
+                                            String[] instanceKlassNames) {
+        HotSpotAgent agent = new HotSpotAgent();
+        try {
+            agent.attach(Integer.parseInt(pid));
+        }
+        catch (DebuggerException e) {
+            System.out.println(e.getMessage());
+            System.err.println("Unable to connect to process ID: " + pid);
+
+            agent.detach();
+            e.printStackTrace();
+        }
+
+        for (String instanceKlassName : instanceKlassNames) {
+            InstanceKlass iKlass = SystemDictionaryHelper.findInstanceKlass(instanceKlassName);
+            MethodArray methods = iKlass.getMethods();
+            MethodArray defaultMethods = iKlass.getDefaultMethods();
+            for (int i = 0; i < methods.length(); i++) {
+                Method m = methods.at(i);
+                System.out.println("Method: " + m.getName().asString() +
+                                   " in instance klass: " + instanceKlassName);
+            }
+            if (defaultMethods != null) {
+                for (int j = 0; j < defaultMethods.length(); j++) {
+                    Method dm = defaultMethods.at(j);
+                    System.out.println("Default method: " + dm.getName().asString() +
+                                       " in instance klass: " + instanceKlassName);
+                }
+            } else {
+                System.out.println("No default methods in " + instanceKlassName);
+            }
+
+        }
+        agent.detach();
+    }
+
+    private static void createAnotherToAttach(
+                            String[] instanceKlassNames,
+                            long lingeredAppPid) throws Exception {
+
+        String[] toolArgs = {
+            "--add-modules=jdk.hotspot.agent",
+            "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED",
+            "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED",
+            "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED",
+            "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.debugger=ALL-UNNAMED",
+            "TestDefaultMethods",
+            Long.toString(lingeredAppPid)
+        };
+
+        // Start a new process to attach to the lingered app
+        ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(toolArgs);
+        OutputAnalyzer SAOutput = ProcessTools.executeProcess(processBuilder);
+        SAOutput.shouldHaveExitValue(0);
+        System.out.println(SAOutput.getOutput());
+
+        SAOutput.shouldContain(
+            "Default method: hasScript in instance klass: " + instanceKlassNames[1]);
+        SAOutput.shouldContain(
+            "No default methods in " + instanceKlassNames[0]);
+        SAOutput.shouldContain(
+            "Method: hasScript in instance klass: " + instanceKlassNames[0]);
+        SAOutput.shouldContain(
+            "No default methods in " + instanceKlassNames[2]);
+    }
+
+    public static void main (String... args) throws Exception {
+
+        String[] instanceKlassNames = new String[] {
+                                          "Language",
+                                          "ParselTongue",
+                                          "SlytherinSpeak"
+                                      };
+
+        if (!Platform.shouldSAAttach()) {
+            System.out.println(
+               "SA attach not expected to work - test skipped.");
+            return;
+        }
+
+        if (args == null || args.length == 0) {
+            try {
+                List<String> vmArgs = new ArrayList<String>();
+                vmArgs.add("-XX:+UsePerfData");
+                vmArgs.addAll(Utils.getVmOptions());
+
+                theApp = new LingeredAppWithDefaultMethods();
+                LingeredApp.startApp(vmArgs, theApp);
+                createAnotherToAttach(instanceKlassNames,
+                                      theApp.getPid());
+            } finally {
+                LingeredApp.stopApp(theApp);
+            }
+        } else {
+            printDefaultMethods(args[0], instanceKlassNames);
+        }
+    }
+}
--- a/jdk/.hgtags	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/.hgtags	Wed Jul 05 22:19:13 2017 +0200
@@ -381,3 +381,4 @@
 54c5931849a33a363e03fdffa141503f5cc4779d jdk-9+136
 e72df94364e3686e7d62059ce0d6b187b82da713 jdk-9+137
 665096863382bf23ce891307cf2a7511e77c1c88 jdk-9+138
+5518ac2f2ead5e594bd983f2047178136aafdfd0 jdk-9+139
--- a/jdk/ASSEMBLY_EXCEPTION	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/ASSEMBLY_EXCEPTION	Wed Jul 05 22:19:13 2017 +0200
@@ -1,27 +1,27 @@
 
 OPENJDK ASSEMBLY EXCEPTION
 
-The OpenJDK source code made available by Sun at openjdk.java.net and
-openjdk.dev.java.net ("OpenJDK Code") is distributed under the terms of the
-GNU General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
+The OpenJDK source code made available by Oracle America, Inc. (Oracle) at
+openjdk.java.net ("OpenJDK Code") is distributed under the terms of the GNU
+General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
 only ("GPL2"), with the following clarification and special exception.
 
     Linking this OpenJDK Code statically or dynamically with other code
     is making a combined work based on this library.  Thus, the terms
     and conditions of GPL2 cover the whole combination.
 
-    As a special exception, Sun gives you permission to link this
-    OpenJDK Code with certain code licensed by Sun as indicated at
+    As a special exception, Oracle gives you permission to link this
+    OpenJDK Code with certain code licensed by Oracle as indicated at
     http://openjdk.java.net/legal/exception-modules-2007-05-08.html
     ("Designated Exception Modules") to produce an executable,
     regardless of the license terms of the Designated Exception Modules,
     and to copy and distribute the resulting executable under GPL2,
     provided that the Designated Exception Modules continue to be
-    governed by the licenses under which they were offered by Sun.
+    governed by the licenses under which they were offered by Oracle.
 
-As such, it allows licensees and sublicensees of Sun's GPL2 OpenJDK Code to
-build an executable that includes those portions of necessary code that Sun
-could not provide under GPL2 (or that Sun has provided under GPL2 with the
-Classpath exception).  If you modify or add to the OpenJDK code, that new
-GPL2 code may still be combined with Designated Exception Modules if the
-new code is made subject to this exception by its copyright holder.
+As such, it allows licensees and sublicensees of Oracle's GPL2 OpenJDK Code
+to build an executable that includes those portions of necessary code that
+Oracle could not provide under GPL2 (or that Oracle has provided under GPL2
+with the Classpath exception).  If you modify or add to the OpenJDK code,
+that new GPL2 code may still be combined with Designated Exception Modules
+if the new code is made subject to this exception by its copyright holder.
--- a/jdk/make/CompileDemos.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/make/CompileDemos.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -338,6 +338,7 @@
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/demos/native/jvmti/$1, \
       OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/demos/image/jvmti/$1/lib, \
       LIBRARY := $1, \
+      STRIP_SYMBOLS := false, \
   ))
 
   $1 += $$(BUILD_DEMO_JVMTI_NATIVE_$1)
@@ -453,6 +454,7 @@
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/demos/native/jni/Poller, \
       OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/demos/native, \
       LIBRARY := Poller, \
+      STRIP_SYMBOLS := false, \
   ))
 
   TARGETS += $(BUILD_DEMO_NATIVE_Poller)
--- a/jdk/make/Import.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,225 +0,0 @@
-#
-# Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-
-################################################################################
-
-# Put the libraries here. Different locations for different target OS types.
-ifneq ($(OPENJDK_TARGET_OS), windows)
-  HOTSPOT_LIB_DIR := $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
-  BASE_INSTALL_LIBRARIES_HERE := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)
-else
-  HOTSPOT_LIB_DIR := $(HOTSPOT_DIST)/bin
-  BASE_INSTALL_LIBRARIES_HERE := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base
-endif
-
-################################################################################
-#
-# Import hotspot
-#
-
-# Don't import jsig library for static builds
-ifneq ($(STATIC_BUILD), true)
-  JSIG_IMPORT = jsig.*
-else
-  JSIG_IMPORT =
-endif
-
-HOTSPOT_BASE_IMPORT_FILES := \
-    $(addprefix $(LIBRARY_PREFIX), jvm.* $(JSIG_IMPORT) jvm_db.* jvm_dtrace.*) \
-    Xusage.txt \
-    #
-
-$(eval $(call SetupCopyFiles,COPY_HOTSPOT_BASE, \
-    SRC := $(HOTSPOT_LIB_DIR), \
-    DEST := $(BASE_INSTALL_LIBRARIES_HERE), \
-    FILES := $(shell $(FIND) $(HOTSPOT_LIB_DIR) -type f  \
-        -a \( -name DUMMY $(addprefix -o$(SPACE)-name$(SPACE), $(HOTSPOT_BASE_IMPORT_FILES)) \) )))
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
-  $(eval $(call SetupCopyFiles,COPY_HOTSPOT_BASE_JVMLIB, \
-      SRC := $(HOTSPOT_DIST)/lib, \
-      DEST := $(BASE_INSTALL_LIBRARIES_HERE), \
-      FILES := $(wildcard $(HOTSPOT_DIST)/lib/*.lib)))
-endif
-
-BASE_TARGETS := $(COPY_HOTSPOT_BASE) $(COPY_HOTSPOT_BASE_JVMLIB)
-
-################################################################################
-
-ifneq ($(STATIC_BUILD), true)
-  ifeq ($(OPENJDK_TARGET_OS), macosx)
-    JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig$(SHARED_LIBRARY_SUFFIX).dSYM) \
-        $(wildcard $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
-  else
-    JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.debuginfo) \
-        $(wildcard $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
-  endif
-
-  ifneq ($(OPENJDK_TARGET_OS), windows)
-    ifeq ($(call check-jvm-variant, server), true)
-      BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/server/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
-      ifneq (, $(JSIG_DEBUGINFO))
-        BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/server/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
-      endif
-    endif
-    ifeq ($(call check-jvm-variant, client), true)
-      BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/client/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
-      ifneq (, $(JSIG_DEBUGINFO))
-        BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/client/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
-      endif
-    endif
-    ifneq ($(OPENJDK_TARGET_OS), macosx)
-      ifeq ($(call check-jvm-variant, minimal), true)
-        BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/minimal/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
-        ifneq (,$(JSIG_DEBUGINFO))
-          BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/minimal/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
-        endif
-      endif
-    endif
-  endif
-endif
-
-$(BASE_INSTALL_LIBRARIES_HERE)/server/%$(SHARED_LIBRARY_SUFFIX): $(BASE_INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(LN) -s ../$(@F) $@
-
-ifeq ($(OPENJDK_TARGET_OS), macosx)
-  $(BASE_INSTALL_LIBRARIES_HERE)/server/%.dSYM:
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(LN) -s ../$(@F) $@
-
-  $(BASE_INSTALL_LIBRARIES_HERE)/server/%.diz : $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(RM) $@.tmp $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
-	$(LN) -s ../$(basename $(@F))$(SHARED_LIBRARY_SUFFIX).dSYM $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
-	$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F))$(SHARED_LIBRARY_SUFFIX).dSYM
-	$(RM) $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
-	$(MV) $@.tmp $@
-else
-  $(BASE_INSTALL_LIBRARIES_HERE)/server/%.debuginfo: $(BASE_INSTALL_LIBRARIES_HERE)/%.debuginfo
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(LN) -s ../$(@F) $@
-
-  $(BASE_INSTALL_LIBRARIES_HERE)/server/%.diz: $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(RM) $@.tmp $(basename $@).debuginfo
-	$(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
-	$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
-	$(RM) $(basename $@).debuginfo
-	$(MV) $@.tmp $@
-endif
-
-$(BASE_INSTALL_LIBRARIES_HERE)/client/%$(SHARED_LIBRARY_SUFFIX): $(BASE_INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(LN) -s ../$(@F) $@
-
-ifeq ($(OPENJDK_TARGET_OS), macosx)
-  $(BASE_INSTALL_LIBRARIES_HERE)/client/%.dSYM : $(BASE_INSTALL_LIBRARIES_HERE)/%.dSYM
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(LN) -s ../$(@F) $@
-
-  $(BASE_INSTALL_LIBRARIES_HERE)/client/%.diz : $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(RM) $@.tmp $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
-	$(LN) -s ../$(basename $(@F))$(SHARED_LIBRARY_SUFFIX).dSYM $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
-	$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F))$(SHARED_LIBRARY_SUFFIX).dSYM
-	$(RM) $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
-	$(MV) $@.tmp $@
-else
-  $(BASE_INSTALL_LIBRARIES_HERE)/client/%.debuginfo: $(BASE_INSTALL_LIBRARIES_HERE)/%.debuginfo
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(LN) -s ../$(@F) $@
-
-  $(BASE_INSTALL_LIBRARIES_HERE)/client/%.diz: $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(RM) $@.tmp $(basename $@).debuginfo
-	$(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
-	$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
-	$(RM) $(basename $@).debuginfo
-	$(MV) $@.tmp $@
-endif
-
-$(BASE_INSTALL_LIBRARIES_HERE)/minimal/%$(SHARED_LIBRARY_SUFFIX): $(BASE_INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(LN) -s ../$(@F) $@
-
-ifneq ($(OPENJDK_TARGET_OS), macosx)
-  $(BASE_INSTALL_LIBRARIES_HERE)/minimal/%.debuginfo: $(BASE_INSTALL_LIBRARIES_HERE)/%.debuginfo
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(LN) -s ../$(@F) $@
-
-  $(BASE_INSTALL_LIBRARIES_HERE)/minimal/%.diz: $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(RM) $@.tmp $(basename $@).debuginfo
-	$(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
-	$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
-	$(RM) $(basename $@).debuginfo
-	$(MV) $@.tmp $@
-endif
-
-################################################################################
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
-  $(eval $(call SetupCopyFiles,BASE_COPY_LIBS_BIN, \
-      SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base, \
-      DEST := $(JDK_OUTPUTDIR)/bin, \
-      FILES := $(filter-out %.lib, $(BASE_TARGETS))))
-
-  $(eval $(call SetupCopyFiles,BASE_COPY_LIBS_LIB, \
-      SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base, \
-      DEST := $(JDK_OUTPUTDIR)/lib, \
-      FILES := $(filter %.lib, $(BASE_TARGETS))))
-
-else
-  $(eval $(call SetupCopyFiles,BASE_COPY_LIBS, \
-      SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base, \
-      DEST := $(JDK_OUTPUTDIR)/lib, \
-      FILES := $(BASE_TARGETS)))
-endif
-
-################################################################################
-
-all: $(BASE_TARGETS) $(BASE_COPY_LIBS_BIN) $(BASE_COPY_LIBS_LIB) \
-    $(BASE_COPY_LIBS)
-
-.PHONY: default all
--- a/jdk/make/data/fontconfig/solaris.fontconfig.properties	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/make/data/fontconfig/solaris.fontconfig.properties	Wed Jul 05 22:19:13 2017 +0200
@@ -1,6 +1,6 @@
 #
-# 
-# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
 # 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,602 +30,489 @@
 
 # Component Font Mappings
 
-allfonts.chinese-gb2312=-monotype-song-medium-r-normal--*-%d-*-*-m-*-gb2312.1980-0
-allfonts.chinese-gbk=-sun-song-medium-r-normal--*-%d-*-*-c-*-gbk-0
-allfonts.chinese-gb18030-0=-fangzheng-song-medium-r-normal--*-%d-*-*-m-*-gb18030.2000-0
-allfonts.chinese-gb18030-1=-fangzheng-song-medium-r-normal--*-%d-*-*-m-*-gb18030.2000-1
-allfonts.chinese-cns11643-1=-Hanyi-Ming-Medium-r-normal--*-%d-*-*-m-*-cns11643-1
-allfonts.chinese-cns11643-2=-Hanyi-Ming-Medium-r-normal--*-%d-*-*-m-*-cns11643-2
-allfonts.chinese-cns11643-3=-Hanyi-Ming-Medium-r-normal--*-%d-*-*-m-*-cns11643-3
-allfonts.chinese-big5=-hanyi-ming-medium-r-normal--*-%d-*-*-m-*-big5-1
-allfonts.chinese-hkscs=-hanyi-ming-medium-r-normal--*-%d-*-*-m-*-hkscs-1
-allfonts.dingbats=-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific
-allfonts.japanese-x0212=-ricoh-heiseimin-w3-r-normal--*-%d-*-*-m-*-jisx0212.1990-0
-allfonts.korean=-hanyang-kodig-medium-r-normal--*-%d-*-*-m-*-ksc5601.1987-0
-allfonts.korean-johab=-hanyang-kodig-medium-r-normal--*-%d-*-*-m-*-ksc5601.1992-3
+allfonts.chinese-gb2312=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+allfonts.chinese-gbk=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+allfonts.chinese-gb18030-0=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+allfonts.chinese-gb18030-1=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+allfonts.chinese-cns11643-1=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+allfonts.chinese-cns11643-2=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+allfonts.chinese-cns11643-3=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+allfonts.chinese-big5=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+allfonts.chinese-hkscs=-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+allfonts.dingbats=-microsoft-wingdings-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific
+allfonts.japanese-x0212=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+allfonts.korean=-hanyang-gothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+allfonts.korean-johab=-hanyang-gothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
 allfonts.lucida=-b&h-lucidasans-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1
-allfonts.symbol=-*-symbol-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific
+allfonts.symbol=-monotype-symbol-medium-r-normal--*-%d-*-*-p-*-adobe-symbol
+allfonts.bengali=-misc-lohit bengali-medium-r-normal--0-0-0-0-p-0-iso10646-1
+allfonts.gujarati=-misc-lohit gujarati-medium-r-normal--0-0-0-0-p-0-iso10646-1
+allfonts.hindi=-misc-lohit hindi-medium-r-normal--0-0-0-0-p-0-iso10646-1
+allfonts.kannada=-misc-lohit kannada-medium-r-normal--0-0-0-0-p-0-iso10646-1
+allfonts.malayalam=-misc-lohit malayalam-medium-r-normal--0-0-0-0-p-0-iso10646-1
+allfonts.marathi=-misc-lohit marathi-medium-r-normal--0-0-0-0-p-0-iso10646-1
+allfonts.tamil=-misc-lohit tamil-medium-r-normal--0-0-0-0-p-0-iso10646-1
+allfonts.telugu=-misc-lohit telugu-medium-r-normal--0-0-0-0-p-0-iso10646-1
+allfonts.dejavusans=-misc-dejavu sans-medium-r-normal--0-0-0-0-p-0-iso10646-1
 
-serif.plain.arabic=-monotype-naskh-medium-r-normal--*-%d-*-*-p-*-iso8859-6
-serif.plain.cyrillic-iso8859-5=-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-5
-serif.plain.cyrillic-cp1251=-monotype-times-regular-r-normal--*-%d-*-*-p-*-ansi-1251
-serif.plain.cyrillic-koi8-r=-monotype-times-regular-r-normal--*-%d-*-*-p-*-koi8-r
-serif.plain.greek=-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-7
-serif.plain.hebrew=-monotype-timesnewroman-medium-r-normal--*-%d-*-*-p-*-iso8859-8
-serif.plain.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-serif.plain.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-serif.plain.latin-1=-monotype-times new roman-regular-r---*-%d-*-*-p-*-iso8859-1
-serif.plain.latin-2=-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-2
-serif.plain.latin-5=-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-9
-serif.plain.latin-7=-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-13
-serif.plain.latin-9=-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-15
-serif.plain.thai=-monotype-angsa-medium-r-normal--*-%d-*-*-m-*-tis620.2533-0
+serif.plain.arabic=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+serif.plain.cyrillic-iso8859-5=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+serif.plain.cyrillic-cp1251=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+serif.plain.cyrillic-koi8-r=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+serif.plain.greek=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+serif.plain.hebrew=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+serif.plain.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+serif.plain.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+serif.plain.latin-1=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+serif.plain.latin-2=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+serif.plain.latin-5=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+serif.plain.latin-7=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+serif.plain.latin-9=-monotype-times new roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+serif.plain.thai=-monotype-angsana new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
 
-serif.bold.arabic=-monotype-naskh-bold-r-normal--*-%d-*-*-p-*-iso8859-6
-serif.bold.cyrillic-iso8859-5=-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-5
-serif.bold.cyrillic-cp1251=-monotype-times-bold-r-normal--*-%d-*-*-p-*-ansi-1251
-serif.bold.cyrillic-koi8-r=-monotype-times-bold-r-normal--*-%d-*-*-p-*-koi8-r
-serif.bold.greek=-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-7
-serif.bold.hebrew=-monotype-timesnewroman-bold-r-normal-bold-*-%d-*-*-p-*-iso8859-8
-serif.bold.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-serif.bold.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-serif.bold.latin-1=-monotype-times new roman-bold-r---*-%d-*-*-p-*-iso8859-1
-serif.bold.latin-2=-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-2
-serif.bold.latin-5=-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-9
-serif.bold.latin-7=-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-13
-serif.bold.latin-9=-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-15
-serif.bold.thai=-monotype-angsab-bold-r-normal--*-%d-*-*-m-*-tis620.2533-0
+serif.bold.arabic=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+serif.bold.cyrillic-iso8859-5=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+serif.bold.cyrillic-cp1251=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+serif.bold.cyrillic-koi8-r=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+serif.bold.greek=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+serif.bold.hebrew=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+serif.bold.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+serif.bold.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+serif.bold.latin-1=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+serif.bold.latin-2=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+serif.bold.latin-5=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+serif.bold.latin-7=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+serif.bold.latin-9=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+serif.bold.thai=-monotype-angsana new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
 
-serif.italic.arabic=-monotype-naskh-medium-r-normal--*-%d-*-*-p-*-iso8859-6
-serif.italic.cyrillic-iso8859-5=-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-5
-serif.italic.cyrillic-cp1251=-monotype-times-regular-i-normal--*-%d-*-*-p-*-ansi-1251
-serif.italic.cyrillic-koi8-r=-monotype-times-regular-i-normal--*-%d-*-*-p-*-koi8-r
-serif.italic.greek=-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-7
-serif.italic.hebrew=-monotype-timesnewroman-medium-i-normal-italic-*-%d-*-*-p-*-iso8859-8
-serif.italic.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-serif.italic.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-serif.italic.latin-1=-monotype-times new roman-regular-i---*-%d-*-*-p-*-iso8859-1
-serif.italic.latin-2=-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-2
-serif.italic.latin-5=-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-9
-serif.italic.latin-7=-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-13
-serif.italic.latin-9=-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-15
-serif.italic.thai=-monotype-angsai-medium-i-normal--*-%d-*-*-m-*-tis620.2533-0
+serif.italic.arabic=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+serif.italic.cyrillic-iso8859-5=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+serif.italic.cyrillic-cp1251=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+serif.italic.cyrillic-koi8-r=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+serif.italic.greek=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+serif.italic.hebrew=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+serif.italic.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+serif.italic.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+serif.italic.latin-1=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+serif.italic.latin-2=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+serif.italic.latin-5=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+serif.italic.latin-7=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+serif.italic.latin-9=-monotype-times new roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+serif.italic.thai=-monotype-angsana new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
 
-serif.bolditalic.arabic=-monotype-naskh-bold-r-normal--*-%d-*-*-p-*-iso8859-6
-serif.bolditalic.cyrillic-iso8859-5=-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-5
-serif.bolditalic.cyrillic-cp1251=-monotype-times-bold-i-normal--*-%d-*-*-p-*-ansi-1251
-serif.bolditalic.cyrillic-koi8-r=-monotype-times-bold-i-normal--*-%d-*-*-p-*-koi8-r
-serif.bolditalic.greek=-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-7
-serif.bolditalic.hebrew=-monotype-timesnewroman-bold-i-normal-bolditalic-*-%d-*-*-p-*-iso8859-8
-serif.bolditalic.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-serif.bolditalic.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-serif.bolditalic.latin-1=-monotype-times new roman-bold-i---*-%d-*-*-p-*-iso8859-1
-serif.bolditalic.latin-2=-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-2
-serif.bolditalic.latin-5=-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-9
-serif.bolditalic.latin-7=-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-13
-serif.bolditalic.latin-9=-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-15
-serif.bolditalic.thai=-monotype-angsaz-bold-i-normal--*-%d-*-*-m-*-tis620.2533-0
+serif.bolditalic.arabic=-monotype-times new roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+serif.bolditalic.cyrillic-iso8859-5=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+serif.bolditalic.cyrillic-cp1251=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+serif.bolditalic.cyrillic-koi8-r=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+serif.bolditalic.greek=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+serif.bolditalic.hebrew=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+serif.bolditalic.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+serif.bolditalic.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+serif.bolditalic.latin-1=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+serif.bolditalic.latin-2=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+serif.bolditalic.latin-5=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+serif.bolditalic.latin-7=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+serif.bolditalic.latin-9=-monotype-times new roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+serif.bolditalic.thai=-monotype-angsana new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
 
-sansserif.plain.arabic=-monotype-naskh-medium-r-normal--*-%d-*-*-p-*-iso8859-6
-sansserif.plain.cyrillic-iso8859-5=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-5
-sansserif.plain.cyrillic-cp1251=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-ansi-1251
-sansserif.plain.cyrillic-koi8-r=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-koi8-r
-sansserif.plain.greek=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-7
-sansserif.plain.hebrew=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso8859-8
-sansserif.plain.japanese-x0201=-ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-sansserif.plain.japanese-x0208=-ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0
-sansserif.plain.latin-1=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-1
-sansserif.plain.latin-2=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-2
-sansserif.plain.latin-5=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-9
-sansserif.plain.latin-7=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-13
-sansserif.plain.latin-9=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-15
-sansserif.plain.thai=-monotype-browa-medium-r-normal--*-%d-*-*-m-*-tis620.2533-0
+sansserif.plain.arabic=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.plain.cyrillic-iso8859-5=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.plain.cyrillic-cp1251=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.plain.cyrillic-koi8-r=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.plain.greek=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.plain.hebrew=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.plain.japanese-x0201=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+sansserif.plain.japanese-x0208=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+sansserif.plain.latin-1=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.plain.latin-2=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.plain.latin-5=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.plain.latin-7=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.plain.latin-9=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.plain.thai=-monotype-browallia new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
 
-sansserif.bold.arabic=-monotype-naskh-bold-r-normal--*-%d-*-*-p-*-iso8859-6
-sansserif.bold.cyrillic-iso8859-5=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-5
-sansserif.bold.cyrillic-cp1251=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-ansi-1251
-sansserif.bold.cyrillic-koi8-r=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-koi8-r
-sansserif.bold.greek=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-7
-sansserif.bold.hebrew=-monotype-arial-bold-r-normal-Bold-*-%d-*-*-p-*-iso8859-8
-sansserif.bold.japanese-x0201=-ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-sansserif.bold.japanese-x0208=-ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0
-sansserif.bold.latin-1=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-1
-sansserif.bold.latin-2=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-2
-sansserif.bold.latin-5=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-9
-sansserif.bold.latin-7=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-13
-sansserif.bold.latin-9=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-15
-sansserif.bold.thai=-monotype-browab-bold-r-normal--*-%d-*-*-m-*-tis620.2533-0
+sansserif.bold.arabic=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.bold.cyrillic-iso8859-5=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.bold.cyrillic-cp1251=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.bold.cyrillic-koi8-r=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.bold.greek=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.bold.hebrew=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.bold.japanese-x0201=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+sansserif.bold.japanese-x0208=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+sansserif.bold.latin-1=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.bold.latin-2=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.bold.latin-5=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.bold.latin-7=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.bold.latin-9=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.bold.thai=-monotype-browallia new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
 
-sansserif.italic.arabic=-monotype-naskh-medium-r-normal--*-%d-*-*-p-*-iso8859-6
-sansserif.italic.cyrillic-iso8859-5=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-5
-sansserif.italic.cyrillic-cp1251=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-ansi-1251
-sansserif.italic.cyrillic-koi8-r=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-koi8-r
-sansserif.italic.greek=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-7
-sansserif.italic.hebrew=-monotype-arial-medium-i-normal-Italic-*-%d-*-*-p-*-iso8859-8
-sansserif.italic.japanese-x0201=-ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-sansserif.italic.japanese-x0208=-ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0
-sansserif.italic.latin-1=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-1
-sansserif.italic.latin-2=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-2
-sansserif.italic.latin-5=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-9
-sansserif.italic.latin-7=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-13
-sansserif.italic.latin-9=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-15
-sansserif.italic.thai=-monotype-browai-medium-i-normal--*-%d-*-*-m-*-tis620.2533-0
+sansserif.italic.arabic=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.italic.cyrillic-iso8859-5=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.italic.cyrillic-cp1251=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.italic.cyrillic-koi8-r=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.italic.greek=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.italic.hebrew=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.italic.japanese-x0201=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+sansserif.italic.japanese-x0208=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+sansserif.italic.latin-1=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.italic.latin-2=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.italic.latin-5=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.italic.latin-7=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.italic.latin-9=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.italic.thai=-monotype-browallia new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
 
-sansserif.bolditalic.arabic=-monotype-naskh-bold-r-normal--*-%d-*-*-p-*-iso8859-6
-sansserif.bolditalic.cyrillic-iso8859-5=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-5
-sansserif.bolditalic.cyrillic-cp1251=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-ansi-1251
-sansserif.bolditalic.cyrillic-koi8-r=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-koi8-r
-sansserif.bolditalic.greek=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-7
-sansserif.bolditalic.hebrew=-monotype-arial-bold-i-normal-BoldItalic-*-%d-*-*-p-*-iso8859-8
-sansserif.bolditalic.japanese-x0201=-ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-sansserif.bolditalic.japanese-x0208=-ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0
-sansserif.bolditalic.latin-1=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-1
-sansserif.bolditalic.latin-2=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-2
-sansserif.bolditalic.latin-5=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-9
-sansserif.bolditalic.latin-7=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-13
-sansserif.bolditalic.latin-9=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-15
-sansserif.bolditalic.thai=-monotype-browaz-bold-i-normal--*-%d-*-*-m-*-tis620.2533-0
+sansserif.bolditalic.arabic=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.bolditalic.cyrillic-iso8859-5=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.bolditalic.cyrillic-cp1251=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.bolditalic.cyrillic-koi8-r=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.bolditalic.greek=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.bolditalic.hebrew=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.bolditalic.japanese-x0201=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+sansserif.bolditalic.japanese-x0208=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+sansserif.bolditalic.latin-1=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.bolditalic.latin-2=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.bolditalic.latin-5=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.bolditalic.latin-7=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.bolditalic.latin-9=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+sansserif.bolditalic.thai=-monotype-browallia new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
 
-monospaced.plain.arabic=-monotype-akhbar-medium-r-normal--*-%d-*-*-p-*-iso8859-6
-monospaced.plain.cyrillic-iso8859-5=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-5
-monospaced.plain.cyrillic-cp1251=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-ansi-1251
-monospaced.plain.cyrillic-koi8-r=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-koi8-r
-monospaced.plain.greek=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-7
-monospaced.plain.hebrew=-monotype-couriernew-medium-r-normal--*-%d-*-*-m-*-iso8859-8
-monospaced.plain.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-monospaced.plain.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-monospaced.plain.latin-1=-monotype-courier new-regular-r---*-%d-*-*-m-*-iso8859-1
-monospaced.plain.latin-2=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-2
-monospaced.plain.latin-5=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-9
-monospaced.plain.latin-7=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-13
-monospaced.plain.latin-9=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-15
-monospaced.plain.thai=-monotype-cordia-medium-r-normal--*-%d-*-*-m-*-tis620.2533-0
+monospaced.plain.arabic=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.plain.cyrillic-iso8859-5=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.plain.cyrillic-cp1251=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.plain.cyrillic-koi8-r=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.plain.greek=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.plain.hebrew=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.plain.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+monospaced.plain.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+monospaced.plain.latin-1=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.plain.latin-2=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.plain.latin-5=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.plain.latin-7=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.plain.latin-9=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.plain.thai=-monotype-cordia new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
 
-monospaced.bold.arabic=-monotype-akhbar-bold-r-normal--*-%d-*-*-p-*-iso8859-6
-monospaced.bold.cyrillic-iso8859-5=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-5
-monospaced.bold.cyrillic-cp1251=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-ansi-1251
-monospaced.bold.cyrillic-koi8-r=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-koi8-r
-monospaced.bold.greek=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-7
-monospaced.bold.hebrew=-monotype-couriernew-bold-r-normal-Bold-*-%d-*-*-m-*-iso8859-8
-monospaced.bold.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-monospaced.bold.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-monospaced.bold.latin-1=-monotype-courier new-bold-r---*-%d-*-*-m-*-iso8859-1
-monospaced.bold.latin-2=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-2
-monospaced.bold.latin-5=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-9
-monospaced.bold.latin-7=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-13
-monospaced.bold.latin-9=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-15
-monospaced.bold.thai=-monotype-cordiab-bold-r-normal--*-%d-*-*-m-*-tis620.2533-0
+monospaced.bold.arabic=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.bold.cyrillic-iso8859-5=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.bold.cyrillic-cp1251=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.bold.cyrillic-koi8-r=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.bold.greek=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.bold.hebrew=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.bold.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+monospaced.bold.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+monospaced.bold.latin-1=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.bold.latin-2=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.bold.latin-5=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.bold.latin-7=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.bold.latin-9=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.bold.thai=-monotype-cordia new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
 
-monospaced.italic.arabic=-monotype-akhbar-medium-r-normal--*-%d-*-*-p-*-iso8859-6
-monospaced.italic.cyrillic-iso8859-5=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-5
-monospaced.italic.cyrillic-cp1251=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-ansi-1251
-monospaced.italic.cyrillic-koi8-r=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-koi8-r
-monospaced.italic.greek=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-7
-monospaced.italic.hebrew=-monotype-couriernew-medium-i-normal-Italic-*-%d-*-*-m-*-iso8859-8
-monospaced.italic.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-monospaced.italic.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-monospaced.italic.latin-1=-monotype-courier new-regular-i---*-%d-*-*-m-*-iso8859-1
-monospaced.italic.latin-2=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-2
-monospaced.italic.latin-5=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-9
-monospaced.italic.latin-7=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-13
-monospaced.italic.latin-9=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-15
-monospaced.italic.thai=-monotype-cordiai-medium-i-normal--*-%d-*-*-m-*-tis620.2533-0
+monospaced.italic.arabic=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.italic.cyrillic-iso8859-5=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.italic.cyrillic-cp1251=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.italic.cyrillic-koi8-r=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.italic.greek=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.italic.hebrew=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.italic.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+monospaced.italic.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+monospaced.italic.latin-1=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.italic.latin-2=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.italic.latin-5=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.italic.latin-7=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.italic.latin-9=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.italic.thai=-monotype-cordia new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
 
-monospaced.bolditalic.arabic=-monotype-akhbar-bold-r-normal--*-%d-*-*-p-*-iso8859-6
-monospaced.bolditalic.cyrillic-iso8859-5=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-5
-monospaced.bolditalic.cyrillic-cp1251=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-ansi-1251
-monospaced.bolditalic.cyrillic-koi8-r=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-koi8-r
-monospaced.bolditalic.greek=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-7
-monospaced.bolditalic.hebrew=-monotype-couriernew-bold-i-normal-BoldItalic-*-%d-*-*-m-*-iso8859-8
-monospaced.bolditalic.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-monospaced.bolditalic.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-monospaced.bolditalic.latin-1=-monotype-courier new-bold-i---*-%d-*-*-m-*-iso8859-1
-monospaced.bolditalic.latin-2=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-2
-monospaced.bolditalic.latin-5=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-9
-monospaced.bolditalic.latin-7=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-13
-monospaced.bolditalic.latin-9=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-15
-monospaced.bolditalic.thai=-monotype-cordiaz-bold-i-normal--*-%d-*-*-m-*-tis620.2533-0
+monospaced.bolditalic.arabic=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.bolditalic.cyrillic-iso8859-5=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.bolditalic.cyrillic-cp1251=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.bolditalic.cyrillic-koi8-r=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.bolditalic.greek=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.bolditalic.hebrew=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.bolditalic.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+monospaced.bolditalic.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+monospaced.bolditalic.latin-1=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.bolditalic.latin-2=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.bolditalic.latin-5=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.bolditalic.latin-7=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.bolditalic.latin-9=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+monospaced.bolditalic.thai=-monotype-cordia new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
 
-dialog.plain.arabic=-monotype-shayyal-medium-r-normal--*-%d-*-*-m-*-iso8859-6
-dialog.plain.cyrillic-iso8859-5=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-5
-dialog.plain.cyrillic-cp1251=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-ansi-1251
-dialog.plain.cyrillic-koi8-r=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-koi8-r
-dialog.plain.greek=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-7
-dialog.plain.hebrew=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso8859-8
-dialog.plain.japanese-x0201=-ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-dialog.plain.japanese-x0208=-ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0
-dialog.plain.latin-1=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-1
-dialog.plain.latin-2=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-2
-dialog.plain.latin-5=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-9
-dialog.plain.latin-7=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-13
-dialog.plain.latin-9=-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-15
-dialog.plain.thai=-monotype-browa-medium-r-normal--*-%d-*-*-m-*-tis620.2533-0
+dialog.plain.arabic=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+dialog.plain.cyrillic-iso8859-5=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+dialog.plain.cyrillic-cp1251=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+dialog.plain.cyrillic-koi8-r=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+dialog.plain.greek=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+dialog.plain.hebrew=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+dialog.plain.japanese-x0201=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+dialog.plain.japanese-x0208=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+dialog.plain.latin-1=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+dialog.plain.latin-2=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+dialog.plain.latin-5=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+dialog.plain.latin-7=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+dialog.plain.latin-9=-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+dialog.plain.thai=-monotype-browallia new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
 
-dialog.bold.arabic=-monotype-shayyal-bold-r-normal--*-%d-*-*-m-*-iso8859-6
-dialog.bold.cyrillic-iso8859-5=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-5
-dialog.bold.cyrillic-cp1251=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-ansi-1251
-dialog.bold.cyrillic-koi8-r=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-koi8-r
-dialog.bold.greek=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-7
-dialog.bold.hebrew=-monotype-arial-bold-r-normal-Bold-*-%d-*-*-p-*-iso8859-8
-dialog.bold.japanese-x0201=-ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-dialog.bold.japanese-x0208=-ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0
-dialog.bold.latin-1=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-1
-dialog.bold.latin-2=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-2
-dialog.bold.latin-5=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-9
-dialog.bold.latin-7=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-13
-dialog.bold.latin-9=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-15
-dialog.bold.thai=-monotype-browab-bold-r-normal--*-%d-*-*-m-*-tis620.2533-0
+dialog.bold.arabic=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+dialog.bold.cyrillic-iso8859-5=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+dialog.bold.cyrillic-cp1251=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+dialog.bold.cyrillic-koi8-r=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+dialog.bold.greek=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+dialog.bold.hebrew=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+dialog.bold.japanese-x0201=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+dialog.bold.japanese-x0208=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+dialog.bold.latin-1=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+dialog.bold.latin-2=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+dialog.bold.latin-5=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+dialog.bold.latin-7=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+dialog.bold.latin-9=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+dialog.bold.thai=-monotype-browallia new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
 
-dialog.italic.arabic=-monotype-shayyal-medium-r-normal--*-%d-*-*-m-*-iso8859-6
-dialog.italic.cyrillic-iso8859-5=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-5
-dialog.italic.cyrillic-cp1251=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-ansi-1251
-dialog.italic.cyrillic-koi8-r=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-koi8-r
-dialog.italic.greek=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-7
-dialog.italic.hebrew=-monotype-arial-medium-i-normal-Italic-*-%d-*-*-p-*-iso8859-8
-dialog.italic.japanese-x0201=-ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-dialog.italic.japanese-x0208=-ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0
-dialog.italic.latin-1=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-1
-dialog.italic.latin-2=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-2
-dialog.italic.latin-5=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-9
-dialog.italic.latin-7=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-13
-dialog.italic.latin-9=-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-15
-dialog.italic.thai=-monotype-browai-medium-i-normal--*-%d-*-*-m-*-tis620.2533-0
+dialog.italic.arabic=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+dialog.italic.cyrillic-iso8859-5=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+dialog.italic.cyrillic-cp1251=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+dialog.italic.cyrillic-koi8-r=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+dialog.italic.greek=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+dialog.italic.hebrew=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+dialog.italic.japanese-x0201=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+dialog.italic.japanese-x0208=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+dialog.italic.latin-1=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+dialog.italic.latin-2=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+dialog.italic.latin-5=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+dialog.italic.latin-7=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+dialog.italic.latin-9=-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+dialog.italic.thai=-monotype-browallia new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
 
-dialog.bolditalic.arabic=-monotype-shayyal-bold-r-normal--*-%d-*-*-m-*-iso8859-6
-dialog.bolditalic.cyrillic-iso8859-5=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-5
-dialog.bolditalic.cyrillic-cp1251=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-ansi-1251
-dialog.bolditalic.cyrillic-koi8-r=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-koi8-r
-dialog.bolditalic.greek=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-7
-dialog.bolditalic.hebrew=-monotype-arial-bold-i-normal-BoldItalic-*-%d-*-*-p-*-iso8859-8
-dialog.bolditalic.japanese-x0201=-ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-dialog.bolditalic.japanese-x0208=-ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0
-dialog.bolditalic.latin-1=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-1
-dialog.bolditalic.latin-2=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-2
-dialog.bolditalic.latin-5=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-9
-dialog.bolditalic.latin-7=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-13
-dialog.bolditalic.latin-9=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-15
-dialog.bolditalic.thai=-monotype-browaz-bold-i-normal--*-%d-*-*-m-*-tis620.2533-0
+dialog.bolditalic.arabic=-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+dialog.bolditalic.cyrillic-iso8859-5=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+dialog.bolditalic.cyrillic-cp1251=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+dialog.bolditalic.cyrillic-koi8-r=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+dialog.bolditalic.greek=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+dialog.bolditalic.hebrew=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+dialog.bolditalic.japanese-x0201=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+dialog.bolditalic.japanese-x0208=-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+dialog.bolditalic.latin-1=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+dialog.bolditalic.latin-2=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+dialog.bolditalic.latin-5=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+dialog.bolditalic.latin-7=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+dialog.bolditalic.latin-9=-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+dialog.bolditalic.thai=-monotype-browallia new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
 
-dialoginput.plain.arabic=-monotype-shayyal-medium-r-normal--*-%d-*-*-m-*-iso8859-6
-dialoginput.plain.cyrillic-iso8859-5=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-5
-dialoginput.plain.cyrillic-cp1251=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-ansi-1251
-dialoginput.plain.cyrillic-koi8-r=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-koi8-r
-dialoginput.plain.greek=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-7
-dialoginput.plain.hebrew=-monotype-couriernew-medium-r-normal--*-%d-*-*-m-*-iso8859-8
-dialoginput.plain.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-dialoginput.plain.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-dialoginput.plain.latin-1=-monotype-courier new-regular-r---*-%d-*-*-m-*-iso8859-1
-dialoginput.plain.latin-2=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-2
-dialoginput.plain.latin-5=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-9
-dialoginput.plain.latin-7=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-13
-dialoginput.plain.latin-9=-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-15
-dialoginput.plain.thai=-monotype-cordia-medium-r-normal--*-%d-*-*-m-*-tis620.2533-0
+dialoginput.plain.arabic=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.plain.cyrillic-iso8859-5=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.plain.cyrillic-cp1251=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.plain.cyrillic-koi8-r=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.plain.greek=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.plain.hebrew=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.plain.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+dialoginput.plain.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+dialoginput.plain.latin-1=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.plain.latin-2=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.plain.latin-5=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.plain.latin-7=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.plain.latin-9=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.plain.thai=-monotype-cordia new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
 
-dialoginput.bold.arabic=-monotype-shayyal-bold-r-normal--*-%d-*-*-m-*-iso8859-6
-dialoginput.bold.cyrillic-iso8859-5=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-5
-dialoginput.bold.cyrillic-cp1251=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-ansi-1251
-dialoginput.bold.cyrillic-koi8-r=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-koi8-r
-dialoginput.bold.greek=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-7
-dialoginput.bold.hebrew=-monotype-couriernew-bold-r-normal-Bold-*-%d-*-*-m-*-iso8859-8
-dialoginput.bold.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-dialoginput.bold.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-dialoginput.bold.latin-1=-monotype-courier new-bold-r---*-%d-*-*-m-*-iso8859-1
-dialoginput.bold.latin-2=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-2
-dialoginput.bold.latin-5=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-9
-dialoginput.bold.latin-7=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-13
-dialoginput.bold.latin-9=-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-15
-dialoginput.bold.thai=-monotype-cordiab-bold-r-normal--*-%d-*-*-m-*-tis620.2533-0
+dialoginput.bold.arabic=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.bold.cyrillic-iso8859-5=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.bold.cyrillic-cp1251=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.bold.cyrillic-koi8-r=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.bold.greek=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.bold.hebrew=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.bold.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+dialoginput.bold.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+dialoginput.bold.latin-1=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.bold.latin-2=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.bold.latin-5=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.bold.latin-7=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.bold.latin-9=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.bold.thai=-monotype-cordia new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
 
-dialoginput.italic.arabic=-monotype-shayyal-medium-r-normal--*-%d-*-*-m-*-iso8859-6
-dialoginput.italic.cyrillic-iso8859-5=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-5
-dialoginput.italic.cyrillic-cp1251=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-ansi-1251
-dialoginput.italic.cyrillic-koi8-r=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-koi8-r
-dialoginput.italic.greek=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-7
-dialoginput.italic.hebrew=-monotype-couriernew-medium-i-normal-Italic-*-%d-*-*-m-*-iso8859-8
-dialoginput.italic.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-dialoginput.italic.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-dialoginput.italic.latin-1=-monotype-courier new-regular-i---*-%d-*-*-m-*-iso8859-1
-dialoginput.italic.latin-2=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-2
-dialoginput.italic.latin-5=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-9
-dialoginput.italic.latin-7=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-13
-dialoginput.italic.latin-9=-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-15
-dialoginput.italic.thai=-monotype-cordiai-medium-i-normal--*-%d-*-*-m-*-tis620.2533-0
+dialoginput.italic.arabic=-monotype-courier new-medium-r-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.italic.cyrillic-iso8859-5=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.italic.cyrillic-cp1251=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.italic.cyrillic-koi8-r=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.italic.greek=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.italic.hebrew=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.italic.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+dialoginput.italic.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+dialoginput.italic.latin-1=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.italic.latin-2=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.italic.latin-5=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.italic.latin-7=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.italic.latin-9=-monotype-courier new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.italic.thai=-monotype-cordia new-medium-i-normal--*-%d-*-*-p-*-iso10646-1
 
-dialoginput.bolditalic.arabic=-monotype-shayyal-bold-r-normal--*-%d-*-*-m-*-iso8859-6
-dialoginput.bolditalic.cyrillic-iso8859-5=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-5
-dialoginput.bolditalic.cyrillic-cp1251=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-ansi-1251
-dialoginput.bolditalic.cyrillic-koi8-r=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-koi8-r
-dialoginput.bolditalic.greek=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-7
-dialoginput.bolditalic.hebrew=-monotype-couriernew-bold-i-normal-BoldItalic-*-%d-*-*-m-*-iso8859-8
-dialoginput.bolditalic.japanese-x0201=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0
-dialoginput.bolditalic.japanese-x0208=-ricoh-hg mincho l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0
-dialoginput.bolditalic.latin-1=-monotype-courier new-bold-i---*-%d-*-*-m-*-iso8859-1
-dialoginput.bolditalic.latin-2=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-2
-dialoginput.bolditalic.latin-5=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-9
-dialoginput.bolditalic.latin-7=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-13
-dialoginput.bolditalic.latin-9=-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-15
-dialoginput.bolditalic.thai=-monotype-cordiaz-bold-i-normal--*-%d-*-*-m-*-tis620.2533-0
+dialoginput.bolditalic.arabic=-monotype-courier new-bold-r-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.bolditalic.cyrillic-iso8859-5=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.bolditalic.cyrillic-cp1251=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.bolditalic.cyrillic-koi8-r=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.bolditalic.greek=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.bolditalic.hebrew=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.bolditalic.japanese-x0201=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+dialoginput.bolditalic.japanese-x0208=-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1
+dialoginput.bolditalic.latin-1=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.bolditalic.latin-2=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.bolditalic.latin-5=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.bolditalic.latin-7=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.bolditalic.latin-9=-monotype-courier new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
+dialoginput.bolditalic.thai=-monotype-cordia new-bold-i-normal--*-%d-*-*-p-*-iso10646-1
 
 # Search Sequences
 
-sequence.allfonts=latin-1,dingbats,symbol
-
-sequence.allfonts.Big5=latin-1,chinese-big5,dingbats,symbol
+sequence.allfonts=latin-1
 
-sequence.allfonts.Big5-HKSCS-2001=latin-1,chinese-big5,chinese-hkscs,dingbats,symbol
+sequence.allfonts.Big5=latin-1,chinese-big5
 
-sequence.allfonts.windows-1251=cyrillic-cp1251,latin-1,dingbats,symbol
+sequence.allfonts.Big5-HKSCS-2001=latin-1,chinese-big5,chinese-hkscs
 
-sequence.allfonts.GB2312=latin-1,chinese-gbk,chinese-gb2312,dingbats,symbol
+sequence.allfonts.windows-1251=cyrillic-cp1251,latin-1
 
-sequence.allfonts.x-eucJP-Open=latin-1,japanese-x0201,japanese-x0208,japanese-x0212,dingbats,symbol
+sequence.allfonts.GB2312=latin-1,chinese-gb2312
 
-sequence.allfonts.EUC-KR=latin-1,korean,dingbats,symbol
+sequence.allfonts.x-eucJP-Open=latin-1,japanese-x0201,japanese-x0208,japanese-x0212
 
-sequence.allfonts.x-EUC-TW=latin-1,chinese-cns11643-1,chinese-cns11643-2,chinese-cns11643-3,dingbats,symbol
+sequence.allfonts.EUC-KR=latin-1,korean
 
-sequence.allfonts.GBK=latin-1,chinese-gbk,dingbats,symbol
+sequence.allfonts.x-EUC-TW=latin-1,chinese-cns11643-1,chinese-cns11643-2,chinese-cns11643-3
 
-sequence.allfonts.GB18030=latin-1,chinese-gb18030-0,chinese-gb18030-1,dingbats,symbol
+sequence.allfonts.GBK=latin-1,chinese-gbk
 
-sequence.allfonts.ISO-8859-2=latin-2,latin-1,dingbats,symbol
+sequence.allfonts.GB18030=latin-1,chinese-gb18030-0,chinese-gb18030-1
 
-sequence.allfonts.ISO-8859-5=cyrillic-iso8859-5,latin-1,dingbats,symbol
+sequence.allfonts.ISO-8859-2=latin-2,latin-1
 
-sequence.allfonts.ISO-8859-6=arabic,latin-1,dingbats,symbol
+sequence.allfonts.ISO-8859-5=cyrillic-iso8859-5,latin-1
 
-sequence.allfonts.ISO-8859-7=latin-1,greek,dingbats,symbol
+sequence.allfonts.ISO-8859-6=arabic,latin-1
 
-sequence.allfonts.ISO-8859-8=latin-1,hebrew,dingbats,symbol
+sequence.allfonts.ISO-8859-7=latin-1,greek
 
-sequence.allfonts.ISO-8859-9=latin-5,latin-1,dingbats,symbol
-
-sequence.allfonts.ISO-8859-13=latin-7,latin-1,dingbats,symbol
+sequence.allfonts.ISO-8859-8=latin-1,hebrew
 
-sequence.allfonts.ISO-8859-15=latin-9,dingbats,symbol
-
-sequence.allfonts.KOI8-R=cyrillic-koi8-r,latin-1,dingbats,symbol
+sequence.allfonts.ISO-8859-9=latin-5,latin-1
 
-sequence.allfonts.x-PCK=latin-1,japanese-x0201,japanese-x0208,japanese-x0212,dingbats,symbol
+sequence.allfonts.ISO-8859-13=latin-7,latin-1
 
-sequence.allfonts.TIS-620=latin-1,thai,dingbats,symbol
+sequence.allfonts.ISO-8859-15=latin-9
 
-sequence.allfonts.UTF-8=latin-1,latin-2,latin-7,cyrillic-iso8859-5,greek,latin-5,latin-9,\
-        japanese-x0201,japanese-x0208,japanese-x0212,korean-johab,\
-        chinese-gb2312,chinese-big5,dingbats,symbol
+sequence.allfonts.KOI8-R=cyrillic-koi8-r,latin-1
 
-sequence.allfonts.UTF-8.hi=latin-1,latin-2,latin-7,cyrillic-iso8859-5,greek,latin-5,latin-9,\
-        japanese-x0201,japanese-x0208,japanese-x0212,korean-johab,\
-        chinese-gb2312,chinese-big5,thai,dingbats,symbol
+sequence.allfonts.x-PCK=latin-1,japanese-x0201,japanese-x0208,japanese-x0212
+
+sequence.allfonts.TIS-620=latin-1,thai
 
-sequence.allfonts.UTF-8.ko=latin-1,latin-2,latin-7,cyrillic-iso8859-5,greek,latin-5,latin-9,\
-        korean-johab,japanese-x0201,japanese-x0208,japanese-x0212,\
-        chinese-gb2312,chinese-big5,dingbats,symbol
-
-sequence.allfonts.UTF-8.th=latin-1,latin-2,latin-7,cyrillic-iso8859-5,greek,latin-5,latin-9,\
-        thai,chinese-gb2312,chinese-big5,japanese-x0201,japanese-x0208,japanese-x0212,\
-        korean-johab,dingbats,symbol
+sequence.allfonts.UTF-8=latin-1
+sequence.allfonts.UTF-8.en=latin-1
+sequence.allfonts.UTF-8.hi=latin-1,hindi
+sequence.allfonts.UTF-8.be=latin-1,bengali
+sequence.allfonts.UTF-8.te=latin-1,telugu
+sequence.allfonts.UTF-8.mr=latin-1,marathi
+sequence.allfonts.UTF-8.ta=latin-1,tamil
+sequence.allfonts.UTF-8.gu=latin-1,gujarati
+sequence.allfonts.UTF-8.kn=latin-1,kannada
+sequence.allfonts.UTF-8.ma=latin-1,malayalam
 
-sequence.allfonts.UTF-8.zh.CN=latin-1,latin-2,latin-7,cyrillic-iso8859-5,greek,latin-5,latin-9,\
-        chinese-gb18030-0,chinese-gb18030-1,chinese-big5,chinese-hkscs,\
-        japanese-x0201,japanese-x0208,japanese-x0212,korean-johab,thai,dingbats,symbol
+sequence.allfonts.UTF-8.ko=latin-1,korean-johab,japanese-x0201,japanese-x0208,japanese-x0212
+
+sequence.allfonts.UTF-8.th=latin-1,thai
 
-sequence.allfonts.UTF-8.zh.HK=latin-1,latin-2,latin-7,cyrillic-iso8859-5,greek,latin-5,latin-9,\
-        chinese-big5,chinese-hkscs,chinese-gb18030-0,chinese-gb18030-1,\
-        japanese-x0201,japanese-x0208,japanese-x0212,korean-johab,thai,dingbats,symbol
+sequence.allfonts.UTF-8.zh.CN=latin-1,chinese-gb18030-0,chinese-gb18030-1,chinese-big5,chinese-hkscs
 
-sequence.allfonts.UTF-8.zh.TW=latin-1,latin-2,latin-7,cyrillic-iso8859-5,greek,latin-5,latin-9,\
-        chinese-big5,chinese-hkscs,chinese-gb18030-0,chinese-gb18030-1,\
-        japanese-x0201,japanese-x0208,japanese-x0212,korean-johab,thai,dingbats,symbol
+sequence.allfonts.UTF-8.zh.HK=latin-1,chinese-big5,chinese-hkscs,chinese-gb18030-0,chinese-gb18030-1
+
+sequence.allfonts.UTF-8.zh.TW=latin-1,chinese-big5,chinese-hkscs,chinese-gb18030-0,chinese-gb18030-1
 
 # the fallback sequence omits the following character subsets:
-# - latin-1, latin-2, latin-5, latin-7, latin-9: characters covered by lucida
-# - cyrillic-cp1251, cyrillic-iso8859-5, cyrillic-koi8-r: characters covered by lucida
-# - arabic, devanagari, greek, hebrew, thai: characters covered by lucida
-# - chinese-cns11643-1, chinese-cns11643-2, chinese-cns11643-3, chinese-hkscs: same file as chinese-big5
-# - chinese-gbk, chinese-gb18030-1: same file as chinese-gb18030-0
+# - chinese: all same file : just use chinese-gb18030-0
 # - japanese-x0208: same files as japanese-x0201
 # - japanese-x0212: same files as japanese-x0201
 # - korean: same file as korean-johab
-# - dingbats, symbol: included in all core sequences
-sequence.fallback=lucida,\
-        chinese-big5,chinese-gb2312,chinese-gb18030-0,\
-        japanese-x0201,korean-johab
-
-# Exclusion Ranges
-
-exclusion.chinese-cns11643-2=0390-03d6,2200-22ef,2701-27be
-exclusion.chinese-cns11643-3=0390-03d6,2200-22ef,2701-27be
+sequence.fallback=latin-1,latin-2,latin-7,cyrillic-iso8859-5,greek,latin-5,latin-9,\
+        arabic,hebrew,thai,lucida,\
+        chinese-gb18030-0,\
+        japanese-x0201,korean-johab,\
+        hindi,bengali,telugu,marathi,tamil,gujarati,kannada,malayalam,\
+        dejavusans,dingbats,symbol
 
 # Font File Names
 
-filename.-*-symbol-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific=/usr/openwin/lib/X11/fonts/TrueType/Symbol.ttf
+filename.-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/arial.ttf
+filename.-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/ariali.ttf
+filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/arialb.ttf
+filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/arialbi.ttf
+filename.-monotype-courier_new-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/cour.ttf
+filename.-monotype-courier_new-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/couri.ttf
+filename.-monotype-courier_new-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/courb.ttf
+filename.-monotype-courier_new-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/courbi.ttf
+filename.-monotype-times_new_roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/times.ttf
+filename.-monotype-times_new_roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/timesi.ttf
+filename.-monotype-times_new_roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/timesb.ttf
+filename.-monotype-times_new_roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/timesbi.ttf
+
+filename.-monotype-angsana_new-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/angsa.ttf
+filename.-monotype-angsana_new-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/angsai.ttf
+filename.-monotype-angsana_new-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/angsab.ttf
+filename.-monotype-angsana_new-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/angsaz.ttf
+filename.-monotype-browallia_new-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/browa.ttf
+filename.-monotype-browallia_new-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/browai.ttf
+filename.-monotype-browallia_new-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/browab.ttf
+filename.-monotype-browallia_new-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/browaz.ttf
+filename.-monotype-cordia_new-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/cordia.ttf
+filename.-monotype-cordia_new-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/cordiai.ttf
+filename.-monotype-cordia_new-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/cordiab.ttf
+filename.-monotype-cordia_new-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/cordiaz.ttf
+
+filename.-misc-ipagothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1=/usr/share/fonts/TrueType/ipafont/ipag.otf
+filename.-misc-ipamincho-medium-r-normal--*-%d-*-*-m-*-iso10646-1=/usr/share/fonts/TrueType/ipafont/ipam.otf
+filename.-hanyang-gothic-medium-r-normal--*-%d-*-*-m-*-iso10646-1=/usr/share/fonts/TrueType/hanyang/h2gtrm.ttf
+filename.-arphic-uming-medium-r-normal--*-%d-*-*-m-*-iso10646-1=/usr/share/fonts/TrueType/arphic/uming.ttf
+filename.-monotype-symbol-medium-r-normal--*-%d-*-*-p-*-adobe-symbol=/usr/share/fonts/TrueType/core/symbol.ttf
+filename.-microsoft-wingdings-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific=/usr/share/fonts/TrueType/core/wingdings.ttf
 filename.-b&h-lucidasans-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1=$JRE_LIB_FONTS/LucidaSansRegular.ttf
-filename.-fangzheng-song-medium-r-normal--*-%d-*-*-m-*-gb18030.2000-0=/usr/openwin/lib/locale/zh_CN.GB18030/X11/fonts/TrueType/songti.ttf
-filename.-fangzheng-song-medium-r-normal--*-%d-*-*-m-*-gb18030.2000-1=/usr/openwin/lib/locale/zh_CN.GB18030/X11/fonts/TrueType/songti.ttf
-filename.-hanyang-kodig-medium-r-normal--*-%d-*-*-m-*-ksc5601.1987-0=/usr/openwin/lib/locale/ko.UTF-8/X11/fonts/TrueType/h2gtrm.ttf
-filename.-hanyang-kodig-medium-r-normal--*-%d-*-*-m-*-ksc5601.1992-3=/usr/openwin/lib/locale/ko.UTF-8/X11/fonts/TrueType/h2gtrm.ttf
-filename.-hanyi-ming-medium-r-normal--*-%d-*-*-m-*-big5-1=/usr/openwin/lib/locale/zh_TW.BIG5/X11/fonts/TT/ming.ttf
-filename.-Hanyi-Ming-Medium-r-normal--*-%d-*-*-m-*-cns11643-1=/usr/openwin/lib/locale/zh_TW.BIG5/X11/fonts/TT/ming.ttf
-filename.-Hanyi-Ming-Medium-r-normal--*-%d-*-*-m-*-cns11643-2=/usr/openwin/lib/locale/zh_TW.BIG5/X11/fonts/TT/ming.ttf
-filename.-Hanyi-Ming-Medium-r-normal--*-%d-*-*-m-*-cns11643-3=/usr/openwin/lib/locale/zh_TW.BIG5/X11/fonts/TT/ming.ttf
-filename.-hanyi-ming-medium-r-normal--*-%d-*-*-m-*-hkscs-1=/usr/openwin/lib/locale/zh_TW.BIG5/X11/fonts/TT/ming.ttf
-filename.-monotype-akhbar-bold-r-normal--*-%d-*-*-p-*-iso8859-6=/usr/openwin/lib/locale/ar/X11/fonts/TrueType/AKHBARBD.ttf
-filename.-monotype-akhbar-medium-r-normal--*-%d-*-*-p-*-iso8859-6=/usr/openwin/lib/locale/ar/X11/fonts/TrueType/AKHBARMT.ttf
-filename.-monotype-angsa-medium-r-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/angsa.ttf
-filename.-monotype-angsab-bold-r-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/angsab.ttf
-filename.-monotype-angsai-medium-i-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/angsai.ttf
-filename.-monotype-angsaz-bold-i-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/angsaz.ttf
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBoldItalic.ttf
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBoldItalic.ttf
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBoldItalic.ttf
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/Arial-BoldItalic.ttf
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBoldItalic.ttf
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBoldItalic.ttf
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBoldItalic.ttf
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBoldItalic.ttf
-filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBoldItalic.ttf
-filename.-monotype-arial-bold-i-normal-BoldItalic-*-%d-*-*-p-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/arialbih.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBold.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBold.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBold.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/Arial-Bold.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBold.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBold.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBold.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBold.ttf
-filename.-monotype-arial-bold-r-normal-Bold-*-%d-*-*-p-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/arialb_h.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialBold.ttf
-filename.-monotype-arial-medium-i-normal-Italic-*-%d-*-*-p-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/ariali_h.ttf
-filename.-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/arial__h.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialItalic.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialItalic.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialItalic.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/Arial-Italic.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialItalic.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialItalic.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialItalic.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialItalic.ttf
-filename.-monotype-arial-regular-i-normal--*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialItalic.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialRegular.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialRegular.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialRegular.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/Arial.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialRegular.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialRegular.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialRegular.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialRegular.ttf
-filename.-monotype-arial-regular-r-normal--*-%d-*-*-p-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/ArialRegular.ttf
-filename.-monotype-browa-medium-r-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/browa.ttf
-filename.-monotype-browab-bold-r-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/browab.ttf
-filename.-monotype-browai-medium-i-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/browai.ttf
-filename.-monotype-browaz-bold-i-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/browaz.ttf
-filename.-monotype-cordia-medium-r-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/cordia.ttf
-filename.-monotype-cordiab-bold-r-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/cordiab.ttf
-filename.-monotype-cordiai-medium-i-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/cordiai.ttf
-filename.-monotype-cordiaz-bold-i-normal--*-%d-*-*-m-*-tis620.2533-0=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType/cordiaz.ttf
-filename.-monotype-courier-bold-i-normal--*-%d-*-*-m-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBoldItalic.ttf
-filename.-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBoldItalic.ttf
-filename.-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBoldItalic.ttf
-filename.-monotype-courier-bold-i-normal--*-%d-*-*-m-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBoldItalic.ttf
-filename.-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBoldItalic.ttf
-filename.-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBoldItalic.ttf
-filename.-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBoldItalic.ttf
-filename.-monotype-courier-bold-i-normal--*-%d-*-*-m-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBoldItalic.ttf
-filename.-monotype-courier-bold-r-normal--*-%d-*-*-m-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBold.ttf
-filename.-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBold.ttf
-filename.-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBold.ttf
-filename.-monotype-courier-bold-r-normal--*-%d-*-*-m-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBold.ttf
-filename.-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBold.ttf
-filename.-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBold.ttf
-filename.-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBold.ttf
-filename.-monotype-courier-bold-r-normal--*-%d-*-*-m-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierBold.ttf
-filename.-monotype-courier-regular-i-normal--*-%d-*-*-m-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierItalic.ttf
-filename.-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierItalic.ttf
-filename.-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierItalic.ttf
-filename.-monotype-courier-regular-i-normal--*-%d-*-*-m-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierItalic.ttf
-filename.-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierItalic.ttf
-filename.-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierItalic.ttf
-filename.-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierItalic.ttf
-filename.-monotype-courier-regular-i-normal--*-%d-*-*-m-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierItalic.ttf
-filename.-monotype-courier-regular-r-normal--*-%d-*-*-m-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierRegular.ttf
-filename.-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierRegular.ttf
-filename.-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierRegular.ttf
-filename.-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierRegular.ttf
-filename.-monotype-courier-regular-r-normal--*-%d-*-*-m-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierRegular.ttf
-filename.-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierRegular.ttf
-filename.-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierRegular.ttf
-filename.-monotype-courier-regular-r-normal--*-%d-*-*-m-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/CourierRegular.ttf
-filename.-monotype-courier_new-bold-i---*-%d-*-*-m-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/CourierNew-BoldItalic.ttf
-filename.-monotype-courier_new-bold-r---*-%d-*-*-m-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/CourierNew-Bold.ttf
-filename.-monotype-courier_new-regular-i---*-%d-*-*-m-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/CourierNew-Italic.ttf
-filename.-monotype-courier_new-regular-r---*-%d-*-*-m-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/CourierNew.ttf
-filename.-monotype-couriernew-bold-i-normal-BoldItalic-*-%d-*-*-m-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/courbi_h.ttf
-filename.-monotype-couriernew-bold-r-normal-Bold-*-%d-*-*-m-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/courb__h.ttf
-filename.-monotype-couriernew-medium-i-normal-Italic-*-%d-*-*-m-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/couri__h.ttf
-filename.-monotype-couriernew-medium-r-normal--*-%d-*-*-m-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/cour___h.ttf
-filename.-monotype-naskh-bold-r-normal--*-%d-*-*-p-*-iso8859-6=/usr/openwin/lib/locale/ar/X11/fonts/TrueType/NASKHBD.ttf
-filename.-monotype-naskh-medium-r-normal--*-%d-*-*-p-*-iso8859-6=/usr/openwin/lib/locale/ar/X11/fonts/TrueType/NASKHMT.ttf
-filename.-monotype-shayyal-bold-r-normal--*-%d-*-*-m-*-iso8859-6=/usr/openwin/lib/locale/ar/X11/fonts/TrueType/SHAYBD.ttf
-filename.-monotype-shayyal-medium-r-normal--*-%d-*-*-m-*-iso8859-6=/usr/openwin/lib/locale/ar/X11/fonts/TrueType/SHAYMT.ttf
-filename.-monotype-song-medium-r-normal--*-%d-*-*-m-*-gb2312.1980-0=/usr/openwin/lib/locale/zh/X11/fonts/TrueType/msgbl.ttf
-filename.-monotype-times-bold-i-normal--*-%d-*-*-p-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBoldItalic.ttf
-filename.-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBoldItalic.ttf
-filename.-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBoldItalic.ttf
-filename.-monotype-times-bold-i-normal--*-%d-*-*-p-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBoldItalic.ttf
-filename.-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBoldItalic.ttf
-filename.-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBoldItalic.ttf
-filename.-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBoldItalic.ttf
-filename.-monotype-times-bold-i-normal--*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBoldItalic.ttf
-filename.-monotype-times-bold-r-normal--*-%d-*-*-p-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBold.ttf
-filename.-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBold.ttf
-filename.-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBold.ttf
-filename.-monotype-times-bold-r-normal--*-%d-*-*-p-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBold.ttf
-filename.-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBold.ttf
-filename.-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBold.ttf
-filename.-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBold.ttf
-filename.-monotype-times-bold-r-normal--*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesBold.ttf
-filename.-monotype-times-regular-i-normal--*-%d-*-*-p-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesItalic.ttf
-filename.-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesItalic.ttf
-filename.-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesItalic.ttf
-filename.-monotype-times-regular-i-normal--*-%d-*-*-p-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesItalic.ttf
-filename.-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesItalic.ttf
-filename.-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesItalic.ttf
-filename.-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesItalic.ttf
-filename.-monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesItalic.ttf
-filename.-monotype-times-regular-r-normal--*-%d-*-*-p-*-ansi-1251=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesRegular.ttf
-filename.-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-13=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesRegular.ttf
-filename.-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-15=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesRegular.ttf
-filename.-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-2=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesRegular.ttf
-filename.-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-5=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesRegular.ttf
-filename.-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-7=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesRegular.ttf
-filename.-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-9=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesRegular.ttf
-filename.-monotype-times-regular-r-normal--*-%d-*-*-p-*-koi8-r=/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType/TimesRegular.ttf
-filename.-monotype-times_new_roman-bold-i---*-%d-*-*-p-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/TimesNewRoman-BoldItalic.ttf
-filename.-monotype-times_new_roman-bold-r---*-%d-*-*-p-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/TimesNewRoman-Bold.ttf
-filename.-monotype-times_new_roman-regular-i---*-%d-*-*-p-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/TimesNewRoman-Italic.ttf
-filename.-monotype-times_new_roman-regular-r---*-%d-*-*-p-*-iso8859-1=/usr/openwin/lib/X11/fonts/TrueType/TimesNewRoman.ttf
-filename.-monotype-timesnewroman-bold-i-normal-bolditalic-*-%d-*-*-p-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/timesbih.ttf
-filename.-monotype-timesnewroman-bold-r-normal-bold-*-%d-*-*-p-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/timesb_h.ttf
-filename.-monotype-timesnewroman-medium-i-normal-italic-*-%d-*-*-p-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/timesi_h.ttf
-filename.-monotype-timesnewroman-medium-r-normal--*-%d-*-*-p-*-iso8859-8=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType/times__h.ttf
-filename.-ricoh-heiseimin-w3-r-normal--*-%d-*-*-m-*-jisx0212.1990-0=/usr/openwin/lib/locale/ja/X11/fonts/TT/hgmlsun.ttf
-filename.-ricoh-hg_gothic_b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0=/usr/openwin/lib/locale/ja/X11/fonts/TT/hggbsun.ttf
-filename.-ricoh-hg_gothic_b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0=/usr/openwin/lib/locale/ja/X11/fonts/TT/hggbsun.ttf
-filename.-ricoh-hg_mincho_l-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0=/usr/openwin/lib/locale/ja/X11/fonts/TT/hgmlsun.ttf
-filename.-ricoh-hg_mincho_l-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0=/usr/openwin/lib/locale/ja/X11/fonts/TT/hgmlsun.ttf
-filename.-sun-song-medium-r-normal--*-%d-*-*-c-*-gbk-0=/usr/openwin/lib/locale/zh_CN.GB18030/X11/fonts/TrueType/songti.ttf
-filename.-urw-itc_zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific=/usr/openwin/lib/X11/fonts/TrueType/MonotypeSorts.ttf
+filename.-misc-lohit_bengali-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Bengali.ttf
+filename.-misc-lohit_gujarati-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Gujarati.ttf
+filename.-misc-lohit_hindi-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Hindi.ttf
+filename.-misc-lohit_kannada-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Kannada.ttf
+filename.-misc-lohit_malayalam-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Malayalam.ttf
+filename.-misc-lohit_marathi-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Marathi.ttf
+filename.-misc-lohit_tamil-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Tamil.ttf
+filename.-misc-lohit_telugu-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/lohit/Lohit-Telugu.ttf
+filename.-misc-dejavu_sans-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/TrueType/dejavu/DejaVuSans.ttf
 
 # AWT X11 font paths
-awtfontpath.latin-1=/usr/openwin/lib/X11/fonts/TrueType
-awtfontpath.latin-2=/usr/openwin/lib/locale/iso_8859_2/X11/fonts/TrueType
-awtfontpath.latin-5=/usr/openwin/lib/locale/iso_8859_9/X11/fonts/TrueType
-awtfontpath.latin-7=/usr/openwin/lib/locale/iso_8859_13/X11/fonts/TrueType
-awtfontpath.latin-9=/usr/openwin/lib/locale/iso_8859_15/X11/fonts/TrueType
-awtfontpath.hebrew=/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType
-awtfontpath.arabic=/usr/openwin/lib/locale/ar/X11/fonts/TrueType
-awtfontpath.thai=/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType
-awtfontpath.greek=/usr/openwin/lib/locale/iso_8859_7/X11/fonts/TrueType
-awtfontpath.cyrillic-iso8859-5=/usr/openwin/lib/locale/iso_8859_5/X11/fonts/TrueType
-awtfontpath.cyrillic-cp1251=/usr/openwin/lib/locale/ru.ansi-1251/X11/fonts/TrueType
-awtfontpath.cyrillic-koi8-r=/usr/openwin/lib/locale/KOI8-R/X11/fonts/TrueType
-awtfontpath.korean=/usr/openwin/lib/locale/ko/X11/fonts/TrueType
-awtfontpath.korean-johab=/usr/openwin/lib/locale/ko.UTF-8/X11/fonts/TrueType
-awtfontpath.japanese-x0201=/usr/openwin/lib/locale/ja/X11/fonts/TT
-awtfontpath.japanese-x0208=/usr/openwin/lib/locale/ja/X11/fonts/TT
-awtfontpath.japanese-x0212=/usr/openwin/lib/locale/ja/X11/fonts/TT
-awtfontpath.chinese-gbk=/usr/openwin/lib/locale/zh.GBK/X11/fonts/TrueType
-awtfontpath.chinese-cns11643-1=/usr/openwin/lib/locale/zh_TW/X11/fonts/TrueType
-awtfontpath.chinese-cns11643-2=/usr/openwin/lib/locale/zh_TW/X11/fonts/TrueType
-awtfontpath.chinese-cns11643-3=/usr/openwin/lib/locale/zh_TW/X11/fonts/TrueType
-awtfontpath.chinese-big5=/usr/openwin/lib/locale/zh_TW.BIG5/X11/fonts/TT
-awtfontpath.chinese-gb2312=/usr/openwin/lib/locale/zh/X11/fonts/TrueType
-awtfontpath.chinese-gb18030-0=/usr/openwin/lib/locale/zh_CN.GB18030/X11/fonts/TrueType
-awtfontpath.chinese-gb18030-1=/usr/openwin/lib/locale/zh_CN.GB18030/X11/fonts/TrueType
-awtfontpath.chinese-hkscs=/usr/openwin/lib/locale/zh_HK.BIG5HK/X11/fonts/TT
+awtfontpath.latin-1=/usr/share/fonts/TrueType/core
+awtfontpath.latin-2=/usr/share/fonts/TrueType/core
+awtfontpath.latin-5=/usr/share/fonts/TrueType/core
+awtfontpath.latin-7=/usr/share/fonts/TrueType/core
+awtfontpath.latin-9=/usr/share/fonts/TrueType/core
+awtfontpath.hebrew=/usr/share/fonts/TrueType/core
+awtfontpath.arabic=/usr/share/fonts/TrueType/core
+awtfontpath.thai=/usr/share/fonts/TrueType/core
+awtfontpath.greek=/usr/share/fonts/TrueType/core
+awtfontpath.cyrillic-iso8859-5=/usr/share/fonts/TrueType/core
+awtfontpath.cyrillic-cp1251=/usr/share/fonts/TrueType/core
+awtfontpath.cyrillic-koi8-r=/usr/share/fonts/TrueType/core
+awtfontpath.korean=/usr/share/fonts/TrueType/hanyang
+awtfontpath.korean-johab=/usr/share/fonts/TrueType/hanyang
+awtfontpath.japanese-x0201=/usr/share/fonts/TrueType/ipafont
+awtfontpath.japanese-x0208=/usr/share/fonts/TrueType/ipafont
+awtfontpath.japanese-x0212=/usr/share/fonts/TrueType/ipafont
+awtfontpath.chinese-gbk=/usr/share/fonts/TrueType/arphic
+awtfontpath.chinese-cns11643-1=/usr/share/fonts/TrueType/arphic
+awtfontpath.chinese-cns11643-2=/usr/share/fonts/TrueType/arphic
+awtfontpath.chinese-cns11643-3=/usr/share/fonts/TrueType/arphic
+awtfontpath.chinese-big5=/usr/share/fonts/TrueType/arphic
+awtfontpath.chinese-gb2312=/usr/share/fonts/TrueType/arphic
+awtfontpath.chinese-gb18030-0=/usr/share/fonts/TrueType/arphic
+awtfontpath.chinese-gb18030-1=/usr/share/fonts/TrueType/arphic
+awtfontpath.chinese-hkscs=/usr/share/fonts/TrueType/arphic
+awtfontpath.bengali=/usr/share/fonts/TrueType/lohit
+awtfontpath.gujarati=/usr/share/fonts/TrueType/lohit
+awtfontpath.hindi=/usr/share/fonts/TrueType/lohit
+awtfontpath.kannada=/usr/share/fonts/TrueType/lohit
+awtfontpath.malayalam=/usr/share/fonts/TrueType/lohit
+awtfontpath.marathi=/usr/share/fonts/TrueType/lohit
+awtfontpath.tamil=/usr/share/fonts/TrueType/lohit
+awtfontpath.telugu=/usr/share/fonts/TrueType/lohit
+awtfontpath.dejavusans=/usr/share/fonts/TrueType/dejavu
 
 # Appended Font Path
 
-
-
--- a/jdk/make/data/tzdata/VERSION	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/make/data/tzdata/VERSION	Wed Jul 05 22:19:13 2017 +0200
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2016f
+tzdata2016g
--- a/jdk/make/data/tzdata/africa	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/make/data/tzdata/africa	Wed Jul 05 22:19:13 2017 +0200
@@ -487,7 +487,7 @@
 # http://www.libyaherald.com/2013/10/24/correction-no-time-change-tomorrow/
 #
 # From Paul Eggert (2013-10-25):
-# For now, assume they're reverting to the pre-2012 rules of permanent UTC+2.
+# For now, assume they're reverting to the pre-2012 rules of permanent UT +02.
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Libya	1951	only	-	Oct	14	2:00	1:00	S
--- a/jdk/make/data/tzdata/antarctica	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/make/data/tzdata/antarctica	Wed Jul 05 22:19:13 2017 +0200
@@ -33,9 +33,7 @@
 # http://www.spri.cam.ac.uk/bob/periant.htm
 # for information.
 # Unless otherwise specified, we have no time zone information.
-#
-# Except for the French entries,
-# I made up all time zone abbreviations mentioned here; corrections welcome!
+
 # FORMAT is '-00' and GMTOFF is 0 for locations while uninhabited.
 
 # Argentina - year-round bases
@@ -52,7 +50,7 @@
 #	previously sealers and scientific personnel wintered
 #	Margaret Turner reports
 #	http://web.archive.org/web/20021204222245/http://www.dstc.qut.edu.au/DST/marg/daylight.html
-#	(1999-09-30) that they're UTC+5, with no DST;
+#	(1999-09-30) that they're UT +05, with no DST;
 #	presumably this is when they have visitors.
 #
 # year-round bases
@@ -91,23 +89,22 @@
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Antarctica/Casey	0	-	-00	1969
-			8:00	-	AWST	2009 Oct 18  2:00
-						# Australian Western Std Time
-			11:00	-	CAST	2010 Mar  5  2:00  # Casey Time
-			8:00	-	AWST	2011 Oct 28  2:00
-			11:00	-	CAST	2012 Feb 21 17:00u
-			8:00	-	AWST
+			8:00	-	+08	2009 Oct 18  2:00
+			11:00	-	+11	2010 Mar  5  2:00
+			8:00	-	+08	2011 Oct 28  2:00
+			11:00	-	+11	2012 Feb 21 17:00u
+			8:00	-	+08
 Zone Antarctica/Davis	0	-	-00	1957 Jan 13
-			7:00	-	DAVT	1964 Nov    # Davis Time
+			7:00	-	+07	1964 Nov
 			0	-	-00	1969 Feb
-			7:00	-	DAVT	2009 Oct 18  2:00
-			5:00	-	DAVT	2010 Mar 10 20:00u
-			7:00	-	DAVT	2011 Oct 28  2:00
-			5:00	-	DAVT	2012 Feb 21 20:00u
-			7:00	-	DAVT
+			7:00	-	+07	2009 Oct 18  2:00
+			5:00	-	+05	2010 Mar 10 20:00u
+			7:00	-	+07	2011 Oct 28  2:00
+			5:00	-	+05	2012 Feb 21 20:00u
+			7:00	-	+07
 Zone Antarctica/Mawson	0	-	-00	1954 Feb 13
-			6:00	-	MAWT	2009 Oct 18  2:00 # Mawson Time
-			5:00	-	MAWT
+			6:00	-	+06	2009 Oct 18  2:00
+			5:00	-	+05
 # References:
 # Casey Weather (1998-02-26)
 # http://www.antdiv.gov.au/aad/exop/sfo/casey/casey_aws.html
@@ -161,7 +158,7 @@
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Indian/Kerguelen	0	-	-00	1950 # Port-aux-Français
-			5:00	-	TFT	# ISO code TF Time
+			5:00	-	+05
 #
 # year-round base in the main continent
 # Dumont d'Urville, Île des Pétrels, -6640+14001, since 1956-11
@@ -172,9 +169,9 @@
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Antarctica/DumontDUrville 0 -	-00	1947
-			10:00	-	PMT	1952 Jan 14 # Port-Martin Time
+			10:00	-	+10	1952 Jan 14
 			0	-	-00	1956 Nov
-			10:00	-	DDUT	# Dumont-d'Urville Time
+			10:00	-	+10
 
 # France & Italy - year-round base
 # Concordia, -750600+1232000, since 2005
@@ -200,7 +197,7 @@
 # station of Japan, it's appropriate for the principal location.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Antarctica/Syowa	0	-	-00	1957 Jan 29
-			3:00	-	SYOT	# Syowa Time
+			3:00	-	+03
 # See:
 # NIPR Antarctic Research Activities (1999-08-17)
 # http://www.nipr.ac.jp/english/ara01.html
@@ -237,17 +234,17 @@
 # correct, but they should be quite close to the actual dates.
 #
 # From Paul Eggert (2014-03-21):
-# The CET-switching Troll rules require zic from tzcode 2014b or later, so as
+# The CET-switching Troll rules require zic from tz 2014b or later, so as
 # suggested by Bengt-Inge Larsson comment them out for now, and approximate
 # with only UTC and CEST.  Uncomment them when 2014b is more prevalent.
 #
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
-#Rule	Troll	2005	max	-	Mar	 1	1:00u	1:00	CET
-Rule	Troll	2005	max	-	Mar	lastSun	1:00u	2:00	CEST
-#Rule	Troll	2005	max	-	Oct	lastSun	1:00u	1:00	CET
-#Rule	Troll	2004	max	-	Nov	 7	1:00u	0:00	UTC
+#Rule	Troll	2005	max	-	Mar	 1	1:00u	1:00	+01
+Rule	Troll	2005	max	-	Mar	lastSun	1:00u	2:00	+02
+#Rule	Troll	2005	max	-	Oct	lastSun	1:00u	1:00	+01
+#Rule	Troll	2004	max	-	Nov	 7	1:00u	0:00	+00
 # Remove the following line when uncommenting the above '#Rule' lines.
-Rule	Troll	2004	max	-	Oct	lastSun	1:00u	0:00	UTC
+Rule	Troll	2004	max	-	Oct	lastSun	1:00u	0:00	+00
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Antarctica/Troll	0	-	-00	2005 Feb 12
 			0:00	Troll	%s
@@ -288,10 +285,10 @@
 # changes during the year and does not necessarily correspond to mean
 # solar noon.  So the Vostok time might have been whatever the clocks
 # happened to be during their visit.  So we still don't really know what time
-# it is at Vostok.  But we'll guess UTC+6.
+# it is at Vostok.  But we'll guess +06.
 #
 Zone Antarctica/Vostok	0	-	-00	1957 Dec 16
-			6:00	-	VOST	# Vostok time
+			6:00	-	+06
 
 # S Africa - year-round bases
 # Marion Island, -4653+03752
@@ -324,7 +321,7 @@
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Antarctica/Rothera	0	-	-00	1976 Dec  1
-			-3:00	-	ROTT	# Rothera time
+			-3:00	-	-03
 
 # Uruguay - year round base
 # Artigas, King George Island, -621104-0585107
--- a/jdk/make/data/tzdata/asia	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/make/data/tzdata/asia	Wed Jul 05 22:19:13 2017 +0200
@@ -139,13 +139,11 @@
 # http://www.worldtimezone.com/dst_news/dst_news_armenia03.html
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Yerevan	2:58:00 -	LMT	1924 May  2
-			3:00	-	YERT	1957 Mar    # Yerevan Time
-			4:00 RussiaAsia YER%sT	1991 Mar 31  2:00s
-			3:00	1:00	YERST	1991 Sep 23 # independence
-			3:00 RussiaAsia	AM%sT	1995 Sep 24  2:00s
-			4:00	-	AMT	1997
-			4:00 RussiaAsia	AM%sT	2012 Feb  9
-			4:00	-	AMT
+			3:00	-	+03	1957 Mar
+			4:00 RussiaAsia +04/+05	1991 Mar 31  2:00s
+			3:00 RussiaAsia	+03/+04	1995 Sep 24  2:00s
+			4:00	-	+04	1997
+			4:00 RussiaAsia	+04/+05
 
 # Azerbaijan
 
@@ -166,13 +164,12 @@
 Rule	Azer	1997	2015	-	Oct	lastSun	 5:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Baku	3:19:24 -	LMT	1924 May  2
-			3:00	-	BAKT	1957 Mar    # Baku Time
-			4:00 RussiaAsia BAK%sT	1991 Mar 31  2:00s
-			3:00	1:00	BAKST	1991 Aug 30 # independence
-			3:00 RussiaAsia	AZ%sT	1992 Sep lastSun  2:00s
-			4:00	-	AZT	1996     # Azerbaijan Time
-			4:00	EUAsia	AZ%sT	1997
-			4:00	Azer	AZ%sT
+			3:00	-	+03	1957 Mar
+			4:00 RussiaAsia +04/+05	1991 Mar 31  2:00s
+			3:00 RussiaAsia	+03/+04	1992 Sep lastSun  2:00s
+			4:00	-	+04	1996
+			4:00	EUAsia	+04/+05	1997
+			4:00	Azer	+04/+05
 
 # Bahrain
 # See Asia/Qatar.
@@ -291,7 +288,7 @@
 # Milne says 6:24:40 was the meridian of the time ball observatory at Rangoon.
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Rangoon	6:24:40 -	LMT	1880        # or Yangon
+Zone	Asia/Yangon	6:24:40 -	LMT	1880        # or Rangoon
 			6:24:40	-	RMT	1920        # Rangoon Mean Time?
 			6:30	-	BURT	1942 May    # Burma Time
 			9:00	-	JST	1945 May  3
@@ -406,7 +403,7 @@
 # Lewiston (ME) Daily Sun (1939-05-29), p 17, said "Even the time is
 # different - the occupied districts going by Tokyo time, an hour
 # ahead of that prevailing in the rest of Shanghai."  Guess that the
-# Xujiahui Observatory was under French control and stuck with UT+8.
+# Xujiahui Observatory was under French control and stuck with UT +08.
 #
 # In earlier versions of this file, China had many separate Zone entries, but
 # this was based on what were apparently incorrect data in Shanks & Pottenger.
@@ -415,26 +412,26 @@
 # Proposed in 1918 and theoretically in effect until 1949 (although in practice
 # mainly observed in coastal areas), the five zones were:
 #
-# Changbai Time ("Long-white Time", Long-white = Heilongjiang area) UT+8.5
+# Changbai Time ("Long-white Time", Long-white = Heilongjiang area) UT +08:30
 # Asia/Harbin (currently a link to Asia/Shanghai)
 # Heilongjiang (except Mohe county), Jilin
 #
-# Zhongyuan Time ("Central plain Time") UT+8
+# Zhongyuan Time ("Central plain Time") UT +08
 # Asia/Shanghai
 # most of China
 # This currently represents most other zones as well,
 # as apparently these regions have been the same since 1970.
 # Milne gives 8:05:43.2 for Xujiahui Observatory time; round to nearest.
-# Guo says Shanghai switched to UT+8 "from the end of the 19th century".
+# Guo says Shanghai switched to UT +08 "from the end of the 19th century".
 #
-# Long-shu Time (probably due to Long and Shu being two names of that area) UT+7
+# Long-shu Time (probably due to Long and Shu being two names of the area) UT +07
 # Asia/Chongqing (currently a link to Asia/Shanghai)
 # Guangxi, Guizhou, Hainan, Ningxia, Sichuan, Shaanxi, and Yunnan;
 # most of Gansu; west Inner Mongolia; west Qinghai; and the Guangdong
 # counties Deqing, Enping, Kaiping, Luoding, Taishan, Xinxing,
 # Yangchun, Yangjiang, Yu'nan, and Yunfu.
 #
-# Xin-zang Time ("Xinjiang-Tibet Time") UT+6
+# Xin-zang Time ("Xinjiang-Tibet Time") UT +06
 # Asia/Urumqi
 # This currently represents Kunlun Time as well,
 # as apparently the two regions have been the same since 1970.
@@ -447,7 +444,7 @@
 # Shihezi, Changji, Yanqi, Heshuo, Tuokexun, Tulufan, Shanshan, Hami,
 # Fukang, Kuitun, Kumukuli, Miquan, Qitai, and Turfan.
 #
-# Kunlun Time UT+5.5
+# Kunlun Time UT +05:30
 # Asia/Kashgar (currently a link to Asia/Urumqi)
 # West Tibet, including Pulan, Aheqi, Shufu, Shule;
 # West Xinjiang, including Aksu, Atushi, Yining, Hetian, Cele, Luopu, Nileke,
@@ -463,7 +460,7 @@
 #
 # On the other hand, ethnic Uyghurs, who make up about half the
 # population of Xinjiang, typically use "Xinjiang time" which is two
-# hours behind Beijing time, or UTC +0600. The government of the Xinjiang
+# hours behind Beijing time, or UT +06. The government of the Xinjiang
 # Uyghur Autonomous Region, (XAUR, or just Xinjiang for short) as well as
 # local governments such as the Ürümqi city government use both times in
 # publications, referring to what is popularly called Xinjiang time as
@@ -519,8 +516,8 @@
 # having the same time as Beijing.
 
 # From Paul Eggert (2014-06-30):
-# In the early days of the PRC, Tibet was given its own time zone (UT+6) but
-# this was withdrawn in 1959 and never reinstated; see Tubten Khétsun,
+# In the early days of the PRC, Tibet was given its own time zone (UT +06)
+# but this was withdrawn in 1959 and never reinstated; see Tubten Khétsun,
 # Memories of life in Lhasa under Chinese Rule, Columbia U Press, ISBN
 # 978-0231142861 (2008), translator's introduction by Matthew Akester, p x.
 # As this is before our 1970 cutoff, Tibet doesn't need a separate zone.
@@ -534,12 +531,12 @@
 # Republics, the Soviet Union, the Kuomintang, and the People's Republic of
 # China, and tracking down all these organizations' timekeeping rules would be
 # quite a trick.  Approximate this lost history by a transition from LMT to
-# XJT at the start of 1928, the year of accession of the warlord Jin Shuren,
+# UT +06 at the start of 1928, the year of accession of the warlord Jin Shuren,
 # which happens to be the date given by Shanks & Pottenger (no doubt as a
-# guess) as the transition from LMT.  Ignore the usage of UT+8 before
-# 1986-02-01 under the theory that the transition date to UT+8 is unknown and
+# guess) as the transition from LMT.  Ignore the usage of +08 before
+# 1986-02-01 under the theory that the transition date to +08 is unknown and
 # that the sort of users who prefer Asia/Urumqi now typically ignored the
-# UT+8 mandate back then.
+# +08 mandate back then.
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 # Beijing time, used throughout China; represented by Shanghai.
@@ -744,7 +741,7 @@
 # be found from historical government announcement database.
 
 # From Paul Eggert (2014-07-03):
-# As per Yu-Cheng Chuang, say that Taiwan was at UT+9 from 1937-10-01
+# As per Yu-Cheng Chuang, say that Taiwan was at UT +09 from 1937-10-01
 # until 1945-09-21 at 01:00, overriding Shanks & Pottenger.
 # Likewise, use Yu-Cheng Chuang's data for DST in Taiwan.
 
@@ -858,16 +855,15 @@
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Tbilisi	2:59:11 -	LMT	1880
 			2:59:11	-	TBMT	1924 May  2 # Tbilisi Mean Time
-			3:00	-	TBIT	1957 Mar    # Tbilisi Time
-			4:00 RussiaAsia TBI%sT	1991 Mar 31  2:00s
-			3:00	1:00	TBIST	1991 Apr  9 # independence
-			3:00 RussiaAsia GE%sT	1992        # Georgia Time
-			3:00 E-EurAsia	GE%sT	1994 Sep lastSun
-			4:00 E-EurAsia	GE%sT	1996 Oct lastSun
-			4:00	1:00	GEST	1997 Mar lastSun
-			4:00 E-EurAsia	GE%sT	2004 Jun 27
-			3:00 RussiaAsia	GE%sT	2005 Mar lastSun  2:00
-			4:00	-	GET
+			3:00	-	+03	1957 Mar
+			4:00 RussiaAsia +04/+05	1991 Mar 31  2:00s
+			3:00 RussiaAsia +03/+04	1992
+			3:00 E-EurAsia	+03/+04	1994 Sep lastSun
+			4:00 E-EurAsia	+04/+05	1996 Oct lastSun
+			4:00	1:00	+05	1997 Mar lastSun
+			4:00 E-EurAsia	+04/+05	2004 Jun 27
+			3:00 RussiaAsia	+03/+04	2005 Mar lastSun  2:00
+			4:00	-	+04
 
 # East Timor
 
@@ -944,7 +940,7 @@
 # These would be the earliest possible times for a change.
 # Régimes horaires pour le monde entier, by Henri Le Corre, (Éditions
 # Traditionnelles, 1987, Paris) says that Java and Madura switched
-# from JST to UTC+07:30 on 1945-09-23, and gives 1944-09-01 for Jayapura
+# from UT +09 to +07:30 on 1945-09-23, and gives 1944-09-01 for Jayapura
 # (Hollandia).  For now, assume all Indonesian locations other than Jayapura
 # switched on 1945-09-23.
 #
@@ -955,11 +951,11 @@
 # summary published by the Time and Frequency Laboratory of the
 # Research Center for Calibration, Instrumentation and Metrology,
 # Indonesia, <http://time.kim.lipi.go.id/time-eng.php> (2006-09-29).
-# The abbreviations are:
+# The time zone abbreviations and UT offsets are:
 #
-# WIB  - UTC+7 - Waktu Indonesia Barat (Indonesia western time)
-# WITA - UTC+8 - Waktu Indonesia Tengah (Indonesia central time)
-# WIT  - UTC+9 - Waktu Indonesia Timur (Indonesia eastern time)
+# WIB  - +07 - Waktu Indonesia Barat (Indonesia western time)
+# WITA - +08 - Waktu Indonesia Tengah (Indonesia central time)
+# WIT  - +09 - Waktu Indonesia Timur (Indonesia eastern time)
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 # Java, Sumatra
@@ -1848,11 +1844,11 @@
 Rule	Kyrgyz	1997	2004	-	Oct	lastSun	2:30	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Bishkek	4:58:24 -	LMT	1924 May  2
-			5:00	-	FRUT	1930 Jun 21 # Frunze Time
-			6:00 RussiaAsia FRU%sT	1991 Mar 31  2:00s
-			5:00	1:00	FRUST	1991 Aug 31  2:00 # independence
-			5:00	Kyrgyz	KG%sT	2005 Aug 12 # Kyrgyzstan Time
-			6:00	-	KGT
+			5:00	-	+05	1930 Jun 21
+			6:00 RussiaAsia +06/+07	1991 Mar 31  2:00s
+			5:00 RussiaAsia	+05/+06	1991 Aug 31  2:00
+			5:00	Kyrgyz	+05/+06	2005 Aug 12
+			6:00	-	+06
 
 ###############################################################################
 
@@ -1891,25 +1887,24 @@
 Rule	ROK	1987	1988	-	May	Sun>=8	2:00	1:00	D
 Rule	ROK	1987	1988	-	Oct	Sun>=8	3:00	0	S
 
-# From Paul Eggert (2014-10-30):
+# From Paul Eggert (2016-08-23):
 # The Korean Wikipedia entry gives the following sources for UT offsets:
 #
-# 1908: Official Journal Article No. 3994 (Edict No. 5)
+# 1908: Official Journal Article No. 3994 (decree No. 5)
 # 1912: Governor-General of Korea Official Gazette Issue No. 367
 #       (Announcement No. 338)
 # 1954: Presidential Decree No. 876 (1954-03-17)
 # 1961: Law No. 676 (1961-08-07)
-# 1987: Law No. 3919 (1986-12-31)
 #
-# The Wikipedia entry also has confusing information about a change
-# to UT+9 in April 1910, but then what would be the point of the later change
-# to UT+9 on 1912-01-01?  Omit the 1910 change for now.
+# (Another source "1987: Law No. 3919 (1986-12-31)" was in the 2014-10-30
+# edition of the Korean Wikipedia entry.)
 #
 # I guessed that time zone abbreviations through 1945 followed the same
 # rules as discussed under Taiwan, with nominal switches from JST to KST
 # when the respective cities were taken over by the Allies after WWII.
 #
-# For Pyongyang we have no information; guess no changes since World War II.
+# For Pyongyang, guess no changes from World War II until 2015, as we
+# have no information otherwise.
 
 # From Steffen Thorsen (2015-08-07):
 # According to many news sources, North Korea is going to change to
@@ -2069,7 +2064,7 @@
 # Bill Bonnet (2005-05-19) reports that the US Embassy in Ulaanbaatar says
 # there is only one time zone and that DST is observed, citing Microsoft
 # Windows XP as the source.  Risto Nykänen (2005-05-16) reports that
-# travelmongolia.org says there are two time zones (UTC+7, UTC+8) with no DST.
+# travelmongolia.org says there are two time zones (UT +07, +08) with no DST.
 # Oscar van Vlijmen (2005-05-20) reports that the Mongolian Embassy in
 # Washington, DC says there are two time zones, with DST observed.
 # He also found
@@ -2705,7 +2700,7 @@
 # earlier date.
 #
 # Shanks & Pottenger also state that until 1968-05-01 Saudi Arabia had two
-# time zones; the other zone, at UTC+4, was in the far eastern part of
+# time zones; the other zone, at UT +04, was in the far eastern part of
 # the country.  Ignore this, as it's before our 1970 cutoff.
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -2974,10 +2969,10 @@
 # From Shanks & Pottenger.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Dushanbe	4:35:12 -	LMT	1924 May  2
-			5:00	-	DUST	1930 Jun 21 # Dushanbe Time
-			6:00 RussiaAsia DUS%sT	1991 Mar 31  2:00s
-			5:00	1:00	DUSST	1991 Sep  9  2:00s
-			5:00	-	TJT	# Tajikistan Time
+			5:00	-	+05	1930 Jun 21
+			6:00 RussiaAsia +06/+07	1991 Mar 31  2:00s
+			5:00	1:00	+05/+06	1991 Sep  9  2:00s
+			5:00	-	+05
 
 # Thailand
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -2991,11 +2986,10 @@
 # From Shanks & Pottenger.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Ashgabat	3:53:32 -	LMT	1924 May  2 # or Ashkhabad
-			4:00	-	ASHT	1930 Jun 21 # Ashkhabad Time
-			5:00 RussiaAsia	ASH%sT	1991 Mar 31  2:00
-			4:00 RussiaAsia	ASH%sT	1991 Oct 27 # independence
-			4:00 RussiaAsia	TM%sT	1992 Jan 19  2:00
-			5:00	-	TMT
+			4:00	-	+04	1930 Jun 21
+			5:00 RussiaAsia	+05/+06	1991 Mar 31  2:00
+			4:00 RussiaAsia	+04/+05	1992 Jan 19  2:00
+			5:00	-	+05
 
 # United Arab Emirates
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -3007,20 +3001,18 @@
 # Byalokoz 1919 says Uzbekistan was 4:27:53.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Samarkand	4:27:53 -	LMT	1924 May  2
-			4:00	-	SAMT	1930 Jun 21 # Samarkand Time
-			5:00	-	SAMT	1981 Apr  1
-			5:00	1:00	SAMST	1981 Oct  1
-			6:00	-	TAST	1982 Apr  1 # Tashkent Time
-			5:00 RussiaAsia	SAM%sT	1991 Sep  1 # independence
-			5:00 RussiaAsia	UZ%sT	1992
-			5:00	-	UZT
+			4:00	-	+04	1930 Jun 21
+			5:00	-	+05	1981 Apr  1
+			5:00	1:00	+06	1981 Oct  1
+			6:00	-	+06	1982 Apr  1
+			5:00 RussiaAsia	+05/+06	1992
+			5:00	-	+05
 # Milne says Tashkent was 4:37:10.8; round to nearest.
 Zone	Asia/Tashkent	4:37:11 -	LMT	1924 May  2
-			5:00	-	TAST	1930 Jun 21 # Tashkent Time
-			6:00 RussiaAsia	TAS%sT	1991 Mar 31  2:00
-			5:00 RussiaAsia	TAS%sT	1991 Sep  1 # independence
-			5:00 RussiaAsia	UZ%sT	1992
-			5:00	-	UZT
+			5:00	-	+05	1930 Jun 21
+			6:00 RussiaAsia	+06/+07	1991 Mar 31  2:00
+			5:00 RussiaAsia	+05/+06	1992
+			5:00	-	+05
 
 # Vietnam
 
--- a/jdk/make/data/tzdata/australasia	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/make/data/tzdata/australasia	Wed Jul 05 22:19:13 2017 +0200
@@ -568,7 +568,7 @@
 # Base the Bougainville entry on the Arawa-Kieta region, which appears to have
 # the most people even though it was devastated in the Bougainville Civil War.
 #
-# Although Shanks gives 1942-03-15 / 1943-11-01 for JST, these dates
+# Although Shanks gives 1942-03-15 / 1943-11-01 for UT +09, these dates
 # are apparently rough guesswork from the starts of military campaigns.
 # The World War II entries below are instead based on Arawa-Kieta.
 # The Japanese occupied Kieta in July 1942,
@@ -576,8 +576,8 @@
 # http://pwencycl.kgbudge.com/B/o/Bougainville.htm
 # and seem to have controlled it until their 1945-08-21 surrender.
 #
-# The Autonomous Region of Bougainville plans to switch from UTC+10 to UTC+11
-# on 2014-12-28 at 02:00.  They call UTC+11 "Bougainville Standard Time";
+# The Autonomous Region of Bougainville switched from UT +10 to +11
+# on 2014-12-28 at 02:00.  They call +11 "Bougainville Standard Time";
 # abbreviate this as BST.  See:
 # http://www.bougainville24.com/bougainville-issues/bougainville-gets-own-timezone/
 #
@@ -643,7 +643,7 @@
 # From Paul Eggert (2014-06-27):
 # The International Date Line Act 2011
 # http://www.parliament.gov.ws/images/ACTS/International_Date_Line_Act__2011_-_Eng.pdf
-# changed Samoa from UTC-11 to UTC+13, effective "12 o'clock midnight, on
+# changed Samoa from UT -11 to +13, effective "12 o'clock midnight, on
 # Thursday 29th December 2011".  The International Date Line was adjusted
 # accordingly.
 
@@ -738,7 +738,7 @@
 # 1886-1891; Baker was similar but exact dates are not known.
 # Inhabited by civilians 1935-1942; U.S. military bases 1943-1944;
 # uninhabited thereafter.
-# Howland observed Hawaii Standard Time (UT-10:30) in 1937;
+# Howland observed Hawaii Standard Time (UT -10:30) in 1937;
 # see page 206 of Elgen M. Long and Marie K. Long,
 # Amelia Earhart: the Mystery Solved, Simon & Schuster (2000).
 # So most likely Howland and Baker observed Hawaii Time from 1935
@@ -1496,7 +1496,7 @@
 # Zealand time.  I understand that is the time they keep locally, anyhow."
 # For now, assume this practice goes back to the introduction of standard time
 # in New Zealand, as this would make Chatham Islands time almost exactly match
-# LMT back when New Zealand was at UTC+11:30; also, assume Chatham Islands did
+# LMT back when New Zealand was at UT +11:30; also, assume Chatham Islands did
 # not observe New Zealand's prewar DST.
 
 ###############################################################################
@@ -1552,7 +1552,7 @@
 # For now, we assume the Ladrones switched at the same time as the Philippines;
 # see Asia/Manila.
 
-# US Public Law 106-564 (2000-12-23) made UTC+10 the official standard time,
+# US Public Law 106-564 (2000-12-23) made UT +10 the official standard time,
 # under the name "Chamorro Standard Time".  There is no official abbreviation,
 # but Congressman Robert A. Underwood, author of the bill that became law,
 # wrote in a press release (2000-12-27) that he will seek the use of "ChST".
@@ -1564,15 +1564,15 @@
 # "I am certain, having lived there for the past decade, that 'Truk'
 # (now properly known as Chuuk) ... is in the time zone GMT+10."
 #
-# Shanks & Pottenger write that Truk switched from UTC+10 to UTC+11
+# Shanks & Pottenger write that Truk switched from UT +10 to +11
 # on 1978-10-01; ignore this for now.
 
 # From Paul Eggert (1999-10-29):
 # The Federated States of Micronesia Visitors Board writes in
 # The Federated States of Micronesia - Visitor Information (1999-01-26)
 # http://www.fsmgov.org/info/clocks.html
-# that Truk and Yap are UTC+10, and Ponape and Kosrae are UTC+11.
-# We don't know when Kosrae switched from UTC+12; assume January 1 for now.
+# that Truk and Yap are UT +10, and Ponape and Kosrae are +11.
+# We don't know when Kosrae switched from +12; assume January 1 for now.
 
 
 # Midway
@@ -1638,11 +1638,11 @@
 # ordaining - by a masterpiece of diplomatic flattery - that
 # the Fourth of July should be celebrated twice in that year."
 
-# Although Shanks & Pottenger says they both switched to UTC-11:30
-# in 1911, and to UTC-11 in 1950. many earlier sources give UTC-11
+# Although Shanks & Pottenger says they both switched to UT -11:30
+# in 1911, and to -11 in 1950. many earlier sources give -11
 # for American Samoa, e.g., the US National Bureau of Standards
 # circular "Standard Time Throughout the World", 1932.
-# Assume American Samoa switched to UTC-11 in 1911, not 1950,
+# Assume American Samoa switched to -11 in 1911, not 1950,
 # and that after 1950 they agreed until (western) Samoa skipped a
 # day in 2011.  Assume also that the Samoas follow the US and New
 # Zealand's "ST"/"DT" style of daylight-saving abbreviations.
--- a/jdk/make/data/tzdata/backward	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/make/data/tzdata/backward	Wed Jul 05 22:19:13 2017 +0200
@@ -59,6 +59,7 @@
 Link	Asia/Urumqi		Asia/Kashgar
 Link	Asia/Kathmandu		Asia/Katmandu
 Link	Asia/Macau		Asia/Macao
+Link	Asia/Yangon		Asia/Rangoon
 Link	Asia/Ho_Chi_Minh	Asia/Saigon
 Link	Asia/Jerusalem		Asia/Tel_Aviv
 Link	Asia/Thimphu		Asia/Thimbu
--- a/jdk/make/data/tzdata/etcetera	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/make/data/tzdata/etcetera	Wed Jul 05 22:19:13 2017 +0200
@@ -31,6 +31,13 @@
 # need now for the entries that are not on UTC are for ships at sea
 # that cannot use POSIX TZ settings.
 
+# Starting with POSIX 1003.1-2001, the entries below are all
+# unnecessary as settings for the TZ environment variable.  E.g.,
+# instead of TZ='Etc/GMT+4' one can use the POSIX setting TZ='<-04>+4'.
+#
+# Do not use a POSIX TZ setting like TZ='GMT+4', which is four hours
+# behind GMT but uses the completely misleading abbreviation "GMT".
+
 Zone	Etc/GMT		0	-	GMT
 Zone	Etc/UTC		0	-	UTC
 Zone	Etc/UCT		0	-	UCT
@@ -49,23 +56,13 @@
 Link	Etc/GMT				Etc/GMT+0
 Link	Etc/GMT				Etc/GMT0
 
-# We use POSIX-style signs in the Zone names and the output abbreviations,
+# Be consistent with POSIX TZ settings in the Zone names,
 # even though this is the opposite of what many people expect.
 # POSIX has positive signs west of Greenwich, but many people expect
 # positive signs east of Greenwich.  For example, TZ='Etc/GMT+4' uses
-# the abbreviation "GMT+4" and corresponds to 4 hours behind UT
+# the abbreviation "-04" and corresponds to 4 hours behind UT
 # (i.e. west of Greenwich) even though many people would expect it to
 # mean 4 hours ahead of UT (i.e. east of Greenwich).
-#
-# In the draft 5 of POSIX 1003.1-200x, the angle bracket notation allows for
-# TZ='<GMT-4>+4'; if you want time zone abbreviations conforming to
-# ISO 8601 you can use TZ='<-0400>+4'.  Thus the commonly-expected
-# offset is kept within the angle bracket (and is used for display)
-# while the POSIX sign is kept outside the angle bracket (and is used
-# for calculation).
-#
-# Do not use a TZ setting like TZ='GMT+4', which is four hours behind
-# GMT but uses the completely misleading abbreviation "GMT".
 
 # Earlier incarnations of this package were not POSIX-compliant,
 # and had lines such as
@@ -74,30 +71,31 @@
 # way does a
 #		zic -l GMT-12
 # so we moved the names into the Etc subdirectory.
+# Also, the time zone abbreviations are now compatible with %z.
 
-Zone	Etc/GMT-14	14	-	GMT-14	# 14 hours ahead of GMT
-Zone	Etc/GMT-13	13	-	GMT-13
-Zone	Etc/GMT-12	12	-	GMT-12
-Zone	Etc/GMT-11	11	-	GMT-11
-Zone	Etc/GMT-10	10	-	GMT-10
-Zone	Etc/GMT-9	9	-	GMT-9
-Zone	Etc/GMT-8	8	-	GMT-8
-Zone	Etc/GMT-7	7	-	GMT-7
-Zone	Etc/GMT-6	6	-	GMT-6
-Zone	Etc/GMT-5	5	-	GMT-5
-Zone	Etc/GMT-4	4	-	GMT-4
-Zone	Etc/GMT-3	3	-	GMT-3
-Zone	Etc/GMT-2	2	-	GMT-2
-Zone	Etc/GMT-1	1	-	GMT-1
-Zone	Etc/GMT+1	-1	-	GMT+1
-Zone	Etc/GMT+2	-2	-	GMT+2
-Zone	Etc/GMT+3	-3	-	GMT+3
-Zone	Etc/GMT+4	-4	-	GMT+4
-Zone	Etc/GMT+5	-5	-	GMT+5
-Zone	Etc/GMT+6	-6	-	GMT+6
-Zone	Etc/GMT+7	-7	-	GMT+7
-Zone	Etc/GMT+8	-8	-	GMT+8
-Zone	Etc/GMT+9	-9	-	GMT+9
-Zone	Etc/GMT+10	-10	-	GMT+10
-Zone	Etc/GMT+11	-11	-	GMT+11
-Zone	Etc/GMT+12	-12	-	GMT+12
+Zone	Etc/GMT-14	14	-	+14
+Zone	Etc/GMT-13	13	-	+13
+Zone	Etc/GMT-12	12	-	+12
+Zone	Etc/GMT-11	11	-	+11
+Zone	Etc/GMT-10	10	-	+10
+Zone	Etc/GMT-9	9	-	+09
+Zone	Etc/GMT-8	8	-	+08
+Zone	Etc/GMT-7	7	-	+07
+Zone	Etc/GMT-6	6	-	+06
+Zone	Etc/GMT-5	5	-	+05
+Zone	Etc/GMT-4	4	-	+04
+Zone	Etc/GMT-3	3	-	+03
+Zone	Etc/GMT-2	2	-	+02
+Zone	Etc/GMT-1	1	-	+01
+Zone	Etc/GMT+1	-1	-	-01
+Zone	Etc/GMT+2	-2	-	-02
+Zone	Etc/GMT+3	-3	-	-03
+Zone	Etc/GMT+4	-4	-	-04
+Zone	Etc/GMT+5	-5	-	-05
+Zone	Etc/GMT+6	-6	-	-06
+Zone	Etc/GMT+7	-7	-	-07
+Zone	Etc/GMT+8	-8	-	-08
+Zone	Etc/GMT+9	-9	-	-09
+Zone	Etc/GMT+10	-10	-	-10
+Zone	Etc/GMT+11	-11	-	-11
+Zone	Etc/GMT+12	-12	-	-12
--- a/jdk/make/data/tzdata/europe	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/make/data/tzdata/europe	Wed Jul 05 22:19:13 2017 +0200
@@ -98,8 +98,7 @@
 #        1:00       CET CEST CEMT Central Europe
 #        1:00:14    SET           Swedish (1879-1899)*
 #        2:00       EET EEST      Eastern Europe
-#        3:00       FET           Further-eastern Europe (2011-2014)*
-#        3:00       MSK MSD  MSM* Minsk, Moscow
+#        3:00       MSK MSD       Moscow
 
 # From Peter Ilieve (1994-12-04),
 # The original six [EU members]: Belgium, France, (West) Germany, Italy,
@@ -606,16 +605,33 @@
 Rule	E-Eur	1981	max	-	Mar	lastSun	 0:00	1:00	S
 Rule	E-Eur	1996	max	-	Oct	lastSun	 0:00	0	-
 
+
+# Daylight saving time for Russia and the Soviet Union
+#
+# The 1917-1921 decree URLs are from Alexander Belopolsky (2016-08-23).
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Russia	1917	only	-	Jul	 1	23:00	1:00	MST  # Moscow Summer Time
+#
+# Decree No. 142 (1917-12-22) http://istmat.info/node/28137
 Rule	Russia	1917	only	-	Dec	28	 0:00	0	MMT  # Moscow Mean Time
+#
+# Decree No. 497 (1918-05-30) http://istmat.info/node/30001
 Rule	Russia	1918	only	-	May	31	22:00	2:00	MDST # Moscow Double Summer Time
 Rule	Russia	1918	only	-	Sep	16	 1:00	1:00	MST
+#
+# Decree No. 258 (1919-05-29) http://istmat.info/node/37949
 Rule	Russia	1919	only	-	May	31	23:00	2:00	MDST
-Rule	Russia	1919	only	-	Jul	 1	 2:00	1:00	MSD
+#
+Rule	Russia	1919	only	-	Jul	 1	 0:00u	1:00	MSD
 Rule	Russia	1919	only	-	Aug	16	 0:00	0	MSK
+#
+# Decree No. 63 (1921-02-03) http://istmat.info/node/45840
 Rule	Russia	1921	only	-	Feb	14	23:00	1:00	MSD
-Rule	Russia	1921	only	-	Mar	20	23:00	2:00	MSM  # Midsummer
+#
+# Decree No. 121 (1921-03-07) http://istmat.info/node/45949
+Rule	Russia	1921	only	-	Mar	20	23:00	2:00	+05
+#
 Rule	Russia	1921	only	-	Sep	 1	 0:00	1:00	MSD
 Rule	Russia	1921	only	-	Oct	 1	 0:00	0	-
 # Act No. 925 of the Council of Ministers of the USSR (1980-10-24):
@@ -798,8 +814,6 @@
 # From Alexander Bokovoy (2014-10-09):
 # Belarussian government decided against changing to winter time....
 # http://eng.belta.by/all_news/society/Belarus-decides-against-adjusting-time-in-Russias-wake_i_76335.html
-# From Paul Eggert (2014-10-08):
-# Hence Belarus can share time zone abbreviations with Moscow again.
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Europe/Minsk	1:50:16 -	LMT	1880
@@ -810,8 +824,7 @@
 			3:00	Russia	MSK/MSD	1990
 			3:00	-	MSK	1991 Mar 31  2:00s
 			2:00	Russia	EE%sT	2011 Mar 27  2:00s
-			3:00	-	FET	2014 Oct 26  1:00s
-			3:00	-	MSK
+			3:00	-	+03
 
 # Belgium
 #
@@ -1319,7 +1332,7 @@
 # http://www.parlament-berlin.de/pds-fraktion.nsf/727459127c8b66ee8525662300459099/defc77cb784f180ac1256c2b0030274b/$FILE/bersarint.pdf
 # says that Bersarin issued an order to use Moscow time on May 20.
 # However, Moscow did not observe daylight saving in 1945, so
-# this was equivalent to CEMT (GMT+3), not GMT+4.
+# this was equivalent to UT +03, not +04.
 
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
@@ -2283,7 +2296,6 @@
 # http://www.worldtimezone.com/dst_news/dst_news_russia-map-2014-07.html
 
 # From Paul Eggert (2006-03-22):
-# Except for Moscow after 1919-07-01, I invented the time zone abbreviations.
 # Moscow time zone abbreviations after 1919-07-01, and Moscow rules after 1991,
 # are from Andrey A. Chernov.  The rest is from Shanks & Pottenger,
 # except we follow Chernov's report that 1992 DST transitions were Sat
@@ -2359,7 +2371,7 @@
 			 2:00	Poland	CE%sT	1946
 			 3:00	Russia	MSK/MSD	1989 Mar 26  2:00s
 			 2:00	Russia	EE%sT	2011 Mar 27  2:00s
-			 3:00	-	FET	2014 Oct 26  2:00s
+			 3:00	-	+03	2014 Oct 26  2:00s
 			 2:00	-	EET
 
 
@@ -2412,6 +2424,16 @@
 # 78	RU-SPE	Saint Petersburg
 # 83	RU-NEN	Nenets Autonomous Okrug
 
+# From Paul Eggert (2016-08-23):
+# The Soviets switched to UT-based time in 1919.  Decree No. 59
+# (1919-02-08) http://istmat.info/node/35567 established UT-based time
+# zones, and Decree No. 147 (1919-03-29) http://istmat.info/node/35854
+# specified a transition date of 1919-07-01, apparently at 00:00 UT.
+# No doubt only the Soviet-controlled regions switched on that date;
+# later transitions to UT-based time in other parts of Russia are
+# taken from what appear to be guesses by Shanks.
+# (Thanks to Alexander Belopolsky for pointers to the decrees.)
+
 # From Stepan Golosunov (2016-03-07):
 # 11. Regions-violators, 1981-1982.
 # Wikipedia refers to
@@ -2453,7 +2475,7 @@
 # attributes the 1982 changes to the Act of the Council of Ministers
 # of the USSR No. 126 from 18.02.1982.  1980-925.txt also adds
 # Udmurtia to the list of affected territories and lists Khatangsky
-# district separately from Taymyr Autonomous Okurg.  Probably erroneously.
+# district separately from Taymyr Autonomous Okrug.  Probably erroneously.
 #
 # The affected territories are currently listed under Europe/Moscow,
 # Asia/Yekaterinburg and Asia/Krasnoyarsk.
@@ -2513,7 +2535,7 @@
 
 Zone Europe/Moscow	 2:30:17 -	LMT	1880
 			 2:30:17 -	MMT	1916 Jul  3 # Moscow Mean Time
-			 2:31:19 Russia	%s	1919 Jul  1  2:00
+			 2:31:19 Russia	%s	1919 Jul  1  0:00u
 			 3:00	Russia	%s	1921 Oct
 			 3:00	Russia	MSK/MSD	1922 Oct
 			 2:00	-	EET	1930 Jun 21
@@ -2596,22 +2618,21 @@
 # The 1988 transition is from USSR act No. 5 (1988-01-04).
 
 Zone Europe/Volgograd	 2:57:40 -	LMT	1920 Jan  3
-			 3:00	-	TSAT	1925 Apr  6 # Tsaritsyn Time
-			 3:00	-	STAT	1930 Jun 21 # Stalingrad Time
-			 4:00	-	STAT	1961 Nov 11
-			 4:00	Russia	VOL%sT	1988 Mar 27  2:00s # Volgograd T
-			 3:00	Russia	VOL%sT	1991 Mar 31  2:00s
-			 4:00	-	VOLT	1992 Mar 29  2:00s
-			 3:00	Russia	MSK/MSD	2011 Mar 27  2:00s
-			 4:00	-	MSK	2014 Oct 26  2:00s
-			 3:00	-	MSK
+			 3:00	-	+03	1930 Jun 21
+			 4:00	-	+04	1961 Nov 11
+			 4:00	Russia	+04/+05	1988 Mar 27  2:00s
+			 3:00	Russia	+03/+04	1991 Mar 31  2:00s
+			 4:00	-	+04	1992 Mar 29  2:00s
+			 3:00	Russia	+03/+04	2011 Mar 27  2:00s
+			 4:00	-	+04	2014 Oct 26  2:00s
+			 3:00	-	+03
 
 # From Paul Eggert (2016-03-18):
 # Europe/Kirov covers:
 # 43	RU-KIR	Kirov Oblast
 # The 1989 transition is from USSR act No. 227 (1989-03-14).
 #
-Zone Europe/Kirov	 3:18:48 -	LMT	1919 Jul  1  2:00
+Zone Europe/Kirov	 3:18:48 -	LMT	1919 Jul  1  0:00u
 			 3:00	-	+03	1930 Jun 21
 			 4:00	Russia	+04/+05	1989 Mar 26  2:00s
 			 3:00	Russia	+03/+04	1991 Mar 31  2:00s
@@ -2629,16 +2650,16 @@
 # Byalokoz 1919 says Samara was 3:20:20.
 # The 1989 transition is from USSR act No. 227 (1989-03-14).
 
-Zone Europe/Samara	 3:20:20 -	LMT	1919 Jul  1  2:00
-			 3:00	-	SAMT	1930 Jun 21 # Samara Time
-			 4:00	-	SAMT	1935 Jan 27
-			 4:00	Russia	KUY%sT	1989 Mar 26  2:00s # Kuybyshev
-			 3:00	Russia	MSK/MSD	1991 Mar 31  2:00s
-			 2:00	Russia	EE%sT	1991 Sep 29  2:00s
-			 3:00	-	SAMT	1991 Oct 20  3:00
-			 4:00	Russia	SAM%sT	2010 Mar 28  2:00s
-			 3:00	Russia	SAM%sT	2011 Mar 27  2:00s
-			 4:00	-	SAMT
+Zone Europe/Samara	 3:20:20 -	LMT	1919 Jul  1  0:00u
+			 3:00	-	+03	1930 Jun 21
+			 4:00	-	+04	1935 Jan 27
+			 4:00	Russia	+04/+05	1989 Mar 26  2:00s
+			 3:00	Russia	+03/+04	1991 Mar 31  2:00s
+			 2:00	Russia	+02/+03	1991 Sep 29  2:00s
+			 3:00	-	+03	1991 Oct 20  3:00
+			 4:00	Russia	+04/+05	2010 Mar 28  2:00s
+			 3:00	Russia	+03/+04	2011 Mar 27  2:00s
+			 4:00	-	+04
 
 # From Paul Eggert (2016-03-18):
 # Europe/Ulyanovsk covers:
@@ -2653,7 +2674,7 @@
 # From Matt Johnson (2016-03-09):
 # http://publication.pravo.gov.ru/Document/View/0001201603090051
 
-Zone Europe/Ulyanovsk	 3:13:36 -	LMT	1919 Jul  1  2:00
+Zone Europe/Ulyanovsk	 3:13:36 -	LMT	1919 Jul  1  0:00u
 			 3:00	-	+03	1930 Jun 21
 			 4:00	Russia	+04/+05	1989 Mar 26  2:00s
 			 3:00	Russia	+03/+04	1991 Mar 31  2:00s
@@ -2685,12 +2706,12 @@
 
 Zone Asia/Yekaterinburg	 4:02:33 -	LMT	1916 Jul  3
 			 3:45:05 -	PMT	1919 Jul 15  4:00
-			 4:00	-	SVET	1930 Jun 21 # Sverdlovsk Time
-			 5:00	Russia	SVE%sT	1991 Mar 31  2:00s
-			 4:00	Russia	SVE%sT	1992 Jan 19  2:00s
-			 5:00	Russia	YEK%sT	2011 Mar 27  2:00s
-			 6:00	-	YEKT	2014 Oct 26  2:00s
-			 5:00	-	YEKT
+			 4:00	-	+04	1930 Jun 21
+			 5:00	Russia	+05/+06	1991 Mar 31  2:00s
+			 4:00	Russia	+04/+05	1992 Jan 19  2:00s
+			 5:00	Russia	+05/+06	2011 Mar 27  2:00s
+			 6:00	-	+06	2014 Oct 26  2:00s
+			 5:00	-	+05
 
 
 # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2001-08-25):
@@ -2700,12 +2721,12 @@
 # Byalokoz 1919 says Omsk was 4:53:30.
 
 Zone Asia/Omsk		 4:53:30 -	LMT	1919 Nov 14
-			 5:00	-	OMST	1930 Jun 21 # Omsk Time
-			 6:00	Russia	OMS%sT	1991 Mar 31  2:00s
-			 5:00	Russia	OMS%sT	1992 Jan 19  2:00s
-			 6:00	Russia	OMS%sT	2011 Mar 27  2:00s
-			 7:00	-	OMST	2014 Oct 26  2:00s
-			 6:00	-	OMST
+			 5:00	-	+05	1930 Jun 21
+			 6:00	Russia	+06/+07	1991 Mar 31  2:00s
+			 5:00	Russia	+05/+06	1992 Jan 19  2:00s
+			 6:00	Russia	+06/+07	2011 Mar 27  2:00s
+			 7:00	-	+07	2014 Oct 26  2:00s
+			 6:00	-	+06
 
 # From Paul Eggert (2016-02-22):
 # Asia/Barnaul covers:
@@ -2785,7 +2806,7 @@
 # Note that time belts (numbered from 2 (Moscow) to 12 according to their
 # GMT/UTC offset and having too many exceptions like regions formally
 # belonging to one belt but using time from another) were replaced
-# with time zones in 2011 with different numberings (there was a
+# with time zones in 2011 with different numbering (there was a
 # 2-hour gap between second and third zones in 2011-2014).
 
 # From Stepan Golosunov (2016-04-12):
@@ -2868,12 +2889,12 @@
 # Byalokoz 1919 says Krasnoyarsk was 6:11:26.
 
 Zone Asia/Krasnoyarsk	 6:11:26 -	LMT	1920 Jan  6
-			 6:00	-	KRAT	1930 Jun 21 # Krasnoyarsk Time
-			 7:00	Russia	KRA%sT	1991 Mar 31  2:00s
-			 6:00	Russia	KRA%sT	1992 Jan 19  2:00s
-			 7:00	Russia	KRA%sT	2011 Mar 27  2:00s
-			 8:00	-	KRAT	2014 Oct 26  2:00s
-			 7:00	-	KRAT
+			 6:00	-	+06	1930 Jun 21
+			 7:00	Russia	+07/+08	1991 Mar 31  2:00s
+			 6:00	Russia	+06/+07	1992 Jan 19  2:00s
+			 7:00	Russia	+07/+08	2011 Mar 27  2:00s
+			 8:00	-	+08	2014 Oct 26  2:00s
+			 7:00	-	+07
 
 
 # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2001-08-25):
@@ -2890,12 +2911,12 @@
 
 Zone Asia/Irkutsk	 6:57:05 -	LMT	1880
 			 6:57:05 -	IMT	1920 Jan 25 # Irkutsk Mean Time
-			 7:00	-	IRKT	1930 Jun 21 # Irkutsk Time
-			 8:00	Russia	IRK%sT	1991 Mar 31  2:00s
-			 7:00	Russia	IRK%sT	1992 Jan 19  2:00s
-			 8:00	Russia	IRK%sT	2011 Mar 27  2:00s
-			 9:00	-	IRKT	2014 Oct 26  2:00s
-			 8:00	-	IRKT
+			 7:00	-	+07	1930 Jun 21
+			 8:00	Russia	+08/+09	1991 Mar 31  2:00s
+			 7:00	Russia	+07/+08	1992 Jan 19  2:00s
+			 8:00	Russia	+08/+09	2011 Mar 27  2:00s
+			 9:00	-	+09	2014 Oct 26  2:00s
+			 8:00	-	+08
 
 
 # From Tim Parenti (2014-07-06):
@@ -2912,13 +2933,13 @@
 # http://publication.pravo.gov.ru/Document/View/0001201512300107
 
 Zone Asia/Chita	 7:33:52 -	LMT	1919 Dec 15
-			 8:00	-	YAKT	1930 Jun 21 # Yakutsk Time
-			 9:00	Russia	YAK%sT	1991 Mar 31  2:00s
-			 8:00	Russia	YAK%sT	1992 Jan 19  2:00s
-			 9:00	Russia	YAK%sT	2011 Mar 27  2:00s
-			10:00	-	YAKT	2014 Oct 26  2:00s
-			 8:00	-	IRKT	2016 Mar 27  2:00
-			 9:00	-	YAKT
+			 8:00	-	+08	1930 Jun 21
+			 9:00	Russia	+09/+10	1991 Mar 31  2:00s
+			 8:00	Russia	+08/+09	1992 Jan 19  2:00s
+			 9:00	Russia	+09/+10	2011 Mar 27  2:00s
+			10:00	-	+10	2014 Oct 26  2:00s
+			 8:00	-	+08	2016 Mar 27  2:00
+			 9:00	-	+09
 
 
 # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2009-11-29):
@@ -2958,12 +2979,12 @@
 # Byalokoz 1919 says Yakutsk was 8:38:58.
 
 Zone Asia/Yakutsk	 8:38:58 -	LMT	1919 Dec 15
-			 8:00	-	YAKT	1930 Jun 21 # Yakutsk Time
-			 9:00	Russia	YAK%sT	1991 Mar 31  2:00s
-			 8:00	Russia	YAK%sT	1992 Jan 19  2:00s
-			 9:00	Russia	YAK%sT	2011 Mar 27  2:00s
-			10:00	-	YAKT	2014 Oct 26  2:00s
-			 9:00	-	YAKT
+			 8:00	-	+08	1930 Jun 21
+			 9:00	Russia	+09/+10	1991 Mar 31  2:00s
+			 8:00	Russia	+08/+09	1992 Jan 19  2:00s
+			 9:00	Russia	+09/+10	2011 Mar 27  2:00s
+			10:00	-	+10	2014 Oct 26  2:00s
+			 9:00	-	+09
 
 
 # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2009-11-29):
@@ -2981,12 +3002,12 @@
 # Go with Byalokoz.
 
 Zone Asia/Vladivostok	 8:47:31 -	LMT	1922 Nov 15
-			 9:00	-	VLAT	1930 Jun 21 # Vladivostok Time
-			10:00	Russia	VLA%sT	1991 Mar 31  2:00s
-			 9:00	Russia	VLA%sT	1992 Jan 19  2:00s
-			10:00	Russia	VLA%sT	2011 Mar 27  2:00s
-			11:00	-	VLAT	2014 Oct 26  2:00s
-			10:00	-	VLAT
+			 9:00	-	+09	1930 Jun 21
+			10:00	Russia	+10/+11	1991 Mar 31  2:00s
+			 9:00	Russia	+09/+10	1992 Jan 19  2:00s
+			10:00	Russia	+10/+11	2011 Mar 27  2:00s
+			11:00	-	+11	2014 Oct 26  2:00s
+			10:00	-	+10
 
 
 # From Tim Parenti (2014-07-03):
@@ -3004,14 +3025,14 @@
 # This transition is no doubt wrong, but we have no better info.
 
 Zone Asia/Khandyga	 9:02:13 -	LMT	1919 Dec 15
-			 8:00	-	YAKT	1930 Jun 21 # Yakutsk Time
-			 9:00	Russia	YAK%sT	1991 Mar 31  2:00s
-			 8:00	Russia	YAK%sT	1992 Jan 19  2:00s
-			 9:00	Russia	YAK%sT	2004
-			10:00	Russia	VLA%sT	2011 Mar 27  2:00s
-			11:00	-	VLAT	2011 Sep 13  0:00s # Decree 725?
-			10:00	-	YAKT	2014 Oct 26  2:00s
-			 9:00	-	YAKT
+			 8:00	-	+08	1930 Jun 21
+			 9:00	Russia	+09/+10	1991 Mar 31  2:00s
+			 8:00	Russia	+08/+09	1992 Jan 19  2:00s
+			 9:00	Russia	+09/+10	2004
+			10:00	Russia	+10/+11	2011 Mar 27  2:00s
+			11:00	-	+11	2011 Sep 13  0:00s # Decree 725?
+			10:00	-	+10	2014 Oct 26  2:00s
+			 9:00	-	+09
 
 
 # From Tim Parenti (2014-07-03):
@@ -3027,15 +3048,14 @@
 
 # The Zone name should be Asia/Yuzhno-Sakhalinsk, but that's too long.
 Zone Asia/Sakhalin	 9:30:48 -	LMT	1905 Aug 23
-			 9:00	-	JCST	1937 Oct  1
-			 9:00	-	JST	1945 Aug 25
-			11:00	Russia	SAK%sT	1991 Mar 31  2:00s # Sakhalin T
-			10:00	Russia	SAK%sT	1992 Jan 19  2:00s
-			11:00	Russia	SAK%sT	1997 Mar lastSun  2:00s
-			10:00	Russia	SAK%sT	2011 Mar 27  2:00s
-			11:00	-	SAKT	2014 Oct 26  2:00s
-			10:00	-	SAKT	2016 Mar 27  2:00s
-			11:00	-	SAKT
+			 9:00	-	+09	1945 Aug 25
+			11:00	Russia	+11/+12	1991 Mar 31  2:00s # Sakhalin T
+			10:00	Russia	+10/+11	1992 Jan 19  2:00s
+			11:00	Russia	+11/+12	1997 Mar lastSun  2:00s
+			10:00	Russia	+10/+11	2011 Mar 27  2:00s
+			11:00	-	+11	2014 Oct 26  2:00s
+			10:00	-	+10	2016 Mar 27  2:00s
+			11:00	-	+11
 
 
 # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2009-11-29):
@@ -3058,13 +3078,13 @@
 # http://publication.pravo.gov.ru/Document/View/0001201604050038
 
 Zone Asia/Magadan	10:03:12 -	LMT	1924 May  2
-			10:00	-	MAGT	1930 Jun 21 # Magadan Time
-			11:00	Russia	MAG%sT	1991 Mar 31  2:00s
-			10:00	Russia	MAG%sT	1992 Jan 19  2:00s
-			11:00	Russia	MAG%sT	2011 Mar 27  2:00s
-			12:00	-	MAGT	2014 Oct 26  2:00s
-			10:00	-	MAGT	2016 Apr 24  2:00s
-			11:00	-	MAGT
+			10:00	-	+10	1930 Jun 21 # Magadan Time
+			11:00	Russia	+11/+12	1991 Mar 31  2:00s
+			10:00	Russia	+10/+11	1992 Jan 19  2:00s
+			11:00	Russia	+11/+12	2011 Mar 27  2:00s
+			12:00	-	+12	2014 Oct 26  2:00s
+			10:00	-	+10	2016 Apr 24  2:00s
+			11:00	-	+11
 
 
 # From Tim Parenti (2014-07-06):
@@ -3107,17 +3127,14 @@
 # in Russian.)  In addition, Srednekolymsk appears to be a much older
 # settlement and the population of Zyryanka seems to be declining.
 # Go with Srednekolymsk.
-#
-# Since Magadan Oblast moves to UTC+10 on 2014-10-26, we cannot keep using MAGT
-# as the abbreviation.  Use SRET instead.
 
 Zone Asia/Srednekolymsk	10:14:52 -	LMT	1924 May  2
-			10:00	-	MAGT	1930 Jun 21 # Magadan Time
-			11:00	Russia	MAG%sT	1991 Mar 31  2:00s
-			10:00	Russia	MAG%sT	1992 Jan 19  2:00s
-			11:00	Russia	MAG%sT	2011 Mar 27  2:00s
-			12:00	-	MAGT	2014 Oct 26  2:00s
-			11:00	-	SRET	# Srednekolymsk Time
+			10:00	-	+10	1930 Jun 21
+			11:00	Russia	+11/+12	1991 Mar 31  2:00s
+			10:00	Russia	+10/+11	1992 Jan 19  2:00s
+			11:00	Russia	+11/+12	2011 Mar 27  2:00s
+			12:00	-	+12	2014 Oct 26  2:00s
+			11:00	-	+11
 
 
 # From Tim Parenti (2014-07-03):
@@ -3135,14 +3152,14 @@
 # UTC+12 since at least then, too.
 
 Zone Asia/Ust-Nera	 9:32:54 -	LMT	1919 Dec 15
-			 8:00	-	YAKT	1930 Jun 21 # Yakutsk Time
-			 9:00	Russia	YAKT	1981 Apr  1
-			11:00	Russia	MAG%sT	1991 Mar 31  2:00s
-			10:00	Russia	MAG%sT	1992 Jan 19  2:00s
-			11:00	Russia	MAG%sT	2011 Mar 27  2:00s
-			12:00	-	MAGT	2011 Sep 13  0:00s # Decree 725?
-			11:00	-	VLAT	2014 Oct 26  2:00s
-			10:00	-	VLAT
+			 8:00	-	+08	1930 Jun 21
+			 9:00	Russia	+09/+10	1981 Apr  1
+			11:00	Russia	+11/+12	1991 Mar 31  2:00s
+			10:00	Russia	+10/+11	1992 Jan 19  2:00s
+			11:00	Russia	+11/+12	2011 Mar 27  2:00s
+			12:00	-	+12	2011 Sep 13  0:00s # Decree 725?
+			11:00	-	+11	2014 Oct 26  2:00s
+			10:00	-	+10
 
 
 # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2001-08-25):
@@ -3155,12 +3172,12 @@
 # The Zone name should be Asia/Petropavlovsk-Kamchatski or perhaps
 # Asia/Petropavlovsk-Kamchatsky, but these are too long.
 Zone Asia/Kamchatka	10:34:36 -	LMT	1922 Nov 10
-			11:00	-	PETT	1930 Jun 21 # P-K Time
-			12:00	Russia	PET%sT	1991 Mar 31  2:00s
-			11:00	Russia	PET%sT	1992 Jan 19  2:00s
-			12:00	Russia	PET%sT	2010 Mar 28  2:00s
-			11:00	Russia	PET%sT	2011 Mar 27  2:00s
-			12:00	-	PETT
+			11:00	-	+11	1930 Jun 21
+			12:00	Russia	+12/+13	1991 Mar 31  2:00s
+			11:00	Russia	+11/+12	1992 Jan 19  2:00s
+			12:00	Russia	+12/+13	2010 Mar 28  2:00s
+			11:00	Russia	+11/+12	2011 Mar 27  2:00s
+			12:00	-	+12
 
 
 # From Tim Parenti (2014-07-03):
@@ -3168,13 +3185,13 @@
 # 87	RU-CHU	Chukotka Autonomous Okrug
 
 Zone Asia/Anadyr	11:49:56 -	LMT	1924 May  2
-			12:00	-	ANAT	1930 Jun 21 # Anadyr Time
-			13:00	Russia	ANA%sT	1982 Apr  1  0:00s
-			12:00	Russia	ANA%sT	1991 Mar 31  2:00s
-			11:00	Russia	ANA%sT	1992 Jan 19  2:00s
-			12:00	Russia	ANA%sT	2010 Mar 28  2:00s
-			11:00	Russia	ANA%sT	2011 Mar 27  2:00s
-			12:00	-	ANAT
+			12:00	-	+12	1930 Jun 21
+			13:00	Russia	+13/+14	1982 Apr  1  0:00s
+			12:00	Russia	+12/+13	1991 Mar 31  2:00s
+			11:00	Russia	+11/+12	1992 Jan 19  2:00s
+			12:00	Russia	+12/+13	2010 Mar 28  2:00s
+			11:00	Russia	+11/+12	2011 Mar 27  2:00s
+			12:00	-	+12
 
 
 # San Marino
@@ -3495,6 +3512,14 @@
 # Engineered Standard Time," said Twitter user @aysekarahasan.
 # http://www.bbc.com/news/world-europe-34631326
 
+# From Burak AYDIN (2016-09-08):
+# Turkey will stay in Daylight Saving Time even in winter....
+# http://www.resmigazete.gov.tr/eskiler/2016/09/20160908-2.pdf
+#
+# From Paul Eggert (2016-09-07):
+# The change is permanent, so this is the new standard time in Turkey.
+# It takes effect today, which is not much notice.
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Turkey	1916	only	-	May	 1	0:00	1:00	S
 Rule	Turkey	1916	only	-	Oct	 1	0:00	0	-
@@ -3558,7 +3583,7 @@
 Zone	Europe/Istanbul	1:55:52 -	LMT	1880
 			1:56:56	-	IMT	1910 Oct # Istanbul Mean Time?
 			2:00	Turkey	EE%sT	1978 Oct 15
-			3:00	Turkey	TR%sT	1985 Apr 20 # Turkey Time
+			3:00	Turkey	+03/+04	1985 Apr 20
 			2:00	Turkey	EE%sT	2007
 			2:00	EU	EE%sT	2011 Mar 27  1:00u
 			2:00	-	EET	2011 Mar 28  1:00u
@@ -3566,7 +3591,8 @@
 			2:00	-	EET	2014 Mar 31  1:00u
 			2:00	EU	EE%sT	2015 Oct 25  1:00u
 			2:00	1:00	EEST	2015 Nov  8  1:00u
-			2:00	EU	EE%sT
+			2:00	EU	EE%sT	2016 Sep  7
+			3:00	-	+03
 Link	Europe/Istanbul	Asia/Istanbul	# Istanbul is in both continents.
 
 # Ukraine
--- a/jdk/make/data/tzdata/factory	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/make/data/tzdata/factory	Wed Jul 05 22:19:13 2017 +0200
@@ -24,9 +24,10 @@
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
-# For companies who don't want to put time zone specification in
-# their installation procedures.  When users run date, they'll get the message.
-# Also useful for the "comp.sources" version.
+# For distributors who don't want to put time zone specification in
+# their installation procedures.  Users that run 'date' will get the
+# time zone abbreviation "-00", indicating that the actual time zone
+# is unknown.
 
 # Zone	NAME	GMTOFF	RULES	FORMAT
-Zone	Factory	0	- "Local time zone must be set--see zic manual page"
+Zone	Factory	0	-	-00
--- a/jdk/make/data/tzdata/leapseconds	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/make/data/tzdata/leapseconds	Wed Jul 05 22:19:13 2017 +0200
@@ -79,6 +79,7 @@
 Leap	2008	Dec	31	23:59:60	+	S
 Leap	2012	Jun	30	23:59:60	+	S
 Leap	2015	Jun	30	23:59:60	+	S
+Leap	2016	Dec	31	23:59:60	+	S
 
-#	Updated through IERS Bulletin C51
-#	File expires on:  28 December 2016
+#	Updated through IERS Bulletin C52
+#	File expires on:  28 June 2017
--- a/jdk/make/data/tzdata/northamerica	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/make/data/tzdata/northamerica	Wed Jul 05 22:19:13 2017 +0200
@@ -436,11 +436,42 @@
 # north of the Salmon River, and the towns of Burgdorf and Warren),
 # Nevada (except West Wendover), Oregon (except the northern 3/4 of
 # Malheur county), and Washington
+
+# From Paul Eggert (2016-08-20):
+# In early February 1948, in response to California's electricity shortage,
+# PG&E changed power frequency from 60 to 59.5 Hz during daylight hours,
+# causing electric clocks to lose six minutes per day.  (This did not change
+# legal time, and is not part of the data here.)  See:
+# Ross SA. An energy crisis from the past: Northern California in 1948.
+# Working Paper No. 8, Institute of Governmental Studies, UC Berkeley,
+# 1973-11.  http://escholarship.org/uc/item/8x22k30c
+#
+# In another measure to save electricity, DST was instituted from 1948-03-14
+# at 02:01 to 1949-01-16 at 02:00, with the governor having the option to move
+# the fallback transition earlier.  See pages 3-4 of:
+# http://clerk.assembly.ca.gov/sites/clerk.assembly.ca.gov/files/archive/Statutes/1948/48Vol1_Chapters.pdf
+#
+# In response:
+#
+#   Governor Warren received a torrent of objecting mail, and it is not too much
+#   to speculate that the objections to Daylight Saving Time were one important
+#   factor in the defeat of the Dewey-Warren Presidential ticket in California.
+#     -- Ross, p 25
+#
+# On December 8 the governor exercised the option, setting the date to January 1
+# (LA Times 1948-12-09).  The transition time was 02:00 (LA Times 1949-01-01).
+#
+# Despite the controversy, in 1949 California voters approved Proposition 12,
+# which established DST from April's last Sunday at 01:00 until September's
+# last Sunday at 02:00. This was amended by 1962's Proposition 6, which changed
+# the fall-back date to October's last Sunday. See:
+# http://repository.uchastings.edu/cgi/viewcontent.cgi?article=1501&context=ca_ballot_props
+# http://repository.uchastings.edu/cgi/viewcontent.cgi?article=1636&context=ca_ballot_props
 #
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
-Rule	CA	1948	only	-	Mar	14	2:00	1:00	D
+Rule	CA	1948	only	-	Mar	14	2:01	1:00	D
 Rule	CA	1949	only	-	Jan	 1	2:00	0	S
-Rule	CA	1950	1966	-	Apr	lastSun	2:00	1:00	D
+Rule	CA	1950	1966	-	Apr	lastSun	1:00	1:00	D
 Rule	CA	1950	1961	-	Sep	lastSun	2:00	0	S
 Rule	CA	1962	1966	-	Oct	lastSun	2:00	0	S
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -3304,7 +3335,7 @@
 # indicating that the normal ET rules are followed.
 #
 # From Paul Eggert (2014-08-19):
-# The 2014-08-13 Cabinet meeting decided to stay on UTC-4 year-round.  See:
+# The 2014-08-13 Cabinet meeting decided to stay on UT -04 year-round.  See:
 # http://tcweeklynews.com/daylight-savings-time-to-be-maintained-p5353-127.htm
 # Model this as a switch from EST/EDT to AST ...
 # From Chris Walton (2014-11-04):
--- a/jdk/make/data/tzdata/southamerica	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/make/data/tzdata/southamerica	Wed Jul 05 22:19:13 2017 +0200
@@ -433,9 +433,9 @@
 # stuck on Summer daylight savings time even though the summer is over.
 
 # From Paul Eggert (2013-09-05):
-# Perhaps San Luis operates on the legal fiction that it is at UTC-4
+# Perhaps San Luis operates on the legal fiction that it is at -04
 # with perpetual summer time, but ordinary usage typically seems to
-# just say it's at UTC-3; see, for example,
+# just say it's at -03; see, for example,
 # http://es.wikipedia.org/wiki/Hora_oficial_argentina
 # We've documented similar situations as being plain changes to
 # standard time, so let's do that here too.  This does not change UTC
--- a/jdk/make/data/tzdata/zone.tab	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/make/data/tzdata/zone.tab	Wed Jul 05 22:19:13 2017 +0200
@@ -284,7 +284,7 @@
 MH	+0905+16720	Pacific/Kwajalein	Kwajalein
 MK	+4159+02126	Europe/Skopje
 ML	+1239-00800	Africa/Bamako
-MM	+1647+09610	Asia/Rangoon
+MM	+1647+09610	Asia/Yangon
 MN	+4755+10653	Asia/Ulaanbaatar	Mongolia (most areas)
 MN	+4801+09139	Asia/Hovd	Bayan-Olgiy, Govi-Altai, Hovd, Uvs, Zavkhan
 MN	+4804+11430	Asia/Choibalsan	Dornod, Sukhbaatar
--- a/jdk/make/lib/CoreLibraries.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/make/lib/CoreLibraries.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -218,7 +218,7 @@
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LDFLAGS_windows := -export:ZIP_Open -export:ZIP_Close -export:ZIP_FindEntry \
         -export:ZIP_ReadEntry -export:ZIP_GetNextEntry \
-        -export:ZIP_InflateFully -export:ZIP_CRC32, \
+        -export:ZIP_InflateFully -export:ZIP_CRC32 -export:ZIP_FreeEntry, \
     LIBS_unix := -ljvm -ljava $(LIBZ), \
     LIBS_solaris := -lc, \
     LIBS_windows := jvm.lib $(WIN_JAVA_LIB), \
--- a/jdk/make/mapfiles/libnet/mapfile-vers	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/make/mapfiles/libnet/mapfile-vers	Wed Jul 05 22:19:13 2017 +0200
@@ -98,7 +98,6 @@
 		Java_sun_net_sdp_SdpSupport_create0;
 		Java_sun_net_spi_DefaultProxySelector_init;
 		Java_sun_net_spi_DefaultProxySelector_getSystemProxy;
-		NET_AllocSockaddr;
 		NET_SockaddrToInetAddress;
                 NET_SockaddrEqualsInetAddress;
 		NET_InetAddressToSockaddr;
--- a/jdk/make/mapfiles/libzip/mapfile-vers	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/make/mapfiles/libzip/mapfile-vers	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -49,6 +49,7 @@
 		Java_java_util_zip_Inflater_setDictionary;
 		ZIP_Close;
 		ZIP_CRC32;
+		ZIP_FreeEntry;
 		ZIP_FindEntry;
 		ZIP_GetEntry;
 		ZIP_GetNextEntry;
--- a/jdk/src/java.base/share/classes/java/io/FilePermission.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/io/FilePermission.java	Wed Jul 05 22:19:13 2017 +0200
@@ -25,11 +25,20 @@
 
 package java.io;
 
+import java.net.URI;
+import java.nio.file.*;
 import java.security.*;
 import java.util.Enumeration;
+import java.util.Objects;
 import java.util.StringJoiner;
 import java.util.Vector;
 import java.util.concurrent.ConcurrentHashMap;
+
+import jdk.internal.misc.JavaIOFilePermissionAccess;
+import jdk.internal.misc.SharedSecrets;
+import sun.nio.fs.DefaultFileSystemProvider;
+import sun.security.action.GetPropertyAction;
+import sun.security.util.FilePermCompat;
 import sun.security.util.SecurityConstants;
 
 /**
@@ -41,8 +50,11 @@
  * the file separator character, <code>File.separatorChar</code>) indicates
  * all the files and directories contained in that directory. A pathname
  * that ends with "/-" indicates (recursively) all files
- * and subdirectories contained in that directory. A pathname consisting of
- * the special token "&lt;&lt;ALL FILES&gt;&gt;" matches <b>any</b> file.
+ * and subdirectories contained in that directory. Such a pathname is called
+ * a wildcard pathname. Otherwise, it's a simple pathname.
+ * <P>
+ * A pathname consisting of the special token {@literal "<<ALL FILES>>"}
+ * matches <b>any</b> file.
  * <P>
  * Note: A pathname consisting of a single "*" indicates all the files
  * in the current directory, while a pathname consisting of a single "-"
@@ -75,12 +87,12 @@
  * <P>
  * Be careful when granting FilePermissions. Think about the implications
  * of granting read and especially write access to various files and
- * directories. The "&lt;&lt;ALL FILES&gt;&gt;" permission with write action is
+ * directories. The {@literal "<<ALL FILES>>"} permission with write action is
  * especially dangerous. This grants permission to write to the entire
  * file system. One thing this effectively allows is replacement of the
  * system binary, including the JVM runtime environment.
- *
- * <p>Please note: Code can always read a file from the same
+ * <P>
+ * Please note: Code can always read a file from the same
  * directory it's in (or a subdirectory of that directory); it does not
  * need explicit permission to do so.
  *
@@ -145,34 +157,127 @@
     private String actions; // Left null as long as possible, then
                             // created and re-used in the getAction function.
 
-    // canonicalized dir path. In the case of
-    // directories, it is the name "/blah/*" or "/blah/-" without
-    // the last character (the "*" or "-").
+    // canonicalized dir path. used by the "old" behavior (nb == false).
+    // In the case of directories, it is the name "/blah/*" or "/blah/-"
+    // without the last character (the "*" or "-").
 
     private transient String cpath;
 
+    // Following fields used by the "new" behavior (nb == true), in which
+    // input path is not canonicalized. For compatibility (so that granting
+    // FilePermission on "x" allows reading "`pwd`/x", an alternative path
+    // can be added so that both can be used in an implies() check. Please note
+    // the alternative path only deals with absolute/relative path, and does
+    // not deal with symlink/target.
+
+    private transient Path npath;       // normalized dir path.
+    private transient Path npath2;      // alternative normalized dir path.
+    private transient boolean allFiles; // whether this is <<ALL FILES>>
+
     // static Strings used by init(int mask)
     private static final char RECURSIVE_CHAR = '-';
     private static final char WILD_CHAR = '*';
 
-/*
-    public String toString()
-    {
-        StringBuffer sb = new StringBuffer();
-        sb.append("***\n");
-        sb.append("cpath = "+cpath+"\n");
-        sb.append("mask = "+mask+"\n");
-        sb.append("actions = "+getActions()+"\n");
-        sb.append("directory = "+directory+"\n");
-        sb.append("recursive = "+recursive+"\n");
-        sb.append("***\n");
-        return sb.toString();
-    }
-*/
+//    public String toString() {
+//        StringBuffer sb = new StringBuffer();
+//        sb.append("*** FilePermission on " + getName() + " ***");
+//        for (Field f : FilePermission.class.getDeclaredFields()) {
+//            if (!Modifier.isStatic(f.getModifiers())) {
+//                try {
+//                    sb.append(f.getName() + " = " + f.get(this));
+//                } catch (Exception e) {
+//                    sb.append(f.getName() + " = " + e.toString());
+//                }
+//                sb.append('\n');
+//            }
+//        }
+//        sb.append("***\n");
+//        return sb.toString();
+//    }
 
     private static final long serialVersionUID = 7930732926638008763L;
 
     /**
+     * Always use the internal default file system, in case it was modified
+     * with java.nio.file.spi.DefaultFileSystemProvider.
+     */
+    private static final java.nio.file.FileSystem builtInFS =
+            DefaultFileSystemProvider.create()
+                    .getFileSystem(URI.create("file:///"));
+
+    /**
+     * Creates FilePermission objects with special internals.
+     * See {@link FilePermCompat#newPermPlusAltPath(Permission)} and
+     * {@link FilePermCompat#newPermUsingAltPath(Permission)}.
+     */
+
+    private static final Path here = builtInFS.getPath(
+            GetPropertyAction.privilegedGetProperty("user.dir"));
+
+    /**
+     * A private constructor like a clone, only npath2 is not touched.
+     * @param input
+     */
+    private FilePermission(FilePermission input) {
+        super(input.getName());
+        this.npath = input.npath;
+        this.actions = input.actions;
+        this.allFiles = input.allFiles;
+        this.recursive = input.recursive;
+        this.directory = input.directory;
+        this.cpath = input.cpath;
+        this.mask = input.mask;
+    }
+
+    /**
+     * Returns the alternative path as a Path object, i.e. absolute path
+     * for a relative one, or vice versa.
+     *
+     * @param in a real path w/o "-" or "*" at the end, and not <<ALL FILES>>.
+     * @return the alternative path, or null if cannot find one.
+     */
+    private static Path altPath(Path in) {
+        try {
+            if (!in.isAbsolute()) {
+                return here.resolve(in).normalize();
+            } else {
+                return here.relativize(in).normalize();
+            }
+        } catch (IllegalArgumentException e) {
+            return null;
+        }
+    }
+
+    static {
+        SharedSecrets.setJavaIOFilePermissionAccess(
+            new JavaIOFilePermissionAccess() {
+                public FilePermission newPermPlusAltPath(FilePermission input) {
+                    if (input.npath2 == null && !input.allFiles) {
+                        Path npath2 = altPath(input.npath);
+                        if (npath2 != null) {
+                            FilePermission np = new FilePermission(input);
+                            np.npath2 = npath2;
+                            return np;
+                        }
+                    }
+                    return input;
+                }
+                public FilePermission newPermUsingAltPath(FilePermission input) {
+                    if (!input.allFiles) {
+                        Path npath2 = altPath(input.npath);
+                        if (npath2 != null) {
+                            FilePermission np = new FilePermission(input);
+                            np.npath = npath2;
+                            return np;
+                        }
+                    }
+                    return null;
+                }
+            }
+        );
+    }
+
+    /**
      * initialize a FilePermission object. Common to all constructors.
      * Also called during de-serialization.
      *
@@ -186,60 +291,106 @@
         if (mask == NONE)
                 throw new IllegalArgumentException("invalid actions mask");
 
-        if ((cpath = getName()) == null)
+        if (FilePermCompat.nb) {
+            String name = getName();
+
+            if (name == null)
+                throw new NullPointerException("name can't be null");
+
+            this.mask = mask;
+
+            if (name.equals("<<ALL FILES>>")) {
+                allFiles = true;
+                npath = builtInFS.getPath("");
+                // other fields remain default
+                return;
+            }
+
+            boolean rememberStar = false;
+            if (name.endsWith("*")) {
+                rememberStar = true;
+                recursive = false;
+                name = name.substring(0, name.length()-1) + "-";
+            }
+
+            try {
+                // new File() can "normalize" some name, for example, "/C:/X" on
+                // Windows. Some JDK codes generate such illegal names.
+                npath = builtInFS.getPath(new File(name).getPath())
+                        .normalize();
+            } catch (InvalidPathException ipe) {
+                // Still invalid. For compatibility reason, accept it
+                // but make this permission useless.
+                npath = builtInFS.getPath("-u-s-e-l-e-s-s-");
+                this.mask = NONE;
+            }
+
+            // lastName should always be non-null now
+            Path lastName = npath.getFileName();
+            if (lastName != null && lastName.toString().equals("-")) {
+                directory = true;
+                recursive = !rememberStar;
+                npath = npath.getParent();
+            }
+            if (npath == null) {
+                npath = builtInFS.getPath("");
+            }
+        } else {
+            if ((cpath = getName()) == null)
                 throw new NullPointerException("name can't be null");
 
-        this.mask = mask;
+            this.mask = mask;
 
-        if (cpath.equals("<<ALL FILES>>")) {
-            directory = true;
-            recursive = true;
-            cpath = "";
-            return;
-        }
+            if (cpath.equals("<<ALL FILES>>")) {
+                directory = true;
+                recursive = true;
+                cpath = "";
+                return;
+            }
 
-        // store only the canonical cpath if possible
-        cpath = AccessController.doPrivileged(new PrivilegedAction<>() {
-            public String run() {
-                try {
-                    String path = cpath;
-                    if (cpath.endsWith("*")) {
-                        // call getCanonicalPath with a path with wildcard character
-                        // replaced to avoid calling it with paths that are
-                        // intended to match all entries in a directory
-                        path = path.substring(0, path.length()-1) + "-";
-                        path = new File(path).getCanonicalPath();
-                        return path.substring(0, path.length()-1) + "*";
-                    } else {
-                        return new File(path).getCanonicalPath();
+            // store only the canonical cpath if possible
+            cpath = AccessController.doPrivileged(new PrivilegedAction<>() {
+                public String run() {
+                    try {
+                        String path = cpath;
+                        if (cpath.endsWith("*")) {
+                            // call getCanonicalPath with a path with wildcard character
+                            // replaced to avoid calling it with paths that are
+                            // intended to match all entries in a directory
+                            path = path.substring(0, path.length() - 1) + "-";
+                            path = new File(path).getCanonicalPath();
+                            return path.substring(0, path.length() - 1) + "*";
+                        } else {
+                            return new File(path).getCanonicalPath();
+                        }
+                    } catch (IOException ioe) {
+                        return cpath;
                     }
-                } catch (IOException ioe) {
-                    return cpath;
                 }
-            }
-        });
+            });
 
-        int len = cpath.length();
-        char last = ((len > 0) ? cpath.charAt(len - 1) : 0);
+            int len = cpath.length();
+            char last = ((len > 0) ? cpath.charAt(len - 1) : 0);
 
-        if (last == RECURSIVE_CHAR &&
-            cpath.charAt(len - 2) == File.separatorChar) {
-            directory = true;
-            recursive = true;
-            cpath = cpath.substring(0, --len);
-        } else if (last == WILD_CHAR &&
-            cpath.charAt(len - 2) == File.separatorChar) {
-            directory = true;
-            //recursive = false;
-            cpath = cpath.substring(0, --len);
-        } else {
-            // overkill since they are initialized to false, but
-            // commented out here to remind us...
-            //directory = false;
-            //recursive = false;
+            if (last == RECURSIVE_CHAR &&
+                    cpath.charAt(len - 2) == File.separatorChar) {
+                directory = true;
+                recursive = true;
+                cpath = cpath.substring(0, --len);
+            } else if (last == WILD_CHAR &&
+                    cpath.charAt(len - 2) == File.separatorChar) {
+                directory = true;
+                //recursive = false;
+                cpath = cpath.substring(0, --len);
+            } else {
+                // overkill since they are initialized to false, but
+                // commented out here to remind us...
+                //directory = false;
+                //recursive = false;
+            }
+
+            // XXX: at this point the path should be absolute. die if it isn't?
         }
-
-        // XXX: at this point the path should be absolute. die if it isn't?
     }
 
     /**
@@ -254,7 +405,7 @@
      * indicates all the files and directories contained in that directory.
      * A pathname that ends with "/-" indicates (recursively) all files and
      * subdirectories contained in that directory. The special pathname
-     * "&lt;&lt;ALL FILES&gt;&gt;" matches any file.
+     * {@literal "<<ALL FILES>>"} matches any file.
      *
      * <p>A pathname consisting of a single "*" indicates all the files
      * in the current directory, while a pathname consisting of a single "-"
@@ -264,6 +415,28 @@
      *
      * <p>A pathname containing an empty string represents an empty path.
      *
+     * @implNote In this implementation, the
+     * {@code jdk.io.permissionsUseCanonicalPath} system property dictates how
+     * the {@code path} argument is processed and stored.
+     * <P>
+     * If the value of the system property is set to {@code true}, {@code path}
+     * is canonicalized and stored as a String object named {@code cpath}.
+     * This means a relative path is converted to an absolute path, a Windows
+     * DOS-style 8.3 path is expanded to a long path, and a symbolic link is
+     * resolved to its target, etc.
+     * <P>
+     * If the value of the system property is set to {@code false}, {@code path}
+     * is converted to a {@link java.nio.file.Path} object named {@code npath}
+     * after {@link Path#normalize() normalization}. No canonicalization is
+     * performed which means the underlying file system is not accessed.
+     * <P>
+     * In either case, the "*" or "-" character at the end of a wildcard
+     * {@code path} is removed before canonicalization or normalization.
+     * It is stored in a separate wildcard flag field.
+     * <P>
+     * The default value of the {@code jdk.io.permissionsUseCanonicalPath}
+     * system property is {@code false} in this implementation.
+     *
      * @param path the pathname of the file/directory.
      * @param actions the action string.
      *
@@ -305,6 +478,38 @@
      *      "/tmp/*" encompasses all files in the "/tmp" directory,
      *      including the one named "foo".
      * </ul>
+     * <P>
+     * Precisely, a simple pathname implies another simple pathname
+     * if and only if they are equal. A simple pathname never implies
+     * a wildcard pathname. A wildcard pathname implies another wildcard
+     * pathname if and only if all simple pathnames implied by the latter
+     * are implied by the former. A wildcard pathname implies a simple
+     * pathname if and only if
+     * <ul>
+     *     <li>if the wildcard flag is "*", the simple pathname's path
+     *     must be right inside the wildcard pathname's path.
+     *     <li>if the wildcard flag is "-", the simple pathname's path
+     *     must be recursively inside the wildcard pathname's path.
+     * </ul>
+     * <P>
+     * {@literal "<<ALL FILES>>"} implies every other pathname. No pathname,
+     * except for {@literal "<<ALL FILES>>"} itself, implies
+     * {@literal "<<ALL FILES>>"}.
+     *
+     * @implNote
+     * If {@code jdk.io.permissionsUseCanonicalPath} is {@code true}, a
+     * simple {@code cpath} is inside a wildcard {@code cpath} if and only if
+     * after removing the base name (the last name in the pathname's name
+     * sequence) from the former the remaining part equals to the latter,
+     * a simple {@code cpath} is recursively inside a wildcard {@code cpath}
+     * if and only if the former starts with the latter.
+     * <p>
+     * If {@code jdk.io.permissionsUseCanonicalPath} is {@code false}, a
+     * simple {@code npath} is inside a wildcard {@code npath} if and only if
+     * {@code  simple_npath.relativize(wildcard_npath)} is exactly "..",
+     * a simple {@code npath} is recursively inside a wildcard {@code npath}
+     * if and only if {@code simple_npath.relativize(wildcard_npath)}
+     * is a series of one or more "..".
      *
      * @param p the permission to check against.
      *
@@ -334,45 +539,125 @@
      * @return the effective mask
      */
     boolean impliesIgnoreMask(FilePermission that) {
-        if (this.directory) {
-            if (this.recursive) {
-                // make sure that.path is longer then path so
-                // something like /foo/- does not imply /foo
-                if (that.directory) {
-                    return (that.cpath.length() >= this.cpath.length()) &&
-                            that.cpath.startsWith(this.cpath);
-                }  else {
-                    return ((that.cpath.length() > this.cpath.length()) &&
-                        that.cpath.startsWith(this.cpath));
+        if (FilePermCompat.nb) {
+            if (allFiles) {
+                return true;
+            }
+            if (that.allFiles) {
+                return false;
+            }
+            // Left at least same level of wildness as right
+            if ((this.recursive && that.recursive) != that.recursive
+                    || (this.directory && that.directory) != that.directory) {
+                return false;
+            }
+            // Same npath is good as long as both or neither are directories
+            if (this.npath.equals(that.npath)
+                    && this.directory == that.directory) {
+                return true;
+            }
+            int diff = containsPath(this.npath, that.npath);
+            // Right inside left is good if recursive
+            if (diff >= 1 && recursive) {
+                return true;
+            }
+            // Right right inside left if it is element in set
+            if (diff == 1 && directory && !that.directory) {
+                return true;
+            }
+
+            // Hack: if a npath2 field exists, apply the same checks
+            // on it as a fallback.
+            if (this.npath2 != null) {
+                if (this.npath2.equals(that.npath)
+                        && this.directory == that.directory) {
+                    return true;
+                }
+                diff = containsPath(this.npath2, that.npath);
+                if (diff >= 1 && recursive) {
+                    return true;
                 }
-            } else {
-                if (that.directory) {
-                    // if the permission passed in is a directory
-                    // specification, make sure that a non-recursive
-                    // permission (i.e., this object) can't imply a recursive
-                    // permission.
-                    if (that.recursive)
-                        return false;
-                    else
-                        return (this.cpath.equals(that.cpath));
+                if (diff == 1 && directory && !that.directory) {
+                    return true;
+                }
+            }
+
+            return false;
+        } else {
+            if (this.directory) {
+                if (this.recursive) {
+                    // make sure that.path is longer then path so
+                    // something like /foo/- does not imply /foo
+                    if (that.directory) {
+                        return (that.cpath.length() >= this.cpath.length()) &&
+                                that.cpath.startsWith(this.cpath);
+                    } else {
+                        return ((that.cpath.length() > this.cpath.length()) &&
+                                that.cpath.startsWith(this.cpath));
+                    }
                 } else {
-                    int last = that.cpath.lastIndexOf(File.separatorChar);
-                    if (last == -1)
-                        return false;
-                    else {
-                        // this.cpath.equals(that.cpath.substring(0, last+1));
-                        // Use regionMatches to avoid creating new string
-                        return (this.cpath.length() == (last + 1)) &&
-                            this.cpath.regionMatches(0, that.cpath, 0, last+1);
+                    if (that.directory) {
+                        // if the permission passed in is a directory
+                        // specification, make sure that a non-recursive
+                        // permission (i.e., this object) can't imply a recursive
+                        // permission.
+                        if (that.recursive)
+                            return false;
+                        else
+                            return (this.cpath.equals(that.cpath));
+                    } else {
+                        int last = that.cpath.lastIndexOf(File.separatorChar);
+                        if (last == -1)
+                            return false;
+                        else {
+                            // this.cpath.equals(that.cpath.substring(0, last+1));
+                            // Use regionMatches to avoid creating new string
+                            return (this.cpath.length() == (last + 1)) &&
+                                    this.cpath.regionMatches(0, that.cpath, 0, last + 1);
+                        }
                     }
                 }
+            } else if (that.directory) {
+                // if this is NOT recursive/wildcarded,
+                // do not let it imply a recursive/wildcarded permission
+                return false;
+            } else {
+                return (this.cpath.equals(that.cpath));
             }
-        } else if (that.directory) {
-            // if this is NOT recursive/wildcarded,
-            // do not let it imply a recursive/wildcarded permission
-            return false;
-        } else {
-            return (this.cpath.equals(that.cpath));
+        }
+    }
+
+    /**
+     * Returns the depth between an outer path p1 and an inner path p2. -1
+     * is returned if
+     *
+     * - p1 does not contains p2.
+     * - this is not decidable. For example, p1="../x", p2="y".
+     * - the depth is not decidable. For example, p1="/", p2="x".
+     *
+     * This method can return 2 if the depth is greater than 2.
+     *
+     * @param p1 the expected outer path, normalized
+     * @param p2 the expected inner path, normalized
+     * @return the depth in between
+     */
+    private static int containsPath(Path p1, Path p2) {
+        Path p;
+        try {
+            p = p2.relativize(p1).normalize();
+            if (p.getName(0).toString().isEmpty()) {
+                return 0;
+            } else {
+                for (Path item: p) {
+                    String s = item.toString();
+                    if (!s.equals("..")) {
+                        return -1;
+                    }
+                }
+                return p.getNameCount();
+            }
+        } catch (IllegalArgumentException iae) {
+            return -1;
         }
     }
 
@@ -380,6 +665,12 @@
      * Checks two FilePermission objects for equality. Checks that <i>obj</i> is
      * a FilePermission, and has the same pathname and actions as this object.
      *
+     * @implNote More specifically, two pathnames are the same if and only if
+     * they have the same wildcard flag and their {@code cpath}
+     * (if {@code jdk.io.permissionsUseCanonicalPath} is {@code true}) or
+     * {@code npath} (if {@code jdk.io.permissionsUseCanonicalPath}
+     * is {@code false}) are equal. Or they are both {@literal "<<ALL FILES>>"}.
+     *
      * @param obj the object we are testing for equality with this object.
      * @return <code>true</code> if obj is a FilePermission, and has the same
      *          pathname and actions as this FilePermission object,
@@ -395,10 +686,18 @@
 
         FilePermission that = (FilePermission) obj;
 
-        return (this.mask == that.mask) &&
-            this.cpath.equals(that.cpath) &&
-            (this.directory == that.directory) &&
-            (this.recursive == that.recursive);
+        if (FilePermCompat.nb) {
+            return (this.mask == that.mask) &&
+                    (this.allFiles == that.allFiles) &&
+                    this.npath.equals(that.npath) &&
+                    (this.directory == that.directory) &&
+                    (this.recursive == that.recursive);
+        } else {
+            return (this.mask == that.mask) &&
+                    this.cpath.equals(that.cpath) &&
+                    (this.directory == that.directory) &&
+                    (this.recursive == that.recursive);
+        }
     }
 
     /**
@@ -408,7 +707,11 @@
      */
     @Override
     public int hashCode() {
-        return 0;
+        if (FilePermCompat.nb) {
+            return Objects.hash(mask, allFiles, directory, recursive, npath);
+        } else {
+            return 0;
+        }
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java	Wed Jul 05 22:19:13 2017 +0200
@@ -292,9 +292,6 @@
         new ProtectionDomain(new CodeSource(null, (Certificate[]) null),
                              null, this, null);
 
-    // The initiating protection domains for all classes loaded by this loader
-    private final Set<ProtectionDomain> domains;
-
     // Invoked by the VM to record every loaded class with this loader.
     void addClass(Class<?> c) {
         classes.addElement(c);
@@ -349,13 +346,11 @@
         if (ParallelLoaders.isRegistered(this.getClass())) {
             parallelLockMap = new ConcurrentHashMap<>();
             package2certs = new ConcurrentHashMap<>();
-            domains = Collections.synchronizedSet(new HashSet<>());
             assertionLock = new Object();
         } else {
             // no finer-grained lock; lock on the classloader instance
             parallelLockMap = null;
             package2certs = new Hashtable<>();
-            domains = new HashSet<>();
             assertionLock = this;
         }
     }
@@ -640,7 +635,6 @@
                 }, new AccessControlContext(new ProtectionDomain[] {pd}));
             }
         }
-        domains.add(pd);
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/lang/Math.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/Math.java	Wed Jul 05 22:19:13 2017 +0200
@@ -1626,7 +1626,7 @@
      *
      * @since 9
      */
-    // @HotSpotIntrinsicCandidate
+    @HotSpotIntrinsicCandidate
     public static double fma(double a, double b, double c) {
         /*
          * Infinity and NaN arithmetic is not quite the same with two
@@ -1743,7 +1743,7 @@
      *
      * @since 9
      */
-    // @HotSpotIntrinsicCandidate
+    @HotSpotIntrinsicCandidate
     public static float fma(float a, float b, float c) {
         /*
          *  Since the double format has more than twice the precision
--- a/jdk/src/java.base/share/classes/java/lang/module/ModulePath.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/module/ModulePath.java	Wed Jul 05 22:19:13 2017 +0200
@@ -56,6 +56,8 @@
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 
+import jdk.internal.jmod.JmodFile;
+import jdk.internal.jmod.JmodFile.Section;
 import jdk.internal.module.ConfigurableModuleFinder;
 import jdk.internal.perf.PerfCounter;
 
@@ -294,11 +296,11 @@
 
     // -- jmod files --
 
-    private Set<String> jmodPackages(ZipFile zf) {
-        return zf.stream()
-            .filter(e -> e.getName().startsWith("classes/") &&
-                    e.getName().endsWith(".class"))
-            .map(e -> toPackageName(e.getName().substring(8)))
+    private Set<String> jmodPackages(JmodFile jf) {
+        return jf.stream()
+            .filter(e -> e.section() == Section.CLASSES)
+            .map(JmodFile.Entry::name)
+            .map(this::toPackageName)
             .filter(pkg -> pkg.length() > 0) // module-info
             .collect(Collectors.toSet());
     }
@@ -311,14 +313,10 @@
      * @throws InvalidModuleDescriptorException
      */
     private ModuleReference readJMod(Path file) throws IOException {
-        try (ZipFile zf = new ZipFile(file.toString())) {
-            ZipEntry ze = zf.getEntry("classes/" + MODULE_INFO);
-            if (ze == null) {
-                throw new IOException(MODULE_INFO + " is missing: " + file);
-            }
+        try (JmodFile jf = new JmodFile(file)) {
             ModuleDescriptor md;
-            try (InputStream in = zf.getInputStream(ze)) {
-                md = ModuleDescriptor.read(in, () -> jmodPackages(zf));
+            try (InputStream in = jf.getInputStream(Section.CLASSES, MODULE_INFO)) {
+                md = ModuleDescriptor.read(in, () -> jmodPackages(jf));
             }
             return ModuleReferences.newJModModule(md, file);
         }
--- a/jdk/src/java.base/share/classes/java/security/AccessControlContext.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/security/AccessControlContext.java	Wed Jul 05 22:19:13 2017 +0200
@@ -27,7 +27,9 @@
 
 import java.util.ArrayList;
 import java.util.List;
+
 import sun.security.util.Debug;
+import sun.security.util.FilePermCompat;
 import sun.security.util.SecurityConstants;
 
 
@@ -175,7 +177,7 @@
 
     /**
      * package private to allow calls from ProtectionDomain without performing
-     * the security check for {@linkplain SecurityConstants.CREATE_ACC_PERMISSION}
+     * the security check for {@linkplain SecurityConstants#CREATE_ACC_PERMISSION}
      * permission
      */
     AccessControlContext(AccessControlContext acc,
@@ -253,7 +255,8 @@
                 if (perms[i].getClass() == AllPermission.class) {
                     parent = null;
                 }
-                tmp[i] = perms[i];
+                // Add altPath into permission for compatibility.
+                tmp[i] = FilePermCompat.newPermPlusAltPath(perms[i]);
             }
         }
 
@@ -443,7 +446,7 @@
         }
 
         for (int i=0; i< context.length; i++) {
-            if (context[i] != null &&  !context[i].implies(perm)) {
+            if (context[i] != null && !context[i].impliesWithAltFilePerm(perm)) {
                 if (dumpDebug) {
                     debug.println("access denied " + perm);
                 }
--- a/jdk/src/java.base/share/classes/java/security/ProtectionDomain.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/security/ProtectionDomain.java	Wed Jul 05 22:19:13 2017 +0200
@@ -32,13 +32,14 @@
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.List;
-import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import jdk.internal.misc.JavaSecurityAccess;
 import jdk.internal.misc.JavaSecurityProtectionDomainAccess;
 import static jdk.internal.misc.JavaSecurityProtectionDomainAccess.ProtectionDomainCache;
 import jdk.internal.misc.SharedSecrets;
+import sun.security.provider.PolicyFile;
 import sun.security.util.Debug;
+import sun.security.util.FilePermCompat;
 import sun.security.util.SecurityConstants;
 
 /**
@@ -303,11 +304,71 @@
         }
 
         if (!staticPermissions &&
-            Policy.getPolicyNoCheck().implies(this, perm))
+            Policy.getPolicyNoCheck().implies(this, perm)) {
+            return true;
+        }
+        if (permissions != null) {
+            return permissions.implies(perm);
+        }
+
+        return false;
+    }
+
+    /**
+     * This method has the same logic flow as {@link #implies} except that
+     * when the {@link FilePermCompat#compat} flag is on it ensures
+     * FilePermission compatibility after JDK-8164705. {@code implies()}
+     * is called when compat flag is not on or user has extended
+     * {@code ProtectionDomain}.
+     *
+     * This method is called by {@link AccessControlContext#checkPermission}
+     * and not intended to be called by an application.
+     */
+    boolean impliesWithAltFilePerm(Permission perm) {
+
+        // If this is a subclass of ProtectionDomain. Call the old method.
+        if (!FilePermCompat.compat || getClass() != ProtectionDomain.class) {
+            return implies(perm);
+        }
+
+        if (hasAllPerm) {
+            // internal permission collection already has AllPermission -
+            // no need to go to policy
             return true;
-        if (permissions != null)
-            return permissions.implies(perm);
+        }
+
+        Permission p2 = null;
+        boolean p2Calculated = false;
 
+        if (!staticPermissions) {
+            Policy policy = Policy.getPolicyNoCheck();
+            if (policy instanceof PolicyFile) {
+                // The PolicyFile implementation supports compatibility
+                // inside and it also covers the static permissions.
+                return policy.implies(this, perm);
+            } else {
+                if (policy.implies(this, perm)) {
+                    return true;
+                }
+                p2 = FilePermCompat.newPermUsingAltPath(perm);
+                p2Calculated = true;
+                if (p2 != null && policy.implies(this, p2)) {
+                    return true;
+                }
+            }
+        }
+        if (permissions != null) {
+            if (permissions.implies(perm)) {
+                return true;
+            } else {
+                if (!p2Calculated) {
+                    p2 = FilePermCompat.newPermUsingAltPath(perm);
+                }
+                if (p2 != null) {
+                    return permissions.implies(p2);
+                }
+            }
+        }
         return false;
     }
 
--- a/jdk/src/java.base/share/classes/java/time/format/ZoneName.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/time/format/ZoneName.java	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,11 +25,8 @@
 package java.time.format;
 
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Locale;
 import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
 
 /**
  * A helper class to map a zone name to metazone and back to the
@@ -335,6 +332,7 @@
         "America/Eirunepe", "Amazon", "America/Manaus",
         "Africa/Nairobi", "Africa_Eastern", "Africa/Nairobi",
         "Asia/Yakutsk", "Yakutsk", "Asia/Yakutsk",
+        "Asia/Yangon", "Myanmar", "Asia/Rangoon",
         "America/Goose_Bay", "Atlantic", "America/Halifax",
         "Africa/Maseru", "Africa_Southern", "Africa/Johannesburg",
         "America/Swift_Current", "America_Central", "America/Chicago",
@@ -770,6 +768,7 @@
         "America/Indianapolis", "America/Indiana/Indianapolis",
         "Europe/Belfast", "Europe/London",
         "America/Kralendijk", "America/Curacao",
+        "Asia/Rangoon", "Asia/Yangon",
     };
 
     private static final Map<String, String> zidToMzone = new HashMap<>();
--- a/jdk/src/java.base/share/classes/java/util/ArrayList.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/ArrayList.java	Wed Jul 05 22:19:13 2017 +0200
@@ -876,6 +876,7 @@
         int lastRet = -1; // index of last element returned; -1 if no such
         int expectedModCount = modCount;
 
+        // prevent creating a synthetic constructor
         Itr() {}
 
         public boolean hasNext() {
--- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicBoolean.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicBoolean.java	Wed Jul 05 22:19:13 2017 +0200
@@ -108,10 +108,18 @@
      * if the current value {@code == expectedValue},
      * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}.
      *
+     * @deprecated This method has plain memory effects but the method
+     * name implies volatile memory effects (see methods such as
+     * {@link #compareAndExchange} and {@link #compareAndSet}).  To avoid
+     * confusion over plain or volatile memory effects it is recommended that
+     * the method {@link #weakCompareAndSetPlain} be used instead.
+     *
      * @param expectedValue the expected value
      * @param newValue the new value
      * @return {@code true} if successful
+     * @see #weakCompareAndSetPlain
      */
+    @Deprecated(since="9")
     public boolean weakCompareAndSet(boolean expectedValue, boolean newValue) {
         return VALUE.weakCompareAndSetPlain(this,
                                             (expectedValue ? 1 : 0),
@@ -119,6 +127,22 @@
     }
 
     /**
+     * Possibly atomically sets the value to {@code newValue}
+     * if the current value {@code == expectedValue},
+     * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}.
+     *
+     * @param expectedValue the expected value
+     * @param newValue the new value
+     * @return {@code true} if successful
+     * @since 9
+     */
+    public boolean weakCompareAndSetPlain(boolean expectedValue, boolean newValue) {
+        return VALUE.weakCompareAndSetPlain(this,
+                                            (expectedValue ? 1 : 0),
+                                            (newValue ? 1 : 0));
+    }
+
+    /**
      * Sets the value to {@code newValue},
      * with memory effects as specified by {@link VarHandle#setVolatile}.
      *
--- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java	Wed Jul 05 22:19:13 2017 +0200
@@ -148,15 +148,37 @@
      * if the current value {@code == expectedValue},
      * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}.
      *
+     * @deprecated This method has plain memory effects but the method
+     * name implies volatile memory effects (see methods such as
+     * {@link #compareAndExchange} and {@link #compareAndSet}).  To avoid
+     * confusion over plain or volatile memory effects it is recommended that
+     * the method {@link #weakCompareAndSetPlain} be used instead.
+     *
      * @param expectedValue the expected value
      * @param newValue the new value
      * @return {@code true} if successful
+     * @see #weakCompareAndSetPlain
      */
+    @Deprecated(since="9")
     public final boolean weakCompareAndSet(int expectedValue, int newValue) {
         return U.weakCompareAndSwapInt(this, VALUE, expectedValue, newValue);
     }
 
     /**
+     * Possibly atomically sets the value to {@code newValue}
+     * if the current value {@code == expectedValue},
+     * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}.
+     *
+     * @param expectedValue the expected value
+     * @param newValue the new value
+     * @return {@code true} if successful
+     * @since 9
+     */
+    public final boolean weakCompareAndSetPlain(int expectedValue, int newValue) {
+        return U.weakCompareAndSwapInt(this, VALUE, expectedValue, newValue);
+    }
+
+    /**
      * Atomically increments the current value,
      * with memory effects as specified by {@link VarHandle#getAndAdd}.
      *
--- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java	Wed Jul 05 22:19:13 2017 +0200
@@ -151,16 +151,39 @@
      * {@code newValue} if the element's current value {@code == expectedValue},
      * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}.
      *
+     * @deprecated This method has plain memory effects but the method
+     * name implies volatile memory effects (see methods such as
+     * {@link #compareAndExchange} and {@link #compareAndSet}).  To avoid
+     * confusion over plain or volatile memory effects it is recommended that
+     * the method {@link #weakCompareAndSetPlain} be used instead.
+     *
      * @param i the index
      * @param expectedValue the expected value
      * @param newValue the new value
      * @return {@code true} if successful
+     * @see #weakCompareAndSetPlain
      */
+    @Deprecated(since="9")
     public final boolean weakCompareAndSet(int i, int expectedValue, int newValue) {
         return AA.weakCompareAndSetPlain(array, i, expectedValue, newValue);
     }
 
     /**
+     * Possibly atomically sets the element at index {@code i} to
+     * {@code newValue} if the element's current value {@code == expectedValue},
+     * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}.
+     *
+     * @param i the index
+     * @param expectedValue the expected value
+     * @param newValue the new value
+     * @return {@code true} if successful
+     * @since 9
+     */
+    public final boolean weakCompareAndSetPlain(int i, int expectedValue, int newValue) {
+        return AA.weakCompareAndSetPlain(array, i, expectedValue, newValue);
+    }
+
+    /**
      * Atomically increments the value of the element at index {@code i},
      * with memory effects as specified by {@link VarHandle#getAndAdd}.
      *
--- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLong.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLong.java	Wed Jul 05 22:19:13 2017 +0200
@@ -164,15 +164,37 @@
      * if the current value {@code == expectedValue},
      * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}.
      *
+     * @deprecated This method has plain memory effects but the method
+     * name implies volatile memory effects (see methods such as
+     * {@link #compareAndExchange} and {@link #compareAndSet}).  To avoid
+     * confusion over plain or volatile memory effects it is recommended that
+     * the method {@link #weakCompareAndSetPlain} be used instead.
+     *
      * @param expectedValue the expected value
      * @param newValue the new value
      * @return {@code true} if successful
+     * @see #weakCompareAndSetPlain
      */
+    @Deprecated(since="9")
     public final boolean weakCompareAndSet(long expectedValue, long newValue) {
         return U.weakCompareAndSwapLong(this, VALUE, expectedValue, newValue);
     }
 
     /**
+     * Possibly atomically sets the value to {@code newValue}
+     * if the current value {@code == expectedValue},
+     * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}.
+     *
+     * @param expectedValue the expected value
+     * @param newValue the new value
+     * @return {@code true} if successful
+     * @since 9
+     */
+    public final boolean weakCompareAndSetPlain(long expectedValue, long newValue) {
+        return U.weakCompareAndSwapLong(this, VALUE, expectedValue, newValue);
+    }
+
+    /**
      * Atomically increments the current value,
      * with memory effects as specified by {@link VarHandle#getAndAdd}.
      *
--- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongArray.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongArray.java	Wed Jul 05 22:19:13 2017 +0200
@@ -151,16 +151,39 @@
      * {@code newValue} if the element's current value {@code == expectedValue},
      * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}.
      *
+     * @deprecated This method has plain memory effects but the method
+     * name implies volatile memory effects (see methods such as
+     * {@link #compareAndExchange} and {@link #compareAndSet}).  To avoid
+     * confusion over plain or volatile memory effects it is recommended that
+     * the method {@link #weakCompareAndSetPlain} be used instead.
+     *
      * @param i the index
      * @param expectedValue the expected value
      * @param newValue the new value
      * @return {@code true} if successful
+     * @see #weakCompareAndSetPlain
      */
+    @Deprecated(since="9")
     public final boolean weakCompareAndSet(int i, long expectedValue, long newValue) {
         return AA.weakCompareAndSetPlain(array, i, expectedValue, newValue);
     }
 
     /**
+     * Possibly atomically sets the element at index {@code i} to
+     * {@code newValue} if the element's current value {@code == expectedValue},
+     * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}.
+     *
+     * @param i the index
+     * @param expectedValue the expected value
+     * @param newValue the new value
+     * @return {@code true} if successful
+     * @since 9
+     */
+    public final boolean weakCompareAndSetPlain(int i, long expectedValue, long newValue) {
+        return AA.weakCompareAndSetPlain(array, i, expectedValue, newValue);
+    }
+
+    /**
      * Atomically increments the value of the element at index {@code i},
      * with memory effects as specified by {@link VarHandle#getAndAdd}.
      *
--- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReference.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReference.java	Wed Jul 05 22:19:13 2017 +0200
@@ -127,15 +127,37 @@
      * if the current value {@code == expectedValue},
      * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}.
      *
+     * @deprecated This method has plain memory effects but the method
+     * name implies volatile memory effects (see methods such as
+     * {@link #compareAndExchange} and {@link #compareAndSet}).  To avoid
+     * confusion over plain or volatile memory effects it is recommended that
+     * the method {@link #weakCompareAndSetPlain} be used instead.
+     *
      * @param expectedValue the expected value
      * @param newValue the new value
      * @return {@code true} if successful
+     * @see #weakCompareAndSetPlain
      */
+    @Deprecated(since="9")
     public final boolean weakCompareAndSet(V expectedValue, V newValue) {
         return VALUE.weakCompareAndSetPlain(this, expectedValue, newValue);
     }
 
     /**
+     * Possibly atomically sets the value to {@code newValue}
+     * if the current value {@code == expectedValue},
+     * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}.
+     *
+     * @param expectedValue the expected value
+     * @param newValue the new value
+     * @return {@code true} if successful
+     * @since 9
+     */
+    public final boolean weakCompareAndSetPlain(V expectedValue, V newValue) {
+        return VALUE.weakCompareAndSetPlain(this, expectedValue, newValue);
+    }
+
+    /**
      * Atomically sets the value to {@code newValue} and returns the old value,
      * with memory effects as specified by {@link VarHandle#getAndSet}.
      *
--- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java	Wed Jul 05 22:19:13 2017 +0200
@@ -157,16 +157,39 @@
      * {@code newValue} if the element's current value {@code == expectedValue},
      * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}.
      *
+     * @deprecated This method has plain memory effects but the method
+     * name implies volatile memory effects (see methods such as
+     * {@link #compareAndExchange} and {@link #compareAndSet}).  To avoid
+     * confusion over plain or volatile memory effects it is recommended that
+     * the method {@link #weakCompareAndSetPlain} be used instead.
+     *
      * @param i the index
      * @param expectedValue the expected value
      * @param newValue the new value
      * @return {@code true} if successful
+     * @see #weakCompareAndSetPlain
      */
+    @Deprecated(since="9")
     public final boolean weakCompareAndSet(int i, E expectedValue, E newValue) {
         return AA.weakCompareAndSetPlain(array, i, expectedValue, newValue);
     }
 
     /**
+     * Possibly atomically sets the element at index {@code i} to
+     * {@code newValue} if the element's current value {@code == expectedValue},
+     * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}.
+     *
+     * @param i the index
+     * @param expectedValue the expected value
+     * @param newValue the new value
+     * @return {@code true} if successful
+     * @since 9
+     */
+    public final boolean weakCompareAndSetPlain(int i, E expectedValue, E newValue) {
+        return AA.weakCompareAndSetPlain(array, i, expectedValue, newValue);
+    }
+
+    /**
      * Atomically updates the element at index {@code i} with the results
      * of applying the given function, returning the previous value. The
      * function should be side-effect-free, since it may be re-applied
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/util/spi/ToolProvider.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.util.spi;
+
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.ServiceLoader;
+import java.util.stream.StreamSupport;
+
+/**
+ * An interface for command-line tools to provide a way to
+ * be invoked without necessarily starting a new VM.
+ *
+ * <p>Tool providers are normally located using the service-provider
+ * loading facility defined by {@link ServiceLoader}.
+ * Each provider must provide a name, and a method to run
+ * an instance of the corresponding tool. When a tool is run,
+ * it will be provided with an array of string arguments, and a
+ * pair of streams: one for normal (or expected) output and the other
+ * for reporting any errors that may occur.
+ * The interpretation of the string arguments will normally be defined by
+ * each individual tool provider, but will generally correspond to the
+ * arguments that could be provided to the tool when invoking the tool
+ * from the command line.
+ *
+ * @since 9
+ */
+public interface ToolProvider {
+    /**
+     * Returns the name of this tool provider.
+     *
+     * @apiNote It is recommended that the name be the same as would be used on
+     *      the command line: for example, "javac", "jar", "jlink".
+     *
+     * @return the name of this tool provider
+     */
+    String name();
+
+    /**
+     * Runs an instance of the tool, returning zero for a successful run.
+     * Any non-zero return value indicates a tool-specific error during the
+     * execution.
+     * Two streams should be provided, for "expected" output, and for any
+     * error messages. If it is not necessary to distinguish the output,
+     * the same stream may be used for both.
+     *
+     * @apiNote The interpretation of the arguments will be specific to
+     *      each tool.
+     *
+     * @param out a stream to which "expected" output should be written
+     *
+     * @param err a stream to which any error messages should be written
+     *
+     * @param args the command-line arguments for the tool
+     *
+     * @return the result of executing the tool.
+     *      A return value of 0 means the tool did not encounter any errors;
+     *      any other value indicates that at least one error occurred during
+     *      execution.
+     *
+     * @throws NullPointerException if any of the arguments are {@code null},
+     *      or if there are any {@code null} values in the {@code args} array
+     */
+    int run(PrintWriter out, PrintWriter err, String... args);
+
+    /**
+     * Runs an instance of the tool, returning zero for a successful run.
+     * Any non-zero return value indicates a tool-specific error during the
+     * execution.
+     * Two streams should be provided, for "expected" output, and for any
+     * error messages. If it is not necessary to distinguish the output,
+     * the same stream may be used for both.
+     *
+     * @apiNote The interpretation of the arguments will be specific to
+     *      each tool.
+     *
+     * @implNote This implementation wraps the {@code out} and {@code err}
+     *      streams within {@link PrintWriter}s, and then calls
+     *      {@link run(PrintWriter, PrintWriter, String[])}.
+     *
+     * @param out a stream to which "expected" output should be written
+     *
+     * @param err a stream to which any error messages should be written
+     *
+     * @param args the command-line arguments for the tool
+     *
+     * @return the result of executing the tool.
+     *      A return value of 0 means the tool did not encounter any errors;
+     *      any other value indicates that at least one error occurred during
+     *      execution.
+     *
+     * @throws NullPointerException if any of the arguments are {@code null},
+     *      or if there are any {@code null} values in the {@code args} array
+     */
+    default int run(PrintStream out, PrintStream err, String... args) {
+        Objects.requireNonNull(out);
+        Objects.requireNonNull(err);
+        for (String arg : args) {
+            Objects.requireNonNull(args);
+        }
+
+        PrintWriter outWriter = new PrintWriter(out);
+        PrintWriter errWriter = new PrintWriter(err);
+        try {
+            try {
+                return run(outWriter, errWriter, args);
+            } finally {
+                outWriter.flush();
+            }
+        } finally {
+            errWriter.flush();
+        }
+    }
+
+    /**
+     * Returns the first instance of a {@code ToolProvider} with the given name,
+     * as loaded by {@link ServiceLoader} using the system class loader.
+     *
+     * @param name the name of the desired tool provider
+     *
+     * @return an {@code Optional<ToolProvider>} of the first instance found
+     *
+     * @throws NullPointerException if {@code name} is {@code null}
+     */
+    static Optional<ToolProvider> findFirst(String name) {
+        Objects.requireNonNull(name);
+        ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
+        return AccessController.doPrivileged(
+            (PrivilegedAction<Optional<ToolProvider>>) () -> {
+                ServiceLoader<ToolProvider> sl =
+                    ServiceLoader.load(ToolProvider.class, systemClassLoader);
+                return StreamSupport.stream(sl.spliterator(), false)
+                    .filter(p -> p.name().equals(name))
+                    .findFirst();
+            });
+    }
+}
+
--- a/jdk/src/java.base/share/classes/java/util/stream/Stream.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/stream/Stream.java	Wed Jul 05 22:19:13 2017 +0200
@@ -282,7 +282,7 @@
      */
     <R> Stream<R> flatMap(Function<? super T, ? extends Stream<? extends R>> mapper);
 
-    /**
+    /**:
      * Returns an {@code IntStream} consisting of the results of replacing each
      * element of this stream with the contents of a mapped stream produced by
      * applying the provided mapping function to each element.  Each mapped
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/jmod/JmodFile.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jmod;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.stream.Stream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+/**
+ * Helper class to read JMOD file
+ */
+public class JmodFile implements AutoCloseable {
+    // jmod magic number and version number
+    public static final int JMOD_MAJOR_VERSION = 0x01;
+    public static final int JMOD_MINOR_VERSION = 0x00;
+    public static final byte[] JMOD_MAGIC_NUMBER = {
+        0x4A, 0x4D, /* JM */
+        JMOD_MAJOR_VERSION, JMOD_MINOR_VERSION, /* version 1.0 */
+    };
+
+    public static void checkMagic(Path file) throws IOException {
+        try (InputStream in = Files.newInputStream(file);
+             BufferedInputStream bis = new BufferedInputStream(in)) {
+            // validate the header
+            byte[] magic = new byte[4];
+            bis.read(magic);
+            if (magic[0] != JMOD_MAGIC_NUMBER[0] ||
+                magic[1] != JMOD_MAGIC_NUMBER[1]) {
+                throw new IOException("Invalid jmod file: " + file.toString());
+            }
+            if (magic[2] > JMOD_MAJOR_VERSION ||
+                (magic[2] == JMOD_MAJOR_VERSION && magic[3] > JMOD_MINOR_VERSION)) {
+                throw new IOException("Unsupported jmod version: " +
+                    magic[2] + "." + magic[3] + " in " + file.toString());
+            }
+        }
+    }
+
+    /**
+     * JMOD sections
+     */
+    public static enum Section {
+        NATIVE_LIBS("native"),
+        NATIVE_CMDS("bin"),
+        CLASSES("classes"),
+        CONFIG("conf");
+
+        private final String jmodDir;
+        private Section(String jmodDir) {
+            this.jmodDir = jmodDir;
+        }
+
+        /**
+         * Returns the directory name in the JMOD file corresponding to
+         * this section
+         */
+        public String jmodDir() { return jmodDir; }
+
+    }
+
+    /**
+     * JMOD file entry.
+     *
+     * Each entry corresponds to a ZipEntry whose name is:
+     *   Section::jmodDir + '/' + name
+     */
+    public static class Entry {
+        private final ZipEntry zipEntry;
+        private final Section section;
+        private final String name;
+
+        private Entry(ZipEntry e) {
+            String name = e.getName();
+            int i = name.indexOf('/');
+            if (i <= 1) {
+                throw new RuntimeException("invalid jmod entry: " + name);
+            }
+
+            this.zipEntry = e;
+            this.section = section(name);
+            this.name = name.substring(i+1);
+        }
+
+        /**
+         * Returns the section of this entry.
+         */
+        public Section section() {
+            return section;
+        }
+
+        /**
+         * Returns the name of this entry.
+         */
+        public String name() {
+            return name;
+        }
+
+        /**
+         * Returns the size of this entry.
+         */
+        public long size() {
+            return zipEntry.getSize();
+        }
+
+        public ZipEntry zipEntry() {
+            return zipEntry;
+        }
+
+        @Override
+        public String toString() {
+            return section.jmodDir() + "/" + name;
+        }
+
+        static Section section(String name) {
+            int i = name.indexOf('/');
+            String s = name.substring(0, i);
+            switch (s) {
+                case "native":
+                    return Section.NATIVE_LIBS;
+                case "bin":
+                    return Section.NATIVE_CMDS;
+                case "classes":
+                    return Section.CLASSES;
+                case "conf":
+                    return Section.CONFIG;
+                default:
+                    throw new IllegalArgumentException("invalid section: " + s);
+            }
+        }
+    }
+
+    private final Path file;
+    private final ZipFile zipfile;
+
+    /**
+     * Constructs a {@code JmodFile} from a given path.
+     */
+    public JmodFile(Path file) throws IOException {
+        checkMagic(file);
+        this.file = file;
+        this.zipfile = new ZipFile(file.toFile());
+    }
+
+    /**
+     * Opens an {@code InputStream} for reading the named entry of the given
+     * section in this jmod file.
+     *
+     * @throws IOException if the named entry is not found, or I/O error
+     *         occurs when reading it
+     */
+    public InputStream getInputStream(Section section, String name)
+        throws IOException
+    {
+
+        String entry = section.jmodDir() + "/" + name;
+        ZipEntry e = zipfile.getEntry(entry);
+        if (e == null) {
+            throw new IOException(name + " not found: " + file);
+        }
+        return zipfile.getInputStream(e);
+    }
+
+    /**
+     * Returns a stream of non-directory entries in this jmod file.
+     */
+    public Stream<Entry> stream() {
+        return zipfile.stream()
+                      .filter(e -> !e.isDirectory())
+                      .map(Entry::new);
+    }
+
+    @Override
+    public void close() throws IOException {
+        if (zipfile != null) {
+            zipfile.close();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaIOFilePermissionAccess.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.internal.misc;
+
+import java.io.FilePermission;
+
+public interface JavaIOFilePermissionAccess {
+
+    /**
+     * Returns a new FilePermission plus an alternative path.
+     *
+     * @param input the input
+     * @return the new FilePermission plus the alt path (as npath2)
+     *         or the input itself if no alt path is available.
+     */
+    FilePermission newPermPlusAltPath(FilePermission input);
+
+    /**
+     * Returns a new FilePermission using an alternative path.
+     *
+     * @param input the input
+     * @return the new FilePermission using the alt path (as npath)
+     *         or null if no alt path is available
+     */
+    FilePermission newPermUsingAltPath(FilePermission input);
+}
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java	Wed Jul 05 22:19:13 2017 +0200
@@ -29,6 +29,7 @@
 import java.util.jar.JarFile;
 import java.io.Console;
 import java.io.FileDescriptor;
+import java.io.FilePermission;
 import java.io.ObjectInputStream;
 import java.io.RandomAccessFile;
 import java.security.ProtectionDomain;
@@ -58,6 +59,7 @@
     private static JavaNetSocketAccess javaNetSocketAccess;
     private static JavaNioAccess javaNioAccess;
     private static JavaIOFileDescriptorAccess javaIOFileDescriptorAccess;
+    private static JavaIOFilePermissionAccess javaIOFilePermissionAccess;
     private static JavaSecurityProtectionDomainAccess javaSecurityProtectionDomainAccess;
     private static JavaSecurityAccess javaSecurityAccess;
     private static JavaUtilZipFileAccess javaUtilZipFileAccess;
@@ -201,6 +203,17 @@
         javaIOFileDescriptorAccess = jiofda;
     }
 
+    public static JavaIOFilePermissionAccess getJavaIOFilePermissionAccess() {
+        if (javaIOFilePermissionAccess == null)
+            unsafe.ensureClassInitialized(FilePermission.class);
+
+        return javaIOFilePermissionAccess;
+    }
+
+    public static void setJavaIOFilePermissionAccess(JavaIOFilePermissionAccess jiofpa) {
+        javaIOFilePermissionAccess = jiofpa;
+    }
+
     public static JavaIOFileDescriptorAccess getJavaIOFileDescriptorAccess() {
         if (javaIOFileDescriptorAccess == null)
             unsafe.ensureClassInitialized(FileDescriptor.class);
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java	Wed Jul 05 22:19:13 2017 +0200
@@ -430,22 +430,23 @@
             // the key is $MODULE
             String mn = e.getKey();
             Optional<Module> om = bootLayer.findModule(mn);
-            if (!om.isPresent())
-                fail("Unknown module: " + mn);
+            if (!om.isPresent()) {
+                warn("Unknown module: " + mn);
+                continue;
+            }
             Module m = om.get();
 
             // the value is the set of other modules (by name)
             for (String name : e.getValue()) {
-
-                Module other;
                 if (ALL_UNNAMED.equals(name)) {
                     Modules.addReadsAllUnnamed(m);
                 } else {
                     om = bootLayer.findModule(name);
-                    if (!om.isPresent())
-                        fail("Unknown module: " + name);
-                    other = om.get();
-                    Modules.addReads(m, other);
+                    if (om.isPresent()) {
+                        Modules.addReads(m, om.get());
+                    } else {
+                        warn("Unknown module: " + name);
+                    }
                 }
 
             }
@@ -472,14 +473,24 @@
 
             String mn = s[0];
             String pn = s[1];
+            if (mn.isEmpty() || pn.isEmpty())
+                fail("Module and package name must be specified:" + key);
 
             // The exporting module is in the boot layer
             Module m;
             Optional<Module> om = bootLayer.findModule(mn);
-            if (!om.isPresent())
-                fail("Unknown module: " + mn);
+            if (!om.isPresent()) {
+                warn("Unknown module: " + mn);
+                continue;
+            }
+
             m = om.get();
 
+            if (!m.getDescriptor().packages().contains(pn)) {
+                warn("package " + pn + " not in " + mn);
+                continue;
+            }
+
             // the value is the set of modules to export to (by name)
             for (String name : e.getValue()) {
                 boolean allUnnamed = false;
@@ -491,10 +502,10 @@
                     if (om.isPresent()) {
                         other = om.get();
                     } else {
-                        fail("Unknown module: " + name);
+                        warn("Unknown module: " + name);
+                        continue;
                     }
                 }
-
                 if (allUnnamed) {
                     Modules.addExportsToAllUnnamed(m, pn);
                 } else {
@@ -534,13 +545,7 @@
             if (rhs.isEmpty())
                 fail("Unable to parse: " + value);
 
-
-            // value is <module>(,<module>)*
-            if (map.containsKey(key))
-                 fail(key + " specified more than once");
-
-            Set<String> values = new HashSet<>();
-            map.put(key, values);
+            Set<String> values = map.computeIfAbsent(key, k -> new HashSet<>());
             for (String s : rhs.split(",")) {
                 if (s.length() > 0) values.add(s);
             }
@@ -566,6 +571,10 @@
         throw new RuntimeException(m);
     }
 
+    static void warn(String m) {
+        System.err.println("WARNING: " + m);
+    }
+
     static class PerfCounters {
 
         static PerfCounter systemModulesTime
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoExtender.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoExtender.java	Wed Jul 05 22:19:13 2017 +0200
@@ -163,6 +163,16 @@
      * be discarded.
      */
     public void write(OutputStream out) throws IOException {
+        // emit to the output stream
+        out.write(toByteArray());
+    }
+
+    /**
+     * Returns the bytes of the modified module-info.class.
+     * Once this method has been called then the Extender object should
+     * be discarded.
+     */
+    public byte[] toByteArray() throws IOException {
         ClassWriter cw
             = new ClassWriter(ClassWriter.COMPUTE_MAXS + ClassWriter.COMPUTE_FRAMES);
 
@@ -197,8 +207,7 @@
         // add any attributes that didn't replace previous attributes
         cv.finish();
 
-        // emit to the output stream
-        out.write(cw.toByteArray());
+        return cw.toByteArray();
     }
 
     /**
--- a/jdk/src/java.base/share/classes/module-info.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/classes/module-info.java	Wed Jul 05 22:19:13 2017 +0200
@@ -108,6 +108,7 @@
     uses java.util.spi.ResourceBundleControlProvider;
     uses java.util.spi.ResourceBundleProvider;
     uses java.util.spi.TimeZoneNameProvider;
+    uses java.util.spi.ToolProvider;
     uses javax.security.auth.spi.LoginModule;
 
 
@@ -124,6 +125,9 @@
         jdk.jlink;
     exports jdk.internal.jimage.decompressor to
         jdk.jlink;
+    exports jdk.internal.jmod to
+        jdk.compiler,
+        jdk.jlink;
     exports jdk.internal.logger to
         java.logging;
     exports jdk.internal.org.objectweb.asm to
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/file/FileURLConnection.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/file/FileURLConnection.java	Wed Jul 05 22:19:13 2017 +0200
@@ -41,10 +41,6 @@
 import java.util.*;
 import java.text.SimpleDateFormat;
 
-import sun.security.action.GetPropertyAction;
-import sun.security.action.GetIntegerAction;
-import sun.security.action.GetBooleanAction;
-
 public class FileURLConnection extends URLConnection {
 
     static String CONTENT_LENGTH = "content-length";
@@ -224,8 +220,13 @@
             if (File.separatorChar == '/') {
                 permission = new FilePermission(decodedPath, "read");
             } else {
+                // decode could return /c:/x/y/z.
+                if (decodedPath.length() > 2 && decodedPath.charAt(0) == '/'
+                        && decodedPath.charAt(2) == ':') {
+                    decodedPath = decodedPath.substring(1);
+                }
                 permission = new FilePermission(
-                        decodedPath.replace('/',File.separatorChar), "read");
+                        decodedPath.replace('/', File.separatorChar), "read");
             }
         }
         return permission;
--- a/jdk/src/java.base/share/classes/sun/security/provider/PolicyFile.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/provider/PolicyFile.java	Wed Jul 05 22:19:13 2017 +0200
@@ -45,11 +45,7 @@
 import jdk.internal.misc.JavaSecurityProtectionDomainAccess;
 import static jdk.internal.misc.JavaSecurityProtectionDomainAccess.ProtectionDomainCache;
 import jdk.internal.misc.SharedSecrets;
-import sun.security.util.PolicyUtil;
-import sun.security.util.PropertyExpander;
-import sun.security.util.Debug;
-import sun.security.util.ResourcesMgr;
-import sun.security.util.SecurityConstants;
+import sun.security.util.*;
 import sun.net.www.ParseUtil;
 
 /**
@@ -534,8 +530,6 @@
     /**
      * Reads a policy configuration into the Policy object using a
      * Reader object.
-     *
-     * @param policyFile the policy Reader object.
      */
     private boolean init(URL policy, PolicyInfo newInfo, boolean defPolicy) {
 
@@ -1099,7 +1093,7 @@
             synchronized (pc) {
                 Enumeration<Permission> e = pc.elements();
                 while (e.hasMoreElements()) {
-                    perms.add(e.nextElement());
+                    perms.add(FilePermCompat.newPermPlusAltPath(e.nextElement()));
                 }
             }
         }
@@ -1127,7 +1121,7 @@
      * object with additional permissions granted to the specified
      * ProtectionDomain.
      *
-     * @param perm the Permissions to populate
+     * @param perms the Permissions to populate
      * @param pd the ProtectionDomain associated with the caller.
      *
      * @return the set of Permissions according to the policy.
@@ -1157,8 +1151,8 @@
      * object with additional permissions granted to the specified
      * CodeSource.
      *
-     * @param permissions the permissions to populate
-     * @param codesource the codesource associated with the caller.
+     * @param perms the permissions to populate
+     * @param cs the codesource associated with the caller.
      * This encapsulates the original location of the code (where the code
      * came from) and the public key(s) of its signer.
      *
@@ -1386,7 +1380,7 @@
                         accPs,
                         perms);
             } else {
-                perms.add(p);
+                perms.add(FilePermCompat.newPermPlusAltPath(p));
             }
         }
     }
@@ -1458,9 +1452,9 @@
         }
         try {
             // first try to instantiate the permission
-            perms.add(getInstance(sp.getSelfType(),
+            perms.add(FilePermCompat.newPermPlusAltPath(getInstance(sp.getSelfType(),
                                   sb.toString(),
-                                  sp.getSelfActions()));
+                                  sp.getSelfActions())));
         } catch (ClassNotFoundException cnfe) {
             // ok, the permission is not in the bootclasspath.
             // before we add an UnresolvedPermission, check to see
--- a/jdk/src/java.base/share/classes/sun/security/util/AnchorCertificates.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/util/AnchorCertificates.java	Wed Jul 05 22:19:13 2017 +0200
@@ -31,8 +31,10 @@
 import java.security.KeyStore;
 import java.security.PrivilegedAction;
 import java.security.cert.X509Certificate;
+import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashSet;
+import java.util.Set;
 
 import sun.security.x509.X509CertImpl;
 
@@ -44,7 +46,7 @@
 
     private static final Debug debug = Debug.getInstance("certpath");
     private static final String HASH = "SHA-256";
-    private static HashSet<String> certs;
+    private static Set<String> certs = Collections.emptySet();
 
     static  {
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
--- a/jdk/src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java	Wed Jul 05 22:19:13 2017 +0200
@@ -543,7 +543,7 @@
      private static class DenyAfterConstraint extends Constraint {
          private Date denyAfterDate;
          private static final SimpleDateFormat dateFormat =
-                 new SimpleDateFormat("EEE, MMM d HH:mm:ss z YYYY");
+                 new SimpleDateFormat("EEE, MMM d HH:mm:ss z yyyy");
 
          DenyAfterConstraint(String algo, int year, int month, int day) {
              Calendar c;
@@ -593,13 +593,17 @@
          public void permits(CertConstraintParameters cp)
                  throws CertPathValidatorException {
              Date currentDate;
+             String errmsg;
 
              if (cp.getJARTimestamp() != null) {
                  currentDate = cp.getJARTimestamp().getTimestamp();
+                 errmsg = "JAR Timestamp date: ";
              } else if (cp.getPKIXParamDate() != null) {
                  currentDate = cp.getPKIXParamDate();
+                 errmsg = "PKIXParameter date: ";
              } else {
                  currentDate = new Date();
+                 errmsg = "Certificate date: ";
              }
 
              if (!denyAfterDate.after(currentDate)) {
@@ -609,10 +613,9 @@
                  throw new CertPathValidatorException(
                          "denyAfter constraint check failed.  " +
                                  "Constraint date: " +
-                                 dateFormat.format(denyAfterDate) +
-                                 "; Cert date: " +
-                                 dateFormat.format(currentDate),
-                          null, null, -1, BasicReason.ALGORITHM_CONSTRAINED);
+                                 dateFormat.format(denyAfterDate) + "; "
+                                 + errmsg + dateFormat.format(currentDate),
+                         null, null, -1, BasicReason.ALGORITHM_CONSTRAINED);
              }
          }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/util/FilePermCompat.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.security.util;
+
+import sun.security.action.GetPropertyAction;
+
+import java.io.FilePermission;
+import java.security.Permission;
+import jdk.internal.misc.SharedSecrets;
+
+/**
+ * Take care of FilePermission compatibility after JDK-8164705.
+ */
+public class FilePermCompat {
+    /**
+     * New behavior? Keep compatibility? Both default true.
+     */
+    public static final boolean nb;
+    public static final boolean compat;
+
+    static {
+        String flag = GetPropertyAction.privilegedGetProperty(
+                "jdk.io.permissionsUseCanonicalPath", "false");
+        switch (flag) {
+            case "true":
+                nb = false;
+                compat = false;
+                break;
+            case "false":
+                nb = true;
+                compat = true;
+                break;
+            default:
+                throw new RuntimeException(
+                        "Invalid jdk.io.permissionsUseCanonicalPath: " + flag);
+        }
+    }
+
+    public static Permission newPermPlusAltPath(Permission input) {
+        if (compat && input instanceof FilePermission) {
+            return SharedSecrets.getJavaIOFilePermissionAccess()
+                    .newPermPlusAltPath((FilePermission) input);
+        }
+        return input;
+    }
+
+    public static Permission newPermUsingAltPath(Permission input) {
+        if (input instanceof FilePermission) {
+            return SharedSecrets.getJavaIOFilePermissionAccess()
+                    .newPermUsingAltPath((FilePermission) input);
+        }
+        return null;
+    }
+}
--- a/jdk/src/java.base/share/classes/sun/util/resources/TimeZoneNames.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/util/resources/TimeZoneNames.java	Wed Jul 05 22:19:13 2017 +0200
@@ -188,6 +188,9 @@
         String MHT[] = new String[] {"Marshall Islands Time", "MHT",
                                      "Marshall Islands Summer Time", "MHST",
                                      "Marshall Islands Time", "MHT"};
+        String MMT[] = new String[] {"Myanmar Time", "MMT",
+                                     "Myanmar Summer Time", "MMST",
+                                     "Myanmar Time", "MMT"};
         String MSK[] = new String[] {"Moscow Standard Time", "MSK",
                                      "Moscow Daylight Time", "MSD",
                                      "Moscow Time", "MT"};
@@ -683,9 +686,7 @@
             {"Asia/Qyzylorda", new String[] {"Qyzylorda Time", "QYZT",
                                              "Qyzylorda Summer Time", "QYZST",
                                              "Qyzylorda Time", "QYZT"}},
-            {"Asia/Rangoon", new String[] {"Myanmar Time", "MMT",
-                                           "Myanmar Summer Time", "MMST",
-                                           "Myanmar Time", "MMT"}},
+            {"Asia/Rangoon", MMT},
             {"Asia/Riyadh", ARAST},
             {"Asia/Saigon", ICT},
             {"Asia/Sakhalin", new String[] {"Sakhalin Time", "SAKT",
@@ -718,6 +719,7 @@
                                                "Vladivostok Summer Time", "VLAST",
                                                "Vladivostok Time", "VLAT"}},
             {"Asia/Yakutsk", YAKT},
+            {"Asia/Yangon", MMT},
             {"Asia/Yekaterinburg", new String[] {"Yekaterinburg Time", "YEKT",
                                                  "Yekaterinburg Summer Time", "YEKST",
                                                  "Yekaterinburg Time", "YEKT"}},
--- a/jdk/src/java.base/share/conf/security/java.policy	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/conf/security/java.policy	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,18 @@
+//
+// This system policy file grants a set of default permissions to all domains
+// and can be configured to grant additional permissions to modules and other
+// code sources. The code source URL scheme for modules linked into a
+// run-time image is "jrt".
+//
+// For example, to grant permission to read the "foo" property to the module
+// "com.greetings", the grant entry is:
+//
+// grant codeBase "jrt:/com.greetings" {
+//     permission java.util.PropertyPermission "foo", "read";
+// };
+//
+
 // default permissions granted to all domains
-
 grant {
     // allows anyone to listen on dynamic ports
     permission java.net.SocketPermission "localhost:0", "listen";
--- a/jdk/src/java.base/share/native/libnet/net_util.h	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/native/libnet/net_util.h	Wed Jul 05 22:19:13 2017 +0200
@@ -42,6 +42,10 @@
 #define NET_ERROR(env, ex, msg) \
 { if (!(*env)->ExceptionOccurred(env)) JNU_ThrowByName(env, ex, msg); }
 
+#define NET_WAIT_READ    0x01
+#define NET_WAIT_WRITE   0x02
+#define NET_WAIT_CONNECT 0x04
+
 /************************************************************************
  * Cached field IDs
  *
@@ -133,9 +137,6 @@
 
 JNIEXPORT jint JNICALL reuseport_available() ;
 
-void
-NET_AllocSockaddr(struct sockaddr **him, int *len);
-
 JNIEXPORT int JNICALL
 NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr *him, int *len, jboolean v4MappedAddress);
 
@@ -196,4 +197,6 @@
 
 unsigned short in_cksum(unsigned short *addr, int len);
 
+jint NET_Wait(JNIEnv *env, jint fd, jint flags, jint timeout);
+
 #endif /* NET_UTILS_H */
--- a/jdk/src/java.base/share/native/libzip/zip_util.c	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/native/libzip/zip_util.c	Wed Jul 05 22:19:13 2017 +0200
@@ -1094,7 +1094,7 @@
  * jzentry for each zip.  This optimizes a common access pattern.
  */
 
-void
+void JNICALL
 ZIP_FreeEntry(jzfile *jz, jzentry *ze)
 {
     jzentry *last;
--- a/jdk/src/java.base/share/native/libzip/zip_util.h	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/share/native/libzip/zip_util.h	Wed Jul 05 22:19:13 2017 +0200
@@ -270,7 +270,8 @@
 void ZIP_Lock(jzfile *zip);
 void ZIP_Unlock(jzfile *zip);
 jint ZIP_Read(jzfile *zip, jzentry *entry, jlong pos, void *buf, jint len);
-void ZIP_FreeEntry(jzfile *zip, jzentry *ze);
+void JNICALL
+ZIP_FreeEntry(jzfile *zip, jzentry *ze);
 jlong ZIP_GetEntryDataOffset(jzfile *zip, jzentry *entry);
 jzentry * ZIP_GetEntry2(jzfile *zip, char *name, jint ulen, jboolean addSlash);
 
--- a/jdk/src/java.base/unix/native/libnet/Inet4AddressImpl.c	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/unix/native/libnet/Inet4AddressImpl.c	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -788,9 +788,9 @@
         case ENETUNREACH: /* Network Unreachable */
         case EAFNOSUPPORT: /* Address Family not supported */
         case EADDRNOTAVAIL: /* address is not available on  the  remote machine */
-#ifdef __linux__
+#if defined(__linux__) || defined(_AIX)
         case EINVAL:
-        case EHOSTUNREACH:
+        case EHOSTUNREACH: /* No route to host */
           /*
            * On some Linux versions, when a socket is bound to the loopback
            * interface, connect will fail and errno will be set to EINVAL
--- a/jdk/src/java.base/unix/native/libnet/Inet6AddressImpl.c	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/unix/native/libnet/Inet6AddressImpl.c	Wed Jul 05 22:19:13 2017 +0200
@@ -775,9 +775,9 @@
         case ENETUNREACH: /* Network Unreachable */
         case EAFNOSUPPORT: /* Address Family not supported */
         case EADDRNOTAVAIL: /* address is not available on  the  remote machine */
-#ifdef __linux__
+#if defined(__linux__) || defined(_AIX)
         case EINVAL:
-        case EHOSTUNREACH:
+        case EHOSTUNREACH: /* No route to host */
           /*
            * On some Linux versions, when  a socket is bound to the
            * loopback interface, connect will fail and errno will
@@ -804,7 +804,7 @@
                          &optlen) <0) {
             connect_rv = errno;
           }
-          if (connect_rv == 0 || ECONNREFUSED) {
+          if (connect_rv == 0 || connect_rv == ECONNREFUSED) {
             close(fd);
             return JNI_TRUE;
           }
--- a/jdk/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c	Wed Jul 05 22:19:13 2017 +0200
@@ -193,8 +193,8 @@
     /* fd is an int field on fdObj */
     int fd;
     int len = 0;
-    SOCKADDR him;
-    socklen_t slen = sizeof(him);
+    SOCKETADDRESS him;
+    socklen_t slen = sizeof(SOCKETADDRESS);
 
     if (IS_NULL(fdObj)) {
         JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
@@ -210,12 +210,12 @@
     }
 
     /* bind */
-    if (NET_InetAddressToSockaddr(env, iaObj, localport, (struct sockaddr *)&him, &len, JNI_TRUE) != 0) {
+    if (NET_InetAddressToSockaddr(env, iaObj, localport, &him.sa, &len, JNI_TRUE) != 0) {
       return;
     }
-    setDefaultScopeID(env, (struct sockaddr *)&him);
+    setDefaultScopeID(env, &him.sa);
 
-    if (NET_Bind(fd, (struct sockaddr *)&him, len) < 0)  {
+    if (NET_Bind(fd, &him.sa, len) < 0)  {
         if (errno == EADDRINUSE || errno == EADDRNOTAVAIL ||
             errno == EPERM || errno == EACCES) {
             NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "BindException",
@@ -232,13 +232,13 @@
         /* Now that we're a connected socket, let's extract the port number
          * that the system chose for us and store it in the Socket object.
          */
-        if (getsockname(fd, (struct sockaddr *)&him, &slen) == -1) {
+        if (getsockname(fd, &him.sa, &slen) == -1) {
             JNU_ThrowByNameWithMessageAndLastError
                 (env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
             return;
         }
 
-        localport = NET_GetPortFromSockaddr((struct sockaddr *)&him);
+        localport = NET_GetPortFromSockaddr(&him.sa);
 
         (*env)->SetIntField(env, this, pdsi_localPortID, localport);
     } else {
@@ -259,7 +259,7 @@
     /* The fdObj'fd */
     jint fd;
     /* The packetAddress address, family and port */
-    SOCKADDR rmtaddr;
+    SOCKETADDRESS rmtaddr;
     int len = 0;
 
     if (IS_NULL(fdObj)) {
@@ -274,18 +274,16 @@
         return;
     }
 
-    if (NET_InetAddressToSockaddr(env, address, port, (struct sockaddr *)&rmtaddr, &len, JNI_TRUE) != 0) {
+    if (NET_InetAddressToSockaddr(env, address, port, &rmtaddr.sa, &len, JNI_TRUE) != 0) {
       return;
     }
 
-    setDefaultScopeID(env, (struct sockaddr *)&rmtaddr);
+    setDefaultScopeID(env, &rmtaddr.sa);
 
-    if (NET_Connect(fd, (struct sockaddr *)&rmtaddr, len) == -1) {
+    if (NET_Connect(fd, &rmtaddr.sa, len) == -1) {
         NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "ConnectException",
                         "Connect failed");
-        return;
     }
-
 }
 
 /*
@@ -301,7 +299,7 @@
     jint fd;
 
 #if defined(__linux__) || defined(_ALLBSD_SOURCE)
-    SOCKADDR addr;
+    SOCKETADDRESS addr;
     socklen_t len;
 #endif
 
@@ -314,36 +312,34 @@
         memset(&addr, 0, sizeof(addr));
 #ifdef AF_INET6
         if (ipv6_available()) {
-            struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)&addr;
-            him6->sin6_family = AF_UNSPEC;
+            addr.sa6.sin6_family = AF_UNSPEC;
             len = sizeof(struct sockaddr_in6);
         } else
 #endif
         {
-            struct sockaddr_in *him4 = (struct sockaddr_in*)&addr;
-            him4->sin_family = AF_UNSPEC;
+            addr.sa4.sin_family = AF_UNSPEC;
             len = sizeof(struct sockaddr_in);
         }
-        NET_Connect(fd, (struct sockaddr *)&addr, len);
+        NET_Connect(fd, &addr.sa, len);
 
 #ifdef __linux__
         int localPort = 0;
-        if (getsockname(fd, (struct sockaddr *)&addr, &len) == -1)
+        if (getsockname(fd, &addr.sa, &len) == -1)
             return;
 
-        localPort = NET_GetPortFromSockaddr((struct sockaddr *)&addr);
+        localPort = NET_GetPortFromSockaddr(&addr.sa);
         if (localPort == 0) {
             localPort = (*env)->GetIntField(env, this, pdsi_localPortID);
 #ifdef AF_INET6
-            if (((struct sockaddr*)&addr)->sa_family == AF_INET6) {
-                ((struct sockaddr_in6*)&addr)->sin6_port = htons(localPort);
+            if (addr.sa.sa_family == AF_INET6) {
+                addr.sa6.sin6_port = htons(localPort);
             } else
 #endif /* AF_INET6 */
             {
-                ((struct sockaddr_in*)&addr)->sin_port = htons(localPort);
+                addr.sa4.sin_port = htons(localPort);
             }
 
-            NET_Bind(fd, (struct sockaddr *)&addr, len);
+            NET_Bind(fd, &addr.sa, len);
         }
 
 #endif
@@ -376,7 +372,7 @@
     /* The fdObj'fd */
     jint fd;
 
-    SOCKADDR rmtaddr, *rmtaddrP=&rmtaddr;
+    SOCKETADDRESS rmtaddr, *rmtaddrP = &rmtaddr;
     int len;
 
     if (IS_NULL(fdObj)) {
@@ -409,11 +405,11 @@
         rmtaddrP = 0;
     } else {
         packetPort = (*env)->GetIntField(env, packet, dp_portID);
-        if (NET_InetAddressToSockaddr(env, packetAddress, packetPort, (struct sockaddr *)&rmtaddr, &len, JNI_TRUE) != 0) {
-          return;
+        if (NET_InetAddressToSockaddr(env, packetAddress, packetPort, &rmtaddr.sa, &len, JNI_TRUE) != 0) {
+            return;
         }
     }
-    setDefaultScopeID(env, (struct sockaddr *)&rmtaddr);
+    setDefaultScopeID(env, &rmtaddr.sa);
 
     if (packetBufferLen > MAX_BUFFER_LEN) {
         /* When JNI-ifying the JDK's IO routines, we turned
@@ -449,7 +445,7 @@
                                (jbyte *)fullPacket);
 #ifdef AF_INET6
     if (trafficClass != 0 && ipv6_available()) {
-        NET_SetTrafficClass((struct sockaddr *)&rmtaddr, trafficClass);
+        NET_SetTrafficClass(&rmtaddr.sa, trafficClass);
     }
 #endif /* AF_INET6 */
 
@@ -492,8 +488,8 @@
     jint timeout = (*env)->GetIntField(env, this, pdsi_timeoutID);
     jint fd;
     ssize_t n;
-    SOCKADDR remote_addr;
-    socklen_t slen = SOCKADDR_LEN;
+    SOCKETADDRESS rmtaddr;
+    socklen_t slen = sizeof(SOCKETADDRESS);
     char buf[1];
     jint family;
     jobject iaObj;
@@ -527,7 +523,7 @@
         }
     }
 
-    n = NET_RecvFrom(fd, buf, 1, MSG_PEEK, (struct sockaddr *)&remote_addr, &slen);
+    n = NET_RecvFrom(fd, buf, 1, MSG_PEEK, &rmtaddr.sa, &slen);
 
     if (n == -1) {
 
@@ -552,7 +548,7 @@
         return 0;
     }
 
-    iaObj = NET_SockaddrToInetAddress(env, (struct sockaddr *)&remote_addr, &port);
+    iaObj = NET_SockaddrToInetAddress(env, &rmtaddr.sa, &port);
 #ifdef AF_INET6
     family = getInetAddress_family(env, iaObj) == IPv4? AF_INET : AF_INET6;
 #else
@@ -574,16 +570,13 @@
     int mallocedPacket = JNI_FALSE;
     jobject fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
     jint timeout = (*env)->GetIntField(env, this, pdsi_timeoutID);
-
     jbyteArray packetBuffer;
     jint packetBufferOffset, packetBufferLen;
-
     int fd;
-
     int n;
-    SOCKADDR remote_addr;
-    socklen_t slen = SOCKADDR_LEN;
-    int port;
+    SOCKETADDRESS rmtaddr;
+    socklen_t slen = sizeof(SOCKETADDRESS);
+    int port = -1;
 
     if (IS_NULL(fdObj)) {
         JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
@@ -661,7 +654,7 @@
     }
 
     n = NET_RecvFrom(fd, fullPacket, packetBufferLen, MSG_PEEK,
-                     (struct sockaddr *)&remote_addr, &slen);
+                     &rmtaddr.sa, &slen);
     /* truncate the data if the packet's length is too small */
     if (n > packetBufferLen) {
         n = packetBufferLen;
@@ -706,18 +699,18 @@
          */
         packetAddress = (*env)->GetObjectField(env, packet, dp_addressID);
         if (packetAddress != NULL) {
-            if (!NET_SockaddrEqualsInetAddress(env, (struct sockaddr *)&remote_addr, packetAddress)) {
+            if (!NET_SockaddrEqualsInetAddress(env, &rmtaddr.sa, packetAddress)) {
                 /* force a new InetAddress to be created */
                 packetAddress = NULL;
             }
         }
         if (packetAddress == NULL) {
-            packetAddress = NET_SockaddrToInetAddress(env, (struct sockaddr *)&remote_addr, &port);
+            packetAddress = NET_SockaddrToInetAddress(env, &rmtaddr.sa, &port);
             /* stuff the new Inetaddress in the packet */
             (*env)->SetObjectField(env, packet, dp_addressID, packetAddress);
         } else {
             /* only get the new port number */
-            port = NET_GetPortFromSockaddr((struct sockaddr *)&remote_addr);
+            port = NET_GetPortFromSockaddr(&rmtaddr.sa);
         }
         /* and fill in the data, remote address/port and such */
         (*env)->SetByteArrayRegion(env, packetBuffer, packetBufferOffset, n,
@@ -753,8 +746,8 @@
     int fd;
 
     int n;
-    SOCKADDR remote_addr;
-    socklen_t slen = SOCKADDR_LEN;
+    SOCKETADDRESS rmtaddr;
+    socklen_t slen = sizeof(SOCKETADDRESS);
     jboolean retry;
 #ifdef __linux__
     jboolean connected = JNI_FALSE;
@@ -849,7 +842,7 @@
         }
 
         n = NET_RecvFrom(fd, fullPacket, packetBufferLen, 0,
-                         (struct sockaddr *)&remote_addr, &slen);
+                         &rmtaddr.sa, &slen);
         /* truncate the data if the packet's length is too small */
         if (n > packetBufferLen) {
             n = packetBufferLen;
@@ -887,18 +880,18 @@
              */
             packetAddress = (*env)->GetObjectField(env, packet, dp_addressID);
             if (packetAddress != NULL) {
-                if (!NET_SockaddrEqualsInetAddress(env, (struct sockaddr *)&remote_addr, packetAddress)) {
+                if (!NET_SockaddrEqualsInetAddress(env, &rmtaddr.sa, packetAddress)) {
                     /* force a new InetAddress to be created */
                     packetAddress = NULL;
                 }
             }
             if (packetAddress == NULL) {
-                packetAddress = NET_SockaddrToInetAddress(env, (struct sockaddr *)&remote_addr, &port);
+                packetAddress = NET_SockaddrToInetAddress(env, &rmtaddr.sa, &port);
                 /* stuff the new Inetaddress in the packet */
                 (*env)->SetObjectField(env, packet, dp_addressID, packetAddress);
             } else {
                 /* only get the new port number */
-                port = NET_GetPortFromSockaddr((struct sockaddr *)&remote_addr);
+                port = NET_GetPortFromSockaddr(&rmtaddr.sa);
             }
             /* and fill in the data, remote address/port and such */
             (*env)->SetByteArrayRegion(env, packetBuffer, packetBufferOffset, n,
@@ -1729,19 +1722,17 @@
      */
     if (opt == java_net_SocketOptions_SO_BINDADDR) {
         /* find out local IP address */
-        SOCKADDR him;
-        socklen_t len = 0;
+        SOCKETADDRESS him;
+        socklen_t len = sizeof(SOCKETADDRESS);
         int port;
         jobject iaObj;
 
-        len = SOCKADDR_LEN;
-
-        if (getsockname(fd, (struct sockaddr *)&him, &len) == -1) {
+        if (getsockname(fd, &him.sa, &len) == -1) {
             JNU_ThrowByNameWithMessageAndLastError
                 (env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
             return NULL;
         }
-        iaObj = NET_SockaddrToInetAddress(env, (struct sockaddr *)&him, &port);
+        iaObj = NET_SockaddrToInetAddress(env, &him.sa, &port);
 
         return iaObj;
     }
--- a/jdk/src/java.base/unix/native/libnet/PlainSocketImpl.c	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/unix/native/libnet/PlainSocketImpl.c	Wed Jul 05 22:19:13 2017 +0200
@@ -274,7 +274,7 @@
     /* fd is an int field on iaObj */
     jint fd;
 
-    SOCKADDR him;
+    SOCKETADDRESS him;
     /* The result of the connection */
     int connect_rv = -1;
 
@@ -290,18 +290,18 @@
     }
 
     /* connect */
-    if (NET_InetAddressToSockaddr(env, iaObj, port, (struct sockaddr *)&him, &len, JNI_TRUE) != 0) {
-      return;
+    if (NET_InetAddressToSockaddr(env, iaObj, port, &him.sa, &len, JNI_TRUE) != 0) {
+        return;
     }
-    setDefaultScopeID(env, (struct sockaddr *)&him);
+    setDefaultScopeID(env, &him.sa);
 
 #ifdef AF_INET6
     if (trafficClass != 0 && ipv6_available()) {
-        NET_SetTrafficClass((struct sockaddr *)&him, trafficClass);
+        NET_SetTrafficClass(&him.sa, trafficClass);
     }
 #endif /* AF_INET6 */
     if (timeout <= 0) {
-        connect_rv = NET_Connect(fd, (struct sockaddr *)&him, len);
+        connect_rv = NET_Connect(fd, &him.sa, len);
 #ifdef __solaris__
         if (connect_rv == -1 && errno == EINPROGRESS ) {
 
@@ -350,7 +350,7 @@
         SET_NONBLOCKING(fd);
 
         /* no need to use NET_Connect as non-blocking */
-        connect_rv = connect(fd, (struct sockaddr *)&him, len);
+        connect_rv = connect(fd, &him.sa, len);
 
         /* connection not established immediately */
         if (connect_rv != 0) {
@@ -497,12 +497,12 @@
         /* Now that we're a connected socket, let's extract the port number
          * that the system chose for us and store it in the Socket object.
          */
-        socklen_t slen = SOCKADDR_LEN;
-        if (getsockname(fd, (struct sockaddr *)&him, &slen) == -1) {
+        socklen_t slen = sizeof(SOCKETADDRESS);
+        if (getsockname(fd, &him.sa, &slen) == -1) {
             JNU_ThrowByNameWithMessageAndLastError
                 (env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
         } else {
-            localport = NET_GetPortFromSockaddr((struct sockaddr *)&him);
+            localport = NET_GetPortFromSockaddr(&him.sa);
             (*env)->SetIntField(env, this, psi_localportID, localport);
         }
     }
@@ -522,7 +522,7 @@
     /* fd is an int field on fdObj */
     int fd;
     int len;
-    SOCKADDR him;
+    SOCKETADDRESS him;
 
     if (IS_NULL(fdObj)) {
         JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
@@ -537,13 +537,13 @@
     }
 
     /* bind */
-    if (NET_InetAddressToSockaddr(env, iaObj, localport, (struct sockaddr *)&him,
+    if (NET_InetAddressToSockaddr(env, iaObj, localport, &him.sa,
                                   &len, JNI_TRUE) != 0) {
         return;
     }
-    setDefaultScopeID(env, (struct sockaddr *)&him);
+    setDefaultScopeID(env, &him.sa);
 
-    if (NET_Bind(fd, (struct sockaddr *)&him, len) < 0) {
+    if (NET_Bind(fd, &him.sa, len) < 0) {
         if (errno == EADDRINUSE || errno == EADDRNOTAVAIL ||
             errno == EPERM || errno == EACCES) {
             NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "BindException",
@@ -560,16 +560,16 @@
 
     /* initialize the local port */
     if (localport == 0) {
-        socklen_t slen = sizeof(him);
+        socklen_t slen = sizeof(SOCKETADDRESS);
         /* Now that we're a connected socket, let's extract the port number
          * that the system chose for us and store it in the Socket object.
          */
-        if (getsockname(fd, (struct sockaddr *)&him, &slen) == -1) {
+        if (getsockname(fd, &him.sa, &slen) == -1) {
             JNU_ThrowByNameWithMessageAndLastError
                 (env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
             return;
         }
-        localport = NET_GetPortFromSockaddr((struct sockaddr *)&him);
+        localport = NET_GetPortFromSockaddr(&him.sa);
         (*env)->SetIntField(env, this, psi_localportID, localport);
     } else {
         (*env)->SetIntField(env, this, psi_localportID, localport);
@@ -637,8 +637,8 @@
     /* accepted fd */
     jint newfd;
 
-    SOCKADDR him;
-    socklen_t slen = SOCKADDR_LEN;
+    SOCKETADDRESS him;
+    socklen_t slen = sizeof(SOCKETADDRESS);
 
     if (IS_NULL(fdObj)) {
         JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
@@ -692,7 +692,7 @@
             return;
         }
 
-        newfd = NET_Accept(fd, (struct sockaddr *)&him, &slen);
+        newfd = NET_Accept(fd, &him.sa, &slen);
 
         /* connection accepted */
         if (newfd >= 0) {
@@ -740,7 +740,7 @@
     /*
      * fill up the remote peer port and address in the new socket structure.
      */
-    socketAddressObj = NET_SockaddrToInetAddress(env, (struct sockaddr *)&him, &port);
+    socketAddressObj = NET_SockaddrToInetAddress(env, &him.sa, &port);
     if (socketAddressObj == NULL) {
         /* should be pending exception */
         close(newfd);
@@ -975,21 +975,19 @@
      * SO_BINDADDR isn't a socket option
      */
     if (cmd == java_net_SocketOptions_SO_BINDADDR) {
-        SOCKADDR him;
-        socklen_t len = 0;
+        SOCKETADDRESS him;
+        socklen_t len = sizeof(SOCKETADDRESS);
         int port;
         jobject iaObj;
         jclass iaCntrClass;
         jfieldID iaFieldID;
 
-        len = SOCKADDR_LEN;
-
-        if (getsockname(fd, (struct sockaddr *)&him, &len) < 0) {
+        if (getsockname(fd, &him.sa, &len) < 0) {
             JNU_ThrowByNameWithMessageAndLastError
                 (env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
             return -1;
         }
-        iaObj = NET_SockaddrToInetAddress(env, (struct sockaddr *)&him, &port);
+        iaObj = NET_SockaddrToInetAddress(env, &him.sa, &port);
         CHECK_NULL_RETURN(iaObj, -1);
 
         iaCntrClass = (*env)->GetObjectClass(env, iaContainerObj);
--- a/jdk/src/java.base/unix/native/libnet/net_util_md.c	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/unix/native/libnet/net_util_md.c	Wed Jul 05 22:19:13 2017 +0200
@@ -334,8 +334,8 @@
 #ifdef AF_INET6
     int fd;
     void *ipv6_fn;
-    SOCKADDR sa;
-    socklen_t sa_len = sizeof(sa);
+    SOCKETADDRESS sa;
+    socklen_t sa_len = sizeof(SOCKETADDRESS);
 
     fd = socket(AF_INET6, SOCK_STREAM, 0) ;
     if (fd < 0) {
@@ -351,9 +351,8 @@
      * xinetd. If it's a socket then check the family - if it's an
      * IPv4 socket then we need to disable IPv6.
      */
-    if (getsockname(0, (struct sockaddr *)&sa, &sa_len) == 0) {
-        struct sockaddr *saP = (struct sockaddr *)&sa;
-        if (saP->sa_family != AF_INET6) {
+    if (getsockname(0, &sa.sa, &sa_len) == 0) {
+        if (sa.sa.sa_family != AF_INET6) {
             close(fd);
             return JNI_FALSE;
         }
@@ -488,25 +487,8 @@
     }
 }
 
-void
-NET_AllocSockaddr(struct sockaddr **him, int *len) {
-#ifdef AF_INET6
-    if (ipv6_available()) {
-        struct sockaddr_in6 *him6 = (struct sockaddr_in6*)malloc(sizeof(struct sockaddr_in6));
-        *him = (struct sockaddr*)him6;
-        *len = sizeof(struct sockaddr_in6);
-    } else
-#endif /* AF_INET6 */
-        {
-            struct sockaddr_in *him4 = (struct sockaddr_in*)malloc(sizeof(struct sockaddr_in));
-            *him = (struct sockaddr*)him4;
-            *len = sizeof(struct sockaddr_in);
-        }
-}
-
 #if defined(__linux__) && defined(AF_INET6)
 
-
 /* following code creates a list of addresses from the kernel
  * routing table that are routed via the loopback address.
  * We check all destination addresses against this table
--- a/jdk/src/java.base/unix/native/libnet/net_util_md.h	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/unix/native/libnet/net_util_md.h	Wed Jul 05 22:19:13 2017 +0200
@@ -60,9 +60,9 @@
 void NET_ThrowByNameWithLastError(JNIEnv *env, const char *name,
                                   const char *defaultDetail);
 
-#define NET_WAIT_READ    0x01
-#define NET_WAIT_WRITE   0x02
-#define NET_WAIT_CONNECT 0x04
+/************************************************************************
+ * Macros and constants
+ */
 
 /* Defines SO_REUSEPORT */
 #ifndef SO_REUSEPORT
@@ -77,12 +77,6 @@
 #endif
 #endif
 
-jint NET_Wait(JNIEnv *env, jint fd, jint flags, jint timeout);
-
-/************************************************************************
- * Macros and constants
- */
-
 /*
  * On 64-bit JDKs we use a much larger stack and heap buffer.
  */
@@ -95,20 +89,16 @@
 #endif
 
 #ifdef AF_INET6
-
-#define SOCKADDR        union { \
-                            struct sockaddr_in him4; \
-                            struct sockaddr_in6 him6; \
-                        }
-
-#define SOCKADDR_LEN    (ipv6_available() ? sizeof(SOCKADDR) : \
-                         sizeof(struct sockaddr_in))
-
+typedef union {
+    struct sockaddr     sa;
+    struct sockaddr_in  sa4;
+    struct sockaddr_in6 sa6;
+} SOCKETADDRESS;
 #else
-
-#define SOCKADDR        union { struct sockaddr_in him4; }
-#define SOCKADDR_LEN    sizeof(SOCKADDR)
-
+typedef union {
+    struct sockaddr     sa;
+    struct sockaddr_in  sa4;
+} SOCKETADDRESS;
 #endif
 
 /************************************************************************
--- a/jdk/src/java.base/unix/native/libnio/ch/DatagramChannelImpl.c	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/unix/native/libnio/ch/DatagramChannelImpl.c	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -87,58 +87,50 @@
     jint fd = fdval(env, fdo);
     int rv;
 
-#ifdef __solaris__
+#if defined(__solaris__)
     rv = connect(fd, 0, 0);
-#endif
+#else
+    int len;
+    SOCKETADDRESS sa;
 
-#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(_AIX)
-    {
-        int len;
-        SOCKADDR sa;
-
-        memset(&sa, 0, sizeof(sa));
+    memset(&sa, 0, sizeof(sa));
 
 #ifdef AF_INET6
-        if (isIPv6) {
-            struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)&sa;
+    if (isIPv6) {
 #if defined(_ALLBSD_SOURCE)
-            him6->sin6_family = AF_INET6;
+        sa.sa6.sin6_family = AF_INET6;
 #else
-            him6->sin6_family = AF_UNSPEC;
+        sa.sa6.sin6_family = AF_UNSPEC;
 #endif
-            len = sizeof(struct sockaddr_in6);
-        } else
+        len = sizeof(struct sockaddr_in6);
+    } else
 #endif
-        {
-            struct sockaddr_in *him4 = (struct sockaddr_in*)&sa;
+    {
 #if defined(_ALLBSD_SOURCE)
-            him4->sin_family = AF_INET;
+        sa.sa4.sin_family = AF_INET;
 #else
-            him4->sin_family = AF_UNSPEC;
+        sa.sa4.sin_family = AF_UNSPEC;
 #endif
-            len = sizeof(struct sockaddr_in);
-        }
+        len = sizeof(struct sockaddr_in);
+    }
 
-        rv = connect(fd, (struct sockaddr *)&sa, len);
+    rv = connect(fd, &sa.sa, len);
 
 #if defined(_ALLBSD_SOURCE)
-        if (rv < 0 && errno == EADDRNOTAVAIL)
-                rv = errno = 0;
+    if (rv < 0 && errno == EADDRNOTAVAIL)
+        rv = errno = 0;
+#elif defined(_AIX)
+    /* See W. Richard Stevens, "UNIX Network Programming, Volume 1", p. 254:
+     * 'Setting the address family to AF_UNSPEC might return EAFNOSUPPORT
+     * but that is acceptable.
+     */
+    if (rv < 0 && errno == EAFNOSUPPORT)
+        rv = errno = 0;
 #endif
-#if defined(_AIX)
-        /* See W. Richard Stevens, "UNIX Network Programming, Volume 1", p. 254:
-         * 'Setting the address family to AF_UNSPEC might return EAFNOSUPPORT
-         * but that is acceptable.
-         */
-        if (rv < 0 && errno == EAFNOSUPPORT)
-            rv = errno = 0;
-#endif
-    }
 #endif
 
     if (rv < 0)
         handleSocketError(env, errno);
-
 }
 
 JNIEXPORT jint JNICALL
@@ -148,8 +140,8 @@
 {
     jint fd = fdval(env, fdo);
     void *buf = (void *)jlong_to_ptr(address);
-    SOCKADDR sa;
-    socklen_t sa_len = SOCKADDR_LEN;
+    SOCKETADDRESS sa;
+    socklen_t sa_len = sizeof(SOCKETADDRESS);
     jboolean retry = JNI_FALSE;
     jint n = 0;
     jobject senderAddr;
@@ -160,7 +152,7 @@
 
     do {
         retry = JNI_FALSE;
-        n = recvfrom(fd, buf, len, 0, (struct sockaddr *)&sa, &sa_len);
+        n = recvfrom(fd, buf, len, 0, &sa.sa, &sa_len);
         if (n < 0) {
             if (errno == EWOULDBLOCK) {
                 return IOS_UNAVAILABLE;
@@ -189,12 +181,11 @@
      */
     senderAddr = (*env)->GetObjectField(env, this, dci_senderAddrID);
     if (senderAddr != NULL) {
-        if (!NET_SockaddrEqualsInetAddress(env, (struct sockaddr *)&sa,
-                                           senderAddr)) {
+        if (!NET_SockaddrEqualsInetAddress(env, &sa.sa, senderAddr)) {
             senderAddr = NULL;
         } else {
             jint port = (*env)->GetIntField(env, this, dci_senderPortID);
-            if (port != NET_GetPortFromSockaddr((struct sockaddr *)&sa)) {
+            if (port != NET_GetPortFromSockaddr(&sa.sa)) {
                 senderAddr = NULL;
             }
         }
@@ -202,7 +193,7 @@
     if (senderAddr == NULL) {
         jobject isa = NULL;
         int port = 0;
-        jobject ia = NET_SockaddrToInetAddress(env, (struct sockaddr *)&sa, &port);
+        jobject ia = NET_SockaddrToInetAddress(env, &sa.sa, &port);
         if (ia != NULL) {
             isa = (*env)->NewObject(env, isa_class, isa_ctorID, ia, port);
         }
@@ -210,7 +201,7 @@
 
         (*env)->SetObjectField(env, this, dci_senderAddrID, ia);
         (*env)->SetIntField(env, this, dci_senderPortID,
-                            NET_GetPortFromSockaddr((struct sockaddr *)&sa));
+                            NET_GetPortFromSockaddr(&sa.sa));
         (*env)->SetObjectField(env, this, dci_senderID, isa);
     }
     return n;
@@ -223,21 +214,20 @@
 {
     jint fd = fdval(env, fdo);
     void *buf = (void *)jlong_to_ptr(address);
-    SOCKADDR sa;
-    int sa_len = SOCKADDR_LEN;
+    SOCKETADDRESS sa;
+    int sa_len = sizeof(SOCKETADDRESS);
     jint n = 0;
 
     if (len > MAX_PACKET_LEN) {
         len = MAX_PACKET_LEN;
     }
 
-    if (NET_InetAddressToSockaddr(env, destAddress, destPort,
-                                  (struct sockaddr *)&sa,
+    if (NET_InetAddressToSockaddr(env, destAddress, destPort, &sa.sa,
                                   &sa_len, preferIPv6) != 0) {
       return IOS_THROWN;
     }
 
-    n = sendto(fd, buf, len, 0, (struct sockaddr *)&sa, sa_len);
+    n = sendto(fd, buf, len, 0, &sa.sa, sa_len);
     if (n < 0) {
         if (errno == EAGAIN) {
             return IOS_UNAVAILABLE;
--- a/jdk/src/java.base/unix/native/libnio/ch/InheritedChannel.c	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/unix/native/libnio/ch/InheritedChannel.c	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,18 +57,16 @@
 JNIEXPORT jobject JNICALL
 Java_sun_nio_ch_InheritedChannel_peerAddress0(JNIEnv *env, jclass cla, jint fd)
 {
-    struct sockaddr *sa;
-    socklen_t sa_len;
+    SOCKETADDRESS sa;
+    socklen_t len = sizeof(SOCKETADDRESS);
     jobject remote_ia = NULL;
     jint remote_port;
 
-    NET_AllocSockaddr(&sa, (int *)&sa_len);
-    if (getpeername(fd, sa, &sa_len) == 0) {
-        if (matchFamily(sa)) {
-            remote_ia = NET_SockaddrToInetAddress(env, sa, (int *)&remote_port);
+    if (getpeername(fd, &sa.sa, &len) == 0) {
+        if (matchFamily(&sa.sa)) {
+            remote_ia = NET_SockaddrToInetAddress(env, &sa.sa, (int *)&remote_port);
         }
     }
-    free((void *)sa);
 
     return remote_ia;
 }
@@ -77,17 +75,15 @@
 JNIEXPORT jint JNICALL
 Java_sun_nio_ch_InheritedChannel_peerPort0(JNIEnv *env, jclass cla, jint fd)
 {
-    struct sockaddr *sa;
-    socklen_t sa_len;
+    SOCKETADDRESS sa;
+    socklen_t len = sizeof(SOCKETADDRESS);
     jint remote_port = -1;
 
-    NET_AllocSockaddr(&sa, (int *)&sa_len);
-    if (getpeername(fd, sa, &sa_len) == 0) {
-        if (matchFamily(sa)) {
-            NET_SockaddrToInetAddress(env, sa, (int *)&remote_port);
+    if (getpeername(fd, &sa.sa, &len) == 0) {
+        if (matchFamily(&sa.sa)) {
+            NET_SockaddrToInetAddress(env, &sa.sa, (int *)&remote_port);
         }
     }
-    free((void *)sa);
 
     return remote_port;
 }
--- a/jdk/src/java.base/unix/native/libnio/ch/Net.c	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/unix/native/libnio/ch/Net.c	Wed Jul 05 22:19:13 2017 +0200
@@ -273,15 +273,16 @@
 Java_sun_nio_ch_Net_bind0(JNIEnv *env, jclass clazz, jobject fdo, jboolean preferIPv6,
                           jboolean useExclBind, jobject iao, int port)
 {
-    SOCKADDR sa;
-    int sa_len = SOCKADDR_LEN;
+    SOCKETADDRESS sa;
+    int sa_len = sizeof(SOCKETADDRESS);
     int rv = 0;
 
-    if (NET_InetAddressToSockaddr(env, iao, port, (struct sockaddr *)&sa, &sa_len, preferIPv6) != 0) {
-      return;
+    if (NET_InetAddressToSockaddr(env, iao, port, &sa.sa, &sa_len,
+                                  preferIPv6) != 0) {
+        return;
     }
 
-    rv = NET_Bind(fdval(env, fdo), (struct sockaddr *)&sa, sa_len);
+    rv = NET_Bind(fdval(env, fdo), &sa.sa, sa_len);
     if (rv != 0) {
         handleSocketError(env, errno);
     }
@@ -298,17 +299,16 @@
 Java_sun_nio_ch_Net_connect0(JNIEnv *env, jclass clazz, jboolean preferIPv6,
                              jobject fdo, jobject iao, jint port)
 {
-    SOCKADDR sa;
-    int sa_len = SOCKADDR_LEN;
+    SOCKETADDRESS sa;
+    int sa_len = sizeof(SOCKETADDRESS);
     int rv;
 
-    if (NET_InetAddressToSockaddr(env, iao, port, (struct sockaddr *) &sa,
-                                  &sa_len, preferIPv6) != 0)
-    {
-      return IOS_THROWN;
+    if (NET_InetAddressToSockaddr(env, iao, port, &sa.sa, &sa_len,
+                                  preferIPv6) != 0) {
+        return IOS_THROWN;
     }
 
-    rv = connect(fdval(env, fdo), (struct sockaddr *)&sa, sa_len);
+    rv = connect(fdval(env, fdo), &sa.sa, sa_len);
     if (rv != 0) {
         if (errno == EINPROGRESS) {
             return IOS_UNAVAILABLE;
@@ -323,9 +323,9 @@
 JNIEXPORT jint JNICALL
 Java_sun_nio_ch_Net_localPort(JNIEnv *env, jclass clazz, jobject fdo)
 {
-    SOCKADDR sa;
-    socklen_t sa_len = SOCKADDR_LEN;
-    if (getsockname(fdval(env, fdo), (struct sockaddr *)&sa, &sa_len) < 0) {
+    SOCKETADDRESS sa;
+    socklen_t sa_len = sizeof(SOCKETADDRESS);
+    if (getsockname(fdval(env, fdo), &sa.sa, &sa_len) < 0) {
 #ifdef _ALLBSD_SOURCE
         /*
          * XXXBSD:
@@ -335,13 +335,11 @@
          * it shouldn't fail. As such, we just fill in generic Linux-compatible values.
          */
         if (errno == ECONNRESET) {
-            struct sockaddr_in *sin;
-            sin = (struct sockaddr_in *) &sa;
-            bzero(sin, sizeof(*sin));
-            sin->sin_len  = sizeof(struct sockaddr_in);
-            sin->sin_family = AF_INET;
-            sin->sin_port = htonl(0);
-            sin->sin_addr.s_addr = INADDR_ANY;
+            bzero(&sa.sa4, sizeof(sa));
+            sa.sa4.sin_len = sizeof(struct sockaddr_in);
+            sa.sa4.sin_family = AF_INET;
+            sa.sa4.sin_port = htonl(0);
+            sa.sa4.sin_addr.s_addr = INADDR_ANY;
         } else {
             handleSocketError(env, errno);
             return -1;
@@ -351,16 +349,16 @@
         return -1;
 #endif /* _ALLBSD_SOURCE */
     }
-    return NET_GetPortFromSockaddr((struct sockaddr *)&sa);
+    return NET_GetPortFromSockaddr(&sa.sa);
 }
 
 JNIEXPORT jobject JNICALL
 Java_sun_nio_ch_Net_localInetAddress(JNIEnv *env, jclass clazz, jobject fdo)
 {
-    SOCKADDR sa;
-    socklen_t sa_len = SOCKADDR_LEN;
+    SOCKETADDRESS sa;
+    socklen_t sa_len = sizeof(SOCKETADDRESS);
     int port;
-    if (getsockname(fdval(env, fdo), (struct sockaddr *)&sa, &sa_len) < 0) {
+    if (getsockname(fdval(env, fdo), &sa.sa, &sa_len) < 0) {
 #ifdef _ALLBSD_SOURCE
         /*
          * XXXBSD:
@@ -370,13 +368,11 @@
          * it shouldn't fail. As such, we just fill in generic Linux-compatible values.
          */
         if (errno == ECONNRESET) {
-            struct sockaddr_in *sin;
-            sin = (struct sockaddr_in *) &sa;
-            bzero(sin, sizeof(*sin));
-            sin->sin_len  = sizeof(struct sockaddr_in);
-            sin->sin_family = AF_INET;
-            sin->sin_port = htonl(0);
-            sin->sin_addr.s_addr = INADDR_ANY;
+            bzero(&sa.sa4, sizeof(sa));
+            sa.sa4.sin_len  = sizeof(struct sockaddr_in);
+            sa.sa4.sin_family = AF_INET;
+            sa.sa4.sin_port = htonl(0);
+            sa.sa4.sin_addr.s_addr = INADDR_ANY;
         } else {
             handleSocketError(env, errno);
             return NULL;
@@ -386,7 +382,7 @@
         return NULL;
 #endif /* _ALLBSD_SOURCE */
     }
-    return NET_SockaddrToInetAddress(env, (struct sockaddr *)&sa, &port);
+    return NET_SockaddrToInetAddress(env, &sa.sa, &port);
 }
 
 JNIEXPORT jint JNICALL
--- a/jdk/src/java.base/unix/native/libnio/ch/ServerSocketChannelImpl.c	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/unix/native/libnio/ch/ServerSocketChannelImpl.c	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -80,26 +80,19 @@
 {
     jint ssfd = (*env)->GetIntField(env, ssfdo, fd_fdID);
     jint newfd;
-    struct sockaddr *sa;
-    int alloc_len;
+    SOCKETADDRESS sa;
+    socklen_t sa_len = sizeof(SOCKETADDRESS);
     jobject remote_ia = 0;
     jobject isa;
     jint remote_port = 0;
 
-    NET_AllocSockaddr(&sa, &alloc_len);
-    if (sa == NULL) {
-        JNU_ThrowOutOfMemoryError(env, NULL);
-        return IOS_THROWN;
-    }
-
     /*
      * accept connection but ignore ECONNABORTED indicating that
      * a connection was eagerly accepted but was reset before
      * accept() was called.
      */
     for (;;) {
-        socklen_t sa_len = alloc_len;
-        newfd = accept(ssfd, sa, &sa_len);
+        newfd = accept(ssfd, &sa.sa, &sa_len);
         if (newfd >= 0) {
             break;
         }
@@ -110,7 +103,6 @@
     }
 
     if (newfd < 0) {
-        free((void *)sa);
         if (errno == EAGAIN)
             return IOS_UNAVAILABLE;
         if (errno == EINTR)
@@ -120,8 +112,7 @@
     }
 
     (*env)->SetIntField(env, newfdo, fd_fdID, newfd);
-    remote_ia = NET_SockaddrToInetAddress(env, sa, (int *)&remote_port);
-    free((void *)sa);
+    remote_ia = NET_SockaddrToInetAddress(env, &sa.sa, (int *)&remote_port);
     CHECK_NULL_RETURN(remote_ia, IOS_THROWN);
     isa = (*env)->NewObject(env, isa_class, isa_ctorID, remote_ia, remote_port);
     CHECK_NULL_RETURN(isa, IOS_THROWN);
--- a/jdk/src/java.base/windows/native/libnet/Inet6AddressImpl.c	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/windows/native/libnet/Inet6AddressImpl.c	Wed Jul 05 22:19:13 2017 +0200
@@ -83,7 +83,7 @@
     jboolean preferIPv6Address;
 
     int error=0;
-    struct addrinfo hints, *res, *resNew = NULL;
+    struct addrinfo hints, *res = NULL, *resNew = NULL;
 
     initInetAddressIDs(env);
     JNU_CHECK_EXCEPTION_RETURN(env, NULL);
@@ -223,7 +223,7 @@
               setInetAddress_addr(env, iaObj, ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr));
               setInetAddress_hostName(env, iaObj, host);
               (*env)->SetObjectArrayElement(env, ret, (inetIndex | originalIndex), iaObj);
-                inetIndex ++;
+              inetIndex ++;
             } else if (iterator->ai_family == AF_INET6) {
               jint scope = 0;
               jboolean ret1;
--- a/jdk/src/java.base/windows/native/libnet/NetworkInterface.c	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/windows/native/libnet/NetworkInterface.c	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -429,8 +429,8 @@
                 return -1;
             }
 
-            curr->addr.him4.sin_family = AF_INET;
-            curr->addr.him4.sin_addr.s_addr = tableP->table[i].dwAddr;
+            curr->addr.sa4.sin_family = AF_INET;
+            curr->addr.sa4.sin_addr.s_addr = tableP->table[i].dwAddr;
             /*
              * Get netmask / broadcast address
              */
@@ -447,11 +447,11 @@
                * to 0 or 1.
                * Yes, I know it's stupid, but what can I say, it's MSFTs API.
                */
-              curr->brdcast.him4.sin_family = AF_INET;
+              curr->brdcast.sa4.sin_family = AF_INET;
               if (tableP->table[i].dwBCastAddr == 1)
-                curr->brdcast.him4.sin_addr.s_addr = (tableP->table[i].dwAddr & tableP->table[i].dwMask) | (0xffffffff ^ tableP->table[i].dwMask);
+                curr->brdcast.sa4.sin_addr.s_addr = (tableP->table[i].dwAddr & tableP->table[i].dwMask) | (0xffffffff ^ tableP->table[i].dwMask);
               else
-                curr->brdcast.him4.sin_addr.s_addr = (tableP->table[i].dwAddr & tableP->table[i].dwMask);
+                curr->brdcast.sa4.sin_addr.s_addr = (tableP->table[i].dwAddr & tableP->table[i].dwMask);
               mask = ntohl(tableP->table[i].dwMask);
               curr->mask = 0;
               while (mask) {
@@ -584,7 +584,7 @@
     while (addrs != NULL) {
         jobject iaObj, ia2Obj;
         jobject ibObj = NULL;
-        if (addrs->addr.him.sa_family == AF_INET) {
+        if (addrs->addr.sa.sa_family == AF_INET) {
             iaObj = (*env)->NewObject(env, ia4_class, ia4_ctrID);
             if (iaObj == NULL) {
                 free_netaddr(netaddrP);
@@ -592,7 +592,7 @@
             }
             /* default ctor will set family to AF_INET */
 
-            setInetAddress_addr(env, iaObj, ntohl(addrs->addr.him4.sin_addr.s_addr));
+            setInetAddress_addr(env, iaObj, ntohl(addrs->addr.sa4.sin_addr.s_addr));
             if (addrs->mask != -1) {
               ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID);
               if (ibObj == NULL) {
@@ -605,7 +605,7 @@
                 free_netaddr(netaddrP);
                 return NULL;
               }
-              setInetAddress_addr(env, ia2Obj, ntohl(addrs->brdcast.him4.sin_addr.s_addr));
+              setInetAddress_addr(env, ia2Obj, ntohl(addrs->brdcast.sa4.sin_addr.s_addr));
               (*env)->SetObjectField(env, ibObj, ni_ibbroadcastID, ia2Obj);
               (*env)->SetShortField(env, ibObj, ni_ibmaskID, addrs->mask);
               (*env)->SetObjectArrayElement(env, bindsArr, bind_index++, ibObj);
@@ -614,12 +614,12 @@
             int scope;
             iaObj = (*env)->NewObject(env, ia6_class, ia6_ctrID);
             if (iaObj) {
-                jboolean ret = setInet6Address_ipaddress(env, iaObj,  (jbyte *)&(addrs->addr.him6.sin6_addr.s6_addr));
+                jboolean ret = setInet6Address_ipaddress(env, iaObj,  (jbyte *)&(addrs->addr.sa6.sin6_addr.s6_addr));
                 if (ret == JNI_FALSE) {
                     return NULL;
                 }
 
-                scope = addrs->addr.him6.sin6_scope_id;
+                scope = addrs->addr.sa6.sin6_scope_id;
                 if (scope != 0) { /* zero is default value, no need to set */
                     setInet6Address_scopeid(env, iaObj, scope);
                     setInet6Address_scopeifname(env, iaObj, netifObj);
@@ -795,7 +795,7 @@
         addrP = addrList;
 
         while (addrP != NULL) {
-            if ((unsigned long)addr == ntohl(addrP->addr.him4.sin_addr.s_addr)) {
+            if ((unsigned long)addr == ntohl(addrP->addr.sa4.sin_addr.s_addr)) {
                 break;
             }
             addrP = addrP->next;
--- a/jdk/src/java.base/windows/native/libnet/NetworkInterface_winXP.c	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/windows/native/libnet/NetworkInterface_winXP.c	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -595,14 +595,14 @@
     while (addrs != NULL) {
         jobject iaObj, ia2Obj;
         jobject ibObj = NULL;
-        if (addrs->addr.him.sa_family == AF_INET) {
+        if (addrs->addr.sa.sa_family == AF_INET) {
             iaObj = (*env)->NewObject(env, ia4_class, ia4_ctrID);
             if (iaObj == NULL) {
                 return NULL;
             }
             /* default ctor will set family to AF_INET */
 
-            setInetAddress_addr(env, iaObj, ntohl(addrs->addr.him4.sin_addr.s_addr));
+            setInetAddress_addr(env, iaObj, ntohl(addrs->addr.sa4.sin_addr.s_addr));
 
             ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID);
             if (ibObj == NULL) {
@@ -615,7 +615,7 @@
               free_netaddr(netaddrP);
               return NULL;
             }
-            setInetAddress_addr(env, ia2Obj, ntohl(addrs->brdcast.him4.sin_addr.s_addr));
+            setInetAddress_addr(env, ia2Obj, ntohl(addrs->brdcast.sa4.sin_addr.s_addr));
             (*env)->SetObjectField(env, ibObj, ni_ibbroadcastID, ia2Obj);
             (*env)->SetShortField(env, ibObj, ni_ibmaskID, addrs->mask);
             (*env)->SetObjectArrayElement(env, bindsArr, bind_index++, ibObj);
@@ -623,11 +623,11 @@
             int scope;
             iaObj = (*env)->NewObject(env, ia6_class, ia6_ctrID);
             if (iaObj) {
-                jboolean ret = setInet6Address_ipaddress(env, iaObj, (jbyte *)&(addrs->addr.him6.sin6_addr.s6_addr));
+                jboolean ret = setInet6Address_ipaddress(env, iaObj, (jbyte *)&(addrs->addr.sa6.sin6_addr.s6_addr));
                 if (ret == JNI_FALSE) {
                     return NULL;
                 }
-                scope = addrs->addr.him6.sin6_scope_id;
+                scope = addrs->addr.sa6.sin6_scope_id;
                 if (scope != 0) { /* zero is default value, no need to set */
                     setInet6Address_scopeid(env, iaObj, scope);
                     setInet6Address_scopeifname(env, iaObj, netifObj);
--- a/jdk/src/java.base/windows/native/libnet/TwoStacksPlainDatagramSocketImpl.c	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/windows/native/libnet/TwoStacksPlainDatagramSocketImpl.c	Wed Jul 05 22:19:13 2017 +0200
@@ -51,6 +51,8 @@
 #define IN_CLASSD(i)    (((long)(i) & 0xf0000000) == 0xe0000000)
 #define IN_MULTICAST(i) IN_CLASSD(i)
 
+extern int getAllInterfacesAndAddresses(JNIEnv *env, netif **netifPP);
+
 /************************************************************************
  * TwoStacksPlainDatagramSocketImpl
  */
@@ -88,7 +90,7 @@
  * Returns a java.lang.Integer based on 'i'
  */
 jobject createInteger(JNIEnv *env, int i) {
-    static jclass i_class;
+    static jclass i_class = NULL;
     static jmethodID i_ctrID;
     static jfieldID i_valueID;
 
@@ -101,14 +103,14 @@
         CHECK_NULL_RETURN(i_class, NULL);
     }
 
-    return ( (*env)->NewObject(env, i_class, i_ctrID, i) );
+    return (*env)->NewObject(env, i_class, i_ctrID, i);
 }
 
 /*
  * Returns a java.lang.Boolean based on 'b'
  */
 jobject createBoolean(JNIEnv *env, int b) {
-    static jclass b_class;
+    static jclass b_class = NULL;
     static jmethodID b_ctrID;
     static jfieldID b_valueID;
 
@@ -121,10 +123,9 @@
         CHECK_NULL_RETURN(b_class, NULL);
     }
 
-    return( (*env)->NewObject(env, b_class, b_ctrID, (jboolean)(b!=0)) );
+    return (*env)->NewObject(env, b_class, b_ctrID, (jboolean)(b!=0));
 }
 
-
 static int getFD(JNIEnv *env, jobject this) {
     jobject fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
 
@@ -333,7 +334,7 @@
     fd_set tbl;
     struct timeval t = { 0, 0 };
     SOCKETADDRESS rmtaddr;
-    int addrlen = sizeof(rmtaddr);
+    int addrlen = sizeof(SOCKETADDRESS);
 
     memset((char *)&rmtaddr, 0, sizeof(rmtaddr));
 
@@ -354,8 +355,7 @@
         if (select(/*ignored*/fd+1, &tbl, 0, 0, &t) <= 0) {
             break;
         }
-        if (recvfrom(fd, buf, 1, MSG_PEEK,
-                         (struct sockaddr *)&rmtaddr, &addrlen) != SOCKET_ERROR) {
+        if (recvfrom(fd, buf, 1, MSG_PEEK, &rmtaddr.sa, &addrlen) != SOCKET_ERROR) {
             break;
         }
         if (WSAGetLastError() != WSAECONNRESET) {
@@ -363,7 +363,7 @@
             break;
         }
 
-        recvfrom(fd, buf, 1, 0,  (struct sockaddr *)&rmtaddr, &addrlen);
+        recvfrom(fd, buf, 1, 0, &rmtaddr.sa, &addrlen);
         got_icmp = JNI_TRUE;
     }
 
@@ -429,11 +429,11 @@
     jobject fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
     jobject fd1Obj = (*env)->GetObjectField(env, this, pdsi_fd1ID);
 
-    int fd, fd1, family;
+    int fd, fd1 = -1, family;
     int ipv6_supported = ipv6_available();
 
     SOCKETADDRESS lcladdr;
-    int lcladdrlen = sizeof(lcladdr);
+    int lcladdrlen = sizeof(SOCKETADDRESS);
     int address;
 
     memset((char *)&lcladdr, 0, sizeof(lcladdr));
@@ -461,8 +461,9 @@
         address = getInetAddress_addr(env, addressObj);
     }
 
-    if (NET_InetAddressToSockaddr(env, addressObj, port, (struct sockaddr *)&lcladdr, &lcladdrlen, JNI_FALSE) != 0) {
-      return;
+    if (NET_InetAddressToSockaddr(env, addressObj, port, &lcladdr.sa,
+                                  &lcladdrlen, JNI_FALSE) != 0) {
+        return;
     }
 
     if (ipv6_supported) {
@@ -500,7 +501,7 @@
             return;
         }
     } else {
-        if (NET_WinBind(fd, (struct sockaddr *)&lcladdr, lcladdrlen, exclBind) == -1) {
+        if (NET_WinBind(fd, &lcladdr.sa, lcladdrlen, exclBind) == -1) {
             if (WSAGetLastError() == WSAEACCES) {
                 WSASetLastError(WSAEADDRINUSE);
             }
@@ -510,11 +511,7 @@
     }
 
     if (port == 0) {
-        if (fd == -1) {
-            /* must be an IPV6 only socket. */
-            fd = fd1;
-        }
-        if (getsockname(fd, (struct sockaddr *)&lcladdr, &lcladdrlen) == -1) {
+        if (getsockname(fd == -1 ? fd1 : fd, &lcladdr.sa, &lcladdrlen) == -1) {
             NET_ThrowCurrent(env, "getsockname");
             return;
         }
@@ -583,11 +580,12 @@
         res = WSAIoctl(fdc,SIO_UDP_CONNRESET,&t,sizeof(t),&x1,sizeof(x1),&x2,0,0);
     }
 
-    if (NET_InetAddressToSockaddr(env, address, port,(struct sockaddr *)&rmtaddr, &rmtaddrlen, JNI_FALSE) != 0) {
-      return;
+    if (NET_InetAddressToSockaddr(env, address, port, &rmtaddr.sa,
+                                  &rmtaddrlen, JNI_FALSE) != 0) {
+        return;
     }
 
-    if (connect(fdc, (struct sockaddr *)&rmtaddr, sizeof(rmtaddr)) == -1) {
+    if (connect(fdc, &rmtaddr.sa, sizeof(rmtaddr)) == -1) {
         NET_ThrowCurrent(env, "connect");
         return;
     }
@@ -622,7 +620,7 @@
     fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
 
     memset((char *)&addr, 0, len);
-    connect(fd, (struct sockaddr *)&addr, len);
+    connect(fd, &addr.sa, len);
 
     /*
      * use SIO_UDP_CONNRESET
@@ -657,8 +655,7 @@
     jbyteArray packetBuffer;
     jboolean connected;
 
-    SOCKETADDRESS rmtaddr;
-    SOCKETADDRESS *addrp = &rmtaddr;
+    SOCKETADDRESS rmtaddr, *addrp = &rmtaddr;
     int addrlen = 0;
 
     memset((char *)&rmtaddr, 0, sizeof(rmtaddr));
@@ -711,9 +708,10 @@
         addrp = 0; /* arg to sendto () null in this case */
         addrlen = 0;
     } else {
-      if (NET_InetAddressToSockaddr(env, iaObj, packetPort, (struct sockaddr *)&rmtaddr, &addrlen, JNI_FALSE) != 0) {
-        return;
-      }
+        if (NET_InetAddressToSockaddr(env, iaObj, packetPort, &rmtaddr.sa,
+                                      &addrlen, JNI_FALSE) != 0) {
+            return;
+        }
     }
 
     if (packetBufferLen > MAX_BUFFER_LEN) {
@@ -732,7 +730,7 @@
             if (connected) {
                 address = getInetAddress_addr(env, iaObj);
             } else {
-                address = ntohl(rmtaddr.him4.sin_addr.s_addr);
+                address = ntohl(rmtaddr.sa4.sin_addr.s_addr);
             }
 
             if (exceedSizeLimit(env, fd, address, packetBufferLen)) {
@@ -813,8 +811,8 @@
     jint address, family;
 
     int n;
-    struct sockaddr_in remote_addr;
-    jint remote_addrsize = sizeof (remote_addr);
+    SOCKETADDRESS remote_addr;
+    jint remote_addrsize = sizeof(SOCKETADDRESS);
     char buf[1];
     BOOL retry;
     jlong prevTime = 0;
@@ -860,8 +858,7 @@
         }
 
         /* now try the peek */
-        n = recvfrom(fd, buf, 1, MSG_PEEK,
-                         (struct sockaddr *)&remote_addr, &remote_addrsize);
+        n = recvfrom(fd, buf, 1, MSG_PEEK, &remote_addr.sa, &remote_addrsize);
 
         if (n == SOCKET_ERROR) {
             if (WSAGetLastError() == WSAECONNRESET) {
@@ -907,11 +904,11 @@
         NET_ThrowCurrent(env, "Datagram peek failed");
         return 0;
     }
-    setInetAddress_addr(env, addressObj, ntohl(remote_addr.sin_addr.s_addr));
+    setInetAddress_addr(env, addressObj, ntohl(remote_addr.sa4.sin_addr.s_addr));
     setInetAddress_family(env, addressObj, IPv4);
 
     /* return port */
-    return ntohs(remote_addr.sin_port);
+    return ntohs(remote_addr.sa4.sin_port);
 }
 
 JNIEXPORT jint JNICALL
@@ -927,13 +924,13 @@
     jbyteArray packetBuffer;
     jint packetBufferOffset, packetBufferLen;
 
-    int fd, fd1, fduse, nsockets=0, errorCode;
+    int fd = -1, fd1 = -1, fduse, nsockets = 0, errorCode;
     int port;
 
     int checkBoth = 0;
     int n;
     SOCKETADDRESS remote_addr;
-    jint remote_addrsize=sizeof(remote_addr);
+    jint remote_addrsize = sizeof(SOCKETADDRESS);
     BOOL retry;
     jlong prevTime = 0;
 
@@ -1063,7 +1060,7 @@
 
         /* receive the packet */
         n = recvfrom(fduse, fullPacket, packetBufferLen, MSG_PEEK,
-                         (struct sockaddr *)&remote_addr, &remote_addrsize);
+                     &remote_addr.sa, &remote_addrsize);
         port = (int) ntohs ((u_short) GET_PORT((SOCKETADDRESS *)&remote_addr));
         if (n == SOCKET_ERROR) {
             if (WSAGetLastError() == WSAECONNRESET) {
@@ -1145,15 +1142,15 @@
          */
         packetAddress = (*env)->GetObjectField(env, packet, dp_addressID);
         if (packetAddress != NULL) {
-            if (!NET_SockaddrEqualsInetAddress(env, (struct sockaddr *)
-                                                &remote_addr, packetAddress)) {
+            if (!NET_SockaddrEqualsInetAddress(env, &remote_addr.sa,
+                                               packetAddress)) {
                 /* force a new InetAddress to be created */
                 packetAddress = NULL;
             }
         }
         if (packetAddress == NULL) {
-            packetAddress = NET_SockaddrToInetAddress(env, (struct sockaddr *)
-                                &remote_addr, &port);
+            packetAddress = NET_SockaddrToInetAddress(env, &remote_addr.sa,
+                                                      &port);
             /* stuff the new Inetaddress in the packet */
             (*env)->SetObjectField(env, packet, dp_addressID, packetAddress);
         }
@@ -1195,11 +1192,11 @@
     /* as a result of the changes for ipv6, peek() or peekData()
      * must be called prior to receive() so that fduse can be set.
      */
-    int fd, fd1, fduse, errorCode;
+    int fd = -1, fd1 = -1, fduse, errorCode;
 
     int n, nsockets=0;
     SOCKETADDRESS remote_addr;
-    jint remote_addrsize=sizeof(remote_addr);
+    jint remote_addrsize = sizeof(SOCKETADDRESS);
     BOOL retry;
     jlong prevTime = 0, selectTime=0;
     jboolean connected;
@@ -1327,8 +1324,8 @@
         retry = FALSE;
 
         /* receive the packet */
-        n = recvfrom(fduse, fullPacket, packetBufferLen, 0,
-                         (struct sockaddr *)&remote_addr, &remote_addrsize);
+        n = recvfrom(fduse, fullPacket, packetBufferLen, 0, &remote_addr.sa,
+                     &remote_addrsize);
 
         if (n == SOCKET_ERROR) {
             if (WSAGetLastError() == WSAECONNRESET) {
@@ -1431,18 +1428,18 @@
         packetAddress = (*env)->GetObjectField(env, packet, dp_addressID);
 
         if (packetAddress != NULL) {
-            if (!NET_SockaddrEqualsInetAddress(env, (struct sockaddr *)&remote_addr, packetAddress)) {
+            if (!NET_SockaddrEqualsInetAddress(env, &remote_addr.sa, packetAddress)) {
                 /* force a new InetAddress to be created */
                 packetAddress = NULL;
             }
         }
         if (packetAddress == NULL) {
-            packetAddress = NET_SockaddrToInetAddress(env, (struct sockaddr *)&remote_addr, &port);
+            packetAddress = NET_SockaddrToInetAddress(env, &remote_addr.sa, &port);
             /* stuff the new Inetaddress in the packet */
             (*env)->SetObjectField(env, packet, dp_addressID, packetAddress);
         } else {
             /* only get the new port number */
-            port = NET_GetPortFromSockaddr((struct sockaddr *)&remote_addr);
+            port = NET_GetPortFromSockaddr(&remote_addr.sa);
         }
         /* populate the packet */
         (*env)->SetByteArrayRegion(env, packetBuffer, packetBufferOffset, n,
@@ -1612,7 +1609,7 @@
 /* Get the multicasting index from the interface */
 
 static int getIndexFromIf (JNIEnv *env, jobject nif) {
-    static jfieldID ni_indexID;
+    static jfieldID ni_indexID = NULL;
 
     if (ni_indexID == NULL) {
         jclass c = (*env)->FindClass(env, "java/net/NetworkInterface");
@@ -1625,10 +1622,9 @@
 }
 
 static int isAdapterIpv6Enabled(JNIEnv *env, int index) {
-  extern int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP);
   netif *ifList, *curr;
   int ipv6Enabled = 0;
-  if (getAllInterfacesAndAddresses (env, &ifList) < 0) {
+  if (getAllInterfacesAndAddresses(env, &ifList) < 0) {
       return ipv6Enabled;
   }
 
@@ -1689,7 +1685,7 @@
          * option instead of IP_MULTICAST_IF
          */
         if (ipv6_supported) {
-            static jclass ni_class;
+            static jclass ni_class = NULL;
             if (ni_class == NULL) {
                 jclass c = (*env)->FindClass(env, "java/net/NetworkInterface");
                 CHECK_NULL(c);
@@ -1729,7 +1725,7 @@
          * option. For IPv6 both must be done.
          */
         if (ipv6_supported) {
-            static jfieldID ni_indexID;
+            static jfieldID ni_indexID = NULL;
             struct in_addr in;
             int index;
 
@@ -2250,10 +2246,10 @@
  * Signature: (I)Ljava/lang/Object;
  */
 JNIEXPORT jobject JNICALL
-Java_java_net_TwoStacksPlainDatagramSocketImpl_socketLocalAddress(JNIEnv *env, jobject this,
-                                                      jint family) {
-
-    int fd=-1, fd1=-1;
+Java_java_net_TwoStacksPlainDatagramSocketImpl_socketLocalAddress
+  (JNIEnv *env, jobject this, jint family)
+{
+    int fd = -1, fd1 = -1;
     SOCKETADDRESS him;
     int len = 0;
     int port;
@@ -2273,7 +2269,7 @@
 
     /* find out local IP address */
 
-    len = sizeof (struct sockaddr_in);
+    len = sizeof(struct sockaddr_in);
 
     /* family==-1 when socket is not connected */
     if ((family == IPv6) || (family == -1 && fd == -1)) {
@@ -2287,12 +2283,12 @@
         return NULL;
     }
 
-    if (getsockname(fd, (struct sockaddr *)&him, &len) == -1) {
+    if (getsockname(fd, &him.sa, &len) == -1) {
         JNU_ThrowByNameWithMessageAndLastError
             (env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
         return NULL;
     }
-    iaObj = NET_SockaddrToInetAddress(env, (struct sockaddr *)&him, &port);
+    iaObj = NET_SockaddrToInetAddress(env, &him.sa, &port);
 
     return iaObj;
 }
@@ -2450,17 +2446,17 @@
         return;
     }
 
-    if (NET_InetAddressToSockaddr(env, iaObj, 0, (struct sockaddr *)&name, &len, JNI_FALSE) != 0) {
+    if (NET_InetAddressToSockaddr(env, iaObj, 0, &name.sa, &len, JNI_FALSE) != 0) {
       return;
     }
 
     /* Set the multicast group address in the ip_mreq field
      * eventually this check should be done by the security manager
      */
-    family = name.him.sa_family;
+    family = name.sa.sa_family;
 
     if (family == AF_INET) {
-        int address = name.him4.sin_addr.s_addr;
+        int address = name.sa4.sin_addr.s_addr;
         if (!IN_MULTICAST(ntohl(address))) {
             JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "not in multicast");
             return;
@@ -2499,7 +2495,7 @@
     } else /* AF_INET6 */ {
         if (ipv6_supported) {
             struct in6_addr *address;
-            address = &name.him6.sin6_addr;
+            address = &name.sa6.sin6_addr;
             if (!IN6_IS_ADDR_MULTICAST(address)) {
                 JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "not in6 multicast");
                 return;
--- a/jdk/src/java.base/windows/native/libnet/TwoStacksPlainSocketImpl.c	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/windows/native/libnet/TwoStacksPlainSocketImpl.c	Wed Jul 05 22:19:13 2017 +0200
@@ -192,7 +192,7 @@
 
     /* family and localport are int fields of iaObj */
     int family;
-    jint fd, fd1=-1;
+    jint fd = -1, fd1 = -1;
     jint len;
     int  ipv6_supported = ipv6_available();
 
@@ -222,11 +222,11 @@
         return;
     }
 
-    if (NET_InetAddressToSockaddr(env, iaObj, port, (struct sockaddr *)&him, &len, JNI_FALSE) != 0) {
+    if (NET_InetAddressToSockaddr(env, iaObj, port, &him.sa, &len, JNI_FALSE) != 0) {
       return;
     }
 
-    family = him.him.sa_family;
+    family = him.sa.sa_family;
     if (family == AF_INET6) {
         if (!ipv6_supported) {
             JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
@@ -258,7 +258,7 @@
     (*env)->SetObjectField(env, this, psi_fd1ID, NULL);
 
     if (timeout <= 0) {
-        connect_res = connect(fd, (struct sockaddr *) &him, SOCKETADDRESS_LEN(&him));
+        connect_res = connect(fd, &him.sa, sizeof(SOCKETADDRESS));
         if (connect_res == SOCKET_ERROR) {
             connect_res = WSAGetLastError();
         }
@@ -268,10 +268,10 @@
 
         /* make socket non-blocking */
         optval = 1;
-        ioctlsocket( fd, FIONBIO, &optval );
+        ioctlsocket(fd, FIONBIO, &optval);
 
         /* initiate the connect */
-        connect_res = connect(fd, (struct sockaddr *) &him, SOCKETADDRESS_LEN(&him));
+        connect_res = connect(fd, &him.sa, sizeof(SOCKETADDRESS));
         if (connect_res == SOCKET_ERROR) {
             if (WSAGetLastError() != WSAEWOULDBLOCK) {
                 connect_res = WSAGetLastError();
@@ -371,18 +371,17 @@
          * that the system chose for us and store it in the Socket object.
          */
         u_short port;
-        int len = SOCKETADDRESS_LEN(&him);
-        if (getsockname(fd, (struct sockaddr *)&him, &len) == -1) {
-
+        int len = sizeof(SOCKETADDRESS);
+        if (getsockname(fd, &him.sa, &len) == -1) {
             if (WSAGetLastError() == WSAENOTSOCK) {
                 JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
-                        "Socket closed");
+                                "Socket closed");
             } else {
                 NET_ThrowCurrent(env, "getsockname failed");
             }
             return;
         }
-        port = ntohs ((u_short)GET_PORT(&him));
+        port = ntohs((u_short)GET_PORT(&him));
         (*env)->SetIntField(env, this, psi_localportID, (int) port);
     }
 }
@@ -400,7 +399,7 @@
     /* fdObj is the FileDescriptor field on this */
     jobject fdObj, fd1Obj;
     /* fd is an int field on fdObj */
-    int fd, fd1, len = 0;
+    int fd, fd1 = -1, len = 0;
     int ipv6_supported = ipv6_available();
 
     /* family is an int field of iaObj */
@@ -435,9 +434,9 @@
         return;
     }
 
-    if (NET_InetAddressToSockaddr(env, iaObj, localport,
-                          (struct sockaddr *)&him, &len, JNI_FALSE) != 0) {
-      return;
+    if (NET_InetAddressToSockaddr(env, iaObj, localport, &him.sa, &len,
+                                  JNI_FALSE) != 0) {
+        return;
     }
     if (ipv6_supported) {
         struct ipv6bind v6bind;
@@ -473,7 +472,7 @@
             (*env)->SetObjectField(env, this, psi_fd1ID, NULL);
         }
     } else {
-        rv = NET_WinBind(fd, (struct sockaddr *)&him, len, exclBind);
+        rv = NET_WinBind(fd, &him.sa, len, exclBind);
     }
 
     if (rv == -1) {
@@ -489,17 +488,16 @@
         /* Now that we're a bound socket, let's extract the port number
          * that the system chose for us and store it in the Socket object.
          */
-        int len = SOCKETADDRESS_LEN(&him);
+        int len = sizeof(SOCKETADDRESS);
         u_short port;
-        fd = him.him.sa_family == AF_INET? fd: fd1;
 
-        if (getsockname(fd, (struct sockaddr *)&him, &len) == -1) {
+        if (getsockname(him.sa.sa_family == AF_INET ? fd: fd1, &him.sa, &len) == -1) {
             NET_ThrowCurrent(env, "getsockname in plain socketBind");
             return;
         }
-        port = ntohs ((u_short) GET_PORT (&him));
+        port = ntohs((u_short) GET_PORT (&him));
 
-        (*env)->SetIntField(env, this, psi_localportID, (int) port);
+        (*env)->SetIntField(env, this, psi_localportID, (int)port);
     } else {
         (*env)->SetIntField(env, this, psi_localportID, localport);
     }
@@ -511,16 +509,17 @@
  * Signature: (I)V
  */
 JNIEXPORT void JNICALL
-Java_java_net_TwoStacksPlainSocketImpl_socketListen (JNIEnv *env, jobject this,
-                                            jint count)
+Java_java_net_TwoStacksPlainSocketImpl_socketListen
+  (JNIEnv *env, jobject this, jint count)
 {
     /* this FileDescriptor fd field */
     jobject fdObj = (*env)->GetObjectField(env, this, psi_fdID);
     jobject fd1Obj = (*env)->GetObjectField(env, this, psi_fd1ID);
     jobject address;
     /* fdObj's int fd field */
-    int fd, fd1;
-    SOCKETADDRESS addr; int addrlen;
+    int fd = INVALID_SOCKET, fd1 = INVALID_SOCKET;
+    SOCKETADDRESS addr;
+    int addrlen;
 
     if (IS_NULL(fdObj) && IS_NULL(fd1Obj)) {
         JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
@@ -540,12 +539,12 @@
         JNU_ThrowNullPointerException(env, "socket address");
         return;
     }
-    if (NET_InetAddressToSockaddr(env, address, 0, (struct sockaddr *)&addr,
-                                  &addrlen, JNI_FALSE) != 0) {
-      return;
+    if (NET_InetAddressToSockaddr(env, address, 0, &addr.sa, &addrlen,
+                                  JNI_FALSE) != 0) {
+        return;
     }
 
-    if (addr.him.sa_family == AF_INET || IN6ADDR_ISANY(&addr.him6)) {
+    if (addr.sa.sa_family == AF_INET || IN6ADDR_ISANY(&addr.sa6)) {
         /* listen on v4 */
         if (listen(fd, count) == -1) {
             NET_ThrowCurrent(env, "listen failed");
@@ -556,7 +555,7 @@
     }
     if (ipv6_available() && !IS_NULL(fd1Obj)) {
         fd1 = (*env)->GetIntField(env, fd1Obj, IO_fd_fdID);
-        if (addr.him.sa_family == AF_INET6 || addr.him4.sin_addr.s_addr == INADDR_ANY) {
+        if (addr.sa.sa_family == AF_INET6 || addr.sa4.sin_addr.s_addr == INADDR_ANY) {
             /* listen on v6 */
             if (listen(fd1, count) == -1) {
                 NET_ThrowCurrent(env, "listen failed");
@@ -687,7 +686,7 @@
             }
         }
     }
-    fd = accept(fd, (struct sockaddr *)&him, &len);
+    fd = accept(fd, &him.sa, &len);
     if (fd < 0) {
         /* REMIND: SOCKET CLOSED PROBLEM */
         if (fd == -2) {
@@ -702,7 +701,7 @@
     SetHandleInformation((HANDLE)(UINT_PTR)fd, HANDLE_FLAG_INHERIT, 0);
     (*env)->SetIntField(env, socketFdObj, IO_fd_fdID, fd);
 
-    if (him.him.sa_family == AF_INET) {
+    if (him.sa.sa_family == AF_INET) {
         if (inet4Cls == NULL) {
             jclass c = (*env)->FindClass(env, "java/net/Inet4Address");
             if (c != NULL) {
@@ -728,7 +727,7 @@
             return;
         }
 
-        setInetAddress_addr(env, socketAddressObj, ntohl(him.him4.sin_addr.s_addr));
+        setInetAddress_addr(env, socketAddressObj, ntohl(him.sa4.sin_addr.s_addr));
         setInetAddress_family(env, socketAddressObj, IPv4);
         (*env)->SetObjectField(env, socket, psi_addressID, socketAddressObj);
     } else {
@@ -754,9 +753,9 @@
             NET_SocketClose(fd);
             return;
         }
-        setInet6Address_ipaddress(env, socketAddressObj, (char *)&him.him6.sin6_addr);
+        setInet6Address_ipaddress(env, socketAddressObj, (char *)&him.sa6.sin6_addr);
         setInetAddress_family(env, socketAddressObj, IPv6);
-        setInet6Address_scopeid(env, socketAddressObj, him.him6.sin6_scope_id);
+        setInet6Address_scopeid(env, socketAddressObj, him.sa6.sin6_scope_id);
 
     }
     /* fields common to AF_INET and AF_INET6 */
@@ -1036,13 +1035,12 @@
      */
     if (opt == java_net_SocketOptions_SO_BINDADDR) {
         SOCKETADDRESS him;
-        int len;
+        int len = sizeof(SOCKETADDRESS);
         int port;
         jobject iaObj;
         jclass iaCntrClass;
         jfieldID iaFieldID;
 
-        len = sizeof(him);
         memset((char *)&him, 0, len);
 
         if (fd == -1) {
@@ -1052,12 +1050,12 @@
             fd = getFD1 (env, this);
         }
 
-        if (getsockname(fd, (struct sockaddr *)&him, &len) < 0) {
+        if (getsockname(fd, &him.sa, &len) < 0) {
             JNU_ThrowByNameWithMessageAndLastError
                 (env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
             return -1;
         }
-        iaObj = NET_SockaddrToInetAddress(env, (struct sockaddr *)&him, &port);
+        iaObj = NET_SockaddrToInetAddress(env, &him.sa, &port);
         CHECK_NULL_RETURN(iaObj, -1);
 
         iaCntrClass = (*env)->GetObjectClass(env, iaContainerObj);
--- a/jdk/src/java.base/windows/native/libnet/net_util_md.c	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/windows/native/libnet/net_util_md.c	Wed Jul 05 22:19:13 2017 +0200
@@ -668,21 +668,21 @@
  */
 
 JNIEXPORT int JNICALL
-NET_BindV6(struct ipv6bind* b, jboolean exclBind) {
+NET_BindV6(struct ipv6bind *b, jboolean exclBind) {
     int fd=-1, ofd=-1, rv, len;
     /* need to defer close until new sockets created */
     int close_fd=-1, close_ofd=-1;
     SOCKETADDRESS oaddr; /* other address to bind */
-    int family = b->addr->him.sa_family;
+    int family = b->addr->sa.sa_family;
     int ofamily;
     u_short port; /* requested port parameter */
     u_short bound_port;
 
-    if (family == AF_INET && (b->addr->him4.sin_addr.s_addr != INADDR_ANY)) {
+    if (family == AF_INET && (b->addr->sa4.sin_addr.s_addr != INADDR_ANY)) {
         /* bind to v4 only */
         int ret;
-        ret = NET_WinBind ((int)b->ipv4_fd, (struct sockaddr *)b->addr,
-                                sizeof (struct sockaddr_in), exclBind);
+        ret = NET_WinBind((int)b->ipv4_fd, (struct sockaddr *)b->addr,
+                                sizeof(SOCKETADDRESS), exclBind);
         if (ret == SOCKET_ERROR) {
             CLOSE_SOCKETS_AND_RETURN;
         }
@@ -690,11 +690,11 @@
         b->ipv6_fd = -1;
         return 0;
     }
-    if (family == AF_INET6 && (!IN6_IS_ADDR_ANY(&b->addr->him6.sin6_addr))) {
+    if (family == AF_INET6 && (!IN6_IS_ADDR_ANY(&b->addr->sa6.sin6_addr))) {
         /* bind to v6 only */
         int ret;
-        ret = NET_WinBind ((int)b->ipv6_fd, (struct sockaddr *)b->addr,
-                                sizeof (struct SOCKADDR_IN6), exclBind);
+        ret = NET_WinBind((int)b->ipv6_fd, (struct sockaddr *)b->addr,
+                          sizeof(SOCKETADDRESS), exclBind);
         if (ret == SOCKET_ERROR) {
             CLOSE_SOCKETS_AND_RETURN;
         }
@@ -711,32 +711,32 @@
         fd = (int)b->ipv4_fd;
         ofd = (int)b->ipv6_fd;
         port = (u_short)GET_PORT (b->addr);
-        IN6ADDR_SETANY (&oaddr.him6);
-        oaddr.him6.sin6_port = port;
+        IN6ADDR_SETANY(&oaddr.sa6);
+        oaddr.sa6.sin6_port = port;
     } else {
         ofamily = AF_INET;
         ofd = (int)b->ipv4_fd;
         fd = (int)b->ipv6_fd;
         port = (u_short)GET_PORT (b->addr);
-        oaddr.him4.sin_family = AF_INET;
-        oaddr.him4.sin_port = port;
-        oaddr.him4.sin_addr.s_addr = INADDR_ANY;
+        oaddr.sa4.sin_family = AF_INET;
+        oaddr.sa4.sin_port = port;
+        oaddr.sa4.sin_addr.s_addr = INADDR_ANY;
     }
 
-    rv = NET_WinBind(fd, (struct sockaddr *)b->addr, SOCKETADDRESS_LEN(b->addr), exclBind);
+    rv = NET_WinBind(fd, (struct sockaddr *)b->addr, sizeof(SOCKETADDRESS), exclBind);
     if (rv == SOCKET_ERROR) {
         CLOSE_SOCKETS_AND_RETURN;
     }
 
     /* get the port and set it in the other address */
-    len = SOCKETADDRESS_LEN(b->addr);
+    len = sizeof(SOCKETADDRESS);
     if (getsockname(fd, (struct sockaddr *)b->addr, &len) == -1) {
         CLOSE_SOCKETS_AND_RETURN;
     }
     bound_port = GET_PORT (b->addr);
     SET_PORT (&oaddr, bound_port);
-    if ((rv=NET_WinBind (ofd, (struct sockaddr *) &oaddr,
-                         SOCKETADDRESS_LEN (&oaddr), exclBind)) == SOCKET_ERROR) {
+    if ((rv = NET_WinBind(ofd, &oaddr.sa,
+                          sizeof(SOCKETADDRESS), exclBind)) == SOCKET_ERROR) {
         int retries;
         int sotype, arglen=sizeof(sotype);
 
@@ -772,8 +772,7 @@
 
             /* bind random port on first socket */
             SET_PORT (&oaddr, 0);
-            rv = NET_WinBind (ofd, (struct sockaddr *)&oaddr, SOCKETADDRESS_LEN(&oaddr),
-                              exclBind);
+            rv = NET_WinBind(ofd, &oaddr.sa, sizeof(SOCKETADDRESS), exclBind);
             if (rv == SOCKET_ERROR) {
                 CLOSE_SOCKETS_AND_RETURN;
             }
@@ -783,14 +782,14 @@
             close_fd = close_ofd = -1;
 
             /* bind new port on second socket */
-            len = SOCKETADDRESS_LEN(&oaddr);
-            if (getsockname(ofd, (struct sockaddr *)&oaddr, &len) == -1) {
+            len = sizeof(SOCKETADDRESS);
+            if (getsockname(ofd, &oaddr.sa, &len) == -1) {
                 CLOSE_SOCKETS_AND_RETURN;
             }
             bound_port = GET_PORT (&oaddr);
             SET_PORT (b->addr, bound_port);
-            rv = NET_WinBind (fd, (struct sockaddr *)b->addr, SOCKETADDRESS_LEN(b->addr),
-                              exclBind);
+            rv = NET_WinBind(fd, (struct sockaddr *)b->addr,
+                             sizeof(SOCKETADDRESS), exclBind);
 
             if (rv != SOCKET_ERROR) {
                 if (family == AF_INET) {
@@ -826,9 +825,9 @@
     }
 
     ret = WSAIoctl(fd, SIO_ROUTING_INTERFACE_QUERY,
-                    (void *)target_addr, sizeof(struct sockaddr_in6),
-                    (void *)&route, sizeof(struct sockaddr_in6),
-                    &b, 0, 0);
+                   (void *)target_addr, sizeof(struct sockaddr_in6),
+                   (void *)&route, sizeof(struct sockaddr_in6),
+                   &b, 0, 0);
     if (ret == SOCKET_ERROR) {
         // error
         closesocket(fd);
@@ -909,13 +908,13 @@
         him6->sin6_scope_id = scopeid != 0 ? scopeid : cached_scope_id;
         *len = sizeof(struct SOCKADDR_IN6) ;
     } else {
-        struct sockaddr_in *him4 = (struct sockaddr_in*)him;
+        struct sockaddr_in *him4 = (struct sockaddr_in *)him;
         jint address;
         if (family != AF_INET) {
           JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Protocol family unavailable");
           return -1;
         }
-        memset((char *) him4, 0, sizeof(struct sockaddr_in));
+        memset((char *)him4, 0, sizeof(struct sockaddr_in));
         address = getInetAddress_addr(env, iaObj);
         him4->sin_port = htons((short) port);
         him4->sin_addr.s_addr = (u_long) htonl(address);
@@ -928,9 +927,9 @@
 JNIEXPORT jint JNICALL
 NET_GetPortFromSockaddr(struct sockaddr *him) {
     if (him->sa_family == AF_INET6) {
-        return ntohs(((struct sockaddr_in6*)him)->sin6_port);
+        return ntohs(((struct sockaddr_in6 *)him)->sin6_port);
     } else {
-        return ntohs(((struct sockaddr_in*)him)->sin_port);
+        return ntohs(((struct sockaddr_in *)him)->sin_port);
     }
 }
 
@@ -966,12 +965,12 @@
     return 1;
 }
 
-int getScopeID (struct sockaddr *him) {
+int getScopeID(struct sockaddr *him) {
     struct SOCKADDR_IN6 *him6 = (struct SOCKADDR_IN6 *)him;
     return him6->sin6_scope_id;
 }
 
-int cmpScopeID (unsigned int scope, struct sockaddr *him) {
+int cmpScopeID(unsigned int scope, struct sockaddr *him) {
     struct SOCKADDR_IN6 *him6 = (struct SOCKADDR_IN6 *)him;
     return him6->sin6_scope_id == scope;
 }
--- a/jdk/src/java.base/windows/native/libnet/net_util_md.h	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.base/windows/native/libnet/net_util_md.h	Wed Jul 05 22:19:13 2017 +0200
@@ -247,9 +247,9 @@
 int NET_GetDefaultTOS(void);
 
 typedef union {
-    struct sockaddr     him;
-    struct sockaddr_in  him4;
-    struct SOCKADDR_IN6 him6;
+    struct sockaddr     sa;
+    struct sockaddr_in  sa4;
+    struct SOCKADDR_IN6 sa6;
 } SOCKETADDRESS;
 
 /*
@@ -257,15 +257,11 @@
  * sockets. On return they may refer to different sockets.
  */
 struct ipv6bind {
-    SOCKETADDRESS       *addr;
-    SOCKET               ipv4_fd;
-    SOCKET               ipv6_fd;
+    SOCKETADDRESS      *addr;
+    SOCKET              ipv4_fd;
+    SOCKET              ipv6_fd;
 };
 
-#define SOCKETADDRESS_LEN(X)    \
-        (((X)->him.sa_family==AF_INET6)? sizeof(struct SOCKADDR_IN6) : \
-                         sizeof(struct sockaddr_in))
-
 #define SOCKETADDRESS_COPY(DST,SRC) {                           \
     if ((SRC)->sa_family == AF_INET6) {                         \
         memcpy ((DST), (SRC), sizeof (struct SOCKADDR_IN6));    \
@@ -274,20 +270,20 @@
     }                                                           \
 }
 
-#define SET_PORT(X,Y) {                         \
-    if ((X)->him.sa_family == AF_INET) {        \
-        (X)->him4.sin_port = (Y);               \
-    } else {                                    \
-        (X)->him6.sin6_port = (Y);              \
-    }                                           \
+#define SET_PORT(X,Y) {                    \
+    if ((X)->sa.sa_family == AF_INET) {    \
+        (X)->sa4.sin_port = (Y);           \
+    } else {                               \
+        (X)->sa6.sin6_port = (Y);          \
+    }                                      \
 }
 
-#define GET_PORT(X) ((X)->him.sa_family==AF_INET ?(X)->him4.sin_port: (X)->him6.sin6_port)
+#define GET_PORT(X) ((X)->sa.sa_family == AF_INET ? (X)->sa4.sin_port : (X)->sa6.sin6_port)
 
 #define IS_LOOPBACK_ADDRESS(x) ( \
-    ((x)->him.sa_family == AF_INET) ? \
-        (ntohl((x)->him4.sin_addr.s_addr)==INADDR_LOOPBACK) : \
-        (IN6ADDR_ISLOOPBACK (x)) \
+    ((x)->sa.sa_family == AF_INET) ? \
+        (ntohl((x)->sa4.sin_addr.s_addr) == INADDR_LOOPBACK) : \
+        (IN6ADDR_ISLOOPBACK(x)) \
 )
 
 JNIEXPORT int JNICALL NET_SocketClose(int fd);
@@ -297,7 +293,7 @@
 int NET_Socket(int domain, int type, int protocol);
 
 void NET_ThrowByNameWithLastError(JNIEnv *env, const char *name,
-         const char *defaultDetail);
+                                  const char *defaultDetail);
 
 /*
  * differs from NET_Timeout() as follows:
@@ -312,46 +308,39 @@
  */
 JNIEXPORT int JNICALL NET_Timeout2(int fd, int fd1, long timeout, int *fdret);
 
-JNIEXPORT int JNICALL NET_BindV6(struct ipv6bind* b, jboolean exclBind);
-
-#define NET_WAIT_READ   0x01
-#define NET_WAIT_WRITE  0x02
-#define NET_WAIT_CONNECT        0x04
-
-extern jint NET_Wait(JNIEnv *env, jint fd, jint flags, jint timeout);
+JNIEXPORT int JNICALL NET_BindV6(struct ipv6bind *b, jboolean exclBind);
 
 JNIEXPORT int JNICALL NET_WinBind(int s, struct sockaddr *him, int len,
-                                   jboolean exclBind);
+                                  jboolean exclBind);
 
 /* XP versions of the native routines */
 
 JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0_XP
-    (JNIEnv *env, jclass cls, jstring name);
+  (JNIEnv *env, jclass cls, jstring name);
 
 JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByIndex0_XP
   (JNIEnv *env, jclass cls, jint index);
 
 JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0_XP
-    (JNIEnv *env, jclass cls, jobject iaObj);
+  (JNIEnv *env, jclass cls, jobject iaObj);
 
 JNIEXPORT jobjectArray JNICALL Java_java_net_NetworkInterface_getAll_XP
-    (JNIEnv *env, jclass cls);
+  (JNIEnv *env, jclass cls);
 
 JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_supportsMulticast0_XP
-(JNIEnv *env, jclass cls, jstring name, jint index);
+  (JNIEnv *env, jclass cls, jstring name, jint index);
 
 JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_isUp0_XP
-(JNIEnv *env, jclass cls, jstring name, jint index);
+  (JNIEnv *env, jclass cls, jstring name, jint index);
 
 JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_isP2P0_XP
-(JNIEnv *env, jclass cls, jstring name, jint index);
+  (JNIEnv *env, jclass cls, jstring name, jint index);
 
 JNIEXPORT jbyteArray JNICALL Java_java_net_NetworkInterface_getMacAddr0_XP
-(JNIEnv *env, jclass cls, jstring name, jint index);
+  (JNIEnv *env, jclass cls, jstring name, jint index);
 
 JNIEXPORT jint JNICALL Java_java_net_NetworkInterface_getMTU0_XP
-(JNIEnv *env, jclass class, jstring name, jint index);
+  (JNIEnv *env, jclass class, jstring name, jint index);
 
 JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_isLoopback0_XP
-(JNIEnv *env, jclass cls, jstring name, jint index);
-
+  (JNIEnv *env, jclass cls, jstring name, jint index);
--- a/jdk/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,8 +56,6 @@
 import sun.java2d.pipe.hw.ContextCapabilities;
 import static sun.java2d.opengl.OGLSurfaceData.*;
 import static sun.java2d.opengl.OGLContext.OGLContextCaps.*;
-import sun.java2d.pipe.hw.AccelDeviceEventListener;
-import sun.java2d.pipe.hw.AccelDeviceEventNotifier;
 
 import sun.lwawt.LWComponentPeer;
 import sun.lwawt.macosx.CPlatformView;
@@ -408,17 +406,6 @@
     }
 
     @Override
-    public void addDeviceEventListener(AccelDeviceEventListener l) {
-        int displayID = getDevice().getCGDisplayID();
-        AccelDeviceEventNotifier.addListener(l, displayID);
-    }
-
-    @Override
-    public void removeDeviceEventListener(AccelDeviceEventListener l) {
-        AccelDeviceEventNotifier.removeListener(l);
-    }
-
-    @Override
     public int getMaxTextureWidth() {
         return Math.max(maxTextureSize / getDevice().getScaleFactor(),
                         getBounds().width);
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java	Wed Jul 05 22:19:13 2017 +0200
@@ -86,6 +86,15 @@
         return null;
     }
 
+    static <T> T invokeAndWait(final Callable<T> callable, final Component c, final T defValue) {
+        T value = null;
+        try {
+            value = LWCToolkit.invokeAndWait(callable, c);
+        } catch (final Exception e) { e.printStackTrace(); }
+
+        return value != null ? value : defValue;
+    }
+
     static void invokeLater(final Runnable runnable, final Component c) {
         try {
             LWCToolkit.invokeLater(runnable, c);
@@ -181,7 +190,7 @@
 
                 return as.isAccessibleChildSelected(index);
             }
-        }, c);
+        }, c, false);
     }
 
     public static AccessibleStateSet getAccessibleStateSet(final AccessibleContext ac, final Component c) {
@@ -203,7 +212,7 @@
                 if (ass == null) return null;
                 return ass.contains(as);
             }
-        }, c);
+        }, c, false);
     }
 
     static String getAccessibleRoleFor(final Accessible a) {
@@ -248,7 +257,7 @@
             public Integer call() throws Exception {
                 return at.getCharCount();
             }
-        }, c);
+        }, c, 0);
     }
 
     // Accessibility Threadsafety for JavaComponentAccessibility.m
@@ -273,7 +282,7 @@
                 if (ac == null) return null;
                 return ac.getAccessibleIndexInParent();
             }
-        }, c);
+        }, c, -1);
     }
 
     public static AccessibleComponent getAccessibleComponent(final Accessible a, final Component c) {
@@ -369,7 +378,7 @@
 
                 return aComp.isFocusTraversable();
             }
-        }, c);
+        }, c, false);
     }
 
     public static Accessible accessibilityHitTest(final Container parent, final float hitPointX, final float hitPointY) {
@@ -428,7 +437,7 @@
 
                 return aComp.isEnabled();
             }
-        }, c);
+        }, c, false);
     }
 
     // KCH - can we make this a postEvent instead?
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m	Wed Jul 05 22:19:13 2017 +0200
@@ -323,11 +323,15 @@
 
 + (JavaComponentAccessibility *)createWithAccessible:(jobject)jaccessible withEnv:(JNIEnv *)env withView:(NSView *)view
 {
+    JavaComponentAccessibility *ret = nil;
     jobject jcomponent = [(AWTView *)view awtComponent:env];
     jint index = JNFCallStaticIntMethod(env, sjm_getAccessibleIndexInParent, jaccessible, jcomponent);
-    NSString *javaRole = getJavaRole(env, jaccessible, jcomponent);
+    if (index >= 0) {
+      NSString *javaRole = getJavaRole(env, jaccessible, jcomponent);
+      ret = [self createWithAccessible:jaccessible role:javaRole index:index withEnv:env withView:view];
+    }
     (*env)->DeleteLocalRef(env, jcomponent);
-    return [self createWithAccessible:jaccessible role:javaRole index:index withEnv:env withView:view];
+    return ret;
 }
 
 + (JavaComponentAccessibility *) createWithAccessible:(jobject)jaccessible role:(NSString *)javaRole index:(jint)index withEnv:(JNIEnv *)env withView:(NSView *)view
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m	Wed Jul 05 22:19:13 2017 +0200
@@ -117,7 +117,7 @@
 }
 
 - (void)dealloc {
-    JNIEnv *env = [ThreadUtilities getJNIEnv];
+    JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
     if (self.runnable) {
         (*env)->DeleteGlobalRef(env, self.runnable);
     }
@@ -125,7 +125,7 @@
 }
 
 - (void)perform {
-    JNIEnv* env = [ThreadUtilities getJNIEnv];
+    JNIEnv* env = [ThreadUtilities getJNIEnvUncached];
     static JNF_CLASS_CACHE(sjc_Runnable, "java/lang/Runnable");
     static JNF_MEMBER_CACHE(jm_Runnable_run, sjc_Runnable, "run", "()V");
     JNFCallVoidMethod(env, self.runnable, jm_Runnable_run);
--- a/jdk/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.m	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.m	Wed Jul 05 22:19:13 2017 +0200
@@ -376,7 +376,6 @@
 {
     void (^copy)() = [block copy];
     NSInteger encode = (NSInteger) copy;
-    [copy retain];
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     NSEvent* event = [NSEvent otherEventWithType: NSApplicationDefined
                                         location: NSMakePoint(0,0)
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriter.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriter.java	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -156,6 +156,10 @@
 
         clearAbortRequest();
         processImageStarted(0);
+        if (abortRequested()) {
+            processWriteAborted();
+            return;
+        }
         if (param == null)
             param = getDefaultWriteParam();
 
@@ -583,12 +587,8 @@
             stream.write(embedded_stream.toByteArray());
             embedded_stream = null;
 
-            if (abortRequested()) {
-                processWriteAborted();
-            } else {
-                processImageComplete();
-                stream.flushBefore(stream.getStreamPosition());
-            }
+            processImageComplete();
+            stream.flushBefore(stream.getStreamPosition());
 
             return;
         }
@@ -606,9 +606,6 @@
             destScanlineLength = destScanlineBytes / (DataBuffer.getDataTypeSize(dataType)>>3);
         }
         for (int i = 0; i < h; i++) {
-            if (abortRequested()) {
-                break;
-            }
 
             int row = minY + i;
 
@@ -724,6 +721,9 @@
             }
 
             processImageProgress(100.0f * (((float)i) / ((float)h)));
+            if (abortRequested()) {
+                break;
+            }
         }
 
         if (compressionType == BI_RLE4 ||
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/gif/GIFImageWriter.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/gif/GIFImageWriter.java	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -574,7 +574,6 @@
                        IIOMetadata sm,
                        IIOImage iioimage,
                        ImageWriteParam p) throws IOException {
-        clearAbortRequest();
 
         RenderedImage image = iioimage.getRenderedImage();
 
@@ -829,11 +828,11 @@
             image.getTile(0, 0) : image.getData();
         for (int y = dy; y < dh; y += ddy) {
             if (numRowsWritten % progressReportRowPeriod == 0) {
+                processImageProgress((numRowsWritten*100.0F)/dh);
                 if (abortRequested()) {
                     processWriteAborted();
                     return;
                 }
-                processImageProgress((numRowsWritten*100.0F)/dh);
             }
 
             raster.getSamples(sx, sy, sw, 1, 0, sbuf);
@@ -857,11 +856,11 @@
         lineStride *= ddy;
         for (int y = dy; y < dh; y += ddy) {
             if (numRowsWritten % progressReportRowPeriod == 0) {
+                processImageProgress((numRowsWritten*100.0F)/dh);
                 if (abortRequested()) {
                     processWriteAborted();
                     return;
                 }
-                processImageProgress((numRowsWritten*100.0F)/dh);
             }
 
             compressor.compress(data, offset, dw);
@@ -924,7 +923,12 @@
 
         int progressReportRowPeriod = Math.max(destHeight/20, 1);
 
+        clearAbortRequest();
         processImageStarted(imageIndex);
+        if (abortRequested()) {
+            processWriteAborted();
+            return;
+        }
 
         if (interlaceFlag) {
             if (DEBUG) System.out.println("Writing interlaced");
@@ -973,6 +977,9 @@
                 writeRowsOpt(data, offset, lineStride, compressor,
                              1, 2, destWidth, destHeight,
                              numRowsWritten, progressReportRowPeriod);
+                if (abortRequested()) {
+                    return;
+                }
             } else {
                 writeRows(image, compressor,
                           sourceXOffset, periodX,
@@ -1016,6 +1023,9 @@
                           sourceWidth,
                           1, 2, destWidth, destHeight,
                           numRowsWritten, progressReportRowPeriod);
+                if (abortRequested()) {
+                    return;
+                }
             }
         } else {
             if (DEBUG) System.out.println("Writing non-interlaced");
@@ -1031,6 +1041,9 @@
                 writeRowsOpt(data, offset, lineStride, compressor,
                              0, 1, destWidth, destHeight,
                              numRowsWritten, progressReportRowPeriod);
+                if (abortRequested()) {
+                    return;
+                }
             } else {
                 writeRows(image, compressor,
                           sourceXOffset, periodX,
@@ -1038,15 +1051,12 @@
                           sourceWidth,
                           0, 1, destWidth, destHeight,
                           numRowsWritten, progressReportRowPeriod);
+                if (abortRequested()) {
+                    return;
+                }
             }
         }
 
-        if (abortRequested()) {
-            return;
-        }
-
-        processImageProgress(100.0F);
-
         compressor.flush();
 
         stream.write(0x00);
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1234,43 +1234,46 @@
         clearAbortRequest();
 
         processImageStarted(0);
-
-        try {
-            write_magic();
-            write_IHDR();
+        if (abortRequested()) {
+            processWriteAborted();
+        } else {
+            try {
+                write_magic();
+                write_IHDR();
 
-            write_cHRM();
-            write_gAMA();
-            write_iCCP();
-            write_sBIT();
-            write_sRGB();
+                write_cHRM();
+                write_gAMA();
+                write_iCCP();
+                write_sBIT();
+                write_sRGB();
 
-            write_PLTE();
+                write_PLTE();
 
-            write_hIST();
-            write_tRNS();
-            write_bKGD();
+                write_hIST();
+                write_tRNS();
+                write_bKGD();
 
-            write_pHYs();
-            write_sPLT();
-            write_tIME();
-            write_tEXt();
-            write_iTXt();
-            write_zTXt();
+                write_pHYs();
+                write_sPLT();
+                write_tIME();
+                write_tEXt();
+                write_iTXt();
+                write_zTXt();
 
-            writeUnknownChunks();
+                writeUnknownChunks();
+
+                write_IDAT(im, deflaterLevel);
 
-            write_IDAT(im, deflaterLevel);
-
-            if (abortRequested()) {
-                processWriteAborted();
-            } else {
-                // Finish up and inform the listeners we are done
-                writeIEND();
-                processImageComplete();
+                if (abortRequested()) {
+                    processWriteAborted();
+                } else {
+                    // Finish up and inform the listeners we are done
+                    writeIEND();
+                    processImageComplete();
+                }
+            } catch (IOException e) {
+                throw new IIOException("I/O error writing PNG file!", e);
             }
-        } catch (IOException e) {
-            throw new IIOException("I/O error writing PNG file!", e);
         }
     }
 }
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriter.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriter.java	Wed Jul 05 22:19:13 2017 +0200
@@ -2437,6 +2437,10 @@
 
         clearAbortRequest();
         processImageStarted(0);
+        if (abortRequested()) {
+            processWriteAborted();
+            return;
+        }
 
         // Optionally write the header.
         if (writeHeader) {
@@ -2587,9 +2591,6 @@
                         nextSpace = pos + byteCount;
                     }
 
-                    pixelsDone += tileRect.width*tileRect.height;
-                    processImageProgress(100.0F*pixelsDone/totalPixels);
-
                     // Fill in the offset and byte count for the file
                     stream.mark();
                     stream.seek(stripOrTileOffsetsPosition);
@@ -2600,14 +2601,16 @@
                     stream.writeInt(byteCount);
                     stripOrTileByteCountsPosition += 4;
                     stream.reset();
+
+                    pixelsDone += tileRect.width*tileRect.height;
+                    processImageProgress(100.0F*pixelsDone/totalPixels);
+                    if (abortRequested()) {
+                        processWriteAborted();
+                        return;
+                    }
                 } catch (IOException e) {
                     throw new IIOException("I/O error writing TIFF file!", e);
                 }
-
-                if (abortRequested()) {
-                    processWriteAborted();
-                    return;
-                }
             }
         }
 
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKEngine.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKEngine.java	Wed Jul 05 22:19:13 2017 +0200
@@ -586,8 +586,8 @@
      * Convenience method that delegates to finishPainting() with
      * caching enabled.
      */
-    public void finishPainting() {
-        finishPainting(true);
+    public BufferedImage finishPainting() {
+        return finishPainting(true);
     }
 
     /**
@@ -595,7 +595,7 @@
      * BufferedImage from the offscreen buffer, (optionally) cache it,
      * and paint it.
      */
-    public void finishPainting(boolean useCache) {
+    public BufferedImage finishPainting(boolean useCache) {
         DataBufferInt dataBuffer = new DataBufferInt(w0 * h0);
         // Note that stealData() requires a markDirty() afterwards
         // since we modify the data in it.
@@ -609,11 +609,12 @@
                 dataBuffer, w0, h0, w0, bands, null);
 
         ColorModel cm = COLOR_MODELS[transparency - 1];
-        Image img = new BufferedImage(cm, raster, false, null);
+        BufferedImage img = new BufferedImage(cm, raster, false, null);
         if (useCache) {
             cache.setImage(getClass(), null, w0, h0, cacheArgs, img);
         }
         graphics.drawImage(img, x0, y0, null);
+        return img;
     }
 
     /**
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java	Wed Jul 05 22:19:13 2017 +0200
@@ -24,6 +24,8 @@
  */
 package com.sun.java.swing.plaf.gtk;
 
+import sun.awt.ModalExclude;
+import sun.awt.SunToolkit;
 import sun.awt.UNIXToolkit;
 
 import javax.swing.plaf.synth.*;
@@ -36,6 +38,7 @@
 import com.sun.java.swing.plaf.gtk.GTKConstants.Orientation;
 import com.sun.java.swing.plaf.gtk.GTKConstants.PositionType;
 import com.sun.java.swing.plaf.gtk.GTKConstants.ShadowType;
+import java.awt.image.BufferedImage;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
@@ -567,8 +570,10 @@
         Region id = context.getRegion();
         int gtkState = GTKLookAndFeel.synthStateToGTKState(
                 id, context.getComponentState());
+        boolean isHW = SunToolkit.getHeavyweightComponent(
+                context.getComponent()) instanceof ModalExclude;
         synchronized (UNIXToolkit.GTK_LOCK) {
-            if (ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState)) {
+            if (ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState, isHW)) {
                 return;
             }
             ENGINE.startPainting(g, x, y, w, h, id, gtkState);
@@ -581,7 +586,25 @@
                 style.getGTKColor(context, gtkState, GTKColorType.BACKGROUND),
                 x + insets.left, y + insets.top, w - insets.left - insets.right,
                 h - insets.top - insets.bottom);
-            ENGINE.finishPainting();
+            BufferedImage img = ENGINE.finishPainting();
+            if(!isHW) {
+                int border = img.getRGB(0, h / 2);
+                if (img != null && border == img.getRGB(w / 2, h / 2)) {
+                    // fix no menu borders in Adwaita theme
+                    Graphics g2 = img.getGraphics();
+                    Color c = new Color(border);
+                    g2.setColor(new Color(Math.max((int) (c.getRed() * 0.8), 0),
+                            Math.max((int) (c.getGreen() * 0.8), 0),
+                            Math.max((int) (c.getBlue() * 0.8), 0)));
+                    g2.drawLine(0, 0, w - 1, 0);
+                    g2.drawLine(w - 1, 0, w - 1, h - 1);
+                    g2.drawLine(0, h - 1, 0, 1);
+                    g2.setColor(c.darker());
+                    g2.drawLine(w - 1, h - 1, 0, h - 1);
+                    g2.dispose();
+                    g.drawImage(img, x, y, null);
+                }
+            }
         }
     }
 
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifCheckBoxMenuItemUI.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifCheckBoxMenuItemUI.java	Wed Jul 05 22:19:13 2017 +0200
@@ -33,6 +33,7 @@
 
 import java.awt.*;
 import java.awt.event.*;
+import sun.swing.SwingUtilities2;
 
 
 /**
@@ -89,7 +90,8 @@
             Point p = e.getPoint();
             if(p.x >= 0 && p.x < menuItem.getWidth() &&
                p.y >= 0 && p.y < menuItem.getHeight()) {
-                if (UIManager.getBoolean("CheckBoxMenuItem.closeOnMouseClick")) {
+                String property = "CheckBoxMenuItem.doNotCloseOnMouseClick";
+                if (!SwingUtilities2.getBoolean(menuItem, property)) {
                     manager.clearSelectedPath();
                 }
                 menuItem.doClick(0);
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifRadioButtonMenuItemUI.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifRadioButtonMenuItemUI.java	Wed Jul 05 22:19:13 2017 +0200
@@ -33,6 +33,7 @@
 import java.awt.*;
 import java.awt.event.*;
 import java.io.Serializable;
+import sun.swing.SwingUtilities2;
 
 
 /**
@@ -97,8 +98,8 @@
             Point p = e.getPoint();
             if(p.x >= 0 && p.x < menuItem.getWidth() &&
                p.y >= 0 && p.y < menuItem.getHeight()) {
-                String property = "RadioButtonMenuItem.closeOnMouseClick";
-                if (UIManager.getBoolean(property)) {
+                String property = "RadioButtonMenuItem.doNotCloseOnMouseClick";
+                if (!SwingUtilities2.getBoolean(menuItem, property)) {
                     manager.clearSelectedPath();
                 }
                 menuItem.doClick(0);
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java	Wed Jul 05 22:19:13 2017 +0200
@@ -36,6 +36,7 @@
 import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
 
 import sun.swing.MenuItemCheckIconFactory;
+import sun.swing.SwingUtilities2;
 
 /**
  * Factory object that can vend Icons appropriate for the Windows {@literal L & F}.
@@ -400,15 +401,24 @@
 
                 // paint check
                 if (model.isSelected()) {
-                    g.drawLine(x+9, y+3, x+9, y+3);
-                    g.drawLine(x+8, y+4, x+9, y+4);
-                    g.drawLine(x+7, y+5, x+9, y+5);
-                    g.drawLine(x+6, y+6, x+8, y+6);
-                    g.drawLine(x+3, y+7, x+7, y+7);
-                    g.drawLine(x+4, y+8, x+6, y+8);
-                    g.drawLine(x+5, y+9, x+5, y+9);
-                    g.drawLine(x+3, y+5, x+3, y+5);
-                    g.drawLine(x+3, y+6, x+4, y+6);
+                    if (SwingUtilities2.isScaledGraphics(g)) {
+                        int[] xPoints = {3, 5, 9, 9, 5, 3};
+                        int[] yPoints = {5, 7, 3, 5, 9, 7};
+                        g.translate(x, y);
+                        g.fillPolygon(xPoints, yPoints, 6);
+                        g.drawPolygon(xPoints, yPoints, 6);
+                        g.translate(-x, -y);
+                    } else {
+                        g.drawLine(x + 9, y + 3, x + 9, y + 3);
+                        g.drawLine(x + 8, y + 4, x + 9, y + 4);
+                        g.drawLine(x + 7, y + 5, x + 9, y + 5);
+                        g.drawLine(x + 6, y + 6, x + 8, y + 6);
+                        g.drawLine(x + 3, y + 7, x + 7, y + 7);
+                        g.drawLine(x + 4, y + 8, x + 6, y + 8);
+                        g.drawLine(x + 5, y + 9, x + 5, y + 9);
+                        g.drawLine(x + 3, y + 5, x + 3, y + 5);
+                        g.drawLine(x + 3, y + 6, x + 4, y + 6);
+                    }
                 }
             }
         }
@@ -475,54 +485,94 @@
                 g.fillRect(x+2, y+2, 8, 8);
 
 
+                boolean isScaledGraphics = SwingUtilities2.isScaledGraphics(g);
+
+                if (isScaledGraphics) {
+
+                    Graphics2D g2d = (Graphics2D) g;
+                    Stroke oldStroke = g2d.getStroke();
+                    g2d.setStroke(new BasicStroke(1.03f, BasicStroke.CAP_ROUND,
+                                                  BasicStroke.JOIN_ROUND));
+                    Object aaHint = g2d.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
+                    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+                                         RenderingHints.VALUE_ANTIALIAS_ON);
+
                     // outter left arc
-                g.setColor(UIManager.getColor("RadioButton.shadow"));
-                g.drawLine(x+4, y+0, x+7, y+0);
-                g.drawLine(x+2, y+1, x+3, y+1);
-                g.drawLine(x+8, y+1, x+9, y+1);
-                g.drawLine(x+1, y+2, x+1, y+3);
-                g.drawLine(x+0, y+4, x+0, y+7);
-                g.drawLine(x+1, y+8, x+1, y+9);
+                    g.setColor(UIManager.getColor("RadioButton.shadow"));
+                    g.drawArc(x, y, 11, 11, 45, 180);
+                    // outter right arc
+                    g.setColor(UIManager.getColor("RadioButton.highlight"));
+                    g.drawArc(x, y, 11, 11, 45, -180);
+                    // inner left arc
+                    g.setColor(UIManager.getColor("RadioButton.darkShadow"));
+                    g.drawArc(x + 1, y + 1, 9, 9, 45, 180);
+                    // inner right arc
+                    g.setColor(UIManager.getColor("RadioButton.light"));
+                    g.drawArc(x + 1, y + 1, 9, 9, 45, -180);
+
+                    g2d.setStroke(oldStroke);
 
-                // outter right arc
-                g.setColor(UIManager.getColor("RadioButton.highlight"));
-                g.drawLine(x+2, y+10, x+3, y+10);
-                g.drawLine(x+4, y+11, x+7, y+11);
-                g.drawLine(x+8, y+10, x+9, y+10);
-                g.drawLine(x+10, y+9, x+10, y+8);
-                g.drawLine(x+11, y+7, x+11, y+4);
-                g.drawLine(x+10, y+3, x+10, y+2);
+                    if (model.isSelected()) {
+                        if (model.isEnabled()) {
+                            g.setColor(UIManager.getColor("RadioButton.foreground"));
+                        } else {
+                            g.setColor(UIManager.getColor("RadioButton.shadow"));
+                        }
+                        g.fillOval(x + 3, y + 3, 5, 5);
+                    }
+                    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, aaHint);
+
+                } else {
+
+                    // outter left arc
+                    g.setColor(UIManager.getColor("RadioButton.shadow"));
+                    g.drawLine(x+4, y+0, x+7, y+0);
+                    g.drawLine(x+2, y+1, x+3, y+1);
+                    g.drawLine(x+8, y+1, x+9, y+1);
+                    g.drawLine(x+1, y+2, x+1, y+3);
+                    g.drawLine(x+0, y+4, x+0, y+7);
+                    g.drawLine(x+1, y+8, x+1, y+9);
+
+                    // outter right arc
+                    g.setColor(UIManager.getColor("RadioButton.highlight"));
+                    g.drawLine(x+2, y+10, x+3, y+10);
+                    g.drawLine(x+4, y+11, x+7, y+11);
+                    g.drawLine(x+8, y+10, x+9, y+10);
+                    g.drawLine(x+10, y+9, x+10, y+8);
+                    g.drawLine(x+11, y+7, x+11, y+4);
+                    g.drawLine(x+10, y+3, x+10, y+2);
 
 
-                // inner left arc
-                g.setColor(UIManager.getColor("RadioButton.darkShadow"));
-                g.drawLine(x+4, y+1, x+7, y+1);
-                g.drawLine(x+2, y+2, x+3, y+2);
-                g.drawLine(x+8, y+2, x+9, y+2);
-                g.drawLine(x+2, y+3, x+2, y+3);
-                g.drawLine(x+1, y+4, x+1, y+7);
-                g.drawLine(x+2, y+8, x+2, y+8);
+                    // inner left arc
+                    g.setColor(UIManager.getColor("RadioButton.darkShadow"));
+                    g.drawLine(x+4, y+1, x+7, y+1);
+                    g.drawLine(x+2, y+2, x+3, y+2);
+                    g.drawLine(x+8, y+2, x+9, y+2);
+                    g.drawLine(x+2, y+3, x+2, y+3);
+                    g.drawLine(x+1, y+4, x+1, y+7);
+                    g.drawLine(x+2, y+8, x+2, y+8);
 
 
-                // inner right arc
-                g.setColor(UIManager.getColor("RadioButton.light"));
-                g.drawLine(x+2,  y+9,  x+3,  y+9);
-                g.drawLine(x+4,  y+10, x+7,  y+10);
-                g.drawLine(x+8,  y+9,  x+9,  y+9);
-                g.drawLine(x+9,  y+8,  x+9,  y+8);
-                g.drawLine(x+10, y+7,  x+10, y+4);
-                g.drawLine(x+9,  y+3,  x+9,  y+3);
+                    // inner right arc
+                    g.setColor(UIManager.getColor("RadioButton.light"));
+                    g.drawLine(x+2,  y+9,  x+3,  y+9);
+                    g.drawLine(x+4,  y+10, x+7,  y+10);
+                    g.drawLine(x+8,  y+9,  x+9,  y+9);
+                    g.drawLine(x+9,  y+8,  x+9,  y+8);
+                    g.drawLine(x+10, y+7,  x+10, y+4);
+                    g.drawLine(x+9,  y+3,  x+9,  y+3);
 
 
-                 // indicate whether selected or not
-                if (model.isSelected()) {
-                    if (model.isEnabled()) {
-                        g.setColor(UIManager.getColor("RadioButton.foreground"));
-                    } else {
-                        g.setColor(UIManager.getColor("RadioButton.shadow"));
+                     // indicate whether selected or not
+                    if (model.isSelected()) {
+                        if (model.isEnabled()) {
+                            g.setColor(UIManager.getColor("RadioButton.foreground"));
+                        } else {
+                            g.setColor(UIManager.getColor("RadioButton.shadow"));
+                        }
+                        g.fillRect(x+4, y+5, 4, 2);
+                        g.fillRect(x+5, y+4, 2, 4);
                     }
-                    g.fillRect(x+4, y+5, 4, 2);
-                    g.fillRect(x+5, y+4, 2, 4);
                 }
             }
         }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AuFileReader.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AuFileReader.java	Wed Jul 05 22:19:13 2017 +0200
@@ -44,7 +44,7 @@
 public final class AuFileReader extends SunFileReader {
 
     @Override
-    public StandardFileFormat getAudioFileFormatImpl(final InputStream stream)
+    StandardFileFormat getAudioFileFormatImpl(final InputStream stream)
             throws UnsupportedAudioFileException, IOException {
         final DataInputStream dis = new DataInputStream(stream);
         final int magic = dis.readInt();
@@ -55,9 +55,15 @@
         }
 
         final int headerSize = dis.readInt();
+        if (headerSize < AuFileFormat.AU_HEADERSIZE) {
+            throw new UnsupportedAudioFileException("Invalid header size");
+        }
         final long /* unsigned int */ dataSize = dis.readInt() & 0xffffffffL;
         final int auType = dis.readInt();
         final int sampleRate = dis.readInt();
+        if (sampleRate <= 0) {
+            throw new UnsupportedAudioFileException("Invalid sample rate");
+        }
         final int channels = dis.readInt();
         if (channels <= 0) {
             throw new UnsupportedAudioFileException("Invalid number of channels");
@@ -119,10 +125,19 @@
                 // unsupported filetype, throw exception
                 throw new UnsupportedAudioFileException("not a valid AU file");
         }
-        // now seek past the header
+
+        // Skip the variable-length annotation field. The content of this field
+        // is currently undefined by AU specification and is unsupported by
+        // JavaSound, so seek past the header
         dis.skipBytes(headerSize - AuFileFormat.AU_HEADERSIZE);
 
+        // Even if the sampleSizeInBits and channels are supported we can get an
+        // unsupported frameSize because of overflow
         final int frameSize = calculatePCMFrameSize(sampleSizeInBits, channels);
+        if (frameSize <= 0) {
+            throw new UnsupportedAudioFileException("Invalid frame size");
+        }
+
         //$$fb 2002-11-02: fix for 4629669: AU file reader: problems with empty files
         //$$fb 2003-10-20: fix for 4940459: AudioInputStream.getFrameLength() returns 0 instead of NOT_SPECIFIED
         long frameLength = AudioSystem.NOT_SPECIFIED;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunFileReader.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunFileReader.java	Wed Jul 05 22:19:13 2017 +0200
@@ -252,6 +252,10 @@
      * @return the size of a PCM frame in bytes.
      */
     static final int calculatePCMFrameSize(int sampleSizeInBits, int channels) {
-        return ((sampleSizeInBits + 7) / 8) * channels;
+        try {
+            return Math.multiplyExact((sampleSizeInBits + 7) / 8, channels);
+        } catch (final ArithmeticException ignored) {
+            return 0;
+        }
     }
 }
--- a/jdk/src/java.desktop/share/classes/java/awt/Desktop.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/java/awt/Desktop.java	Wed Jul 05 22:19:13 2017 +0200
@@ -271,6 +271,14 @@
         }
     }
 
+    private void checkEventsProcessingPermission() {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(new RuntimePermission(
+                    "canProcessApplicationEvents"));
+        }
+    }
+
     /**
      * Returns the {@code Desktop} instance of the current
      * desktop context. On some platforms the Desktop API may not be
@@ -662,7 +670,7 @@
      *
      * @throws SecurityException if a security manager exists and it
      * denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")}
+     * {@code RuntimePermission("canProcessApplicationEvents")}
      * permission
      *
      * @see java.awt.desktop.AppForegroundListener
@@ -674,7 +682,7 @@
      * @since 9
      */
     public void addAppEventListener(final SystemEventListener listener) {
-        checkAWTPermission();
+        checkEventsProcessingPermission();
         peer.addAppEventListener(listener);
     }
 
@@ -689,7 +697,7 @@
      *
      * @throws SecurityException if a security manager exists and it
      * denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")}
+     * {@code RuntimePermission("canProcessApplicationEvents")}
      * permission
      *
      * @see java.awt.desktop.AppForegroundListener
@@ -701,7 +709,7 @@
      * @since 9
      */
     public void removeAppEventListener(final SystemEventListener listener) {
-        checkAWTPermission();
+        checkEventsProcessingPermission();
         peer.removeAppEventListener(listener);
     }
 
@@ -716,7 +724,7 @@
      *
      * @throws SecurityException if a security manager exists and it
      * denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")}
+     * {@code RuntimePermission("canProcessApplicationEvents")}
      * permission
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Desktop.Action#APP_ABOUT} action
@@ -724,7 +732,7 @@
      * @since 9
      */
     public void setAboutHandler(final AboutHandler aboutHandler) {
-        checkAWTPermission();
+        checkEventsProcessingPermission();
         checkActionSupport(Action.APP_ABOUT);
         peer.setAboutHandler(aboutHandler);
     }
@@ -741,14 +749,13 @@
      *
      * @throws SecurityException if a security manager exists and it
      * denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")}
-     * permission
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Desktop.Action#APP_PREFERENCES} action
      * @since 9
      */
     public void setPreferencesHandler(final PreferencesHandler preferencesHandler) {
-        checkAWTPermission();
+        checkEventsProcessingPermission();
         checkActionSupport(Action.APP_PREFERENCES);
         peer.setPreferencesHandler(preferencesHandler);
     }
@@ -770,7 +777,7 @@
      * @throws SecurityException if a security manager exists and its
      * {@link java.lang.SecurityManager#checkRead(java.lang.String)}
      * method denies read access to the files, or it denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")}
+     * {@code RuntimePermission("canProcessApplicationEvents")}
      * permission, or the calling thread is not allowed to create a
      * subprocess
      * @throws UnsupportedOperationException if the current platform
@@ -778,7 +785,7 @@
      * @since 9
      */
     public void setOpenFileHandler(final OpenFilesHandler openFileHandler) {
-        checkAWTPermission();
+        checkEventsProcessingPermission();
         checkExec();
         checkRead();
         checkActionSupport(Action.APP_OPEN_FILE);
@@ -800,12 +807,14 @@
      * @param printFileHandler handler
      * @throws SecurityException if a security manager exists and its
      * {@link java.lang.SecurityManager#checkPrintJobAccess()} method denies
-     * the permission to print.
+     * the permission to print or it denies the
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Desktop.Action#APP_PRINT_FILE} action
      * @since 9
      */
     public void setPrintFileHandler(final PrintFilesHandler printFileHandler) {
+        checkEventsProcessingPermission();
         SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
             sm.checkPrintJobAccess();
@@ -832,7 +841,7 @@
      *
      * @param openURIHandler handler
      *
-     * {@code AWTPermission("showWindowWithoutWarningBanner")}
+     * {@code RuntimePermission("canProcessApplicationEvents")}
      * permission, or the calling thread is not allowed to create a
      * subprocess
      * @throws UnsupportedOperationException if the current platform
@@ -840,7 +849,7 @@
      * @since 9
      */
     public void setOpenURIHandler(final OpenURIHandler openURIHandler) {
-        checkAWTPermission();
+        checkEventsProcessingPermission();
         checkExec();
         checkActionSupport(Action.APP_OPEN_URI);
         peer.setOpenURIHandler(openURIHandler);
@@ -856,12 +865,14 @@
      * asked to quit
      *
      * @throws SecurityException if a security manager exists and it
-     * will not allow the caller to invoke {@code System.exit}
+     * will not allow the caller to invoke {@code System.exit} or it denies the
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Desktop.Action#APP_QUIT_HANDLER} action
      * @since 9
      */
     public void setQuitHandler(final QuitHandler quitHandler) {
+        checkEventsProcessingPermission();
         checkQuitPermission();
         checkActionSupport(Action.APP_QUIT_HANDLER);
         peer.setQuitHandler(quitHandler);
@@ -874,13 +885,15 @@
      * @param strategy the way this application should be shutdown
      *
      * @throws SecurityException if a security manager exists and it
-     * will not allow the caller to invoke {@code System.exit}
+     * will not allow the caller to invoke {@code System.exit} or it denies the
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Desktop.Action#APP_QUIT_STRATEGY} action
      * @see QuitStrategy
      * @since 9
      */
     public void setQuitStrategy(final QuitStrategy strategy) {
+        checkEventsProcessingPermission();
         checkQuitPermission();
         checkActionSupport(Action.APP_QUIT_STRATEGY);
         peer.setQuitStrategy(strategy);
@@ -901,13 +914,15 @@
      * effectively "kill -KILL" your application.
      *
      * @throws SecurityException if a security manager exists and it
-     * will not allow the caller to invoke {@code System.exit}
+     * will not allow the caller to invoke {@code System.exit} or it denies the
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Desktop.Action#APP_SUDDEN_TERMINATION} action
      * @see #disableSuddenTermination()
      * @since 9
      */
     public void enableSuddenTermination() {
+        checkEventsProcessingPermission();
         checkQuitPermission();
         checkActionSupport(Action.APP_SUDDEN_TERMINATION);
         peer.enableSuddenTermination();
@@ -920,13 +935,15 @@
      * may not be terminated without notification.
      *
      * @throws SecurityException if a security manager exists and it
-     * will not allow the caller to invoke {@code System.exit}
+     * will not allow the caller to invoke {@code System.exit} or it denies the
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Desktop.Action#APP_SUDDEN_TERMINATION} action
      * @see #enableSuddenTermination()
      * @since 9
      */
     public void disableSuddenTermination() {
+        checkEventsProcessingPermission();
         checkQuitPermission();
         checkActionSupport(Action.APP_SUDDEN_TERMINATION);
         peer.disableSuddenTermination();
@@ -938,13 +955,13 @@
      * @param allWindows if all windows of this application should be moved to
      * the foreground, or only the foremost one
      * @throws SecurityException if a security manager exists and it denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Desktop.Action#APP_REQUEST_FOREGROUND} action
      * @since 9
      */
     public void requestForeground(final boolean allWindows) {
-        checkAWTPermission();
+        checkEventsProcessingPermission();
         checkActionSupport(Action.APP_REQUEST_FOREGROUND);
         peer.requestForeground(allWindows);
     }
@@ -957,13 +974,13 @@
      * and registered in the Info.plist with CFBundleHelpBookFolder
      *
      * @throws SecurityException if a security manager exists and it denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Desktop.Action#APP_HELP_VIEWER} action
      * @since 9
      */
     public void openHelpViewer() {
-        checkAWTPermission();
+        checkEventsProcessingPermission();
         checkActionSupport(Action.APP_HELP_VIEWER);
         peer.openHelpViewer();
     }
@@ -975,13 +992,13 @@
      *
      * @param menuBar to use when no other frames are active
      * @throws SecurityException if a security manager exists and it denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Desktop.Action#APP_MENU_BAR} action
      * @since 9
      */
     public void setDefaultMenuBar(final JMenuBar menuBar) {
-        checkAWTPermission();
+        checkEventsProcessingPermission();
         checkActionSupport(Action.APP_MENU_BAR);
         peer.setDefaultMenuBar(menuBar);
     }
--- a/jdk/src/java.desktop/share/classes/java/awt/Taskbar.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/java/awt/Taskbar.java	Wed Jul 05 22:19:13 2017 +0200
@@ -179,14 +179,13 @@
 
     /**
      *  Calls to the security manager's {@code checkPermission} method with
-     *  an {@code AWTPermission("showWindowWithoutWarningBanner")}
-     *  permission.
+     *  an {@code RuntimePermission("canProcessApplicationEvents")} permissions.
      */
-    private void checkAWTPermission(){
+    private void checkEventsProcessingPermission(){
         SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
-            sm.checkPermission(new AWTPermission(
-                    "showWindowWithoutWarningBanner"));
+            sm.checkPermission(new RuntimePermission(
+                    "canProcessApplicationEvents"));
         }
     }
 
@@ -262,12 +261,12 @@
      * @param enabled disables this request if false
      * @param critical if this is an important request
      * @throws SecurityException if a security manager exists and it denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Taskbar.Feature#USER_ATTENTION} feature
      */
     public void requestUserAttention(final boolean enabled, final boolean critical) {
-        checkAWTPermission();
+        checkEventsProcessingPermission();
         checkFeatureSupport(Feature.USER_ATTENTION);
         peer.requestUserAttention(enabled, critical);
     }
@@ -277,12 +276,12 @@
      *
      * @param w window
      * @throws SecurityException if a security manager exists and it denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Taskbar.Feature#USER_ATTENTION_WINDOW} feature
      */
     public void requestWindowUserAttention(Window w) {
-        checkAWTPermission();
+        checkEventsProcessingPermission();
         checkFeatureSupport(Feature.USER_ATTENTION_WINDOW);
         peer.requestWindowUserAttention(w);
     }
@@ -293,12 +292,12 @@
      *
      * @param menu the PopupMenu to attach to this application
      * @throws SecurityException if a security manager exists and it denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Taskbar.Feature#MENU} feature
      */
     public void setMenu(final PopupMenu menu) {
-        checkAWTPermission();
+        checkEventsProcessingPermission();
         checkFeatureSupport(Feature.MENU);
         peer.setMenu(menu);
     }
@@ -308,12 +307,12 @@
      *
      * @return the PopupMenu
      * @throws SecurityException if a security manager exists and it denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Taskbar.Feature#MENU} feature
      */
     public PopupMenu getMenu() {
-        checkAWTPermission();
+        checkEventsProcessingPermission();
         checkFeatureSupport(Feature.MENU);
         return peer.getMenu();
     }
@@ -323,12 +322,12 @@
      *
      * @param image to change
      * @throws SecurityException if a security manager exists and it denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Taskbar.Feature#ICON_IMAGE} feature
      */
     public void setIconImage(final Image image) {
-        checkAWTPermission();
+        checkEventsProcessingPermission();
         checkFeatureSupport(Feature.ICON_IMAGE);
         peer.setIconImage(image);
     }
@@ -338,12 +337,12 @@
      *
      * @return an image of this application's icon
      * @throws SecurityException if a security manager exists and it denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Taskbar.Feature#ICON_IMAGE} feature
      */
     public Image getIconImage() {
-        checkAWTPermission();
+        checkEventsProcessingPermission();
         checkFeatureSupport(Feature.ICON_IMAGE);
         return peer.getIconImage();
     }
@@ -360,13 +359,13 @@
      * Passing {@code null} as parameter hides the badge.
      * @param badge label to affix to the icon
      * @throws SecurityException if a security manager exists and it denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Taskbar.Feature#ICON_BADGE_NUMBER}
      * or {@link Taskbar.Feature#ICON_BADGE_TEXT} feature
      */
     public void setIconBadge(final String badge) {
-        checkAWTPermission();
+        checkEventsProcessingPermission();
         checkFeatureSupport(Feature.ICON_BADGE_NUMBER);
         peer.setIconBadge(badge);
     }
@@ -379,12 +378,12 @@
      * @param w window to update
      * @param badge image to affix to the icon
      * @throws SecurityException if a security manager exists and it denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Taskbar.Feature#ICON_BADGE_IMAGE_WINDOW} feature
      */
     public void setWindowIconBadge(Window w, final Image badge) {
-        checkAWTPermission();
+        checkEventsProcessingPermission();
         checkFeatureSupport(Feature.ICON_BADGE_IMAGE_WINDOW);
         if (w != null) {
             peer.setWindowIconBadge(w, badge);
@@ -396,11 +395,13 @@
      * Affixes a small system-provided progress bar to this application's icon.
      *
      * @param value from 0 to 100, other to disable progress indication
+     * @throws SecurityException if a security manager exists and it denies the
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Taskbar.Feature#PROGRESS_VALUE} feature
      */
     public void setProgressValue(int value) {
-        checkAWTPermission();
+        checkEventsProcessingPermission();
         checkFeatureSupport(Feature.PROGRESS_VALUE);
         peer.setProgressValue(value);
     }
@@ -411,12 +412,12 @@
      * @param w window to update
      * @param value from 0 to 100, other to disable progress indication
      * @throws SecurityException if a security manager exists and it denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Taskbar.Feature#PROGRESS_VALUE_WINDOW} feature
      */
     public void setWindowProgressValue(Window w, int value) {
-        checkAWTPermission();
+        checkEventsProcessingPermission();
         checkFeatureSupport(Feature.PROGRESS_VALUE_WINDOW);
         if (w != null) {
             peer.setWindowProgressValue(w, value);
@@ -434,12 +435,12 @@
      * @see State#INDETERMINATE
      * @see State#ERROR
      * @throws SecurityException if a security manager exists and it denies the
-     * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
+     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Taskbar.Feature#PROGRESS_STATE_WINDOW} feature
      */
     public void setWindowProgressState(Window w, State state) {
-        checkAWTPermission();
+        checkEventsProcessingPermission();
         checkFeatureSupport(Feature.PROGRESS_STATE_WINDOW);
         if (w != null) {
             peer.setWindowProgressState(w, state);
--- a/jdk/src/java.desktop/share/classes/java/awt/TextField.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/java/awt/TextField.java	Wed Jul 05 22:19:13 2017 +0200
@@ -159,8 +159,8 @@
      * @param      text       the text to be displayed. If
      *             {@code text} is {@code null}, the empty
      *             string {@code ""} will be displayed.
-     *             If {@code text} contains EOL character, then
-     *             it will be replaced by space character.
+     *             If {@code text} contains EOL and/or LF characters, then
+     *             each will be replaced by space character.
      * @exception HeadlessException if GraphicsEnvironment.isHeadless()
      * returns true.
      * @see java.awt.GraphicsEnvironment#isHeadless
@@ -192,8 +192,8 @@
      * @param      text       the text to be displayed. If
      *             {@code text} is {@code null}, the empty
      *             string {@code ""} will be displayed.
-     *             If {@code text} contains EOL character, then
-     *             it will be replaced by space character.
+     *             If {@code text} contains EOL and/or LF characters, then
+     *             each will be replaced by space character.
      * @param      columns     the number of columns.  If
      *             {@code columns} is less than {@code 0},
      *             {@code columns} is set to {@code 0}.
@@ -300,8 +300,8 @@
      * @param      t       the new text. If
      *             {@code t} is {@code null}, the empty
      *             string {@code ""} will be displayed.
-     *             If {@code t} contains EOL character, then
-     *             it will be replaced by space character.
+     *             If {@code t} contains EOL and/or LF characters, then
+     *             each will be replaced by space character.
      * @see         java.awt.TextComponent#getText
      */
     public void setText(String t) {
--- a/jdk/src/java.desktop/share/classes/java/awt/Window.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/java/awt/Window.java	Wed Jul 05 22:19:13 2017 +0200
@@ -678,6 +678,10 @@
      * Depending on the platform capabilities one or several images
      * of different dimensions will be used as the window's icon.
      * <p>
+     * The {@code icons} list can contain {@code MultiResolutionImage} images also.
+     * Suitable image depending on screen resolution is extracted from
+     * base {@code MultiResolutionImage} image and added to the icons list
+     * while base resolution image is removed from list.
      * The {@code icons} list is scanned for the images of most
      * appropriate dimensions from the beginning. If the list contains
      * several images of the same size, the first will be used.
--- a/jdk/src/java.desktop/share/classes/javax/swing/JCheckBoxMenuItem.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JCheckBoxMenuItem.java	Wed Jul 05 22:19:13 2017 +0200
@@ -58,10 +58,13 @@
  * <p>
  * Some times it is required to select several check box menu items from a menu.
  * In this case it is useful that clicking on one check box menu item does not
- * close the menu. Such behavior can be controlled by the Look and Feel property
- * named {@code "CheckBoxMenuItem.closeOnMouseClick"}. The default value is
- * {@code true}. Setting the property to {@code false} prevents the menu from
- * closing when it is clicked by the mouse.
+ * close the menu. Such behavior can be controlled either by client
+ * {@link JComponent#putClientProperty} or the Look and Feel
+ * {@link UIManager#put} property named
+ * {@code "CheckBoxMenuItem.doNotCloseOnMouseClick"}. The default value is
+ * {@code false}. Setting the property to {@code true} prevents the menu from
+ * closing when it is clicked by the mouse. If the client property is set its
+ * value is always used; otherwise the {@literal L&F} property is queried.
  * Note: some {@code L&F}s may ignore this property. All built-in {@code L&F}s
  * inherit this behaviour.
  * <p>
--- a/jdk/src/java.desktop/share/classes/javax/swing/JRadioButtonMenuItem.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JRadioButtonMenuItem.java	Wed Jul 05 22:19:13 2017 +0200
@@ -52,10 +52,13 @@
  * <p>
  * Some menus can have several button groups with radio button menu items. In
  * this case it is useful that clicking on one radio button menu item does not
- * close the menu. Such behavior can be controlled by the Look and Feel property
- * named {@code "RadioButtonMenuItem.closeOnMouseClick"}. The default value is
- * {@code true}. Setting the property to {@code false} prevents the menu from
- * closing when it is clicked by the mouse.
+ * close the menu. Such behavior can be controlled either by client
+ * {@link JComponent#putClientProperty} or the Look and Feel
+ * {@link UIManager#put} property named
+ * {@code "RadioButtonMenuItem.doNotCloseOnMouseClick"}. The default value is
+ * {@code false}. Setting the property to {@code true} prevents the menu from
+ * closing when it is clicked by the mouse. If the client property is set its
+ * value is always used; otherwise the {@literal L&F} property is queried.
  * Note: some {@code L&F}s may ignore this property. All built-in {@code L&F}s
  * inherit this behaviour.
  * <p>
--- a/jdk/src/java.desktop/share/classes/javax/swing/LayoutFocusTraversalPolicy.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/swing/LayoutFocusTraversalPolicy.java	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,9 +26,9 @@
 
 import java.awt.Component;
 import java.awt.Container;
-import java.awt.ComponentOrientation;
 import java.util.Comparator;
 import java.io.*;
+import java.util.Enumeration;
 import sun.awt.SunToolkit;
 
 
@@ -236,6 +236,31 @@
             JComboBox<?> box = (JComboBox)aComponent;
             return box.getUI().isFocusTraversable(box);
         } else if (aComponent instanceof JComponent) {
+            if (SunToolkit.isInstanceOf(aComponent,
+                                                 "javax.swing.JToggleButton")) {
+                JToggleButton.ToggleButtonModel model =
+                        (JToggleButton.ToggleButtonModel) ((JToggleButton)
+                                aComponent).getModel();
+                if (model != null) {
+                    ButtonGroup group = model.getGroup();
+                    if (group != null) {
+                        Enumeration<AbstractButton> elements =
+                                                            group.getElements();
+                        int idx = 0;
+                        while (elements.hasMoreElements()) {
+                            AbstractButton member = elements.nextElement();
+                            if (member.isVisible() && member.isDisplayable() &&
+                                   member.isEnabled() && member.isFocusable()) {
+                                if (member == aComponent) {
+                                    return idx == 0;
+                                }
+                                idx++;
+                            }
+                        }
+                    }
+                }
+            }
+
             JComponent jComponent = (JComponent)aComponent;
             InputMap inputMap = jComponent.getInputMap(JComponent.WHEN_FOCUSED,
                                                        false);
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicArrowButton.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicArrowButton.java	Wed Jul 05 22:19:13 2017 +0200
@@ -27,9 +27,13 @@
 import java.awt.Dimension;
 import java.awt.Graphics;
 import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Path2D;
 
 import javax.swing.*;
 import javax.swing.plaf.UIResource;
+import sun.swing.SwingUtilities2;
 
 /**
  * JButton object that draws a scaled Arrow in one of the cardinal directions.
@@ -236,6 +240,16 @@
          */
         public void paintTriangle(Graphics g, int x, int y, int size,
                                         int direction, boolean isEnabled) {
+            if (SwingUtilities2.isScaledGraphics(g)) {
+                paintScaledTriangle(g, x, y, size, direction, isEnabled);
+            } else {
+                paintUnscaledTriangle(g, x, y, size, direction, isEnabled);
+            }
+        }
+
+        private void paintUnscaledTriangle(Graphics g, int x, int y, int size,
+                                           int direction, boolean isEnabled)
+        {
             Color oldColor = g.getColor();
             int mid, i, j;
 
@@ -309,4 +323,32 @@
             g.setColor(oldColor);
         }
 
+    private void paintScaledTriangle(Graphics g, double x, double y, double size,
+                                     int direction, boolean isEnabled) {
+        size = Math.max(size, 2);
+        Path2D.Double path = new Path2D.Double();
+        path.moveTo(-size, size / 2);
+        path.lineTo(size, size / 2);
+        path.lineTo(0, -size / 2);
+        path.closePath();
+        AffineTransform affineTransform = new AffineTransform();
+        affineTransform.rotate(Math.PI * (direction - 1) / 4);
+        path.transform(affineTransform);
+
+        Graphics2D g2d = (Graphics2D) g;
+        double tx = x + size / 2;
+        double ty = y + size / 2;
+        g2d.translate(tx, ty);
+        Color oldColor = g.getColor();
+        if (!isEnabled) {
+            g2d.translate(1, 0);
+            g2d.setColor(highlight);
+            g2d.fill(path);
+            g2d.translate(-1, 0);
+        }
+        g2d.setColor(isEnabled ? darkShadow : shadow);
+        g2d.fill(path);
+        g2d.translate(-tx, -ty);
+        g2d.setColor(oldColor);
+    }
 }
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java	Wed Jul 05 22:19:13 2017 +0200
@@ -1055,7 +1055,6 @@
             "RadioButtonMenuItem.checkIcon", radioButtonMenuItemIcon,
             "RadioButtonMenuItem.arrowIcon", menuItemArrowIcon,
             "RadioButtonMenuItem.commandSound", null,
-            "RadioButtonMenuItem.closeOnMouseClick", Boolean.TRUE,
 
             "CheckBoxMenuItem.font", dialogPlain12,
             "CheckBoxMenuItem.acceleratorFont", dialogPlain12,
@@ -1072,7 +1071,6 @@
             "CheckBoxMenuItem.checkIcon", checkBoxMenuItemIcon,
             "CheckBoxMenuItem.arrowIcon", menuItemArrowIcon,
             "CheckBoxMenuItem.commandSound", null,
-            "CheckBoxMenuItem.closeOnMouseClick", Boolean.TRUE,
 
             "Menu.font", dialogPlain12,
             "Menu.acceleratorFont", dialogPlain12,
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java	Wed Jul 05 22:19:13 2017 +0200
@@ -936,13 +936,15 @@
         }
     }
 
-    boolean closeOnMouseClick() {
+    boolean doNotCloseOnMouseClick() {
         if (menuItem instanceof JCheckBoxMenuItem) {
-            return UIManager.getBoolean("CheckBoxMenuItem.closeOnMouseClick");
+            String property = "CheckBoxMenuItem.doNotCloseOnMouseClick";
+            return SwingUtilities2.getBoolean(menuItem, property);
         } else if (menuItem instanceof JRadioButtonMenuItem) {
-            return UIManager.getBoolean("RadioButtonMenuItem.closeOnMouseClick");
+            String property = "RadioButtonMenuItem.doNotCloseOnMouseClick";
+            return SwingUtilities2.getBoolean(menuItem, property);
         }
-        return true;
+        return false;
     }
 
     /**
@@ -967,7 +969,7 @@
             BasicLookAndFeel.playSound(menuItem, getPropertyPrefix() +
                                        ".commandSound");
         }
-        if (closeOnMouseClick()) {
+        if (!doNotCloseOnMouseClick()) {
             // Visual feedback
             if (msm == null) {
                 msm = MenuSelectionManager.defaultManager();
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -438,21 +438,7 @@
         // Check if the next object to gain focus belongs
         // to the button group or not
         Component getFocusTransferBaseComponent(boolean next){
-            Component focusBaseComp = activeBtn;
-            Container container = focusBaseComp.getFocusCycleRootAncestor();
-            if (container != null) {
-                FocusTraversalPolicy policy = container.getFocusTraversalPolicy();
-                Component comp = next ? policy.getComponentAfter(container, activeBtn)
-                                      : policy.getComponentBefore(container, activeBtn);
-
-                // If next component in the button group, use last/first button as base focus
-                // otherwise, use the activeBtn as the base focus
-                if (containsInGroup(comp)) {
-                    focusBaseComp = next ? lastBtn : firstBtn;
-                }
-            }
-
-            return focusBaseComp;
+            return firstBtn;
         }
 
         boolean getButtonGroupInfo() {
--- a/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java	Wed Jul 05 22:19:13 2017 +0200
@@ -46,6 +46,7 @@
 import java.lang.reflect.InvocationTargetException;
 import java.net.URL;
 import java.security.AccessController;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.Locale;
@@ -887,12 +888,21 @@
         if (width == 0 || height == 0) {
             return null;
         }
+        java.util.List<Image> multiResAndnormalImages = new ArrayList<>(imageList.size());
+        for (Image image : imageList) {
+            if ((image instanceof MultiResolutionImage)) {
+                Image im = ((MultiResolutionImage) image).getResolutionVariant(width, height);
+                multiResAndnormalImages.add(im);
+            } else {
+                multiResAndnormalImages.add(image);
+            }
+        }
         Image bestImage = null;
         int bestWidth = 0;
         int bestHeight = 0;
         double bestSimilarity = 3; //Impossibly high value
         double bestScaleFactor = 0;
-        for (Iterator<Image> i = imageList.iterator();i.hasNext();) {
+        for (Iterator<Image> i = multiResAndnormalImages.iterator();i.hasNext();) {
             //Iterate imageList looking for best matching image.
             //'Similarity' measure is defined as good scale factor and small insets.
             //best possible similarity is 0 (no scale, no insets).
--- a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/hw/AccelDeviceEventListener.java	Fri Oct 07 21:28:20 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.java2d.pipe.hw;
-
-/**
- * An interface for receiving notifications about imminent accelerated device's
- * events. Upon receiving such event appropriate actions can be taken (for
- * example, resources associated with the device can be freed).
- */
-public interface AccelDeviceEventListener {
-    /**
-     * Called when the device is about to be reset.
-     *
-     * One must release all native resources associated with the device which
-     * prevent the device from being reset (such as Default Pool resources for
-     * the D3D pipeline).
-     *
-     * It is safe to remove the listener while in the call back.
-     *
-     * Note: this method is called on the rendering thread,
-     * do not call into user code, do not take RQ lock!
-     */
-    public void onDeviceReset();
-
-    /**
-     * Called when the device is about to be disposed of.
-     *
-     * One must release all native resources associated with the device.
-     *
-     * It is safe to remove the listener while in the call back.
-     *
-     * Note: this method is called on the rendering thread,
-     * do not call into user code, do not take RQ lock!
-     */
-    public void onDeviceDispose();
-}
--- a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/hw/AccelDeviceEventNotifier.java	Fri Oct 07 21:28:20 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,169 +0,0 @@
-/*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.java2d.pipe.hw;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.lang.annotation.Native;
-
-
-/**
- * This class is used to notify listeners about accelerated device's
- * events such as device reset or dispose that are about to occur.
- */
-public class AccelDeviceEventNotifier {
-
-    private static AccelDeviceEventNotifier theInstance;
-
-    /**
-     * A device is about to be reset. The listeners have to release all
-     * resources associated with the device which are required for the device
-     * to be reset.
-     */
-    @Native public static final int DEVICE_RESET = 0;
-
-    /**
-     * A device is about to be disposed. The listeners have to release all
-     * resources associated with the device.
-     */
-    @Native public static final int DEVICE_DISPOSED = 1;
-
-    private final Map<AccelDeviceEventListener, Integer> listeners;
-
-    private AccelDeviceEventNotifier() {
-        listeners = Collections.synchronizedMap(
-            new HashMap<AccelDeviceEventListener, Integer>(1));
-    }
-
-    /**
-     * Returns a singleton of AccelDeviceEventNotifier if it exists. If the
-     * passed boolean is false and singleton doesn't exist yet, null is
-     * returned. If the passed boolean is {@code true} and singleton doesn't
-     * exist it will be created and returned.
-     *
-     * @param create whether to create a singleton instance if doesn't yet
-     * exist
-     * @return a singleton instance or null
-     */
-    private static synchronized
-        AccelDeviceEventNotifier getInstance(boolean create)
-    {
-        if (theInstance == null && create) {
-            theInstance = new AccelDeviceEventNotifier();
-        }
-        return theInstance;
-    }
-
-    /**
-     * Called to indicate that a device event had occurred.
-     * If a singleton exists, the listeners (those associated with
-     * the device) will be notified.
-     *
-     * @param screen a screen number of the device which is a source of
-     * the event
-     * @param eventType a type of the event
-     * @see #DEVICE_DISPOSED
-     * @see #DEVICE_RESET
-     */
-    public static final void eventOccured(int screen, int eventType) {
-        AccelDeviceEventNotifier notifier = getInstance(false);
-        if (notifier != null) {
-            notifier.notifyListeners(eventType, screen);
-        }
-    }
-
-    /**
-     * Adds the listener associated with a device on particular screen.
-     *
-     * Note: the listener must be removed as otherwise it will forever
-     * be referenced by the notifier.
-     *
-     * @param l the listener
-     * @param screen the screen number indicating which device the listener is
-     * interested in.
-     */
-    public static final void addListener(AccelDeviceEventListener l,int screen){
-        getInstance(true).add(l, screen);
-    }
-
-    /**
-     * Removes the listener.
-     *
-     * @param l the listener
-     */
-    public static final void removeListener(AccelDeviceEventListener l) {
-        getInstance(true).remove(l);
-    }
-
-    private final void add(AccelDeviceEventListener theListener, int screen) {
-        listeners.put(theListener, screen);
-    }
-    private final void remove(AccelDeviceEventListener theListener) {
-        listeners.remove(theListener);
-    }
-
-    /**
-     * Notifies the listeners associated with the screen's device about the
-     * event.
-     *
-     * Implementation note: the current list of listeners is first duplicated
-     * which allows the listeners to remove themselves during the iteration.
-     *
-     * @param screen a screen number with which the device which is a source of
-     * the event is associated with
-     * @param deviceEventType a type of the event
-     * @see #DEVICE_DISPOSED
-     * @see #DEVICE_RESET
-     */
-    private final void notifyListeners(int deviceEventType, int screen) {
-        HashMap<AccelDeviceEventListener, Integer> listClone;
-        Set<AccelDeviceEventListener> cloneSet;
-
-        synchronized(listeners) {
-            listClone =
-                new HashMap<AccelDeviceEventListener, Integer>(listeners);
-        }
-
-        cloneSet = listClone.keySet();
-        Iterator<AccelDeviceEventListener> itr = cloneSet.iterator();
-        while (itr.hasNext()) {
-            AccelDeviceEventListener current = itr.next();
-            Integer i = listClone.get(current);
-            // only notify listeners which are interested in this device
-            if (i != null && i.intValue() != screen) {
-                continue;
-            }
-            if (deviceEventType == DEVICE_RESET) {
-                current.onDeviceReset();
-            } else if (deviceEventType == DEVICE_DISPOSED) {
-                current.onDeviceDispose();
-            }
-        }
-    }
-}
--- a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/hw/AccelGraphicsConfig.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/hw/AccelGraphicsConfig.java	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -70,26 +70,4 @@
      * @see ContextCapabilities
      */
     public ContextCapabilities getContextCapabilities();
-
-    /**
-     * Adds an {@code AccelDeviceEventListener} to listen to accelerated
-     * device's (which is associated with this {@code AccelGraphicsConfig})
-     * events.
-     *
-     * Note: a hard link to the listener may be kept so it must be explicitly
-     * removed via {@link #removeDeviceEventListener}.
-     *
-     * @param l the listener
-     * @see AccelDeviceEventListener
-     */
-    public void addDeviceEventListener(AccelDeviceEventListener l);
-
-    /**
-     * Removes an {@code AccelDeviceEventListener} from the list of listeners
-     * for this device's events.
-     *
-     * @param l the listener
-     * @see AccelDeviceEventListener
-     */
-    public void removeDeviceEventListener(AccelDeviceEventListener l);
 }
--- a/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java	Wed Jul 05 22:19:13 2017 +0200
@@ -1282,12 +1282,6 @@
         JobSheets jobSheets = (JobSheets)attributes.get(JobSheets.class);
         if (jobSheets != null) {
             noJobSheet = jobSheets == JobSheets.NONE;
-        } else {
-            JobSheets js = (JobSheets)getPrintService().
-                                      getDefaultAttributeValue(JobSheets.class);
-            if (js != null && js.equals(JobSheets.NONE)) {
-                noJobSheet = true;
-            }
         }
 
         JobName jobName = (JobName)attributes.get(JobName.class);
@@ -1487,6 +1481,22 @@
             throw new PrinterException("Printer is not accepting job.");
         }
 
+        /*
+         * Check the default job-sheet value on underlying platform. If IPP
+         * reports job-sheets=none, then honour that and modify noJobSheet since
+         * by default, noJobSheet is false which mean jdk will print banner page.
+         * This is because if "attributes" is null (if user directly calls print()
+         * without specifying any attributes and without showing printdialog) then
+         * setAttribute will return without changing noJobSheet value.
+         * Also, we do this before setAttributes() call so as to allow the user
+         * to override this via explicitly adding JobSheets attributes to
+         * PrintRequestAttributeSet while calling print(attributes)
+         */
+        JobSheets js = (JobSheets)psvc.getDefaultAttributeValue(JobSheets.class);
+        if (js != null && js.equals(JobSheets.NONE)) {
+            noJobSheet = true;
+        }
+
         if ((psvc instanceof SunPrinterJobService) &&
             ((SunPrinterJobService)psvc).usesClass(getClass())) {
             setAttributes(attributes);
--- a/jdk/src/java.desktop/share/classes/sun/swing/CachedPainter.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/swing/CachedPainter.java	Wed Jul 05 22:19:13 2017 +0200
@@ -25,7 +25,6 @@
 package sun.swing;
 
 import java.awt.*;
-import java.awt.geom.AffineTransform;
 import java.awt.image.*;
 import java.util.*;
 
@@ -60,7 +59,11 @@
         synchronized(CachedPainter.class) {
             ImageCache cache = cacheMap.get(key);
             if (cache == null) {
-                cache = new ImageCache(1);
+                if (key == PainterMultiResolutionCachedImage.class) {
+                    cache = new ImageCache(32);
+                } else {
+                    cache = new ImageCache(1);
+                }
                 cacheMap.put(key, cache);
             }
             return cache;
@@ -271,7 +274,8 @@
         public Image getResolutionVariant(double destWidth, double destHeight) {
             int w = (int) Math.ceil(destWidth);
             int h = (int) Math.ceil(destHeight);
-            return getImage(this, c, baseWidth, baseHeight, w, h, args);
+            return getImage(PainterMultiResolutionCachedImage.class,
+                    c, baseWidth, baseHeight, w, h, args);
         }
 
         @Override
--- a/jdk/src/java.desktop/share/classes/sun/swing/SwingUtilities2.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/swing/SwingUtilities2.java	Wed Jul 05 22:19:13 2017 +0200
@@ -31,6 +31,8 @@
 import java.awt.event.*;
 import java.awt.font.*;
 import java.awt.geom.AffineTransform;
+import static java.awt.geom.AffineTransform.TYPE_FLIP;
+import static java.awt.geom.AffineTransform.TYPE_TRANSLATION;
 import java.awt.print.PrinterGraphics;
 import java.text.BreakIterator;
 import java.text.CharacterIterator;
@@ -2036,6 +2038,33 @@
         return path;
     }
 
+    public static boolean isScaledGraphics(Graphics g) {
+        if (g instanceof Graphics2D) {
+            AffineTransform tx = ((Graphics2D) g).getTransform();
+            return (tx.getType() & ~(TYPE_TRANSLATION | TYPE_FLIP)) != 0;
+        }
+        return false;
+    }
+
+    /**
+     * Returns the client property for the given key if it is set; otherwise
+     * returns the {@L&F} property.
+     *
+     * @param component the component
+     * @param key an {@code String} specifying the key for the desired boolean value
+     * @return the boolean value of the client property if it is set or the {@L&F}
+     *         property in other case.
+     */
+    public static boolean getBoolean(JComponent component, String key) {
+        Object clientProperty = component.getClientProperty(key);
+
+        if (clientProperty instanceof Boolean) {
+            return Boolean.TRUE.equals(clientProperty);
+        }
+
+        return UIManager.getBoolean(key);
+    }
+
     /**
      * Used to listen to "blit" repaints in RepaintManager.
      */
--- a/jdk/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -553,30 +553,43 @@
 METHODDEF(void)
 sun_jpeg_output_message (j_common_ptr cinfo)
 {
-  char buffer[JMSG_LENGTH_MAX];
-  jstring string;
-  imageIODataPtr data = (imageIODataPtr) cinfo->client_data;
-  JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
-  jobject theObject;
-
-  /* Create the message */
-  (*cinfo->err->format_message) (cinfo, buffer);
-
-  // Create a new java string from the message
-  string = (*env)->NewStringUTF(env, buffer);
-  CHECK_NULL(string);
-
-  theObject = data->imageIOobj;
-
-  if (cinfo->is_decompressor) {
-      (*env)->CallVoidMethod(env, theObject,
-                             JPEGImageReader_warningWithMessageID,
-                             string);
-  } else {
-      (*env)->CallVoidMethod(env, theObject,
-                             JPEGImageWriter_warningWithMessageID,
-                             string);
-  }
+    char buffer[JMSG_LENGTH_MAX];
+    jstring string;
+    imageIODataPtr data = (imageIODataPtr) cinfo->client_data;
+    JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
+    jobject theObject;
+
+    /* Create the message */
+    (*cinfo->err->format_message) (cinfo, buffer);
+
+    // Create a new java string from the message
+    string = (*env)->NewStringUTF(env, buffer);
+    CHECK_NULL(string);
+
+    theObject = data->imageIOobj;
+
+    if (cinfo->is_decompressor) {
+        struct jpeg_source_mgr *src = ((j_decompress_ptr)cinfo)->src;
+        RELEASE_ARRAYS(env, data, src->next_input_byte);
+        (*env)->CallVoidMethod(env, theObject,
+            JPEGImageReader_warningWithMessageID,
+            string);
+        if ((*env)->ExceptionOccurred(env)
+            || !GET_ARRAYS(env, data, &(src->next_input_byte))) {
+            cinfo->err->error_exit(cinfo);
+        }
+    } else {
+        struct jpeg_destination_mgr *dest = ((j_compress_ptr)cinfo)->dest;
+        RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte));
+        (*env)->CallVoidMethod(env, theObject,
+            JPEGImageWriter_warningWithMessageID,
+            string);
+        if ((*env)->ExceptionOccurred(env)
+            || !GET_ARRAYS(env, data,
+            (const JOCTET **)(&dest->next_output_byte))) {
+            cinfo->err->error_exit(cinfo);
+        }
+    }
 }
 
 /* End of verbatim copy from jpegdecoder.c */
@@ -1043,6 +1056,7 @@
         if (!GET_ARRAYS(env, data, &(src->next_input_byte))) {
             cinfo->err->error_exit((j_common_ptr) cinfo);
         }
+        RELEASE_ARRAYS(env, data, src->next_input_byte);
         return;
     }
 
@@ -1798,9 +1812,14 @@
                                cinfo->out_color_space,
                                cinfo->num_components,
                                profileData);
+        if ((*env)->ExceptionOccurred(env)
+            || !GET_ARRAYS(env, data, &(src->next_input_byte))) {
+            cinfo->err->error_exit((j_common_ptr) cinfo);
+        }
         if (reset) {
             jpeg_abort_decompress(cinfo);
         }
+        RELEASE_ARRAYS(env, data, src->next_input_byte);
     }
 
     return retval;
@@ -2010,6 +2029,7 @@
     jpeg_start_decompress(cinfo);
 
     if (numBands !=  cinfo->output_components) {
+        RELEASE_ARRAYS(env, data, src->next_input_byte);
         JNU_ThrowByName(env, "javax/imageio/IIOException",
                         "Invalid argument to native readImage");
         return data->abortFlag;
@@ -2018,6 +2038,7 @@
     if (cinfo->output_components <= 0 ||
         cinfo->image_width > (0xffffffffu / (unsigned int)cinfo->output_components))
     {
+        RELEASE_ARRAYS(env, data, src->next_input_byte);
         JNU_ThrowByName(env, "javax/imageio/IIOException",
                         "Invalid number of output components");
         return data->abortFlag;
@@ -2041,15 +2062,24 @@
             // the first interesting pass.
             jpeg_start_output(cinfo, cinfo->input_scan_number);
             if (wantUpdates) {
+                RELEASE_ARRAYS(env, data, src->next_input_byte);
                 (*env)->CallVoidMethod(env, this,
                                        JPEGImageReader_passStartedID,
                                        cinfo->input_scan_number-1);
+                if ((*env)->ExceptionOccurred(env)
+                    || !GET_ARRAYS(env, data, &(src->next_input_byte))) {
+                    cinfo->err->error_exit((j_common_ptr) cinfo);
+                }
             }
         } else if (wantUpdates) {
+            RELEASE_ARRAYS(env, data, src->next_input_byte);
             (*env)->CallVoidMethod(env, this,
                                    JPEGImageReader_passStartedID,
                                    0);
-
+            if ((*env)->ExceptionOccurred(env)
+                || !GET_ARRAYS(env, data, &(src->next_input_byte))) {
+                cinfo->err->error_exit((j_common_ptr) cinfo);
+            }
         }
 
         // Skip until the first interesting line
@@ -2137,8 +2167,13 @@
             done = TRUE;
         }
         if (wantUpdates) {
+            RELEASE_ARRAYS(env, data, src->next_input_byte);
             (*env)->CallVoidMethod(env, this,
                                    JPEGImageReader_passCompleteID);
+            if ((*env)->ExceptionOccurred(env)
+                || !GET_ARRAYS(env, data, &(src->next_input_byte))) {
+                cinfo->err->error_exit((j_common_ptr) cinfo);
+            }
         }
 
     }
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java	Wed Jul 05 22:19:13 2017 +0200
@@ -308,6 +308,19 @@
         super.handlePropertyNotify(xev);
 
         XPropertyEvent ev = xev.get_xproperty();
+        if( !insets_corrected && isReparented() &&
+                                         XWM.getWMID() == XWM.UNITY_COMPIZ_WM) {
+            int state = XWM.getWM().getState(this);
+            if ((state & Frame.MAXIMIZED_BOTH) ==  Frame.MAXIMIZED_BOTH) {
+                // Stop ignoring ConfigureNotify because no extents will be sent
+                // by WM for initially maximized decorated window.
+                // Re-request window bounds to ensure actual dimensions and
+                // notify the target with the initial size.
+                insets_corrected = true;
+                XlibWrapper.XConfigureWindow(XToolkit.getDisplay(),
+                                                             getWindow(), 0, 0);
+            }
+        }
         if (ev.get_atom() == XWM.XA_KDE_NET_WM_FRAME_STRUT.getAtom()
             || ev.get_atom() == XWM.XA_NET_FRAME_EXTENTS.getAtom())
         {
@@ -326,9 +339,29 @@
                     lastKnownInsets.put(getClass(), in);
                 }
                 if (!in.equals(dimensions.getInsets())) {
-                    handleCorrectInsets(in);
+                    if (insets_corrected || isMaximized()) {
+                        currentInsets = in;
+                        insets_corrected = true;
+                        // insets were changed by WM. To handle this situation
+                        // re-request window bounds because the current
+                        // dimensions may be not actual as well.
+                        XlibWrapper.XConfigureWindow(XToolkit.getDisplay(),
+                                                             getWindow(), 0, 0);
+                    } else {
+                        // recalculate dimensions when window is just created
+                        // and the initially guessed insets were wrong
+                        handleCorrectInsets(in);
+                    }
+                } else if (!dimensions.isClientSizeSet()) {
+                    insets_corrected = true;
+                    // initial insets were guessed correctly. Re-request
+                    // frame bounds because they may be changed by WM if the
+                    // initial window position overlapped desktop's toolbars.
+                    // This should initiate the final ConfigureNotify upon which
+                    // the target will be notified with the final size.
+                    XlibWrapper.XConfigureWindow(XToolkit.getDisplay(),
+                                                             getWindow(), 0, 0);
                 }
-                insets_corrected = true;
             }
         }
     }
@@ -374,6 +407,9 @@
             } else { /* reparented to WM frame, figure out our insets */
                 setReparented(true);
                 insets_corrected = false;
+                if (XWM.getWMID() == XWM.UNITY_COMPIZ_WM) {
+                    return;
+                }
 
                 // Check if we have insets provided by the WM
                 Insets correctWM = getWMSetInsets(null);
@@ -405,7 +441,7 @@
                     }
                 }
 
-                if (correctWM != null && XWM.getWMID() != XWM.UNITY_COMPIZ_WM) {
+                if (correctWM != null) {
                     handleCorrectInsets(correctWM);
                 }
             }
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XRobotPeer.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XRobotPeer.java	Wed Jul 05 22:19:13 2017 +0200
@@ -26,6 +26,8 @@
 
 import java.awt.*;
 import java.awt.peer.*;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 
 import sun.awt.AWTAccessor;
 import sun.awt.SunToolkit;
@@ -38,7 +40,8 @@
     static final boolean tryGtk;
     static {
         loadNativeLibraries();
-        tryGtk = Boolean.getBoolean("awt.robot.gtk");
+        tryGtk = AccessController.doPrivileged((PrivilegedAction<Boolean>)()
+                -> Boolean.getBoolean("awt.robot.gtk"));
     }
 
     private static boolean isGtkSupported =  false;
--- a/jdk/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +27,6 @@
 
 import java.awt.AWTException;
 import java.awt.BufferCapabilities;
-import java.awt.BufferCapabilities.FlipContents;
 import java.awt.Color;
 import java.awt.Component;
 import java.awt.Graphics;
@@ -59,8 +58,6 @@
 import static sun.java2d.opengl.OGLContext.*;
 import static sun.java2d.opengl.OGLContext.OGLContextCaps.*;
 import sun.java2d.opengl.GLXSurfaceData.GLXVSyncOffScreenSurfaceData;
-import sun.java2d.pipe.hw.AccelDeviceEventListener;
-import sun.java2d.pipe.hw.AccelDeviceEventNotifier;
 
 public class GLXGraphicsConfig
     extends X11GraphicsConfig
@@ -426,14 +423,4 @@
     public ContextCapabilities getContextCapabilities() {
         return oglCaps;
     }
-
-    @Override
-    public void addDeviceEventListener(AccelDeviceEventListener l) {
-        AccelDeviceEventNotifier.addListener(l, screen.getScreen());
-    }
-
-    @Override
-    public void removeDeviceEventListener(AccelDeviceEventListener l) {
-        AccelDeviceEventNotifier.removeListener(l);
-    }
 }
--- a/jdk/src/java.desktop/unix/classes/sun/java2d/xr/XRPaints.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/unix/classes/sun/java2d/xr/XRPaints.java	Wed Jul 05 22:19:13 2017 +0200
@@ -95,15 +95,15 @@
         private XRGradient() {
         }
 
-        /**
-         * There are no restrictions for accelerating GradientPaint, so this
-         * method always returns true.
-         */
         @Override
         boolean isPaintValid(SunGraphics2D sg2d) {
-            return true;
+            GradientPaint paint = (GradientPaint) sg2d.paint;
+
+            return XRUtils.isPointCoordInShortRange(paint.getPoint1())
+                    && XRUtils.isPointCoordInShortRange(paint.getPoint2());
         }
 
+        @Override
         void setXRPaint(SunGraphics2D sg2d, Paint pt) {
             GradientPaint paint = (GradientPaint) pt;
 
@@ -130,24 +130,27 @@
 
         @Override
         boolean isPaintValid(SunGraphics2D sg2d) {
-            return ((LinearGradientPaint) sg2d.getPaint()).getColorSpace() == ColorSpaceType.SRGB;
+            LinearGradientPaint paint = (LinearGradientPaint) sg2d.getPaint();
+
+            return paint.getColorSpace() == ColorSpaceType.SRGB
+                    && XRUtils.isPointCoordInShortRange(paint.getStartPoint())
+                    && XRUtils.isPointCoordInShortRange(paint.getEndPoint())
+                    && paint.getTransform().getDeterminant() != 0.0;
         }
 
         @Override
         void setXRPaint(SunGraphics2D sg2d, Paint pt) {
             LinearGradientPaint paint = (LinearGradientPaint) pt;
-
             Color[] colors = paint.getColors();
             Point2D pt1 = paint.getStartPoint();
             Point2D pt2 = paint.getEndPoint();
-
             int repeat = XRUtils.getRepeatForCycleMethod(paint.getCycleMethod());
             float[] fractions = paint.getFractions();
             int[] pixels = convertToIntArgbPixels(colors);
+            AffineTransform at = paint.getTransform();
 
-            AffineTransform at = paint.getTransform();
             try {
-                at.invert();
+               at.invert();
             } catch (NoninvertibleTransformException ex) {
                 ex.printStackTrace();
             }
@@ -165,8 +168,12 @@
         @Override
         boolean isPaintValid(SunGraphics2D sg2d) {
             RadialGradientPaint grad = (RadialGradientPaint) sg2d.paint;
-            return grad.getFocusPoint().equals(grad.getCenterPoint())
-                   && grad.getColorSpace() == ColorSpaceType.SRGB;
+
+            return grad.getColorSpace() == ColorSpaceType.SRGB
+                   && grad.getFocusPoint().equals(grad.getCenterPoint())
+                   && XRUtils.isPointCoordInShortRange(grad.getCenterPoint())
+                   && grad.getRadius() <= Short.MAX_VALUE
+                   && grad.getTransform().getDeterminant() != 0.0;
         }
 
         @Override
@@ -174,18 +181,17 @@
             RadialGradientPaint paint = (RadialGradientPaint) pt;
             Color[] colors = paint.getColors();
             Point2D center = paint.getCenterPoint();
+            float cx = (float) center.getX();
+            float cy = (float) center.getY();
 
+            AffineTransform at = paint.getTransform();
             int repeat = XRUtils.getRepeatForCycleMethod(paint.getCycleMethod());
             float[] fractions = paint.getFractions();
             int[] pixels = convertToIntArgbPixels(colors);
             float radius = paint.getRadius();
 
-            float cx = (float) center.getX();
-            float cy = (float) center.getY();
-
-            AffineTransform at = paint.getTransform();
             try {
-                at.invert();
+               at.invert();
             } catch (NoninvertibleTransformException ex) {
                 ex.printStackTrace();
             }
--- a/jdk/src/java.desktop/unix/classes/sun/java2d/xr/XRUtils.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/unix/classes/sun/java2d/xr/XRUtils.java	Wed Jul 05 22:19:13 2017 +0200
@@ -26,6 +26,7 @@
 package sun.java2d.xr;
 
 import java.awt.*;
+import java.awt.geom.Point2D;
 import java.awt.MultipleGradientPaint.*;
 import java.awt.geom.AffineTransform;
 import java.awt.image.*;
@@ -260,6 +261,15 @@
         return (x > 65535 ? 65535 : (x < 0) ? 0 : x);
     }
 
+    public static boolean isDoubleInShortRange(double dbl) {
+         return dbl <= Short.MAX_VALUE && dbl >= Short.MIN_VALUE;
+    }
+
+    public static boolean isPointCoordInShortRange(Point2D p) {
+        return isDoubleInShortRange(p.getX()) && isDoubleInShortRange(p.getY());
+    }
+
+
     public static boolean isTransformQuadrantRotated(AffineTransform tr) {
         return ((tr.getType() & (AffineTransform.TYPE_GENERAL_ROTATION |
                  AffineTransform.TYPE_GENERAL_TRANSFORM)) == 0);
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WTrayIconPeer.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WTrayIconPeer.java	Wed Jul 05 22:19:13 2017 +0200
@@ -28,16 +28,19 @@
 import java.awt.Graphics2D;
 import java.awt.AWTEvent;
 import java.awt.Frame;
+import java.awt.GraphicsEnvironment;
 import java.awt.PopupMenu;
 import java.awt.Point;
 import java.awt.TrayIcon;
 import java.awt.Image;
+import java.awt.geom.AffineTransform;
 import java.awt.peer.TrayIconPeer;
 import java.awt.image.*;
 
 import sun.awt.AWTAccessor;
 import sun.awt.SunToolkit;
 import sun.awt.image.IntegerComponentRaster;
+import sun.java2d.pipe.Region;
 
 final class WTrayIconPeer extends WObjectPeer implements TrayIconPeer {
     static final int TRAY_ICON_WIDTH = 16;
@@ -123,16 +126,22 @@
             return;
 
         boolean autosize = ((TrayIcon)target).isImageAutoSize();
-
-        BufferedImage bufImage = new BufferedImage(TRAY_ICON_WIDTH, TRAY_ICON_HEIGHT,
-                                                   BufferedImage.TYPE_INT_ARGB);
+        AffineTransform tx = GraphicsEnvironment.getLocalGraphicsEnvironment().
+                getDefaultScreenDevice().getDefaultConfiguration().
+                getDefaultTransform();
+        int w = Region.clipScale(TRAY_ICON_WIDTH, tx.getScaleX());
+        int h = Region.clipScale(TRAY_ICON_HEIGHT, tx.getScaleY());
+        int imgWidth = Region.clipScale(image.getWidth(observer), tx.getScaleX());
+        int imgHeight = Region.clipScale(image.getHeight(observer), tx.getScaleY());
+        BufferedImage bufImage = new BufferedImage(w,
+                h, BufferedImage.TYPE_INT_ARGB);
         Graphics2D gr = bufImage.createGraphics();
         if (gr != null) {
             try {
                 gr.setPaintMode();
 
-                gr.drawImage(image, 0, 0, (autosize ? TRAY_ICON_WIDTH : image.getWidth(observer)),
-                             (autosize ? TRAY_ICON_HEIGHT : image.getHeight(observer)), observer);
+                gr.drawImage(image, 0, 0, (autosize ? w : imgWidth),
+                             (autosize ? h : imgHeight), observer);
 
                 createNativeImage(bufImage);
 
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WWindowPeer.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WWindowPeer.java	Wed Jul 05 22:19:13 2017 +0200
@@ -34,7 +34,7 @@
 import java.util.*;
 import java.util.List;
 import sun.util.logging.PlatformLogger;
-
+import java.awt.geom.AffineTransform;
 import sun.awt.*;
 
 import sun.java2d.pipe.Region;
@@ -391,6 +391,11 @@
             int h = getSysIconHeight();
             int smw = getSysSmIconWidth();
             int smh = getSysSmIconHeight();
+            AffineTransform tx = getGraphicsConfiguration().getDefaultTransform();
+            w = Region.clipScale(w, tx.getScaleX());
+            h = Region.clipScale(h, tx.getScaleY());
+            smw = Region.clipScale(smw, tx.getScaleX());
+            smh = Region.clipScale(smh, tx.getScaleY());
             DataBufferInt iconData = SunToolkit.getScaledIconData(imageList,
                                                                   w, h);
             DataBufferInt iconSmData = SunToolkit.getScaledIconData(imageList,
--- a/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsConfig.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsConfig.java	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +27,6 @@
 
 import java.awt.AWTException;
 import java.awt.BufferCapabilities;
-import java.awt.BufferCapabilities.FlipContents;
 import java.awt.Component;
 import java.awt.Graphics;
 import java.awt.ImageCapabilities;
@@ -43,14 +42,12 @@
 import sun.awt.windows.WComponentPeer;
 import sun.java2d.Surface;
 import sun.java2d.SurfaceData;
-import sun.java2d.pipe.hw.AccelDeviceEventNotifier;
 import sun.java2d.pipe.hw.AccelTypedVolatileImage;
 import sun.java2d.pipe.hw.AccelGraphicsConfig;
 import sun.java2d.pipe.hw.AccelSurface;
 import sun.java2d.pipe.hw.ContextCapabilities;
 import static sun.java2d.pipe.hw.AccelSurface.*;
 import static sun.java2d.d3d.D3DContext.D3DContextCaps.*;
-import sun.java2d.pipe.hw.AccelDeviceEventListener;
 
 public class D3DGraphicsConfig
     extends Win32GraphicsConfig
@@ -315,14 +312,4 @@
     public ContextCapabilities getContextCapabilities() {
         return device.getContextCapabilities();
     }
-
-    @Override
-    public void addDeviceEventListener(AccelDeviceEventListener l) {
-        AccelDeviceEventNotifier.addListener(l, device.getScreen());
-    }
-
-    @Override
-    public void removeDeviceEventListener(AccelDeviceEventListener l) {
-        AccelDeviceEventNotifier.removeListener(l);
-    }
 }
--- a/jdk/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,8 +54,6 @@
 import static sun.java2d.opengl.OGLContext.OGLContextCaps.*;
 import static sun.java2d.opengl.WGLSurfaceData.*;
 import sun.java2d.opengl.OGLContext.OGLContextCaps;
-import sun.java2d.pipe.hw.AccelDeviceEventListener;
-import sun.java2d.pipe.hw.AccelDeviceEventNotifier;
 import sun.java2d.windows.GDIWindowSurfaceData;
 
 public class WGLGraphicsConfig
@@ -92,8 +90,7 @@
         // add a record to the Disposer so that we destroy the native
         // WGLGraphicsConfigInfo data when this object goes away
         Disposer.addRecord(disposerReferent,
-                           new WGLGCDisposerRecord(pConfigInfo,
-                                                   device.getScreen()));
+                           new WGLGCDisposerRecord(pConfigInfo));
     }
 
     public Object getProxyKey() {
@@ -198,27 +195,10 @@
 
     private static class WGLGCDisposerRecord implements DisposerRecord {
         private long pCfgInfo;
-        private int screen;
-        public WGLGCDisposerRecord(long pCfgInfo, int screen) {
+        public WGLGCDisposerRecord(long pCfgInfo) {
             this.pCfgInfo = pCfgInfo;
         }
         public void dispose() {
-            OGLRenderQueue rq = OGLRenderQueue.getInstance();
-            rq.lock();
-            try {
-                rq.flushAndInvokeNow(new Runnable() {
-                    public void run() {
-                        AccelDeviceEventNotifier.
-                            eventOccured(screen,
-                                AccelDeviceEventNotifier.DEVICE_RESET);
-                        AccelDeviceEventNotifier.
-                            eventOccured(screen,
-                                AccelDeviceEventNotifier.DEVICE_DISPOSED);
-                    }
-                });
-            } finally {
-                rq.unlock();
-            }
             if (pCfgInfo != 0) {
                 OGLRenderQueue.disposeGraphicsConfig(pCfgInfo);
                 pCfgInfo = 0;
@@ -455,14 +435,4 @@
     public ContextCapabilities getContextCapabilities() {
         return oglCaps;
     }
-
-    @Override
-    public void addDeviceEventListener(AccelDeviceEventListener l) {
-        AccelDeviceEventNotifier.addListener(l, screen.getScreen());
-    }
-
-    @Override
-    public void removeDeviceEventListener(AccelDeviceEventListener l) {
-        AccelDeviceEventNotifier.removeListener(l);
-    }
 }
--- a/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DContext.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DContext.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -253,9 +253,6 @@
 
     EndScene();
 
-    D3DPipelineManager::NotifyAdapterEventListeners(devCaps.AdapterOrdinal,
-                                                    DEVICE_RESET);
-
     contextCaps = CAPS_EMPTY;
 
     SAFE_RELEASE(pSyncQuery);
@@ -292,9 +289,6 @@
 
     ReleaseDefPoolResources();
 
-    D3DPipelineManager::NotifyAdapterEventListeners(devCaps.AdapterOrdinal,
-                                                    DEVICE_DISPOSED);
-
     // dispose shader lists
     ShaderList_Dispose(&convolvePrograms);
     ShaderList_Dispose(&rescalePrograms);
--- a/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DContext.h	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DContext.h	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,6 @@
 #include "sun_java2d_pipe_BufferedContext.h"
 #include "sun_java2d_d3d_D3DContext_D3DContextCaps.h"
 #include "sun_java2d_d3d_D3DSurfaceData.h"
-#include "sun_java2d_pipe_hw_AccelDeviceEventNotifier.h"
 
 #include "ShaderList.h"
 #include "D3DPipeline.h"
@@ -413,9 +412,4 @@
 #define CAPS_PS30           \
     sun_java2d_d3d_D3DContext_D3DContextCaps_CAPS_PS30
 
-#define DEVICE_RESET    \
-    sun_java2d_pipe_hw_AccelDeviceEventNotifier_DEVICE_RESET
-#define DEVICE_DISPOSED \
-    sun_java2d_pipe_hw_AccelDeviceEventNotifier_DEVICE_DISPOSED
-
 #endif // D3DCONTEXT_H
--- a/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPipelineManager.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPipelineManager.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -173,41 +173,6 @@
     return S_OK;
 }
 
-// static
-void D3DPipelineManager::NotifyAdapterEventListeners(UINT adapter,
-                                                     jint eventType)
-{
-    HMONITOR hMon;
-    int gdiScreen;
-    D3DPipelineManager *pMgr;
-
-    // fix for 6946559: if d3d preloading fails jmv may be NULL
-    if (jvm == NULL) {
-        return;
-    }
-
-    JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
-    RETURN_IF_NULL(env);
-
-    pMgr = D3DPipelineManager::GetInstance();
-    RETURN_IF_NULL(pMgr);
-    hMon = pMgr->pd3d9->GetAdapterMonitor(adapter);
-
-    /*
-     * If we don't have devices initialized yet, no sense to clear them.
-     */
-    if (!Devices::GetInstance()){
-         return;
-    }
-
-    gdiScreen = AwtWin32GraphicsDevice::GetScreenFromHMONITOR(hMon);
-
-    JNU_CallStaticMethodByName(env, NULL,
-        "sun/java2d/pipe/hw/AccelDeviceEventNotifier",
-        "eventOccured", "(II)V",
-        gdiScreen, eventType);
-}
-
 UINT D3DPipelineManager::GetAdapterOrdinalForScreen(jint gdiScreen)
 {
     HMONITOR mHnd = AwtWin32GraphicsDevice::GetMonitor(gdiScreen);
--- a/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPipelineManager.h	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPipelineManager.h	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -78,11 +78,6 @@
     // these may differ depending on which display is primary
     UINT GetAdapterOrdinalForScreen(jint gdiScreen);
 
-    // notifies adapter event listeners by calling
-    // AccelDeviceEventNotifier.eventOccured()
-    static
-    void NotifyAdapterEventListeners(UINT adapter, jint eventType);
-
 private:
     D3DPipelineManager(void);
    ~D3DPipelineManager(void);
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_DnDDS.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_DnDDS.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -266,11 +266,14 @@
 
     dragSource->Signal();
 
+    AwtToolkit &toolkit = AwtToolkit::GetInstance();
+    toolkit.isInDoDragDropLoop = TRUE;
     res = ::DoDragDrop(dragSource,
                        dragSource,
                        convertActionsToDROPEFFECT(dragSource->m_actions),
                        &effects
           );
+    toolkit.isInDoDragDropLoop = FALSE;
 
     if (effects == DROPEFFECT_NONE && dragSource->m_dwPerformedDropEffect != DROPEFFECT_NONE) {
         effects = dragSource->m_dwPerformedDropEffect;
@@ -626,6 +629,7 @@
  */
 
 HRESULT __stdcall  AwtDragSource::QueryContinueDrag(BOOL fEscapeKeyPressed, DWORD grfKeyState) {
+    AwtToolkit::GetInstance().eventNumber++;
     TRY;
 
     JNIEnv* env       = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
@@ -681,6 +685,7 @@
  */
 
 HRESULT __stdcall  AwtDragSource::GiveFeedback(DWORD dwEffect) {
+    AwtToolkit::GetInstance().eventNumber++;
     TRY;
 
     JNIEnv* env       = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
@@ -760,6 +765,7 @@
 
 HRESULT __stdcall AwtDragSource::GetData(FORMATETC __RPC_FAR *pFormatEtc,
                                          STGMEDIUM __RPC_FAR *pmedium) {
+    AwtToolkit::GetInstance().eventNumber++;
     TRY;
     STGMEDIUM *pPicMedia = PictureDragHelper::FindData(*pFormatEtc);
     if (NULL != pPicMedia) {
@@ -934,6 +940,7 @@
 
 HRESULT __stdcall AwtDragSource::GetDataHere(FORMATETC __RPC_FAR *pFormatEtc,
                                              STGMEDIUM __RPC_FAR *pmedium) {
+    AwtToolkit::GetInstance().eventNumber++;
     TRY;
 
     if (pmedium->pUnkForRelease != (IUnknown *)NULL) {
@@ -1036,6 +1043,7 @@
  */
 
 HRESULT __stdcall  AwtDragSource::QueryGetData(FORMATETC __RPC_FAR *pFormatEtc) {
+    AwtToolkit::GetInstance().eventNumber++;
     TRY;
 
     return MatchFormatEtc(pFormatEtc, (FORMATETC *)NULL);
@@ -1049,6 +1057,7 @@
  */
 
 HRESULT __stdcall  AwtDragSource::GetCanonicalFormatEtc(FORMATETC __RPC_FAR *pFormatEtcIn, FORMATETC __RPC_FAR *pFormatEtcOut) {
+    AwtToolkit::GetInstance().eventNumber++;
     TRY;
 
     HRESULT   res = MatchFormatEtc(pFormatEtcIn, (FORMATETC *)NULL);
@@ -1069,6 +1078,7 @@
  */
 
 HRESULT __stdcall AwtDragSource::SetData(FORMATETC __RPC_FAR *pFormatEtc, STGMEDIUM __RPC_FAR *pmedium, BOOL fRelease) {
+    AwtToolkit::GetInstance().eventNumber++;
     if (pFormatEtc->cfFormat == CF_PERFORMEDDROPEFFECT && pmedium->tymed == TYMED_HGLOBAL) {
         m_dwPerformedDropEffect = *(DWORD*)::GlobalLock(pmedium->hGlobal);
         ::GlobalUnlock(pmedium->hGlobal);
@@ -1091,6 +1101,7 @@
  */
 
 HRESULT __stdcall  AwtDragSource::EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC *__RPC_FAR *ppenumFormatEtc) {
+    AwtToolkit::GetInstance().eventNumber++;
     TRY;
 
     *ppenumFormatEtc = new ADSIEnumFormatEtc(this);
@@ -1104,6 +1115,7 @@
  */
 
 HRESULT __stdcall  AwtDragSource::DAdvise(FORMATETC __RPC_FAR *pFormatEtc, DWORD advf, IAdviseSink __RPC_FAR *pAdvSink, DWORD __RPC_FAR *pdwConnection) {
+    AwtToolkit::GetInstance().eventNumber++;
     return E_NOTIMPL;
 }
 
@@ -1112,6 +1124,7 @@
  */
 
 HRESULT __stdcall  AwtDragSource::DUnadvise(DWORD dwConnection) {
+    AwtToolkit::GetInstance().eventNumber++;
     return OLE_E_ADVISENOTSUPPORTED;
 }
 
@@ -1120,6 +1133,7 @@
  */
 
 HRESULT __stdcall  AwtDragSource::EnumDAdvise(IEnumSTATDATA __RPC_FAR *__RPC_FAR *ppenumAdvise) {
+    AwtToolkit::GetInstance().eventNumber++;
     return OLE_E_ADVISENOTSUPPORTED;
 }
 
@@ -1127,7 +1141,7 @@
     ::RegisterClipboardFormat(TEXT("_SUNW_JAVA_AWT_PROCESS_ID"));
 
 HRESULT __stdcall AwtDragSource::GetProcessId(FORMATETC __RPC_FAR *pFormatEtc, STGMEDIUM __RPC_FAR *pmedium) {
-
+    AwtToolkit::GetInstance().eventNumber++;
     if ((pFormatEtc->tymed & TYMED_HGLOBAL) == 0) {
         return DV_E_TYMED;
     } else if (pFormatEtc->lindex != -1) {
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -334,6 +334,7 @@
     ::GetKeyboardState(m_lastKeyboardState);
 
     m_waitEvent = ::CreateEvent(NULL, FALSE, FALSE, NULL);
+    isInDoDragDropLoop = FALSE;
     eventNumber = 0;
 }
 
@@ -2752,7 +2753,12 @@
     AwtToolkit & tk = AwtToolkit::GetInstance();
     DWORD eventNumber = tk.eventNumber;
     tk.PostMessage(WM_SYNC_WAIT, 0, 0);
-    ::WaitForSingleObject(tk.m_waitEvent, INFINITE);
+    for(long t = 2; t < timeout &&
+               WAIT_TIMEOUT == ::WaitForSingleObject(tk.m_waitEvent, 2); t+=2) {
+        if (tk.isInDoDragDropLoop) {
+            break;
+        }
+    }
     DWORD newEventNumber = tk.eventNumber;
     return (newEventNumber - eventNumber) > 2;
 }
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.h	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.h	Wed Jul 05 22:19:13 2017 +0200
@@ -388,7 +388,8 @@
     static BOOL activateKeyboardLayout(HKL hkl);
 
     HANDLE m_waitEvent;
-    DWORD eventNumber;
+    volatile DWORD eventNumber;
+    volatile BOOL isInDoDragDropLoop;
 private:
     HWND CreateToolkitWnd(LPCTSTR name);
 
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Window.cpp	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Window.cpp	Wed Jul 05 22:19:13 2017 +0200
@@ -46,11 +46,16 @@
 #include "sun_awt_windows_WCanvasPeer.h"
 
 #include <windowsx.h>
-
+#include <math.h>
 #if !defined(__int3264)
 typedef __int32 LONG_PTR;
 #endif // __int3264
 
+#if defined(_MSC_VER) && _MSC_VER >= 1800
+#  define ROUND_TO_INT(num)    ((int) round(num))
+#else
+#  define ROUND_TO_INT(num)    ((int) floor((num) + 0.5))
+#endif
 // Used for Swing's Menu/Tooltip animation Support
 const int UNSPECIFIED = 0;
 const int TOOLTIP = 1;
@@ -3097,7 +3102,7 @@
 
     env->DeleteGlobalRef(self);
 }
-
+extern "C" int getSystemMetricValue(int msgType);
 extern "C" {
 
 /*
@@ -3407,7 +3412,7 @@
 {
     TRY;
 
-    return ::GetSystemMetrics(SM_CYICON);
+    return getSystemMetricValue(SM_CYICON);
 
     CATCH_BAD_ALLOC_RET(0);
 }
@@ -3422,7 +3427,7 @@
 {
     TRY;
 
-    return ::GetSystemMetrics(SM_CXICON);
+    return getSystemMetricValue(SM_CXICON);
 
     CATCH_BAD_ALLOC_RET(0);
 }
@@ -3437,7 +3442,7 @@
 {
     TRY;
 
-    return ::GetSystemMetrics(SM_CYSMICON);
+    return getSystemMetricValue(SM_CYSMICON);
 
     CATCH_BAD_ALLOC_RET(0);
 }
@@ -3452,11 +3457,44 @@
 {
     TRY;
 
-    return ::GetSystemMetrics(SM_CXSMICON);
+    return getSystemMetricValue(SM_CXSMICON);
 
     CATCH_BAD_ALLOC_RET(0);
 }
 
+int getSystemMetricValue(int msgType) {
+    int value = 1;
+    int logPixels = LOGPIXELSX;
+    switch (msgType) {
+        case SM_CXICON:
+            value = ::GetSystemMetrics(SM_CXICON);
+            break;
+        case SM_CYICON:
+            value = ::GetSystemMetrics(SM_CYICON);
+            logPixels = LOGPIXELSY;
+            break;
+        case SM_CXSMICON:
+            value = ::GetSystemMetrics(SM_CXSMICON);
+            break;
+        case SM_CYSMICON:
+            value = ::GetSystemMetrics(SM_CYSMICON);
+            logPixels = LOGPIXELSY;
+            break;
+    }
+    static int dpi = -1;
+    if (dpi == -1) {
+        HWND hWnd = ::GetDesktopWindow();
+        HDC hDC = ::GetDC(hWnd);
+        dpi = GetDeviceCaps(hDC, logPixels);
+        ::ReleaseDC(hWnd, hDC);
+    }
+    if(dpi != 0 && dpi != 96) {
+        float invScaleX = 96.0f / dpi;
+        value = (int) ROUND_TO_INT(value * invScaleX);
+    }
+    return value;
+}
+
 /*
  * Class:     sun_awt_windows_WWindowPeer
  * Method:    setIconImagesData
--- a/jdk/src/java.instrument/share/native/libinstrument/JPLISAgent.c	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/java.instrument/share/native/libinstrument/JPLISAgent.c	Wed Jul 05 22:19:13 2017 +0200
@@ -790,9 +790,10 @@
     pkg_name_buf[len] = '\0';
 
     err = (*jvmti)->GetNamedModule(jvmti, loaderObject, pkg_name_buf, &moduleObject);
+    free((void*)pkg_name_buf);
+    check_phase_ret_blob(err, NULL);
     jplis_assert_msg(err == JVMTI_ERROR_NONE, "error in the JVMTI GetNamedModule");
 
-    free((void*)pkg_name_buf);
     return moduleObject;
 }
 
--- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/invoker.c	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/invoker.c	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -343,6 +343,35 @@
     debugMonitorExit(invokerLock);
 }
 
+/*
+ * Check that method is in the specified clazz or one of its super classes.
+ * We have to enforce this check at the JDWP layer because the JNI layer
+ * has different requirements.
+ */
+static jvmtiError check_methodClass(JNIEnv *env, jclass clazz, jmethodID method)
+{
+    jclass containing_class = NULL;
+    jvmtiError error;
+
+    error = JVMTI_FUNC_PTR(gdata->jvmti,GetMethodDeclaringClass)
+                (gdata->jvmti, method, &containing_class);
+    if (error != JVMTI_ERROR_NONE) {
+        return JVMTI_ERROR_NONE;  /* Bad jmethodID ?  This will be handled elsewhere */
+    }
+
+    if (JNI_FUNC_PTR(env,IsSameObject)(env, clazz, containing_class)) {
+        return JVMTI_ERROR_NONE;
+    }
+
+    // If not the same class then check that containing_class is a superclass of
+    // clazz (not a superinterface).
+    if (JNI_FUNC_PTR(env,IsAssignableFrom)(env, clazz, containing_class) &&
+        referenceTypeTag(containing_class) != JDWP_TYPE_TAG(INTERFACE)) {
+        return JVMTI_ERROR_NONE;
+    }
+    return JVMTI_ERROR_INVALID_METHODID;
+}
+
 jvmtiError
 invoker_requestInvoke(jbyte invokeType, jbyte options, jint id,
                       jthread thread, jclass clazz, jmethodID method,
@@ -353,6 +382,13 @@
     InvokeRequest *request;
     jvmtiError error = JVMTI_ERROR_NONE;
 
+    if (invokeType == INVOKE_STATIC) {
+        error = check_methodClass(env, clazz, method);
+        if (error != JVMTI_ERROR_NONE) {
+            return error;
+        }
+    }
+
     debugMonitorEnter(invokerLock);
     request = threadControl_getInvokeRequest(thread);
     if (request != NULL) {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Archive.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Archive.java	Wed Jul 05 22:19:13 2017 +0200
@@ -55,6 +55,13 @@
         private final Archive archive;
         private final String path;
 
+        /**
+         * Constructs an entry of the given archive
+         * @param archive archive
+         * @param path
+         * @param name an entry name that does not contain the module name
+         * @param type
+         */
         public Entry(Archive archive, String path, String name, EntryType type) {
             this.archive = Objects.requireNonNull(archive);
             this.path = Objects.requireNonNull(path);
@@ -62,25 +69,29 @@
             this.type = Objects.requireNonNull(type);
         }
 
-        public Archive archive() {
+        public final Archive archive() {
             return archive;
         }
 
-        public String path() {
-            return path;
-        }
-
-        public EntryType type() {
+        public final EntryType type() {
             return type;
         }
 
-        /*
+        /**
          * Returns the name of this entry.
          */
-        public String name() {
+        public final String name() {
             return name;
         }
 
+        /**
+         * Returns the name representing a ResourcePoolEntry in the form of:
+         *    /$MODULE/$ENTRY_NAME
+         */
+        public final String getResourcePoolEntryName() {
+            return "/" + archive.moduleName() + "/" + name;
+        }
+
         @Override
         public String toString() {
             return "type " + type.name() + " path " + path;
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/DirArchive.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/DirArchive.java	Wed Jul 05 22:19:13 2017 +0200
@@ -50,7 +50,7 @@
 
         FileEntry(Path path, String name) {
             super(DirArchive.this, getPathName(path), name,
-                    Archive.Entry.EntryType.CLASS_OR_RESOURCE);
+                  Archive.Entry.EntryType.CLASS_OR_RESOURCE);
             this.path = path;
             try {
                 size = Files.size(path);
@@ -124,13 +124,7 @@
             return null;
         }
         String name = getPathName(p).substring(chop);
-        if (name.startsWith("_")) {
-            return null;
-        }
         log.accept(moduleName + "/" + name);
-        if (name.equals(MODULE_INFO)) {
-            name = moduleName + "/" + MODULE_INFO;
-        }
         return new FileEntry(p, name);
     }
 
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageFileCreator.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageFileCreator.java	Wed Jul 05 22:19:13 2017 +0200
@@ -40,6 +40,7 @@
 import java.util.Set;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
+
 import jdk.tools.jlink.internal.Archive.Entry;
 import jdk.tools.jlink.internal.Archive.Entry.EntryType;
 import jdk.tools.jlink.internal.ResourcePoolManager.CompressedModuleData;
@@ -122,10 +123,6 @@
         });
     }
 
-    public static boolean isClassPackage(String path) {
-        return path.endsWith(".class") && !path.endsWith("module-info.class");
-    }
-
     public static void recreateJimage(Path jimageFile,
             Set<Archive> archives,
             ImagePluginStack pluginSupport)
@@ -265,26 +262,13 @@
                 return writer.getString(id);
             }
         });
+
         for (Archive archive : archives) {
             String mn = archive.moduleName();
-            for (Entry entry : entriesForModule.get(mn)) {
-                String path;
-                if (entry.type() == EntryType.CLASS_OR_RESOURCE) {
-                    // Removal of "classes/" radical.
-                    path = entry.name();
-                    if (path.endsWith("module-info.class")) {
-                        path = "/" + path;
-                    } else {
-                        path = "/" + mn + "/" + path;
-                    }
-                } else {
-                    // Entry.path() contains the kind of file native, conf, bin, ...
-                    // Keep it to avoid naming conflict (eg: native/jvm.cfg and config/jvm.cfg
-                    path = "/" + mn + "/" + entry.path();
-                }
-
-                resources.add(new ArchiveEntryResourcePoolEntry(mn, path, entry));
-            }
+            entriesForModule.get(mn).stream()
+                .map(e -> new ArchiveEntryResourcePoolEntry(mn,
+                                    e.getResourcePoolEntryName(), e))
+                .forEach(resources::add);
         }
         return resources;
     }
@@ -320,6 +304,20 @@
         return result.toArray(array);
     }
 
+    /**
+     * Returns the path of the resource.
+     */
+    public static String resourceName(String path) {
+        Objects.requireNonNull(path);
+        String s = path.substring(1);
+        int index = s.indexOf("/");
+        return s.substring(index + 1);
+    }
+
+    public static String toPackage(String name) {
+        return toPackage(name, false);
+    }
+
     private static String toPackage(String name, boolean log) {
         int index = name.lastIndexOf('/');
         if (index > 0) {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JarArchive.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JarArchive.java	Wed Jul 05 22:19:13 2017 +0200
@@ -43,7 +43,7 @@
     /**
      * An entry located in a jar file.
      */
-    private class JarEntry extends Entry {
+    public class JarEntry extends Entry {
 
         private final long size;
         private final ZipEntry entry;
@@ -70,12 +70,10 @@
         }
     }
 
-    private static final String MODULE_INFO = "module-info.class";
-
     private final Path file;
     private final String moduleName;
     // currently processed ZipFile
-    private ZipFile zipFile;
+    protected ZipFile zipFile;
 
     protected JarArchive(String mn, Path file) {
         Objects.requireNonNull(mn);
@@ -110,21 +108,7 @@
 
     abstract String getFileName(String entryName);
 
-    private Entry toEntry(ZipEntry ze) {
-        String name = ze.getName();
-        String fn = getFileName(name);
-
-        if (ze.isDirectory() || fn.startsWith("_")) {
-            return null;
-        }
-
-        EntryType rt = toEntryType(name);
-
-        if (fn.equals(MODULE_INFO)) {
-            fn = moduleName + "/" + MODULE_INFO;
-        }
-        return new JarEntry(ze.getName(), fn, rt, zipFile, ze);
-    }
+    abstract Entry toEntry(ZipEntry ze);
 
     @Override
     public void close() throws IOException {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JmodArchive.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JmodArchive.java	Wed Jul 05 22:19:13 2017 +0200
@@ -25,34 +25,106 @@
 
 package jdk.tools.jlink.internal;
 
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UncheckedIOException;
 import java.nio.file.Path;
 import java.util.Objects;
+import java.util.stream.Stream;
+
+import jdk.internal.jmod.JmodFile;
 import jdk.tools.jlink.internal.Archive.Entry.EntryType;
 
 /**
  * An Archive backed by a jmod file.
  */
-public class JmodArchive extends JarArchive {
-
+public class JmodArchive implements Archive {
     private static final String JMOD_EXT    = ".jmod";
-    private static final String MODULE_NAME = "module";
-    private static final String MODULE_INFO = "module-info.class";
-    private static final String CLASSES     = "classes";
-    private static final String NATIVE_LIBS = "native";
-    private static final String NATIVE_CMDS = "bin";
-    private static final String CONFIG      = "conf";
+
+    /**
+     * An entry located in a jmod file.
+     */
+    public class JmodEntry extends Entry {
+        private final JmodFile.Entry entry;
+
+        JmodEntry(String path, String name, EntryType type,
+                  JmodFile.Entry entry) {
+            super(JmodArchive.this, path, name, type);
+            this.entry = Objects.requireNonNull(entry);
+        }
+
+        /**
+         * Returns the number of uncompressed bytes for this entry.
+         */
+        @Override
+        public long size() {
+            return entry.size();
+        }
+
+        @Override
+        public InputStream stream() throws IOException {
+            return jmodFile.getInputStream(entry.section(), entry.name());
+        }
+    }
+
+    private final Path file;
+    private final String moduleName;
+    private JmodFile jmodFile;
 
     public JmodArchive(String mn, Path jmod) {
-        super(mn, jmod);
-        String filename = Objects.requireNonNull(jmod.getFileName()).toString();
+        Objects.requireNonNull(mn);
+        Objects.requireNonNull(jmod.getFileName());
+        String filename = jmod.toString();
         if (!filename.endsWith(JMOD_EXT)) {
             throw new UnsupportedOperationException("Unsupported format: " + filename);
         }
+        this.moduleName = mn;
+        this.file = jmod;
+    }
+
+    @Override
+    public String moduleName() {
+        return moduleName;
+    }
+
+    @Override
+    public Path getPath() {
+        return file;
+    }
+
+    @Override
+    public Stream<Entry> entries() {
+        ensureOpen();
+        return jmodFile.stream()
+                       .map(this::toEntry);
     }
 
     @Override
-    EntryType toEntryType(String entryName) {
-        String section = getSection(entryName.replace('\\', '/'));
+    public void open() throws IOException {
+        if (jmodFile != null) {
+            jmodFile.close();
+        }
+        this.jmodFile = new JmodFile(file);
+    }
+
+    @Override
+    public void close() throws IOException {
+        if (jmodFile != null) {
+            jmodFile.close();
+        }
+    }
+
+    private void ensureOpen() {
+        if (jmodFile == null) {
+            try {
+                open();
+            } catch(IOException ioe){
+                throw new UncheckedIOException(ioe);
+            }
+        }
+    }
+
+    private EntryType toEntryType(JmodFile.Section section) {
         switch (section) {
             case CLASSES:
                 return EntryType.CLASS_OR_RESOURCE;
@@ -62,26 +134,23 @@
                 return EntryType.NATIVE_CMD;
             case CONFIG:
                 return EntryType.CONFIG;
-            case MODULE_NAME:
-                return EntryType.MODULE_NAME;
             default:
                 throw new InternalError("unexpected entry: " + section);
         }
     }
 
-    private static String getSection(String entryName) {
-        int i = entryName.indexOf('/');
-        // Unnamed section.
-        String section = "";
-        if (i > 0) {
-            section = entryName.substring(0, entryName.indexOf('/'));
+    private Entry toEntry(JmodFile.Entry entry) {
+        EntryType type = toEntryType(entry.section());
+        String name = entry.name();
+        String path = entry.section().jmodDir() + "/" + name;
+
+        // Entry.path() contains the kind of file native, conf, bin, ...
+        // Keep it to avoid naming conflict (eg: native/jvm.cfg and config/jvm.cfg
+        String resourceName = name;
+        if (type != EntryType.CLASS_OR_RESOURCE) {
+            resourceName = path;
         }
-        return section;
-    }
 
-    @Override
-    String getFileName(String entryName) {
-        entryName = entryName.replace('\\', '/');
-        return entryName.substring(entryName.indexOf('/') + 1);
+        return new JmodEntry(path, resourceName, type, entry);
     }
 }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ModularJarArchive.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ModularJarArchive.java	Wed Jul 05 22:19:13 2017 +0200
@@ -27,6 +27,8 @@
 
 import java.nio.file.Path;
 import java.util.Objects;
+import java.util.zip.ZipEntry;
+
 import jdk.tools.jlink.internal.Archive.Entry.EntryType;
 
 /**
@@ -35,6 +37,7 @@
 public class ModularJarArchive extends JarArchive {
 
     private static final String JAR_EXT = ".jar";
+    private static final String MODULE_INFO = "module-info.class";
 
     public ModularJarArchive(String mn, Path jmod) {
         super(mn, jmod);
@@ -50,6 +53,17 @@
     }
 
     @Override
+    Entry toEntry(ZipEntry ze) {
+        if (ze.isDirectory()) {
+            return null;
+        }
+
+        String name = ze.getName();
+        EntryType type = toEntryType(name);
+        return new JarEntry(ze.getName(), getFileName(name), type, zipFile, ze);
+    }
+
+    @Override
     String getFileName(String entryName) {
         return entryName;
     }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePoolManager.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePoolManager.java	Wed Jul 05 22:19:13 2017 +0200
@@ -27,15 +27,12 @@
 import java.lang.module.ModuleDescriptor;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
-import java.util.Collections;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.Set;
-import java.util.function.Function;
 import java.util.stream.Stream;
 import jdk.internal.jimage.decompressor.CompressedResourceHeader;
 import jdk.tools.jlink.plugin.ResourcePool;
@@ -44,7 +41,6 @@
 import jdk.tools.jlink.plugin.ResourcePoolModule;
 import jdk.tools.jlink.plugin.ResourcePoolModuleView;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.internal.plugins.FileCopierPlugin;
 
 /**
  * A manager for pool of resources.
@@ -100,17 +96,17 @@
         @Override
         public Set<String> packages() {
             Set<String> pkgs = new HashSet<>();
-            moduleContent.values().stream().filter(m -> m.type().
-                    equals(ResourcePoolEntry.Type.CLASS_OR_RESOURCE)).forEach(res -> {
-                // Module metadata only contains packages with .class files
-                if (ImageFileCreator.isClassPackage(res.path())) {
-                    String[] split = ImageFileCreator.splitPath(res.path());
-                    String pkg = split[1];
-                    if (pkg != null && !pkg.isEmpty()) {
-                        pkgs.add(pkg);
+            moduleContent.values().stream()
+                .filter(m -> m.type() == ResourcePoolEntry.Type.CLASS_OR_RESOURCE)
+                .forEach(res -> {
+                    String name = ImageFileCreator.resourceName(res.path());
+                    if (name.endsWith(".class") && !name.endsWith("module-info.class")) {
+                        String pkg = ImageFileCreator.toPackage(name);
+                        if (!pkg.isEmpty()) {
+                            pkgs.add(pkg);
+                        }
                     }
-                }
-            });
+                });
             return pkgs;
         }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodOutputStream.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.tools.jmod;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.UncheckedIOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import static jdk.internal.jmod.JmodFile.*;
+
+/**
+ * Output stream to write to JMOD file
+ */
+class JmodOutputStream extends OutputStream implements AutoCloseable {
+    /**
+     * This method creates (or overrides, if exists) the JMOD file,
+     * returning the the output stream to write to the JMOD file.
+     */
+    static JmodOutputStream newOutputStream(Path file) throws IOException {
+        OutputStream out = Files.newOutputStream(file);
+        BufferedOutputStream bos = new BufferedOutputStream(out);
+        return new JmodOutputStream(bos);
+    }
+
+    private final ZipOutputStream zos;
+    private JmodOutputStream(OutputStream out) {
+        this.zos = new ZipOutputStream(out);
+        try {
+            out.write(JMOD_MAGIC_NUMBER);
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
+    /**
+     * Writes the input stream to the named entry of the given section.
+     */
+    public void writeEntry(InputStream in, Section section, String name)
+        throws IOException
+    {
+        ZipEntry ze = newEntry(section, name);
+        zos.putNextEntry(ze);
+        in.transferTo(zos);
+        zos.closeEntry();
+    }
+
+    /**
+     * Writes the given bytes to the named entry of the given section.
+     */
+    public void writeEntry(byte[] bytes, Section section, String path)
+        throws IOException
+    {
+        ZipEntry ze = newEntry(section, path);
+        zos.putNextEntry(ze);
+        zos.write(bytes);
+        zos.closeEntry();
+    }
+
+    /**
+     * Writes the given entry to the given input stream.
+     */
+    public void writeEntry(InputStream in, Entry e) throws IOException {
+        zos.putNextEntry(e.zipEntry());
+        zos.write(in.readAllBytes());
+        zos.closeEntry();
+    }
+
+    private ZipEntry newEntry(Section section, String path) {
+        String prefix = section.jmodDir();
+        String name = Paths.get(prefix, path).toString()
+                           .replace(File.separatorChar, '/');
+        return new ZipEntry(name);
+    }
+
+    @Override
+    public void write(int b) throws IOException {
+        zos.write(b);
+    }
+
+    @Override
+    public void close() throws IOException {
+        zos.close();
+    }
+}
+
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java	Wed Jul 05 22:19:13 2017 +0200
@@ -25,8 +25,6 @@
 
 package jdk.tools.jmod;
 
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
@@ -60,7 +58,6 @@
 import java.text.MessageFormat;
 import java.util.ArrayDeque;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
@@ -80,15 +77,16 @@
 import java.util.function.Supplier;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
+import java.util.jar.JarOutputStream;
 import java.util.stream.Collectors;
 import java.util.regex.Pattern;
 import java.util.regex.PatternSyntaxException;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipException;
 import java.util.zip.ZipFile;
-import java.util.zip.ZipInputStream;
-import java.util.zip.ZipOutputStream;
 
+import jdk.internal.jmod.JmodFile;
+import jdk.internal.jmod.JmodFile.Section;
 import jdk.internal.joptsimple.BuiltinHelpFormatter;
 import jdk.internal.joptsimple.NonOptionArgumentSpec;
 import jdk.internal.joptsimple.OptionDescriptor;
@@ -250,23 +248,14 @@
     }
 
     private boolean describe() throws IOException {
-        ZipFile zip = null;
-        try {
-            try {
-                zip = new ZipFile(options.jmodFile.toFile());
-            } catch (IOException x) {
-                throw new IOException("error opening jmod file", x);
+        try (JmodFile jf = new JmodFile(options.jmodFile)) {
+            try (InputStream in = jf.getInputStream(Section.CLASSES, MODULE_INFO)) {
+                ModuleDescriptor md = ModuleDescriptor.read(in);
+                printModuleDescriptor(md);
+                return true;
+            } catch (IOException e) {
+                throw new CommandException("err.module.descriptor.not.found");
             }
-
-            try (InputStream in = Files.newInputStream(options.jmodFile)) {
-                boolean found = printModuleDescriptor(in);
-                if (!found)
-                    throw new CommandException("err.module.descriptor.not.found");
-                return found;
-            }
-        } finally {
-            if (zip != null)
-                zip.close();
         }
     }
 
@@ -278,65 +267,52 @@
 
     private static final JavaLangModuleAccess JLMA = SharedSecrets.getJavaLangModuleAccess();
 
-    private boolean printModuleDescriptor(InputStream in)
+    private void printModuleDescriptor(ModuleDescriptor md)
         throws IOException
     {
-        final String mi = Section.CLASSES.jmodDir() + "/" + MODULE_INFO;
-        try (BufferedInputStream bis = new BufferedInputStream(in);
-             ZipInputStream zis = new ZipInputStream(bis)) {
-
-            ZipEntry e;
-            while ((e = zis.getNextEntry()) != null) {
-                if (e.getName().equals(mi)) {
-                    ModuleDescriptor md = ModuleDescriptor.read(zis);
-                    StringBuilder sb = new StringBuilder();
-                    sb.append("\n").append(md.toNameAndVersion());
+        StringBuilder sb = new StringBuilder();
+        sb.append("\n").append(md.toNameAndVersion());
 
-                    md.requires().stream()
-                        .sorted(Comparator.comparing(Requires::name))
-                        .forEach(r -> {
-                            sb.append("\n  requires ");
-                            if (!r.modifiers().isEmpty())
-                                sb.append(toString(r.modifiers())).append(" ");
-                            sb.append(r.name());
-                        });
+        md.requires().stream()
+            .sorted(Comparator.comparing(Requires::name))
+            .forEach(r -> {
+                sb.append("\n  requires ");
+                if (!r.modifiers().isEmpty())
+                    sb.append(toString(r.modifiers())).append(" ");
+                sb.append(r.name());
+            });
 
-                    md.uses().stream().sorted()
-                        .forEach(s -> sb.append("\n  uses ").append(s));
+        md.uses().stream().sorted()
+            .forEach(s -> sb.append("\n  uses ").append(s));
 
-                    md.exports().stream()
-                        .sorted(Comparator.comparing(Exports::source))
-                        .forEach(p -> sb.append("\n  exports ").append(p));
+        md.exports().stream()
+            .sorted(Comparator.comparing(Exports::source))
+            .forEach(p -> sb.append("\n  exports ").append(p));
+
+        md.conceals().stream().sorted()
+            .forEach(p -> sb.append("\n  conceals ").append(p));
 
-                    md.conceals().stream().sorted()
-                        .forEach(p -> sb.append("\n  conceals ").append(p));
+        md.provides().values().stream()
+            .sorted(Comparator.comparing(Provides::service))
+            .forEach(p -> sb.append("\n  provides ").append(p.service())
+                .append(" with ")
+                .append(toString(p.providers())));
 
-                    md.provides().values().stream()
-                        .sorted(Comparator.comparing(Provides::service))
-                        .forEach(p -> sb.append("\n  provides ").append(p.service())
-                                        .append(" with ")
-                                        .append(toString(p.providers())));
+        md.mainClass().ifPresent(v -> sb.append("\n  main-class " + v));
 
-                    md.mainClass().ifPresent(v -> sb.append("\n  main-class " + v));
-
-                    md.osName().ifPresent(v -> sb.append("\n  operating-system-name " + v));
-
-                    md.osArch().ifPresent(v -> sb.append("\n  operating-system-architecture " + v));
+        md.osName().ifPresent(v -> sb.append("\n  operating-system-name " + v));
 
-                    md.osVersion().ifPresent(v -> sb.append("\n  operating-system-version " + v));
+        md.osArch().ifPresent(v -> sb.append("\n  operating-system-architecture " + v));
+
+        md.osVersion().ifPresent(v -> sb.append("\n  operating-system-version " + v));
 
-                    JLMA.hashes(md).ifPresent(
-                            hashes -> hashes.names().stream().sorted().forEach(
-                                    mod -> sb.append("\n  hashes ").append(mod).append(" ")
-                                             .append(hashes.algorithm()).append(" ")
-                                             .append(hashes.hashFor(mod))));
+        JLMA.hashes(md).ifPresent(
+            hashes -> hashes.names().stream().sorted().forEach(
+                mod -> sb.append("\n  hashes ").append(mod).append(" ")
+                    .append(hashes.algorithm()).append(" ")
+                    .append(hashes.hashFor(mod))));
 
-                    out.println(sb.toString());
-                    return true;
-                }
-            }
-        }
-        return false;
+        out.println(sb.toString());
     }
 
     private boolean create() throws IOException {
@@ -347,9 +323,8 @@
         Path target = options.jmodFile;
         Path tempTarget = target.resolveSibling(target.getFileName() + ".tmp");
         try {
-            try (OutputStream out = Files.newOutputStream(tempTarget);
-                 BufferedOutputStream bos = new BufferedOutputStream(out)) {
-                jmod.write(bos);
+            try (JmodOutputStream jos = JmodOutputStream.newOutputStream(tempTarget)) {
+                jmod.write(jos);
             }
             Files.move(tempTarget, target);
         } catch (Exception e) {
@@ -383,19 +358,16 @@
         /**
          * Writes the jmod to the given output stream.
          */
-        void write(OutputStream out) throws IOException {
-            try (ZipOutputStream zos = new ZipOutputStream(out)) {
-
-                // module-info.class
-                writeModuleInfo(zos, findPackages(classpath));
+        void write(JmodOutputStream out) throws IOException {
+            // module-info.class
+            writeModuleInfo(out, findPackages(classpath));
 
-                // classes
-                processClasses(zos, classpath);
+            // classes
+            processClasses(out, classpath);
 
-                processSection(zos, Section.NATIVE_CMDS, cmds);
-                processSection(zos, Section.NATIVE_LIBS, libs);
-                processSection(zos, Section.CONFIG, configs);
-            }
+            processSection(out, Section.NATIVE_CMDS, cmds);
+            processSection(out, Section.NATIVE_LIBS, libs);
+            processSection(out, Section.CONFIG, configs);
         }
 
         /**
@@ -441,7 +413,7 @@
          * then the corresponding class file attributes are added to the
          * module-info here.
          */
-        void writeModuleInfo(ZipOutputStream zos, Set<String> packages)
+        void writeModuleInfo(JmodOutputStream out, Set<String> packages)
             throws IOException
         {
             Supplier<InputStream> miSupplier = newModuleInfoSupplier();
@@ -492,11 +464,7 @@
                 }
 
                 // write the (possibly extended or modified) module-info.class
-                String e = Section.CLASSES.jmodDir() + "/" + MODULE_INFO;
-                ZipEntry ze = new ZipEntry(e);
-                zos.putNextEntry(ze);
-                extender.write(zos);
-                zos.closeEntry();
+                out.writeEntry(extender.toByteArray(), Section.CLASSES, MODULE_INFO);
             }
         }
 
@@ -627,7 +595,7 @@
                 return "";
         }
 
-        void processClasses(ZipOutputStream zos, List<Path> classpaths)
+        void processClasses(JmodOutputStream zos, List<Path> classpaths)
             throws IOException
         {
             if (classpaths == null)
@@ -645,7 +613,7 @@
             }
         }
 
-        void processSection(ZipOutputStream zos, Section section, List<Path> paths)
+        void processSection(JmodOutputStream zos, Section section, List<Path> paths)
             throws IOException
         {
             if (paths == null)
@@ -655,11 +623,9 @@
                 processSection(zos, section, p);
         }
 
-        void processSection(ZipOutputStream zos, Section section, Path top)
+        void processSection(JmodOutputStream out, Section section, Path top)
             throws IOException
         {
-            final String prefix = section.jmodDir();
-
             Files.walkFileTree(top, new SimpleFileVisitor<Path>() {
                 @Override
                 public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
@@ -667,13 +633,19 @@
                 {
                     Path relPath = top.relativize(file);
                     if (relPath.toString().equals(MODULE_INFO)
-                            && !Section.CLASSES.equals(section))
+                        && !Section.CLASSES.equals(section))
                         warning("warn.ignore.entry", MODULE_INFO, section);
 
                     if (!relPath.toString().equals(MODULE_INFO)
-                            && !matches(relPath, excludes)) {
+                        && !matches(relPath, excludes)) {
                         try (InputStream in = Files.newInputStream(file)) {
-                            writeZipEntry(zos, in, prefix, relPath.toString());
+                            out.writeEntry(in, section, relPath.toString());
+                        } catch (IOException x) {
+                            if (x.getMessage().contains("duplicate entry")) {
+                                warning("warn.ignore.duplicate.entry", relPath.toString(), section);
+                                return FileVisitResult.CONTINUE;
+                            }
+                            throw x;
                         }
                     }
                     return FileVisitResult.CONTINUE;
@@ -691,36 +663,17 @@
             return false;
         }
 
-        void writeZipEntry(ZipOutputStream zos, InputStream in, String prefix, String other)
-            throws IOException
-        {
-            String name = Paths.get(prefix, other).toString()
-                               .replace(File.separatorChar, '/');
-            ZipEntry ze = new ZipEntry(name);
-            try {
-                zos.putNextEntry(ze);
-                in.transferTo(zos);
-                zos.closeEntry();
-            } catch (ZipException x) {
-                if (x.getMessage().contains("duplicate entry")) {
-                    warning("warn.ignore.duplicate.entry", name, prefix);
-                    return;
-                }
-                throw x;
-            }
-        }
-
         class JarEntryConsumer implements Consumer<JarEntry>, Predicate<JarEntry> {
-            final ZipOutputStream zos;
+            final JmodOutputStream out;
             final JarFile jarfile;
-            JarEntryConsumer(ZipOutputStream zos, JarFile jarfile) {
-                this.zos = zos;
+            JarEntryConsumer(JmodOutputStream out, JarFile jarfile) {
+                this.out = out;
                 this.jarfile = jarfile;
             }
             @Override
             public void accept(JarEntry je) {
                 try (InputStream in = jarfile.getInputStream(je)) {
-                    writeZipEntry(zos, in, Section.CLASSES.jmodDir(), je.getName());
+                    out.writeEntry(in, Section.CLASSES, je.getName());
                 } catch (IOException e) {
                     throw new UncheckedIOException(e);
                 }
@@ -947,29 +900,11 @@
         {
             Path target = moduleNameToPath.get(name);
             Path tempTarget = target.resolveSibling(target.getFileName() + ".tmp");
-            ZipFile zip = new ZipFile(target.toFile());
             try {
-                try (OutputStream out = Files.newOutputStream(tempTarget);
-                     ZipOutputStream zos = new ZipOutputStream(out)) {
-                    zip.stream().forEach(e -> {
-                        try {
-                            InputStream in = zip.getInputStream(e);
-                            if (e.getName().equals(MODULE_INFO) ||
-                                e.getName().equals(Section.CLASSES.jmodDir() + "/" + MODULE_INFO)) {
-                                ZipEntry ze = new ZipEntry(e.getName());
-                                ze.setTime(System.currentTimeMillis());
-                                zos.putNextEntry(ze);
-                                recordHashes(in, zos, moduleHashes);
-                                zos.closeEntry();
-                            } else {
-                                zos.putNextEntry(e);
-                                zos.write(in.readAllBytes());
-                                zos.closeEntry();
-                            }
-                        } catch (IOException x) {
-                            throw new UncheckedIOException(x);
-                        }
-                    });
+                if (target.getFileName().toString().endsWith(".jmod")) {
+                    updateJmodFile(target, tempTarget, moduleHashes);
+                } else {
+                    updateModularJar(target, tempTarget, moduleHashes);
                 }
             } catch (IOException|RuntimeException e) {
                 if (Files.exists(tempTarget)) {
@@ -980,13 +915,67 @@
                     }
                 }
                 throw e;
-            } finally {
-                zip.close();
             }
+
             out.println(getMessage("module.hashes.recorded", name));
             Files.move(tempTarget, target, StandardCopyOption.REPLACE_EXISTING);
         }
 
+        private void updateModularJar(Path target, Path tempTarget,
+                                      ModuleHashes moduleHashes)
+            throws IOException
+        {
+            try (JarFile jf = new JarFile(target.toFile());
+                 OutputStream out = Files.newOutputStream(tempTarget);
+                 JarOutputStream jos = new JarOutputStream(out))
+            {
+                jf.stream().forEach(e -> {
+                    try (InputStream in = jf.getInputStream(e)) {
+                        if (e.getName().equals(MODULE_INFO)) {
+                            // what about module-info.class in versioned entries?
+                            ZipEntry ze = new ZipEntry(e.getName());
+                            ze.setTime(System.currentTimeMillis());
+                            jos.putNextEntry(ze);
+                            recordHashes(in, jos, moduleHashes);
+                            jos.closeEntry();
+                        } else {
+                            jos.putNextEntry(e);
+                            jos.write(in.readAllBytes());
+                            jos.closeEntry();
+                        }
+                    } catch (IOException x) {
+                        throw new UncheckedIOException(x);
+                    }
+                });
+            }
+        }
+
+        private void updateJmodFile(Path target, Path tempTarget,
+                                    ModuleHashes moduleHashes)
+            throws IOException
+        {
+
+            try (JmodFile jf = new JmodFile(target);
+                 JmodOutputStream jos = JmodOutputStream.newOutputStream(tempTarget))
+            {
+                jf.stream().forEach(e -> {
+                    try (InputStream in = jf.getInputStream(e.section(), e.name())) {
+                        if (e.name().equals(MODULE_INFO)) {
+                            // replace module-info.class
+                            ModuleInfoExtender extender =
+                                ModuleInfoExtender.newExtender(in);
+                            extender.hashes(moduleHashes);
+                            jos.writeEntry(extender.toByteArray(), e.section(), e.name());
+                        } else {
+                            jos.writeEntry(in, e);
+                        }
+                    } catch (IOException x) {
+                        throw new UncheckedIOException(x);
+                    }
+                });
+            }
+        }
+
         private Path moduleToPath(String name) {
             ModuleReference mref = moduleFinder.find(name).orElseThrow(
                 () -> new InternalError("Selected module " + name + " not on module path"));
@@ -1001,22 +990,6 @@
         }
     }
 
-    enum Section {
-        NATIVE_LIBS("native"),
-        NATIVE_CMDS("bin"),
-        CLASSES("classes"),
-        CONFIG("conf"),
-        UNKNOWN("unknown");
-
-        private final String jmodDir;
-
-        Section(String jmodDir) {
-            this.jmodDir = jmodDir;
-        }
-
-        String jmodDir() { return jmodDir; }
-    }
-
     static class ClassPathConverter implements ValueConverter<Path> {
         static final ValueConverter<Path> INSTANCE = new ClassPathConverter();
 
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_de.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_de.java	Wed Jul 05 22:19:13 2017 +0200
@@ -189,6 +189,9 @@
         String MHT[] = new String[] {"Marshallinseln Zeit", "MHT",
                                      "Marshallinseln Sommerzeit", "MHST",
                                      "Marshallinseln Zeit", "MHT"};
+        String MMT[] = new String[] {"Myanmar Zeit", "MMT",
+                                     "Myanmar Sommerzeit", "MMST",
+                                     "Myanmar Zeit", "MMT"};
         String MSK[] = new String[] {"Moskauer Normalzeit", "MSK",
                                      "Moskauer Sommerzeit", "MSD",
                                      "Zeitzone f\u00FCr Moskau", "MT"};
@@ -684,9 +687,7 @@
             {"Asia/Qyzylorda", new String[] {"Qyzylorda Zeit", "QYZT",
                                              "Qyzylorda Sommerzeit", "QYZST",
                                              "Qyzylorda Zeit", "QYZT"}},
-            {"Asia/Rangoon", new String[] {"Myanmar Zeit", "MMT",
-                                           "Myanmar Sommerzeit", "MMST",
-                                           "Myanmar Zeit", "MMT"}},
+            {"Asia/Rangoon", MMT},
             {"Asia/Riyadh", ARAST},
             {"Asia/Saigon", ICT},
             {"Asia/Sakhalin", new String[] {"Sakhalin Zeit", "SAKT",
@@ -719,6 +720,7 @@
                                                "Wladiwostok Sommerzeit", "VLAST",
                                                "Wladiwostok Zeit", "VLAT"}},
             {"Asia/Yakutsk", YAKT},
+            {"Asia/Yangon", MMT},
             {"Asia/Yekaterinburg", new String[] {"Jekaterinburger Zeit", "YEKT",
                                                  "Jekaterinburger Sommerzeit", "YEKST",
                                                  "Jekaterinburger Zeit", "YEKT"}},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_es.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_es.java	Wed Jul 05 22:19:13 2017 +0200
@@ -189,6 +189,9 @@
         String MHT[] = new String[] {"Hora de las Islas Marshall", "MHT",
                                      "Hora de verano de las Islas Marshall", "MHST",
                                      "Hora de Islas Marshall", "MHT"};
+        String MMT[] = new String[] {"Hora de Myanmar", "MMT",
+                                     "Hora de verano de Myanmar", "MMST",
+                                     "Hora de Myanmar", "MMT"};
         String MSK[] = new String[] {"Hora est\u00e1ndar de Mosc\u00fa", "MSK",
                                      "Hora de verano de Mosc\u00fa", "MSD",
                                      "Hora de Mosc\u00FA", "MT"};
@@ -684,9 +687,7 @@
             {"Asia/Qyzylorda", new String[] {"Hora de Qyzylorda", "QYZT",
                                              "Hora de verano de Qyzylorda", "QYZST",
                                              "Hora de Qyzylorda", "QYZT"}},
-            {"Asia/Rangoon", new String[] {"Hora de Myanmar", "MMT",
-                                           "Hora de verano de Myanmar", "MMST",
-                                           "Hora de Myanmar", "MMT"}},
+            {"Asia/Rangoon", MMT},
             {"Asia/Riyadh", ARAST},
             {"Asia/Saigon", ICT},
             {"Asia/Sakhalin", new String[] {"Hora de Sajalin", "SAKT",
@@ -719,6 +720,7 @@
                                                "Hora de verano de Vladivostok", "VLAST",
                                                "Hora de Vladivostok", "VLAT"}},
             {"Asia/Yakutsk", YAKT},
+            {"Asia/Yangon", MMT},
             {"Asia/Yekaterinburg", new String[] {"Hora de Ekaterinburgo", "YEKT",
                                                  "Hora de verano de Ekaterinburgo", "YEKST",
                                                  "Hora de Ekaterinburgo", "YEKT"}},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_fr.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_fr.java	Wed Jul 05 22:19:13 2017 +0200
@@ -189,6 +189,9 @@
         String MHT[] = new String[] {"Heure des Iles Marshall", "MHT",
                                      "Heure d'\u00e9t\u00e9 des Iles Marshall", "MHST",
                                      "Heure des Iles Marshall", "MHT"};
+        String MMT[] = new String[] {"Heure de Myanmar", "MMT",
+                                     "Heure d'\u00e9t\u00e9 de Myanmar", "MMST",
+                                     "Heure de Myanmar", "MMT"};
         String MSK[] = new String[] {"Heure standard de Moscou", "MSK",
                                      "Heure avanc\u00e9e de Moscou", "MSD",
                                      "Moscou", "MT"};
@@ -684,9 +687,7 @@
             {"Asia/Qyzylorda", new String[] {"Heure de Kyzylorda", "QYZT",
                                              "Heure d'\u00e9t\u00e9 de Kyzylorda", "QYZST",
                                              "Heure de Kyzylorda", "QYZT"}},
-            {"Asia/Rangoon", new String[] {"Heure de Myanmar", "MMT",
-                                           "Heure d'\u00e9t\u00e9 de Myanmar", "MMST",
-                                           "Heure de Myanmar", "MMT"}},
+            {"Asia/Rangoon", MMT},
             {"Asia/Riyadh", ARAST},
             {"Asia/Saigon", ICT},
             {"Asia/Sakhalin", new String[] {"Heure de Sakhalin", "SAKT",
@@ -719,6 +720,7 @@
                                                "Heure d'\u00e9t\u00e9 de Vladivostok", "VLAST",
                                                "Heure de Vladivostok", "VLAT"}},
             {"Asia/Yakutsk", YAKT},
+            {"Asia/Yangon", MMT},
             {"Asia/Yekaterinburg", new String[] {"Heure de Yekaterinburg", "YEKT",
                                                  "Heure d'\u00e9t\u00e9 de Yekaterinburg", "YEKST",
                                                  "Heure de Yekaterinburg", "YEKT"}},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_it.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_it.java	Wed Jul 05 22:19:13 2017 +0200
@@ -189,6 +189,9 @@
         String MHT[] = new String[] {"Ora delle Isole Marshall", "MHT",
                                      "Ora estiva delle Isole Marshall", "MHST",
                                      "Ora delle Isole Marshall", "MHT"};
+        String MMT[] = new String[] {"Ora della Birmania/Myanmar", "MMT",
+                                     "Ora estiva della Birmania/Myanmar", "MMST",
+                                     "Ora della Birmania/Myanmar", "MMT"};
         String MSK[] = new String[] {"Ora standard di Mosca", "MSK",
                                      "Ora legale di Mosca", "MSD",
                                      "Ora Mosca", "MT"};
@@ -684,9 +687,7 @@
             {"Asia/Qyzylorda", new String[] {"Ora di Qyzylorda", "QYZT",
                                              "Ora estiva di Qyzylorda", "QYZST",
                                              "Ora di Qyzylorda", "QYZT"}},
-            {"Asia/Rangoon", new String[] {"Ora della Birmania/Myanmar", "MMT",
-                                           "Ora estiva della Birmania/Myanmar", "MMST",
-                                           "Ora della Birmania/Myanmar", "MMT"}},
+            {"Asia/Rangoon", MMT},
             {"Asia/Riyadh", ARAST},
             {"Asia/Saigon", ICT},
             {"Asia/Sakhalin", new String[] {"Ora di Sakhalin", "SAKT",
@@ -719,6 +720,7 @@
                                                "Ora estiva di Vladivostok", "VLAST",
                                                "Ora di Vladivostok", "VLAT"}},
             {"Asia/Yakutsk", YAKT},
+            {"Asia/Yangon", MMT},
             {"Asia/Yekaterinburg", new String[] {"Ora di Ekaterinburg", "YEKT",
                                                  "Ora estiva di Ekaterinburg", "YEKST",
                                                  "Ora di Ekaterinburg", "YEKT"}},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_ja.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_ja.java	Wed Jul 05 22:19:13 2017 +0200
@@ -189,6 +189,9 @@
         String MHT[] = new String[] {"\u30de\u30fc\u30b7\u30e3\u30eb\u5cf6\u6642\u9593", "MHT",
                                      "\u30de\u30fc\u30b7\u30e3\u30eb\u5cf6\u590f\u6642\u9593", "MHST",
                                      "\u30DE\u30FC\u30B7\u30E3\u30EB\u8AF8\u5CF6\u6642\u9593", "MHT"};
+        String MMT[] = new String[] {"\u30df\u30e3\u30f3\u30de\u30fc\u6642\u9593", "MMT",
+                                     "\u30df\u30e3\u30f3\u30de\u30fc\u590f\u6642\u9593", "MMST",
+                                     "\u30DF\u30E3\u30F3\u30DE\u30FC\u6642\u9593", "MMT"};
         String MSK[] = new String[] {"\u30e2\u30b9\u30af\u30ef\u6a19\u6e96\u6642", "MSK",
                                      "\u30e2\u30b9\u30af\u30ef\u590f\u6642\u9593", "MSD",
                                      "\u30E2\u30B9\u30AF\u30EF\u6642\u9593", "MT"};
@@ -684,9 +687,7 @@
             {"Asia/Qyzylorda", new String[] {"\u30ad\u30b8\u30eb\u30aa\u30eb\u30c0\u6642\u9593", "QYZT",
                                              "\u30ad\u30b8\u30eb\u30aa\u30eb\u30c0\u590f\u6642\u9593", "QYZST",
                                              "\u30AF\u30BA\u30ED\u30EB\u30C0\u6642\u9593", "QYZT"}},
-            {"Asia/Rangoon", new String[] {"\u30df\u30e3\u30f3\u30de\u30fc\u6642\u9593", "MMT",
-                                           "\u30df\u30e3\u30f3\u30de\u30fc\u590f\u6642\u9593", "MMST",
-                                           "\u30DF\u30E3\u30F3\u30DE\u30FC\u6642\u9593", "MMT"}},
+            {"Asia/Rangoon", MMT},
             {"Asia/Riyadh", ARAST},
             {"Asia/Saigon", ICT},
             {"Asia/Sakhalin", new String[] {"\u6a3a\u592a\u6642\u9593", "SAKT",
@@ -719,6 +720,7 @@
                                                "\u30a6\u30e9\u30b8\u30aa\u30b9\u30c8\u30af\u590f\u6642\u9593", "VLAST",
                                                "\u30A6\u30E9\u30B8\u30AA\u30B9\u30C8\u30AF\u6642\u9593", "VLAT"}},
             {"Asia/Yakutsk", YAKT},
+            {"Asia/Yangon", MMT},
             {"Asia/Yekaterinburg", new String[] {"\u30a8\u30ab\u30c6\u30ea\u30f3\u30d6\u30eb\u30b0\u6642\u9593", "YEKT",
                                                  "\u30a8\u30ab\u30c6\u30ea\u30f3\u30d6\u30eb\u30b0\u590f\u6642\u9593", "YEKST",
                                                  "\u30A8\u30AB\u30C6\u30EA\u30F3\u30D6\u30EB\u30AF\u6642\u9593", "YEKT"}},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_ko.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_ko.java	Wed Jul 05 22:19:13 2017 +0200
@@ -189,6 +189,9 @@
         String MHT[] = new String[] {"\ub9c8\uc15c\uc81c\ub3c4 \uc2dc\uac04", "MHT",
                                      "\ub9c8\uc15c\uc81c\ub3c4 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "MHST",
                                      "\uB9C8\uC15C \uC81C\uB3C4 \uD45C\uC900\uC2DC", "MHT"};
+        String MMT[] = new String[] {"\ubbf8\uc580\ub9c8 \uc2dc\uac04", "MMT",
+                                     "\ubbf8\uc580\ub9c8 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "MMST",
+                                     "\uBBF8\uC580\uB9C8 \uD45C\uC900\uC2DC", "MMT"};
         String MSK[] = new String[] {"\ubaa8\uc2a4\ud06c\ubc14 \ud45c\uc900\uc2dc", "MSK",
                                      "\ubaa8\uc2a4\ud06c\ubc14 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "MSD",
                                      "\uBAA8\uC2A4\uD06C\uBC14 \uD45C\uC900\uC2DC", "MT"};
@@ -684,9 +687,7 @@
             {"Asia/Qyzylorda", new String[] {"Qyzylorda \ud45c\uc900\uc2dc", "QYZT",
                                              "Qyzylorda \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "QYZST",
                                              "\uD0A4\uC9C8\uB85C\uB974\uB2E4 \uD45C\uC900\uC2DC", "QYZT"}},
-            {"Asia/Rangoon", new String[] {"\ubbf8\uc580\ub9c8 \uc2dc\uac04", "MMT",
-                                           "\ubbf8\uc580\ub9c8 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "MMST",
-                                           "\uBBF8\uC580\uB9C8 \uD45C\uC900\uC2DC", "MMT"}},
+            {"Asia/Rangoon", MMT},
             {"Asia/Riyadh", ARAST},
             {"Asia/Saigon", ICT},
             {"Asia/Sakhalin", new String[] {"\uc0ac\ud560\ub9b0 \uc2dc\uac04", "SAKT",
@@ -719,6 +720,7 @@
                                                "\ube14\ub77c\ub514\ubcf4\uc2a4\ud1a1 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "VLAST",
                                                "\uBE14\uB77C\uB514\uBCF4\uC2A4\uD1A1 \uD45C\uC900\uC2DC", "VLAT"}},
             {"Asia/Yakutsk", YAKT},
+            {"Asia/Yangon", MMT},
             {"Asia/Yekaterinburg", new String[] {"\uc608\uce74\ud14c\ub9b0\ubc84\uadf8 \uc2dc\uac04", "YEKT",
                                                  "\uc608\uce74\ud14c\ub9b0\ubc84\uadf8 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "YEKST",
                                                  "\uC608\uCE74\uD14C\uB9B0\uBD80\uB974\uD06C \uD45C\uC900\uC2DC", "YEKT"}},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_pt_BR.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_pt_BR.java	Wed Jul 05 22:19:13 2017 +0200
@@ -189,6 +189,9 @@
         String MSK[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Moscou", "MSK",
                                      "Hor\u00e1rio de luz natural de Moscou", "MSD",
                                      "Hor\u00E1rio de Moscou", "MT"};
+        String MMT[] = new String[] {"Fuso hor\u00e1rio de Mianmar", "MMT",
+                                     "Fuso hor\u00e1rio de ver\u00e3o de Mianmar", "MMST",
+                                     "Hor\u00E1rio de Mianmar", "MMT"};
         String MST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o das montanhas", "MST",
                                      "Hor\u00e1rio de luz natural das montanhas", "MDT",
                                      "Hor\u00E1rio das Montanhas Rochosas", "MT"};
@@ -684,9 +687,7 @@
             {"Asia/Qyzylorda", new String[] {"Fuso hor\u00e1rio de Kizil-Orda", "QYZT",
                                              "Fuso hor\u00e1rio de ver\u00e3o de Kizil-Orda", "QYZST",
                                              "Hor\u00E1rio de Qyzylorda", "QYZT"}},
-            {"Asia/Rangoon", new String[] {"Fuso hor\u00e1rio de Mianmar", "MMT",
-                                           "Fuso hor\u00e1rio de ver\u00e3o de Mianmar", "MMST",
-                                           "Hor\u00E1rio de Mianmar", "MMT"}},
+            {"Asia/Rangoon", MMT},
             {"Asia/Riyadh", ARAST},
             {"Asia/Saigon", ICT},
             {"Asia/Sakhalin", new String[] {"Fuso hor\u00e1rio de Sakhalina", "SAKT",
@@ -719,6 +720,7 @@
                                                "Fuso hor\u00e1rio de ver\u00e3o de Vladivostok", "VLAST",
                                                "Hor\u00E1rio de Vladivostok", "VLAT"}},
             {"Asia/Yakutsk", YAKT},
+            {"Asia/Yangon", MMT},
             {"Asia/Yekaterinburg", new String[] {"Fuso hor\u00e1rio de Yekaterinburgo", "YEKT",
                                                  "Fuso hor\u00e1rio de ver\u00e3o de Yekaterinburgo", "YEKST",
                                                  "Hor\u00E1rio de Yekaterinburg", "YEKT"}},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_sv.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_sv.java	Wed Jul 05 22:19:13 2017 +0200
@@ -189,6 +189,9 @@
         String MHT[] = new String[] {"Marshall\u00f6arna, normaltid", "MHT",
                                      "Marshall\u00f6arna, sommartid", "MHST",
                                      "Marshall\u00F6arna-tid", "MHT"};
+        String MMT[] = new String[] {"Myanmar, normaltid", "MMT",
+                                     "Myanmar, sommartid", "MMST",
+                                     "Myanmar-tid", "MMT"};
         String MSK[] = new String[] {"Moskva, normaltid", "MSK",
                                      "Moskva, sommartid", "MSD",
                                      "Moskvas tid", "MT"};
@@ -684,9 +687,7 @@
             {"Asia/Qyzylorda", new String[] {"Qyzylorda, normaltid", "QYZT",
                                              "Qyzylorda, sommartid", "QYZST",
                                              "Qyzylorda-tid", "QYZT"}},
-            {"Asia/Rangoon", new String[] {"Myanmar, normaltid", "MMT",
-                                           "Myanmar, sommartid", "MMST",
-                                           "Myanmar-tid", "MMT"}},
+            {"Asia/Rangoon", MMT},
             {"Asia/Riyadh", ARAST},
             {"Asia/Saigon", ICT},
             {"Asia/Sakhalin", new String[] {"Sakhalin, normaltid", "SAKT",
@@ -719,6 +720,7 @@
                                                "Vladivostok, sommartid", "VLAST",
                                                "Vladivostok-tid", "VLAT"}},
             {"Asia/Yakutsk", YAKT},
+            {"Asia/Yangon", MMT},
             {"Asia/Yekaterinburg", new String[] {"Jekaterinburg, normaltid", "YEKT",
                                                  "Jekaterinburg, sommartid", "YEKST",
                                                  "Jekaterinburg-tid", "YEKT"}},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_zh_CN.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_zh_CN.java	Wed Jul 05 22:19:13 2017 +0200
@@ -189,6 +189,9 @@
         String MHT[] = new String[] {"\u9a6c\u7ecd\u5c14\u7fa4\u5c9b\u65f6\u95f4", "MHT",
                                      "\u9a6c\u7ecd\u5c14\u7fa4\u5c9b\u590f\u4ee4\u65f6", "MHST",
                                      "\u9A6C\u7ECD\u5C14\u7FA4\u5C9B\u65F6\u95F4", "MHT"};
+        String MMT[] = new String[] {"\u7f05\u7538\u65f6\u95f4", "MMT",
+                                     "\u7f05\u7538\u590f\u4ee4\u65f6", "MMST",
+                                     "\u7F05\u7538\u65F6\u95F4", "MMT"};
         String MSK[] = new String[] {"\u83ab\u65af\u79d1\u6807\u51c6\u65f6\u95f4", "MSK",
                                      "\u83ab\u65af\u79d1\u590f\u4ee4\u65f6", "MSD",
                                      "\u83AB\u65AF\u79D1\u65F6\u95F4", "MT"};
@@ -684,9 +687,7 @@
             {"Asia/Qyzylorda", new String[] {"Qyzylorda \u65f6\u95f4", "QYZT",
                                              "Qyzylorda \u590f\u4ee4\u65f6", "QYZST",
                                              "Qyzylorda \u65F6\u95F4", "QYZT"}},
-            {"Asia/Rangoon", new String[] {"\u7f05\u7538\u65f6\u95f4", "MMT",
-                                           "\u7f05\u7538\u590f\u4ee4\u65f6", "MMST",
-                                           "\u7F05\u7538\u65F6\u95F4", "MMT"}},
+            {"Asia/Rangoon", MMT},
             {"Asia/Riyadh", ARAST},
             {"Asia/Saigon", ICT},
             {"Asia/Sakhalin", new String[] {"\u5e93\u9875\u5c9b\u65f6\u95f4", "SAKT",
@@ -719,6 +720,7 @@
                                                "\u6d77\u53c2\u5d34\u590f\u4ee4\u65f6", "VLAST",
                                                "\u6D77\u53C2\u5D34\u65F6\u95F4", "VLAT"}},
             {"Asia/Yakutsk", YAKT},
+            {"Asia/Yangon", MMT},
             {"Asia/Yekaterinburg", new String[] {"Yekaterinburg \u65f6\u95f4", "YEKT",
                                                  "Yekaterinburg \u590f\u4ee4\u65f6", "YEKST",
                                                  "Yekaterinburg \u65F6\u95F4", "YEKT"}},
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_zh_TW.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_zh_TW.java	Wed Jul 05 22:19:13 2017 +0200
@@ -189,6 +189,9 @@
         String MHT[] = new String[] {"\u99ac\u7d39\u723e\u7fa4\u5cf6\u6642\u9593", "MHT",
                                      "\u99ac\u7d39\u723e\u7fa4\u5cf6\u590f\u4ee4\u6642\u9593", "MHST",
                                      "\u99AC\u7D39\u723E\u7FA4\u5CF6\u6642\u9593", "MHT"};
+        String MMT[] = new String[] {"\u7dec\u7538\u6642\u9593", "MMT",
+                                     "\u7dec\u7538\u590f\u4ee4\u6642\u9593", "MMST",
+                                     "\u7DEC\u7538\u6642\u9593", "MMT"};
         String MSK[] = new String[] {"\u83ab\u65af\u79d1\u6a19\u6e96\u6642\u9593", "MSK",
                                      "\u83ab\u65af\u79d1\u65e5\u5149\u7bc0\u7d04\u6642\u9593", "MSD",
                                      "\u83AB\u65AF\u79D1\u6642\u9593", "MT"};
@@ -684,9 +687,7 @@
             {"Asia/Qyzylorda", new String[] {"Qyzylorda \u6642\u9593", "QYZT",
                                              "Qyzylorda \u590f\u4ee4\u6642\u9593", "QYZST",
                                              "\u514B\u5B5C\u6D1B\u723E\u9054\u6642\u9593", "QYZT"}},
-            {"Asia/Rangoon", new String[] {"\u7dec\u7538\u6642\u9593", "MMT",
-                                           "\u7dec\u7538\u590f\u4ee4\u6642\u9593", "MMST",
-                                           "\u7DEC\u7538\u6642\u9593", "MMT"}},
+            {"Asia/Rangoon", MMT},
             {"Asia/Riyadh", ARAST},
             {"Asia/Saigon", ICT},
             {"Asia/Sakhalin", new String[] {"\u5eab\u9801\u5cf6\u6642\u9593", "SAKT",
@@ -721,6 +722,7 @@
                                                "\u6d77\u53c3\u5d34\u590f\u4ee4\u6642\u9593", "VLAST",
                                                "\u6D77\u53C3\u5D34\u6642\u9593", "VLAT"}},
             {"Asia/Yakutsk", YAKT},
+            {"Asia/Yangon", MMT},
             {"Asia/Yekaterinburg", new String[] {"Yekaterinburg \u6642\u9593", "YEKT",
                                                  "Yekaterinburg \u590f\u4ee4\u6642\u9593", "YEKST",
                                                  "\u8449\u5361\u6377\u7433\u5821\u6642\u9593", "YEKT"}},
--- a/jdk/src/jdk.sctp/unix/native/libsctp/SctpChannelImpl.c	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/jdk.sctp/unix/native/libsctp/SctpChannelImpl.c	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -417,8 +417,8 @@
 JNIEXPORT jint JNICALL Java_sun_nio_ch_sctp_SctpChannelImpl_receive0
   (JNIEnv *env, jclass klass, jint fd, jobject resultContainerObj,
    jlong address, jint length, jboolean peek) {
-    SOCKADDR sa;
-    int sa_len = sizeof(sa);
+    SOCKETADDRESS sa;
+    int sa_len = sizeof(SOCKETADDRESS);
     ssize_t rv = 0;
     jlong *addr = jlong_to_ptr(address);
     struct iovec iov[1];
@@ -501,7 +501,7 @@
             snp = (union sctp_notification *) bufp;
             if (handleNotification(env, fd, resultContainerObj, snp, rv,
                                    (msg->msg_flags & MSG_EOR),
-                                   (struct sockaddr*)&sa ) == JNI_TRUE) {
+                                   &sa.sa) == JNI_TRUE) {
                 /* We have received a notification that is of interest
                    to the Java API. The appropriate notification will be
                    set in the result container. */
@@ -524,7 +524,7 @@
     } while (msg->msg_flags & MSG_NOTIFICATION);
 
     handleMessage(env, resultContainerObj, msg, rv,
-            (msg->msg_flags & MSG_EOR), (struct sockaddr*)&sa);
+            (msg->msg_flags & MSG_EOR), &sa.sa);
     return rv;
 }
 
@@ -537,8 +537,8 @@
   (JNIEnv *env, jclass klass, jint fd, jlong address, jint length,
    jobject targetAddress, jint targetPort, jint assocId, jint streamNumber,
    jboolean unordered, jint ppid) {
-    SOCKADDR sa;
-    int sa_len = sizeof(sa);
+    SOCKETADDRESS sa;
+    int sa_len = sizeof(SOCKETADDRESS);
     ssize_t rv = 0;
     jlong *addr = jlong_to_ptr(address);
     struct iovec iov[1];
@@ -555,8 +555,7 @@
      *    Association already existing, assocId != -1, targetAddress = preferred addr
      */
     if (targetAddress != NULL /*&& assocId <= 0*/) {
-        if (NET_InetAddressToSockaddr(env, targetAddress, targetPort,
-                                      (struct sockaddr *)&sa,
+        if (NET_InetAddressToSockaddr(env, targetAddress, targetPort, &sa.sa,
                                       &sa_len, JNI_TRUE) != 0) {
             return IOS_THROWN;
         }
--- a/jdk/src/jdk.sctp/unix/native/libsctp/SctpNet.c	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/jdk.sctp/unix/native/libsctp/SctpNet.c	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -210,20 +210,20 @@
 JNIEXPORT void JNICALL Java_sun_nio_ch_sctp_SctpNet_bindx
   (JNIEnv *env, jclass klass, jint fd, jobjectArray addrs, jint port,
    jint addrsLength, jboolean add, jboolean preferIPv6) {
-    SOCKADDR *sap, *tmpSap;
-    int i, sa_len = sizeof(SOCKADDR);
+    SOCKETADDRESS *sap, *tmpSap;
+    int i, sa_len = sizeof(SOCKETADDRESS);
     jobject ia;
 
     if (addrsLength < 1)
         return;
 
-    if ((sap = calloc(addrsLength,  sa_len)) == NULL) {
+    if ((sap = calloc(addrsLength, sa_len)) == NULL) {
           JNU_ThrowOutOfMemoryError(env, "heap allocation failure");
         return;
     }
 
     tmpSap = sap;
-    for (i=0; i<addrsLength; i++) {
+    for (i = 0; i < addrsLength; i++) {
         ia = (*env)->GetObjectArrayElement(env, addrs, i);
         if (NET_InetAddressToSockaddr(env, ia, port, (struct sockaddr*)tmpSap,
                                       &sa_len, preferIPv6) != 0) {
@@ -233,7 +233,7 @@
         tmpSap++;
     }
 
-    if (nio_sctp_bindx(fd, (void*)sap, addrsLength, add ? SCTP_BINDX_ADD_ADDR :
+    if (nio_sctp_bindx(fd, (void *)sap, addrsLength, add ? SCTP_BINDX_ADD_ADDR :
                        SCTP_BINDX_REM_ADDR) != 0) {
         handleSocketError(env, errno);
     }
@@ -261,16 +261,16 @@
 JNIEXPORT jint JNICALL
 Java_sun_nio_ch_sctp_SctpNet_connect0
   (JNIEnv *env, jclass clazz, int fd, jobject iao, jint port) {
-    SOCKADDR sa;
-    int sa_len = SOCKADDR_LEN;
+    SOCKETADDRESS sa;
+    int sa_len = sizeof(SOCKETADDRESS);
     int rv;
 
-    if (NET_InetAddressToSockaddr(env, iao, port, (struct sockaddr *) &sa,
+    if (NET_InetAddressToSockaddr(env, iao, port, &sa.sa,
                                   &sa_len, JNI_TRUE) != 0) {
         return IOS_THROWN;
     }
 
-    rv = connect(fd, (struct sockaddr *)&sa, sa_len);
+    rv = connect(fd, &sa.sa, sa_len);
     if (rv != 0) {
         if (errno == EINPROGRESS) {
             return IOS_UNAVAILABLE;
--- a/jdk/src/jdk.security.jgss/share/classes/com/sun/security/jgss/ExtendedGSSContext.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/jdk.security.jgss/share/classes/com/sun/security/jgss/ExtendedGSSContext.java	Wed Jul 05 22:19:13 2017 +0200
@@ -26,8 +26,6 @@
 package com.sun.security.jgss;
 
 import org.ietf.jgss.*;
-import sun.security.jgss.GSSContextImpl;
-import sun.security.krb5.internal.AuthorizationData;
 
 /**
  * The extended GSSContext interface for supporting additional
@@ -36,40 +34,6 @@
  */
 public interface ExtendedGSSContext extends GSSContext {
 
-    // The impl is almost identical to GSSContextImpl with only 2 differences:
-    // 1. It implements the extended interface
-    // 2. It translates result to data types here in inquireSecContext
-    static class ExtendedGSSContextImpl extends GSSContextImpl
-            implements ExtendedGSSContext {
-
-        public ExtendedGSSContextImpl(GSSContextImpl old) {
-            super(old);
-        }
-
-        @Override
-        public Object inquireSecContext(InquireType type) throws GSSException {
-            SecurityManager security = System.getSecurityManager();
-            if (security != null) {
-                security.checkPermission(
-                        new InquireSecContextPermission(type.toString()));
-            }
-            Object output = super.inquireSecContext(type.name());
-            if (output != null) {
-                if (type == InquireType.KRB5_GET_AUTHZ_DATA) {
-                    AuthorizationData ad = (AuthorizationData) output;
-                    AuthorizationDataEntry[] authzData =
-                            new AuthorizationDataEntry[ad.count()];
-                    for (int i = 0; i < ad.count(); i++) {
-                        authzData[i] = new AuthorizationDataEntry(
-                                ad.item(i).adType, ad.item(i).adData);
-                    }
-                    output = authzData;
-                }
-            }
-            return output;
-        }
-    }
-
     /**
      * Return the mechanism-specific attribute associated with {@code type}.
      * <p>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.security.jgss/share/classes/com/sun/security/jgss/ExtendedGSSContextImpl.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.security.jgss;
+
+import org.ietf.jgss.*;
+import sun.security.jgss.GSSContextImpl;
+import sun.security.krb5.internal.AuthorizationData;
+
+// The impl is almost identical to GSSContextImpl with only 2 differences:
+// 1. It implements the extended interface
+// 2. It translates result to data types here in inquireSecContext
+class ExtendedGSSContextImpl extends GSSContextImpl
+        implements ExtendedGSSContext {
+
+    public ExtendedGSSContextImpl(GSSContextImpl old) {
+        super(old);
+    }
+
+    @Override
+    public Object inquireSecContext(InquireType type) throws GSSException {
+        SecurityManager security = System.getSecurityManager();
+        if (security != null) {
+            security.checkPermission(
+                    new InquireSecContextPermission(type.toString()));
+        }
+        Object output = super.inquireSecContext(type.name());
+        if (output != null) {
+            if (type == InquireType.KRB5_GET_AUTHZ_DATA) {
+                AuthorizationData ad = (AuthorizationData) output;
+                AuthorizationDataEntry[] authzData =
+                        new AuthorizationDataEntry[ad.count()];
+                for (int i = 0; i < ad.count(); i++) {
+                    authzData[i] = new AuthorizationDataEntry(
+                            ad.item(i).adType, ad.item(i).adData);
+                }
+                output = authzData;
+            }
+        }
+        return output;
+    }
+}
--- a/jdk/src/jdk.security.jgss/share/classes/com/sun/security/jgss/ExtendedGSSCredential.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/jdk.security.jgss/share/classes/com/sun/security/jgss/ExtendedGSSCredential.java	Wed Jul 05 22:19:13 2017 +0200
@@ -26,7 +26,6 @@
 package com.sun.security.jgss;
 
 import org.ietf.jgss.*;
-import sun.security.jgss.GSSCredentialImpl;
 
 /**
  * The extended GSSCredential interface for supporting additional
@@ -35,14 +34,6 @@
  */
 public interface ExtendedGSSCredential extends GSSCredential {
 
-    static class ExtendedGSSCredentialImpl extends GSSCredentialImpl
-            implements ExtendedGSSCredential {
-
-        public ExtendedGSSCredentialImpl(GSSCredentialImpl old) {
-            super(old);
-        }
-    }
-
     /**
      * Impersonates a principal. In Kerberos, this can be implemented
      * using the Microsoft S4U2self extension.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.security.jgss/share/classes/com/sun/security/jgss/ExtendedGSSCredentialImpl.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.security.jgss;
+
+import sun.security.jgss.GSSCredentialImpl;
+
+class ExtendedGSSCredentialImpl extends GSSCredentialImpl
+        implements ExtendedGSSCredential {
+
+    public ExtendedGSSCredentialImpl(GSSCredentialImpl old) {
+        super(old);
+    }
+}
--- a/jdk/src/jdk.security.jgss/share/classes/com/sun/security/jgss/Extender.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/src/jdk.security.jgss/share/classes/com/sun/security/jgss/Extender.java	Wed Jul 05 22:19:13 2017 +0200
@@ -39,18 +39,18 @@
     }
 
     public GSSCredential wrap(GSSCredential cred) {
-        if (cred instanceof ExtendedGSSCredential.ExtendedGSSCredentialImpl) {
+        if (cred instanceof ExtendedGSSCredentialImpl) {
             return cred;
         } else {
-            return new ExtendedGSSCredential.ExtendedGSSCredentialImpl((GSSCredentialImpl)cred);
+            return new ExtendedGSSCredentialImpl((GSSCredentialImpl)cred);
         }
     }
 
     public GSSContext wrap(GSSContext ctxt) {
-        if (ctxt instanceof ExtendedGSSContext.ExtendedGSSContextImpl) {
+        if (ctxt instanceof ExtendedGSSContextImpl) {
             return ctxt;
         } else {
-            return new ExtendedGSSContext.ExtendedGSSContextImpl((GSSContextImpl)ctxt);
+            return new ExtendedGSSContextImpl((GSSContextImpl)ctxt);
         }
     }
 }
--- a/jdk/test/ProblemList.txt	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/ProblemList.txt	Wed Jul 05 22:19:13 2017 +0200
@@ -134,8 +134,6 @@
 
 java/lang/instrument/BootClassPath/BootClassPathTest.sh         8072130 macosx-all
 
-java/lang/instrument/DaemonThread/TestDaemonThread.java         8161225 generic-all
-
 java/lang/instrument/DaemonThread/TestDaemonThread.java         8167001 generic-all
 
 java/lang/management/MemoryMXBean/Pending.java                  8158837 generic-all
--- a/jdk/test/com/sun/crypto/provider/Cipher/PBE/TestCipherPBECons.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/com/sun/crypto/provider/Cipher/PBE/TestCipherPBECons.java	Wed Jul 05 22:19:13 2017 +0200
@@ -36,7 +36,6 @@
  * @author Yun Ke
  * @author Bill Situ
  * @author Yu-Ching (Valerie) PENG
- * @run main TestCipherKeyWrapperPBEKey
  */
 public class TestCipherPBECons {
 
--- a/jdk/test/com/sun/jdi/InterfaceMethodsTest.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/com/sun/jdi/InterfaceMethodsTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -197,14 +197,18 @@
         // invoke interface static method A
         testInvokePos(ifaceClass, null, "staticMethodA", "()I", vm().mirrorOf(RESULT_A));
 
-        // try to invoke static method A on the instance
-        testInvokePos(ifaceClass, ref, "staticMethodA", "()I", vm().mirrorOf(RESULT_A));
+        // invoking static method A on the instance fails because static method A is
+        // not inherited by TargetClass.
+        testInvokeNeg(ifaceClass, ref, "staticMethodA", "()I", vm().mirrorOf(RESULT_A),
+                "Invalid MethodID");
 
         // invoke interface static method B
         testInvokePos(ifaceClass, null, "staticMethodB", "()I", vm().mirrorOf(RESULT_A));
 
-        // try to invoke static method B on the instance
-        testInvokePos(ifaceClass, ref, "staticMethodB", "()I", vm().mirrorOf(RESULT_A));
+        // invoking static method B on the instance fails because static method B is
+        // not inherited by TargetClass.
+        testInvokeNeg(ifaceClass, ref, "staticMethodB", "()I", vm().mirrorOf(RESULT_A),
+                "Invalid MethodID");
 
         // try to invoke a virtual method
         testInvokePos(ifaceClass, ref, "implementedMethod", "()I", vm().mirrorOf(RESULT_A), true);
@@ -239,21 +243,25 @@
         testInvokeNeg(ifaceClass, null, "staticMethodA", "()I", vm().mirrorOf(RESULT_A),
                 "Static interface methods are not inheritable");
 
-        // however it is possible to call "staticMethodA" on the actual instance
+        // "staticMethodA" is not inherited by InterfaceB even from an actual instance
         testInvokeNeg(ifaceClass, ref, "staticMethodA", "()I", vm().mirrorOf(RESULT_A),
                 "Static interface methods are not inheritable");
 
-        // "staticMethodB" is overridden in InterfaceB
+        // "staticMethodB" is re-defined in InterfaceB
         testInvokePos(ifaceClass, null, "staticMethodB", "()I", vm().mirrorOf(RESULT_B));
 
-        // the instance invokes the overriden form of "staticMethodB" from InterfaceB
-        testInvokePos(ifaceClass, ref, "staticMethodB", "()I", vm().mirrorOf(RESULT_B));
+        // the instance fails to invoke the re-defined form of "staticMethodB" from
+        // InterfaceB because staticMethodB is not inherited by TargetClass
+        testInvokeNeg(ifaceClass, ref, "staticMethodB", "()I", vm().mirrorOf(RESULT_B),
+                "Invalid MethodID");
 
         // "staticMethodC" is present only in InterfaceB
         testInvokePos(ifaceClass, null, "staticMethodC", "()I", vm().mirrorOf(RESULT_B));
 
-        // "staticMethodC" should be reachable from the instance too
-        testInvokePos(ifaceClass, ref, "staticMethodC", "()I", vm().mirrorOf(RESULT_B));
+        // "staticMethodC" is not reachable from the instance because staticMethodC
+        // is not inherited by TargetClass.
+        testInvokeNeg(ifaceClass, ref, "staticMethodC", "()I", vm().mirrorOf(RESULT_B),
+                "Invalid MethodID");
     }
 
     private void testImplementationClass(ReferenceType targetClass, ObjectReference thisObject) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/FocusTraversalPolicy/ButtonGroupLayoutTraversal/ButtonGroupLayoutTraversalTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 8154043
+  @summary Fields not reachable anymore by tab-key, because of new tabbing
+  behaviour of radio button groups.
+  @run main ButtonGroupLayoutTraversalTest
+*/
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
+import java.awt.event.KeyEvent;
+
+public class ButtonGroupLayoutTraversalTest {
+    static int nx = 3;
+    static int ny = 3;
+
+    static int focusCnt[] = new int[nx * ny];
+    private static JFrame window;
+
+
+    public static void main(String[] args) throws Exception {
+
+        SwingUtilities.invokeAndWait(()->initLayout(nx, ny));
+        Robot robot = new Robot();
+        robot.setAutoDelay(100);
+        robot.waitForIdle();
+        robot.delay(200);
+
+
+        for(int i = 0; i < nx * ny - nx * ny / 2 - 1; i++) {
+            robot.keyPress(KeyEvent.VK_RIGHT);
+            robot.keyRelease(KeyEvent.VK_RIGHT);
+        }
+
+        for(int i = 0; i < nx * ny / 2; i++) {
+            robot.keyPress(KeyEvent.VK_TAB);
+            robot.keyRelease(KeyEvent.VK_TAB);
+        }
+
+        robot.waitForIdle();
+        robot.delay(200);
+
+        for(int i = 0; i < nx * ny; i++) {
+            if(focusCnt[i] < 1) {
+                SwingUtilities.invokeLater(window::dispose);
+                throw new RuntimeException("Component " + i +
+                        " is not reachable in the forward focus cycle");
+            } else if (focusCnt[i] > 1) {
+                SwingUtilities.invokeLater(window::dispose);
+                throw new RuntimeException("Component " + i +
+                        " got focus more than once in the forward focus cycle");
+            }
+        }
+
+        for(int i = 0; i < nx * ny / 2; i++) {
+            robot.keyPress(KeyEvent.VK_SHIFT);
+            robot.keyPress(KeyEvent.VK_TAB);
+            robot.keyRelease(KeyEvent.VK_TAB);
+            robot.keyRelease(KeyEvent.VK_SHIFT);
+        }
+
+        for(int i = 0; i < nx * ny - nx * ny / 2 - 1; i++) {
+            robot.keyPress(KeyEvent.VK_LEFT);
+            robot.keyRelease(KeyEvent.VK_LEFT);
+        }
+
+        robot.keyPress(KeyEvent.VK_SHIFT);
+        robot.keyPress(KeyEvent.VK_TAB);
+        robot.keyRelease(KeyEvent.VK_TAB);
+        robot.keyRelease(KeyEvent.VK_SHIFT);
+
+        robot.waitForIdle();
+        robot.delay(200);
+
+        for(int i = 0; i < nx * ny; i++) {
+            if(focusCnt[i] < 2) {
+                SwingUtilities.invokeLater(window::dispose);
+                throw new RuntimeException("Component " + i +
+                        " is not reachable in the backward focus cycle");
+            } else if (focusCnt[i] > 2) {
+                SwingUtilities.invokeLater(window::dispose);
+                throw new RuntimeException("Component " + i +
+                        " got focus more than once in the backward focus cycle");
+            }
+        }
+
+        SwingUtilities.invokeLater(window::dispose);
+    }
+
+    public static void initLayout(int nx, int ny)
+    {
+        window = new JFrame("Test");
+        window.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+        JPanel rootPanel = new JPanel();
+        rootPanel.setLayout(new BorderLayout());
+        JPanel formPanel = new JPanel(new GridLayout(nx, ny));
+        formPanel.setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
+        formPanel.setFocusCycleRoot(true);
+        ButtonGroup radioButtonGroup = new ButtonGroup();
+        for(int i = 0; i < nx * ny; i++) {
+            JToggleButton comp;
+            if(i % 2 == 0) {
+                comp = new JRadioButton("Grouped component");
+                radioButtonGroup.add(comp);
+            } else {
+                comp = new JRadioButton("Single component");
+            }
+            formPanel.add(comp);
+            int fi = i;
+            comp.setBackground(Color.red);
+            comp.addFocusListener(new FocusAdapter() {
+                @Override
+                public void focusGained(FocusEvent e) {
+                    focusCnt[fi]++;
+                    if( focusCnt[fi] == 1) {
+                        ((JComponent) e.getSource())
+                                .setBackground(Color.yellow);
+                    } else if(focusCnt[fi] == 2) {
+                        ((JComponent) e.getSource())
+                                .setBackground(Color.green);
+                    } else {
+                        ((JComponent) e.getSource())
+                                .setBackground(Color.red);
+                    }
+                }
+            });
+        }
+        rootPanel.add(formPanel, BorderLayout.CENTER);
+        window.add(rootPanel);
+        window.pack();
+        window.setVisible(true);
+    }
+}
--- a/jdk/test/java/awt/Focus/ModalDialogActivationTest/ModalDialogActivationTest.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/java/awt/Focus/ModalDialogActivationTest/ModalDialogActivationTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -23,15 +23,21 @@
  * questions.
  */
 
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.*;
+import java.awt.EventQueue;
+import java.awt.Frame;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
 
 /*
   @test
-  @bug       8160570
-  @summary   Tests that a modal dialog receives WINDOW_ACTIVATED & WINDOW_GAINED_FOCUS on first show.
+  @key headful
+  @bug 8160570 8166015
+  @summary Tests that a modal dialog receives WINDOW_ACTIVATED
+            & WINDOW_GAINED_FOCUS on first show.
 */
+
 public class ModalDialogActivationTest {
     static final Object lock = new Object();
     static volatile boolean activated;
@@ -48,7 +54,8 @@
             }
         }
         if (!activated || !focused) {
-            throw new RuntimeException("Test FAILED: activated: " + activated + ", focused: " + focused);
+            throw new RuntimeException("Test FAILED: activated: " + activated
+                                        + ", focused: " + focused);
         }
         System.out.println("Test PASSED");
     }
@@ -79,7 +86,7 @@
     }
 
     static class MyModalDialog extends JDialog {
-        public MyModalDialog(Frame owner, String title)ª {
+        public MyModalDialog(Frame owner, String title) {
             super(owner, title, true);
         }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Frame/DecoratedFrameInsets/DecoratedFrameInsetsTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 8165619
+ * @summary Frame is not repainted if created in state=MAXIMIZED_BOTH on Unity
+ * @run main DecoratedFrameInsetsTest
+ */
+
+import java.awt.*;
+
+public class DecoratedFrameInsetsTest {
+    static Robot robot;
+    private static Insets expectedInsets;
+
+    public static void main(String[] args) throws Exception {
+        robot = new Robot();
+        expectedInsets = getExpectedInsets();
+        System.out.println("Normal state insets: " + expectedInsets);
+        testState(Frame.MAXIMIZED_BOTH);
+        testState(Frame.ICONIFIED);
+        testState(Frame.MAXIMIZED_HORIZ);
+        testState(Frame.MAXIMIZED_VERT);
+    }
+
+    private static Insets getExpectedInsets() {
+        Frame frame = new Frame();
+        frame.setVisible(true);
+        robot.waitForIdle();
+        robot.delay(200);
+        Insets expectedInsets = frame.getInsets();
+        frame.dispose();
+        return expectedInsets;
+    }
+
+    static void testState(int state) {
+        Frame frame = new Frame();
+        if( Toolkit.getDefaultToolkit().isFrameStateSupported(state)) {
+            frame.setBounds(150, 150, 200, 200);
+            frame.setExtendedState(state);
+            frame.setVisible(true);
+            robot.waitForIdle();
+            robot.delay(200);
+            System.out.println("State " + state +
+                                               " insets: " + frame.getInsets());
+
+            frame.setExtendedState(Frame.NORMAL);
+            frame.toFront();
+            robot.waitForIdle();
+            robot.delay(200);
+            Insets insets = frame.getInsets();
+            frame.dispose();
+            System.out.println("State " + state +
+                                           " back to normal insets: " + insets);
+            if(!expectedInsets.equals(insets)) {
+                throw new RuntimeException("Insets are wrong " + insets);
+            }
+        }
+    }
+}
--- a/jdk/test/java/awt/LightweightDispatcher/LWDispatcherMemoryLeakTest.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/java/awt/LightweightDispatcher/LWDispatcherMemoryLeakTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,7 @@
 /*
  @test
  @key headful
- @bug 7079254
+ @bug 7079254 8163261
  @summary Toolkit eventListener leaks memory
  @library ../regtesthelpers
  @build Util
@@ -93,8 +93,15 @@
             }
         }
         alloc = null;
+        String leakObjs = "";
         if (button.get() != null) {
-            throw new Exception("Test failed: JButton was not collected");
+            leakObjs = "JButton";
+        }
+        if (p.get() != null) {
+            leakObjs += " JPanel";
+        }
+        if (leakObjs != "") {
+            throw new Exception("Test failed: " + leakObjs + " not collected");
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Robot/SpuriousMouseEvents/SpuriousMouseEvents.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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
+  @key headful
+  @bug 5097801 8163270
+  @summary Tests that no mouse events are sent to component if robot is
+           moving mouse on another screen, Xinerama
+  @run main SpuriousMouseEvents
+ */
+import java.awt.AWTException;
+import java.awt.GraphicsEnvironment;
+import java.awt.GraphicsDevice;
+import java.awt.Robot;
+import java.awt.GraphicsConfiguration;
+import java.awt.Frame;
+import java.awt.event.MouseMotionAdapter;
+import java.awt.event.MouseEvent;
+
+public class SpuriousMouseEvents {
+
+    private static volatile boolean testPassed = true;
+
+    public static void main(String args[]) throws AWTException {
+        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+        GraphicsDevice[] gds = ge.getScreenDevices();
+        if (gds.length < 2) {
+            return;
+        }
+
+        Robot r = null;
+        try {
+            r = new Robot();
+        } catch (Exception e) {
+            throw new RuntimeException("Couldn't create AWT robot" + e);
+        }
+
+        for (int i = 1; i >= 0; i--) {
+            GraphicsDevice gd = gds[i];
+            GraphicsDevice gdo = gds[1 - i];
+            GraphicsConfiguration gc = gd.getDefaultConfiguration();
+            GraphicsConfiguration gco = gdo.getDefaultConfiguration();
+            Frame f = new Frame("Frame", gc);
+            f.setBounds(gc.getBounds().x + 100, gc.getBounds().y + 100, 200, 200);
+            f.addMouseMotionListener(new MouseMotionAdapter() {
+                public void mouseMoved(MouseEvent me) {
+                    testPassed = false;
+                }
+            });
+            f.setVisible(true);
+
+            r = new Robot(gdo);
+            int x = (int) gco.getBounds().x;
+            for (int j = x; j < x + 400; j += 10) {
+                r.mouseMove(j, 200);
+                r.delay(10);
+            }
+            r.delay(1000);
+
+            f.setVisible(false);
+            f.dispose();
+
+            if (!testPassed) {
+                break;
+            }
+        }
+
+        if (!testPassed) {
+            throw new RuntimeException("Wrong mouse events are sent");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/multiresolution/MultiResolutionIcon/MultiResIconTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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
+ * @key headful
+ * @bug 8149371
+ * @summary multi-res. image: -Dsun.java2d.uiScale does not work for Window
+ * icons (some ambiguity for Window.setIconImages()?)
+ * @run main/othervm/manual -Dsun.java2d.uiScale=2 MultiResIconTest
+ */
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.image.BaseMultiResolutionImage;
+import java.awt.image.BufferedImage;
+import java.util.concurrent.CountDownLatch;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+
+public class MultiResIconTest {
+
+    private static GridBagLayout layout;
+    private static JPanel mainControlPanel;
+    private static JPanel resultButtonPanel;
+    private static JLabel instructionText;
+    private static JButton passButton;
+    private static JButton failButton;
+    private static JDialog f;
+    private static CountDownLatch latch;
+    private static TestFrame frame;
+
+    private static BufferedImage generateImage(int x, Color c) {
+
+        BufferedImage img = new BufferedImage(x, x, BufferedImage.TYPE_INT_RGB);
+        Graphics g = img.getGraphics();
+        g.setColor(c);
+        g.fillRect(0, 0, x, x);
+        g.setColor(Color.WHITE);
+        g.fillRect(x / 3, x / 3, x / 3, x / 3);
+        return img;
+    }
+
+    public MultiResIconTest() {
+        try {
+            latch = new CountDownLatch(1);
+            createUI();
+            latch.await();
+        } catch (Exception ex) {
+        }
+    }
+
+    private static void createUI() throws Exception {
+        SwingUtilities.invokeAndWait(() -> {
+            frame = new TestFrame();
+            f = new JDialog(frame);
+            f.setTitle("Instruction Dialog");
+            layout = new GridBagLayout();
+            mainControlPanel = new JPanel(layout);
+            resultButtonPanel = new JPanel(layout);
+            GridBagConstraints gbc = new GridBagConstraints();
+            String instructions
+                    = "<html>    INSTRUCTIONS:<br><br>"
+                    + "1) Test frame title icon and frame color should be green."
+                    + "<br>"
+                    + "2) Test frame task bar icon should be blue<br>"
+                    + "3) If color are same as mentioned in 1 and 2 press pass<br>"
+                    + "   else press fail.<br><br></html>";
+
+            instructionText = new JLabel();
+            instructionText.setText(instructions);
+
+            gbc.gridx = 0;
+            gbc.gridy = 0;
+            gbc.fill = GridBagConstraints.HORIZONTAL;
+            mainControlPanel.add(instructionText, gbc);
+            passButton = new JButton("Pass");
+            passButton.setActionCommand("Pass");
+            passButton.addActionListener((ActionEvent e) -> {
+                latch.countDown();
+                f.dispose();
+                frame.dispose();
+            });
+            failButton = new JButton("Fail");
+            failButton.setActionCommand("Fail");
+            failButton.addActionListener(new ActionListener() {
+                @Override
+                public void actionPerformed(ActionEvent e) {
+                    latch.countDown();
+                    f.dispose();
+                    frame.dispose();
+                    throw new RuntimeException("Test Failed");
+                }
+            });
+            gbc.gridx = 1;
+            gbc.gridy = 0;
+            resultButtonPanel.add(passButton, gbc);
+            gbc.gridx = 2;
+            gbc.gridy = 0;
+            resultButtonPanel.add(failButton, gbc);
+
+            gbc.gridx = 0;
+            gbc.gridy = 1;
+            mainControlPanel.add(resultButtonPanel, gbc);
+
+            f.add(mainControlPanel);
+            f.setSize(400, 200);
+            f.setLocationRelativeTo(null);
+            f.setVisible(true);
+
+            f.addWindowListener(new WindowAdapter() {
+                @Override
+                public void windowClosing(WindowEvent e) {
+                    latch.countDown();
+                    f.dispose();
+                    frame.dispose();
+                }
+            });
+        });
+    }
+
+    private static class TestFrame extends JFrame {
+
+        private static final int W = 200;
+
+        private static final BaseMultiResolutionImage IMG
+                = new BaseMultiResolutionImage(
+                        new BufferedImage[]{generateImage(W, Color.RED),
+                            generateImage(2 * W, Color.GREEN),
+                            generateImage(4 * W, Color.BLUE)});
+
+        private static final BaseMultiResolutionImage ICON
+                = new BaseMultiResolutionImage(
+                        new BufferedImage[]{generateImage(16, Color.RED),
+                            generateImage(32, Color.GREEN),
+                            generateImage(64, Color.BLUE),
+                            generateImage(128, Color.BLACK),
+                            generateImage(256, Color.GRAY)});
+
+        public TestFrame() {
+            createUI();
+        }
+
+        private void createUI() {
+            setTitle("Test Frame");
+            setIconImage(ICON);
+            addWindowListener(new WindowAdapter() {
+                @Override
+                public void windowClosing(WindowEvent e) {
+                    dispose();
+                }
+            });
+            setSize(W, W);
+            setLocation(50, 50);
+            setResizable(false);
+            setVisible(true);
+        }
+
+        @Override
+        public void paint(Graphics gr) {
+            gr.drawImage(IMG, 0, 0, this);
+        }
+    }
+
+    public static void main(String[] args) {
+        new MultiResIconTest();
+    }
+}
+
--- a/jdk/test/java/awt/image/multiresolution/MultiResolutionTrayIconTest/MultiResolutionTrayIconTest.html	Fri Oct 07 21:28:20 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-<!--
- Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- 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.
--->
-
-<html>
-<head>
-<title> MultiResolutionTrayIconTest </title>
-</head>
-<body>
-<applet code="MultiResolutionTrayIconTest.class" width=100 height=30></applet>
-
-To run test please push "Start" (if system tray is not supported, push "Pass").
-
-Two tray icons will appear (note: sometimes they can go to the tray icons pool).
-
-Please check if both of them have correct size and
-the same colouring (white rectagle in a blue mount). In this case please push "Pass".
-
-Otherwise (if the 2nd red-white small icon appears) please push "Fail".
-
-</body>
-</html>
--- a/jdk/test/java/awt/image/multiresolution/MultiResolutionTrayIconTest/MultiResolutionTrayIconTest.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/java/awt/image/multiresolution/MultiResolutionTrayIconTest/MultiResolutionTrayIconTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -22,96 +22,177 @@
  */
 
 
-/*
-  @test
-  @bug 8150176 8151773
-  @summary Check if correct resolution variant is used for tray icon.
-  @author a.stepanov
-  @run applet/manual=yesno MultiResolutionTrayIconTest.html
-*/
-
-
-import java.applet.Applet;
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.image.*;
-
-
-public class MultiResolutionTrayIconTest extends Applet {
-
-    private SystemTray tray;
-    private TrayIcon   icon, iconMRI;
+/**
+ * @test
+ * @key headful
+ * @bug 8150176 8151773 8150176
+ * @summary Check if correct resolution variant is used for tray icon.
+ * @run main/manual/othervm -Dsun.java2d.uiScale=2 MultiResolutionTrayIconTest
+ */
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.GridBagLayout;
+import java.awt.GridBagConstraints;
+import java.awt.SystemTray;
+import java.awt.TrayIcon;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.image.BaseMultiResolutionImage;
+import java.awt.image.BufferedImage;
+import javax.swing.JFrame;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 
-    public void init() { this.setLayout(new BorderLayout()); }
-
-    public void start() {
-
-        boolean trayIsSupported = SystemTray.isSupported();
-        Button b = new Button("Start");
-        if (trayIsSupported) {
+public class MultiResolutionTrayIconTest {
+    private static SystemTray tray;
+    private static TrayIcon icon;
+    private static GridBagLayout layout;
+    private static JPanel mainControlPanel;
+    private static JPanel resultButtonPanel;
+    private static JLabel instructionText;
+    private static JButton passButton;
+    private static JButton failButton;
+    private static JButton startButton;
+    private static JFrame mainFrame;
+    private static CountDownLatch latch;
 
-            prepareIcons();
-            b.addActionListener(new ActionListener() {
-                @Override
-                public void actionPerformed(ActionEvent e) { doTest(); }
-            });
-        } else {
-             b.setLabel("not supported");
-             b.setEnabled(false);
-             System.out.println("system tray is not supported");
-        }
-        add(b, BorderLayout.CENTER);
-
-        validate();
-        setVisible(true);
+    public static void main(String[] args) throws Exception {
+        latch = new CountDownLatch(1);
+        createUI();
+        latch.await(200, TimeUnit.SECONDS);
     }
 
-    private BufferedImage generateImage(int w, int h, Color c) {
+    public static void createUI() throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                mainFrame = new JFrame("TrayIcon Test");
+                boolean trayIsSupported = SystemTray.isSupported();
+                tray = SystemTray.getSystemTray();
+                Dimension d = tray.getTrayIconSize();
+                icon = new TrayIcon(createIcon(d.width, d.height));
+                icon.setImageAutoSize(true);
+                layout = new GridBagLayout();
+                mainControlPanel = new JPanel(layout);
+                resultButtonPanel = new JPanel(layout);
+
+                GridBagConstraints gbc = new GridBagConstraints();
+                String instructions
+                        = "<html>INSTRUCTIONS:<br>"
+                        + "Press start button to add icon to system tray.<br><br>"
+                        + "If Icon color is green test"
+                        + " passes else failed.<br><br></html>";
+
+                instructionText = new JLabel();
+                instructionText.setText(instructions);
+
+                gbc.gridx = 0;
+                gbc.gridy = 0;
+                gbc.fill = GridBagConstraints.HORIZONTAL;
+                mainControlPanel.add(instructionText, gbc);
+                startButton = new JButton("Start");
+                startButton.setActionCommand("Start");
+                if (trayIsSupported) {
+
+                    startButton.addActionListener((ActionEvent e) -> {
+                        doTest();
+                    });
+                } else {
+                    startButton.setEnabled(false);
+                    System.out.println("system tray is not supported");
+                    latch.countDown();
+                }
+                gbc.gridx = 0;
+                gbc.gridy = 0;
+                resultButtonPanel.add(startButton, gbc);
 
-        BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
+                passButton = new JButton("Pass");
+                passButton.setActionCommand("Pass");
+                passButton.addActionListener((ActionEvent e) -> {
+                    latch.countDown();
+                    removeIcon();
+                    mainFrame.dispose();
+                });
+                failButton = new JButton("Fail");
+                failButton.setActionCommand("Fail");
+                failButton.addActionListener(new ActionListener() {
+                    @Override
+                    public void actionPerformed(ActionEvent e) {
+                        removeIcon();
+                        latch.countDown();
+                        mainFrame.dispose();
+                        throw new RuntimeException("Test Failed");
+                    }
+                });
+                gbc.gridx = 1;
+                gbc.gridy = 0;
+                resultButtonPanel.add(passButton, gbc);
+                gbc.gridx = 2;
+                gbc.gridy = 0;
+                resultButtonPanel.add(failButton, gbc);
+
+                gbc.gridx = 0;
+                gbc.gridy = 1;
+                mainControlPanel.add(resultButtonPanel, gbc);
+
+                mainFrame.add(mainControlPanel);
+                mainFrame.setSize(400, 200);
+                mainFrame.setLocationRelativeTo(null);
+                mainFrame.setVisible(true);
+
+                mainFrame.addWindowListener(new WindowAdapter() {
+                    @Override
+                    public void windowClosing(WindowEvent e) {
+                        removeIcon();
+                        latch.countDown();
+                        mainFrame.dispose();
+                    }
+                });
+            }
+        });
+
+    }
+
+    private static BaseMultiResolutionImage createIcon(int w, int h) {
+        return new BaseMultiResolutionImage(
+                new BufferedImage[]{generateImage(w, h, 1, Color.RED),
+                    generateImage(w, h, 2, Color.GREEN)});
+    }
+
+    private static BufferedImage generateImage(int w, int h, int scale, Color c) {
+
+        int x = w * scale, y = h * scale;
+        BufferedImage img = new BufferedImage(x, y, BufferedImage.TYPE_INT_RGB);
         Graphics g = img.getGraphics();
         g.setColor(c);
-        g.fillRect(0, 0, w, h);
+        g.fillRect(0, 0, x, y);
         g.setColor(Color.WHITE);
-        int r = (Math.min(w, h) >= 8) ? 3 : 1;
-        g.fillRect(r, r, w - 2 * r, h - 2 * r);
+        g.fillRect(x / 3, y / 3, x / 3, y / 3);
         return img;
     }
 
-    private void prepareIcons() {
-
-        tray = SystemTray.getSystemTray();
-        Dimension d = tray.getTrayIconSize();
-        int w = d.width, h = d.height;
+    private static void doTest() {
 
-        BufferedImage img = generateImage(w, h, Color.BLUE);
-        // use wrong icon size for "nok"
-        BufferedImage nok = generateImage(w / 2 + 2, h / 2 + 2, Color.RED);
-        BaseMultiResolutionImage mri =
-            new BaseMultiResolutionImage(new BufferedImage[] {nok, img});
-        icon = new TrayIcon(img);
-        icon.setImageAutoSize(true); // just in case
-        iconMRI = new TrayIcon(mri);
-        iconMRI.setImageAutoSize(true);
-    }
-
-    private void doTest() {
-
-        if (tray.getTrayIcons().length > 0) { return; } // icons were added already
+        if (tray.getTrayIcons().length > 0) {
+            return;
+        }
         try {
             tray.add(icon);
-            tray.add(iconMRI);
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
     }
 
-    public void stop() {
-
-        // check for null, just in case
+    private static void removeIcon() {
         if (tray != null) {
             tray.remove(icon);
-            tray.remove(iconMRI);
         }
     }
 }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/print/PrinterJob/TestCheckSystemDefaultBannerOption.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 8165947
+ * @summary  Verifies System default banner page option is honoured by jdk
+ * @requires (os.family == "linux" | os.family == "solaris")
+ * @run main/manual TestCheckSystemDefaultBannerOption
+ */
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.Graphics;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.print.PageFormat;
+import java.awt.print.Printable;
+import static java.awt.print.Printable.NO_SUCH_PAGE;
+import static java.awt.print.Printable.PAGE_EXISTS;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+import javax.print.attribute.standard.JobSheets;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+
+
+public class TestCheckSystemDefaultBannerOption implements Printable {
+    private static Thread mainThread;
+    private static boolean testPassed;
+    private static boolean testGeneratedInterrupt;
+    private static boolean noJobSheet = false;
+    private static PrinterJob job = null;
+
+    public static void main (String[] args) throws Exception {
+
+        job = PrinterJob.getPrinterJob();
+        if (job.getPrintService() == null) {
+            System.out.println("No printers. Test cannot continue");
+            return;
+        }
+        // check system default banner option and let user know what to expect
+        JobSheets js = (JobSheets)job.getPrintService().
+                getDefaultAttributeValue(JobSheets.class);
+        if (js != null && js.equals(JobSheets.NONE)) {
+            noJobSheet = true;
+        }
+        SwingUtilities.invokeAndWait(() -> {
+            doTest(TestCheckSystemDefaultBannerOption::printTest);
+        });
+        mainThread = Thread.currentThread();
+        try {
+            Thread.sleep(60000);
+        } catch (InterruptedException e) {
+            if (!testPassed && testGeneratedInterrupt) {
+                String banner = noJobSheet ? "Banner page" : " No Banner page";
+                throw new RuntimeException(banner + " is printed");
+            }
+        }
+        if (!testGeneratedInterrupt) {
+            throw new RuntimeException("user has not executed the test");
+        }
+    }
+
+    private static void printTest() {
+        job.setPrintable(new TestCheckSystemDefaultBannerOption());
+        try {
+            job.print();
+        } catch (PrinterException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static synchronized void pass() {
+        testPassed = true;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }
+
+    public static synchronized void fail() {
+        testPassed = false;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }
+
+    private static void doTest(Runnable action) {
+        String banner = null;
+        if (noJobSheet) {
+            banner = "No Banner page";
+        } else {
+            banner = "Banner page";
+        }
+        String description
+                = " A testpage will be sent to printer. \n"
+                + " Please check if " + banner + " is printed \n"
+                + " along with testpage.\n "
+                + " If " + banner + " is printed, press PASS else press FAIL";
+
+        final JDialog dialog = new JDialog();
+        dialog.setTitle("printSelectionTest");
+        JTextArea textArea = new JTextArea(description);
+        textArea.setEditable(false);
+        final JButton testButton = new JButton("Start Test");
+        final JButton passButton = new JButton("PASS");
+        passButton.setEnabled(false);
+        passButton.addActionListener((e) -> {
+            dialog.dispose();
+            pass();
+        });
+        final JButton failButton = new JButton("FAIL");
+        failButton.setEnabled(false);
+        failButton.addActionListener((e) -> {
+            dialog.dispose();
+            fail();
+        });
+        testButton.addActionListener((e) -> {
+            testButton.setEnabled(false);
+            action.run();
+            passButton.setEnabled(true);
+            failButton.setEnabled(true);
+        });
+        JPanel mainPanel = new JPanel(new BorderLayout());
+        mainPanel.add(textArea, BorderLayout.CENTER);
+        JPanel buttonPanel = new JPanel(new FlowLayout());
+        buttonPanel.add(testButton);
+        buttonPanel.add(passButton);
+        buttonPanel.add(failButton);
+        mainPanel.add(buttonPanel, BorderLayout.SOUTH);
+        dialog.add(mainPanel);
+        dialog.pack();
+        dialog.setVisible(true);
+        dialog.addWindowListener(new WindowAdapter() {
+           @Override
+            public void windowClosing(WindowEvent e) {
+                System.out.println("main dialog closing");
+                testGeneratedInterrupt = false;
+                mainThread.interrupt();
+            }
+        });
+    }
+
+    @Override
+    public int print(Graphics g, PageFormat pf, int pi)
+            throws PrinterException {
+        System.out.println("pi = " + pi);
+        g.drawString("Testing", 100, 100);
+        if (pi == 1)
+            return NO_SUCH_PAGE;
+        return PAGE_EXISTS;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/FilePermission/Correctness.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 8164705
+ * @summary Remove pathname canonicalization from FilePermission
+ */
+
+import java.io.FilePermission;
+import java.lang.reflect.Method;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public class Correctness {
+
+    static boolean err = false;
+    static Method containsMethod;
+    static boolean isWindows =
+            System.getProperty("os.name").contains("Windows");
+    public static void main(String args[]) throws Exception {
+        check("/", "/");
+        checkNo("/", "/x");
+        checkNo("/", "/../x");
+
+        checkNo("/", "x");
+
+        check("/-", "/*");
+        checkNo("/*", "/-");
+
+        check("/*", "/x");
+        check("/-", "/x");
+        check("/-", "/x/*");
+        check("/-", "/x/-");
+        check("/-", "/x/y");
+        checkNo("/*", "/x/y");
+        check("/x/*", "/x/x");
+        checkNo("/x/-", "/x");
+        checkNo("/x/*", "/x");
+        check("/x/-", "/x/x");
+        check("/x/-", "/x/x/y");
+        checkNo("/x/*", "/x/x/y");
+        checkNo("/x/*", "/x");
+
+        check("*", "x");
+        checkNo("", "x");
+        check("-", "x");
+        check("-", "*");
+        check("-", "a/-");
+        check("-", "a/*");
+        checkNo("*", "a/b");
+        check("a/*", "a/b");
+        check("a/-", "a/*");
+        check("a/-", "a/b/c");
+        checkNo("a/*", "a/b/c");
+
+        check("../", "../");
+        check("../-", "../*");
+        check("../../*", "../../a");
+
+        // If we allow .. and abs/rel checks
+        check("../-", "a");
+        check("../../-", "-");
+        checkNo("../../*", "a");
+        //check("/-", "a");
+        //checkNo("/*", "a");
+        //check("/-", "-");
+
+        try {
+            // containsPath is broken on Windows.
+            containsMethod = FilePermission.class.getDeclaredMethod(
+                    "containsPath", Path.class, Path.class);
+            containsMethod.setAccessible(true);
+            System.out.println();
+
+            contains("x", "x", 0);
+            contains("x", "x/y", 1);
+            contains("x", "x/y/z", 2);
+            contains("x", "y", -1);
+            contains("x", "", -1);
+            contains("", "", 0);
+            contains("", "x", 1);
+            contains("", "x/y", 2);
+            contains("/", "/", 0);
+            contains("/", "/x", 1);
+            contains("/", "/x/y", 2);
+            contains("/x", "/x/y", 1);
+            contains("/x", "/y", -1);
+            //contains("/", "..", Integer.MAX_VALUE);
+            //contains("/", "x", Integer.MAX_VALUE);
+            //contains("/", "x/y", Integer.MAX_VALUE);
+            //contains("/", "../x", Integer.MAX_VALUE);
+            contains("/x", "y", -1);
+            contains("x", "/y", -1);
+
+            contains("", "..", -1);
+            contains("", "../x", -1);
+            contains("..", "", 1);
+            contains("..", "x", 2);
+            contains("..", "x/y", 3);
+            contains("../x", "x", -1);
+            contains("../x", "y", -1);
+            contains("../x", "../x/y", 1);
+            contains("../../x", "../../x/y", 1);
+            contains("../../../x", "../../../x/y", 1);
+            contains("../x", "../y", -1);
+        } catch (NoSuchMethodException e) {
+            // Ignored
+        }
+        if (err) throw new Exception("Failed.");
+    }
+
+    // Checks if s2 is inside s1 and depth is expected.
+    static void contains(String s1, String s2, int expected) throws Exception {
+        contains0(s1, s2, expected);
+        if (isWindows) {
+            contains0("C:" + s1, s2, -1);
+            contains0(s1, "C:" + s2, -1);
+            contains0("C:" + s1, "D:" + s2, -1);
+            contains0("C:" + s1, "C:" + s2, expected);
+        }
+    }
+
+    static void contains0(String s1, String s2, int expected) throws Exception {
+        Path p1 = Paths.get(s1);
+        Path p2 = Paths.get(s2);
+        int d = (int)containsMethod.invoke(null, p1, p2);
+        Path p;
+        try {
+            p = p2.relativize(p1);
+        } catch (Exception e) {
+            p = null;
+        }
+        System.out.printf("%-20s -> %-20s: %20s %5d %5d %s\n", s1, s2, p,
+                d, expected, d==expected?"":" WRONG");
+        if (d != expected) {
+            err = true;
+        }
+    }
+
+    static void check(String s1, String s2, boolean expected) {
+        FilePermission fp1 = new FilePermission(s1, "read");
+        FilePermission fp2 = new FilePermission(s2, "read");
+        boolean b = fp1.implies(fp2);
+        System.out.printf("%-30s -> %-30s: %5b %s\n",
+                s1, s2, b, b==expected?"":" WRONG");
+        if (b != expected) {
+            err = true;
+            System.out.println(fp1);
+            System.out.println(fp2);
+        }
+    }
+
+    static void check(String s1, String s2) {
+        check(s1, s2, true);
+    }
+
+    static void checkNo(String s1, String s2) {
+        check(s1, s2, false);
+    }
+}
--- a/jdk/test/java/io/FilePermission/FilePermissionCollection.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/java/io/FilePermission/FilePermissionCollection.java	Wed Jul 05 22:19:13 2017 +0200
@@ -47,14 +47,14 @@
             ("test 1: add throws IllegalArgExc for wrong perm type");
         try {
             perms.add(new SecurityPermission("createAccessControlContext"));
-            System.err.println("Expected IllegalArgumentException");
+            System.out.println("Expected IllegalArgumentException");
             testFail++;
         } catch (IllegalArgumentException iae) {}
 
         // test 2
         System.out.println("test 2: implies returns false for wrong perm type");
         if (perms.implies(new SecurityPermission("getPolicy"))) {
-            System.err.println("Expected false, returned true");
+            System.out.println("Expected false, returned true");
             testFail++;
         }
 
@@ -63,7 +63,7 @@
                            "name and action");
         perms.add(new FilePermission("/tmp/foo", "read"));
         if (!perms.implies(new FilePermission("/tmp/foo", "read"))) {
-            System.err.println("Expected true, returned false");
+            System.out.println("Expected true, returned false");
             testFail++;
         }
 
@@ -71,7 +71,7 @@
         System.out.println("test 4: implies returns false for match on " +
                            "name but not action");
         if (perms.implies(new FilePermission("/tmp/foo", "write"))) {
-            System.err.println("Expected false, returned true");
+            System.out.println("Expected false, returned true");
             testFail++;
         }
 
@@ -80,7 +80,7 @@
                            "name and subset of actions");
         perms.add(new FilePermission("/tmp/bar", "read, write"));
         if (!perms.implies(new FilePermission("/tmp/bar", "write"))) {
-            System.err.println("Expected true, returned false");
+            System.out.println("Expected true, returned false");
             testFail++;
         }
 
@@ -90,11 +90,11 @@
         perms.add(new FilePermission("/tmp/baz", "read"));
         perms.add(new FilePermission("/tmp/baz", "write"));
         if (!perms.implies(new FilePermission("/tmp/baz", "read"))) {
-            System.err.println("Expected true, returned false");
+            System.out.println("Expected true, returned false");
             testFail++;
         }
         if (!perms.implies(new FilePermission("/tmp/baz", "write,read"))) {
-            System.err.println("Expected true, returned false");
+            System.out.println("Expected true, returned false");
             testFail++;
         }
 
@@ -103,7 +103,7 @@
                            "and match on action");
         perms.add(new FilePermission("/usr/tmp/*", "read"));
         if (!perms.implies(new FilePermission("/usr/tmp/foo", "read"))) {
-            System.err.println("Expected true, returned false");
+            System.out.println("Expected true, returned false");
             testFail++;
         }
 
@@ -111,7 +111,7 @@
         System.out.println
             ("test 8: implies returns false for non-match on wildcard");
         if (perms.implies(new FilePermission("/usr/tmp/bar/foo", "read"))) {
-            System.err.println("Expected false, returned true");
+            System.out.println("Expected false, returned true");
             testFail++;
         }
 
@@ -120,25 +120,25 @@
             ("test 9: implies returns true for deep wildcard match");
         perms.add(new FilePermission("/usr/tmp/-", "read"));
         if (!perms.implies(new FilePermission("/usr/tmp/bar/foo", "read"))) {
-            System.err.println("Expected true, returned false");
+            System.out.println("Expected true, returned false");
             testFail++;
         }
 
         // test 10
-        System.out.println("test 10: implies returns true for relative match");
+        //System.out.println("test 10: implies returns true for relative match");
         perms.add(new FilePermission(".", "read"));
-        if (!perms.implies(new FilePermission(System.getProperty("user.dir"),
-                                              "read"))) {
-            System.err.println("Expected true, returned false");
-            testFail++;
-        }
+        //if (!perms.implies(new FilePermission(System.getProperty("user.dir"),
+        //                                      "read"))) {
+        //    System.out.println("Expected true, returned false");
+        //    testFail++;
+        //}
 
         // test 11
         System.out.println("test 11: implies returns true for all " +
                            "wildcard and match on action");
         perms.add(new FilePermission("<<ALL FILES>>", "read"));
         if (!perms.implies(new FilePermission("/tmp/foobar", "read"))) {
-            System.err.println("Expected true, returned false");
+            System.out.println("Expected true, returned false");
             testFail++;
         }
 
@@ -146,7 +146,7 @@
         System.out.println("test 12: implies returns false for wildcard " +
                            "and non-match on action");
         if (perms.implies(new FilePermission("/tmp/foobar", "write"))) {
-            System.err.println("Expected false, returned true");
+            System.out.println("Expected false, returned true");
             testFail++;
         }
 
@@ -160,7 +160,7 @@
         }
         // the two "/tmp/baz" entries were combined into one
         if (numPerms != 7) {
-            System.err.println("Expected 7, got " + numPerms);
+            System.out.println("Expected 7, got " + numPerms);
             testFail++;
         }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/FilePermission/FilePermissionTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.io.FilePermission;
+import java.util.Arrays;
+import java.util.List;
+
+/*
+ * @test
+ * @bug 8156054
+ * @summary Test some of FilePermission methods when canonicalization property
+ *          set and un-set.
+ * @run main/othervm -Djdk.io.permissionsUseCanonicalPath=true
+ *      FilePermissionTest truetruetruetruetruetrue
+ * @run main/othervm -Djdk.io.permissionsUseCanonicalPath=false
+ *      FilePermissionTest falsefalsefalsefalsefalsefalse
+ * @run main FilePermissionTest falsefalsefalsefalsefalsefalse
+ */
+public class FilePermissionTest {
+
+    public static void main(String[] args) throws Exception {
+
+        final File realFile = new File("exist.file");
+        try {
+            if (!realFile.createNewFile()) {
+                throw new RuntimeException("Unable to create a file.");
+            }
+            check(Arrays.asList(realFile.getName(), "notexist.file"), args[0]);
+        } finally {
+            if (realFile.exists()) {
+                realFile.delete();
+            }
+        }
+    }
+
+    private static void check(List<String> files, String expected) {
+
+        StringBuilder actual = new StringBuilder();
+        files.forEach(f -> {
+            StringBuilder result = new StringBuilder();
+            FilePermission fp1 = new FilePermission(f, "read");
+            FilePermission fp2 = new FilePermission(
+                    new File(f).getAbsolutePath(), "read");
+            result.append(fp1.equals(fp2));
+            result.append(fp1.implies(fp2));
+            result.append(fp1.hashCode() == fp2.hashCode());
+            System.out.println(fp1 + " Vs. " + fp2 + " : Result: " + result);
+            actual.append(result);
+        });
+        if (!expected.equals(actual.toString())) {
+            throw new RuntimeException("Failed: " + expected + "/" + actual);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/FilePermission/ReadFileOnPath.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 8164705
+ * @library /lib/testlibrary /test/lib
+ * @modules java.base/jdk.internal.misc
+ * @run main ReadFileOnPath
+ * @summary Still able to read file on the same path
+ */
+
+import jdk.test.lib.process.ProcessTools;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class ReadFileOnPath {
+
+    private static final Path SRC_DIR    = Paths.get(System.getProperty("test.src"));
+    private static final Path HERE_DIR   = Paths.get(".");
+    private static final Path MODS_DIR   = Paths.get("modules");
+
+    public static void main(String args[]) throws Exception {
+        CompilerUtils.compile(SRC_DIR.resolve("m"), MODS_DIR.resolve("m"));
+        Files.write(MODS_DIR.resolve("m/base"), "base".getBytes());
+        Files.write(MODS_DIR.resolve("m/p/child"), "child".getBytes());
+        JarUtils.createJarFile(HERE_DIR.resolve("old.jar"),
+                MODS_DIR.resolve("m"),
+                "base", "p/App.class", "p/child");
+        JarUtils.createJarFile(HERE_DIR.resolve("new.jar"),
+                MODS_DIR.resolve("m"),
+                "module-info.class", "base", "p/App.class", "p/child");
+
+        // exploded module
+        test("--module-path", "modules", "-m", "m/p.App", "SS+++++");
+
+        // module in jar
+        test("--module-path", "new.jar", "-m", "m/p.App", "SSSS++0");
+
+        // exploded classpath
+        test("-cp", "modules/m", "p.App", "SS+++++");
+
+        // classpath in jar
+        test("-cp", "old.jar", "p.App", "SSSS++0");
+    }
+
+    static void test(String... args) throws Exception {
+        List<String> cmds = new ArrayList<>();
+        cmds.add("-Djava.security.manager");
+        cmds.addAll(Arrays.asList(args));
+        cmds.addAll(List.of(
+                "x", "modules/m", "modules/m/base", "modules/m/p/child",
+                "-", "child", "/base", "../base"));
+        ProcessTools.executeTestJvm(cmds.toArray(new String[cmds.size()]))
+                .shouldHaveExitValue(0);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/FilePermission/m/module-info.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,3 @@
+module m {
+    exports p;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/FilePermission/m/p/App.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,44 @@
+package p;
+import java.io.InputStream;
+import java.io.FileInputStream;
+public class App {
+    public static void main(String[] args) throws Exception {
+        boolean f = true;
+        StringBuilder sb = new StringBuilder();
+        String expected = null;
+        for (String s: args) {
+            if (expected == null) {
+                expected = s;
+            } else if (s.equals("-")) {
+                f = false;
+            } else if (f) {
+                try (InputStream is = new FileInputStream(s)) {
+                    is.readAllBytes();
+                    sb.append('+');
+                } catch (SecurityException se) {
+                    System.out.println(se);
+                    sb.append('S');
+                } catch (Exception e) {
+                    System.out.println(e);
+                    sb.append('-');
+                }
+            } else {
+                try (InputStream is = App.class.getResourceAsStream(s)) {
+                    is.readAllBytes();
+                    sb.append('+');
+                } catch (NullPointerException npe) {
+                    System.out.println(npe);
+                    sb.append('0');
+                } catch (Exception e) {
+                    System.out.println(e);
+                    sb.append('-');
+                }
+            }
+        }
+        if (!sb.toString().equals(expected)) {
+            throw new Exception("Expected " + expected + ", actually " + sb);
+        } else {
+            System.out.println("OK");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ClassLoader/forNameLeak/ClassForName.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.net.URLClassLoader;
+
+/*
+ * This class is loaded by the custom URLClassLoader, and then calls
+ * Class.forName();
+ */
+public class ClassForName implements Runnable {
+    static {
+        if (!(ClassForName.class.getClassLoader() instanceof URLClassLoader)) {
+            throw new RuntimeException("Supposed to be loaded by URLClassLoader");
+        }
+    }
+
+    public void run() {
+        try {
+            Class.forName(java.util.List.class.getName(), false,
+                          ClassLoader.getSystemClassLoader());
+        } catch (Throwable e) {
+            e.printStackTrace();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ClassLoader/forNameLeak/ClassForNameLeak.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 8151486
+ * @summary Call Class.forName() on the system classloader from a class loaded
+ *          from a custom classloader.
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.Utils JarUtils
+ * @build ClassForName ClassForNameLeak
+ * @run main/othervm/policy=test.policy -Djava.security.manager ClassForNameLeak
+ */
+
+import java.lang.ref.PhantomReference;
+import java.lang.ref.Reference;
+import java.lang.ref.ReferenceQueue;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import jdk.testlibrary.Utils;
+
+/*
+ * Create .jar, load ClassForName from .jar using a URLClassLoader
+ */
+public class ClassForNameLeak {
+    private static final long TIMEOUT = (long)(5000.0 * Utils.TIMEOUT_FACTOR);
+    private static final String TESTCLASSES = System.getProperty("test.classes", ".");
+    private static final String CLASSFILENAME = "ClassForName.class";
+    private static final int THREADS = 10;
+    private static final ReferenceQueue<ClassLoader> rq = new ReferenceQueue<>();
+
+    // Use a new classloader to load the ClassForName class, then run its
+    // Runnable.
+    public static PhantomReference<ClassLoader> loadAndRun(Path jarFilePath)
+            throws Exception {
+        ClassLoader classLoader = new URLClassLoader(
+                new URL[]{jarFilePath.toUri().toURL()}) {
+            @Override public String toString() { return "LeakedClassLoader"; }
+        };
+
+        Class<?> loadClass = Class.forName("ClassForName", true, classLoader);
+        ((Runnable) loadClass.newInstance()).run();
+
+        PhantomReference<ClassLoader> ref = new PhantomReference<>(classLoader, rq);
+        System.out.println("returning phantom ref: " + ref + " to " + classLoader);
+        return ref;
+    }
+
+    public static void main(final String[] args) throws Exception {
+        // Create a temporary .jar file containing ClassForName.class
+        Path testClassesDir = Paths.get(TESTCLASSES);
+        Path jarFilePath = Files.createTempFile("cfn", ".jar");
+        JarUtils.createJarFile(jarFilePath, testClassesDir, CLASSFILENAME);
+        jarFilePath.toFile().deleteOnExit();
+
+        // Remove the ClassForName.class file that jtreg built, to make sure
+        // we're loading from the tmp .jar
+        Path classFile = FileSystems.getDefault().getPath(TESTCLASSES,
+                                                          CLASSFILENAME);
+        Files.delete(classFile);
+
+        // Make simultaneous calls to the test method, to stress things a bit
+        ExecutorService es = Executors.newFixedThreadPool(THREADS);
+
+        List<Callable<PhantomReference<ClassLoader>>> callables =
+                Stream.generate(() -> {
+                    Callable<PhantomReference<ClassLoader>> cprcl = () -> {
+                        return loadAndRun(jarFilePath);
+                    };
+                    return cprcl;
+                }).limit(THREADS).collect(Collectors.toList());
+
+        List<Future<PhantomReference<ClassLoader>>> refs = es.invokeAll(callables);
+
+        // Give the GC a chance to enqueue the PhantomReferences
+        for (int i = 0; i < 10; i++) {
+            System.gc();
+        }
+        // Make sure all PhantomReferences to the leaked classloader are enqueued
+        for (int j = 0; j < THREADS; j++) {
+            Reference rmRef = rq.remove(TIMEOUT);
+            if (rmRef == null) {
+                throw new RuntimeException("ClassLoader was never enqueued!");
+            } else {
+                System.out.println("Enqueued " + rmRef);
+            }
+        }
+        System.out.println("All Classloaders successfully enqued");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ClassLoader/forNameLeak/test.policy	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,6 @@
+grant {
+  permission java.io.FilePermission "<<ALL FILES>>", "read, write, delete";
+  permission java.lang.RuntimePermission "createClassLoader";
+  permission java.lang.RuntimePermission "getClassLoader";
+  permission java.util.PropertyPermission "*", "read"; /* for Utils */
+};
--- a/jdk/test/java/lang/Math/FusedMultiplyAddTests.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/java/lang/Math/FusedMultiplyAddTests.java	Wed Jul 05 22:19:13 2017 +0200
@@ -221,6 +221,9 @@
 
             {Double.MIN_VALUE, -0.0, +0.0,
              +0.0},
+
+            {1.0+Math.ulp(1.0), 1.0+Math.ulp(1.0), -1.0-2.0*Math.ulp(1.0),
+             Math.ulp(1.0)*Math.ulp(1.0)},
         };
 
         for (double[] testCase: testCases)
@@ -344,6 +347,9 @@
 
             {Float.MAX_VALUE, 2.0f, 1.0f,
              InfinityF},
+
+            {1.0f+Math.ulp(1.0f), 1.0f+Math.ulp(1.0f), -1.0f-2.0f*Math.ulp(1.0f),
+             Math.ulp(1.0f)*Math.ulp(1.0f)},
         };
 
         for (float[] testCase: testCases)
--- a/jdk/test/java/lang/instrument/DaemonThread/TestDaemonThreadLauncher.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/java/lang/instrument/DaemonThread/TestDaemonThreadLauncher.java	Wed Jul 05 22:19:13 2017 +0200
@@ -1,6 +1,6 @@
 /*
  * Copyright 2014 Goldman Sachs.
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@
             ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-javaagent:DummyAgent.jar", "TestDaemonThread", ".");
             OutputAnalyzer analyzer = ProcessTools.executeProcess(pb);
             analyzer.shouldNotContain("ASSERTION FAILED");
+            analyzer.shouldHaveExitValue(0);
         }
     }
 }
--- a/jdk/test/java/net/URLClassLoader/getresourceasstream/Test.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/java/net/URLClassLoader/getresourceasstream/Test.java	Wed Jul 05 22:19:13 2017 +0200
@@ -26,12 +26,12 @@
 
 public class Test {
     public static void main (String[] args) throws Exception {
-        test1();
+        test1(args[0]);
     }
 
-    public static void test1 () throws Exception {
+    public static void test1 (String s) throws Exception {
         URLClassLoader cl = new URLClassLoader (new URL[] {
-            new URL ("file:./test.jar")
+            new URL ("file:" + s)
         });
         Class clazz = Class.forName ("Test\u00a3", true, cl);
         InputStream is = clazz.getResourceAsStream ("Test\u00a3.class");
--- a/jdk/test/java/net/URLClassLoader/getresourceasstream/test.sh	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/java/net/URLClassLoader/getresourceasstream/test.sh	Wed Jul 05 22:19:13 2017 +0200
@@ -39,18 +39,33 @@
 
 checkExit () {
     if [ $? != 0 ]; then
-	exit 1;
+	exit $1;
     fi
 }
 
 ${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . ${TESTSRC}/Test.java
 cp ${TESTSRC}/test.jar .
 
-${TESTJAVA}/bin/java ${TESTVMOPTS} Test
-checkExit 
+${TESTJAVA}/bin/java ${TESTVMOPTS} Test ./test.jar
+checkExit 1
 
 # try with security manager
 
-${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.security.policy=file:./policy -Djava.security.manager Test
-checkExit 
+${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.security.policy=file:./policy \
+		-Djava.security.manager Test ./test.jar
+checkExit 2
+
+mkdir tmp
+cd tmp
+${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.security.policy=file:../policy \
+		-cp .. -Djava.security.manager Test ../test.jar
+checkExit 3
+
+cd ..
+THISDIR=$(basename $(pwd))
+cd ..
+${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.security.policy=file:$THISDIR/policy \
+		-cp $THISDIR -Djava.security.manager Test $THISDIR/test.jar
+checkExit 4
+
 exit 0
--- a/jdk/test/java/net/httpclient/http2/ErrorTest.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/java/net/httpclient/http2/ErrorTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -28,6 +28,7 @@
  * @library /lib/testlibrary
  * @build jdk.testlibrary.SimpleSSLContext
  * @modules java.httpclient
+ *          java.security.jgss
  * @compile/module=java.httpclient java/net/http/BodyOutputStream.java
  * @compile/module=java.httpclient java/net/http/BodyInputStream.java
  * @compile/module=java.httpclient java/net/http/EchoHandler.java
@@ -41,18 +42,21 @@
  * @summary check exception thrown when bad TLS parameters selected
  */
 
-import java.io.*;
-import java.net.*;
-import java.net.http.*;
-import static java.net.http.HttpClient.Version.HTTP_2;
-import javax.net.ssl.*;
-import java.nio.file.*;
-import java.util.concurrent.*;
+import java.io.IOException;
+import java.net.URI;
+import java.net.http.EchoHandler;
+import java.net.http.HttpClient;
+import java.net.http.Http2TestServer;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+import java.util.concurrent.ExecutorService;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLParameters;
 import jdk.testlibrary.SimpleSSLContext;
 
+import org.testng.annotations.Test;
 
-import org.testng.annotations.Test;
-import org.testng.annotations.Parameters;
+import static java.net.http.HttpClient.Version.HTTP_2;
 
 /**
  * When selecting an unacceptable cipher suite the TLS handshake will fail.
--- a/jdk/test/java/net/httpclient/http2/HpackDriver.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/java/net/httpclient/http2/HpackDriver.java	Wed Jul 05 22:19:13 2017 +0200
@@ -33,7 +33,6 @@
  * @run testng/othervm java.httpclient/sun.net.httpclient.hpack.CircularBufferTest
  * @run testng/othervm java.httpclient/sun.net.httpclient.hpack.DecoderTest
  * @run testng/othervm java.httpclient/sun.net.httpclient.hpack.EncoderTest
- * @run testng/othervm java.httpclient/sun.net.httpclient.hpack.HeaderTableTest
  * @run testng/othervm java.httpclient/sun.net.httpclient.hpack.HuffmanTest
  * @run testng/othervm java.httpclient/sun.net.httpclient.hpack.TestHelper
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/httpclient/http2/HpackDriverHeaderTable.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 8153353
+ * @modules java.httpclient/sun.net.httpclient.hpack
+ *          jdk.localedata
+ * @key randomness
+ * @compile/module=java.httpclient sun/net/httpclient/hpack/SpecHelper.java
+ * @compile/module=java.httpclient sun/net/httpclient/hpack/TestHelper.java
+ * @compile/module=java.httpclient sun/net/httpclient/hpack/BuffersTestingKit.java
+ * @run testng/othervm java.httpclient/sun.net.httpclient.hpack.HeaderTableTest
+ */
+public class HpackDriverHeaderTable { }
--- a/jdk/test/java/net/httpclient/security/Driver.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/java/net/httpclient/security/Driver.java	Wed Jul 05 22:19:13 2017 +0200
@@ -23,10 +23,12 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 8087112
  * @library /lib/testlibrary/
+ * @modules java.httpclient
+ *          jdk.httpserver
  * @build jdk.testlibrary.SimpleSSLContext jdk.testlibrary.Utils
  * @compile ../../../../com/sun/net/httpserver/LogFilter.java
  * @compile ../../../../com/sun/net/httpserver/FileServerHandler.java
@@ -43,11 +45,14 @@
  * The tests are in Security.java and port number supplied in -Dport.number
  * and -Dport.number1 for tests that require a second free port
  */
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
-import java.io.*;
-import java.net.*;
 
 import jdk.testlibrary.OutputAnalyzer;
 import jdk.testlibrary.Utils;
--- a/jdk/test/java/net/spi/URLStreamHandlerProvider/Basic.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/java/net/spi/URLStreamHandlerProvider/Basic.java	Wed Jul 05 22:19:13 2017 +0200
@@ -21,11 +21,19 @@
  * questions.
  */
 
-import java.io.*;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.Reader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.SequenceInputStream;
+import java.io.StringWriter;
+import java.io.Writer;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.util.*;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
@@ -46,6 +54,7 @@
  * @test
  * @bug 8064924
  * @modules java.compiler
+ *          jdk.compiler
  * @summary Basic test for URLStreamHandlerProvider
  * @library /lib/testlibrary
  * @build jdk.testlibrary.FileUtils jdk.testlibrary.JDKToolFinder
--- a/jdk/test/java/security/testlibrary/Proc.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/java/security/testlibrary/Proc.java	Wed Jul 05 22:19:13 2017 +0200
@@ -29,6 +29,7 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.security.Permission;
+import java.security.Principal;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Base64;
@@ -37,6 +38,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
 /**
@@ -49,7 +51,8 @@
  *        .args("x")            // with args
  *        .env("env", "value")  // and an environment variable
  *        .prop("key","value")  // and a system property
- *        .perm(perm)           // with granted permissions
+ *        .grant(file)          // grant codes in this codebase
+ *        .perm(perm)           // with the permission
  *        .start();             // and start
  *
  * create/start must be called, args/env/prop/perm can be called zero or
@@ -57,7 +60,7 @@
  *
  * The controller can call inheritIO to share its I/O to the process.
  * Otherwise, it can send data into a proc's stdin with write/println, and
- * read its stdout with readLine. stderr is always redirected to DFILE
+ * read its stdout with readLine. stderr is always redirected to a file
  * unless nodump() is called. A protocol is designed to make
  * data exchange among the controller and the processes super easy, in which
  * useful data are always printed with a special prefix ("PROCISFUN:").
@@ -84,10 +87,10 @@
  *
  * As the Proc objects are hidden so deeply, two static methods, d(String) and
  * d(Throwable) are provided to output info into stderr, where they will
- * normally be appended messages to DFILE (unless nodump() is called).
+ * normally be appended messages to a debug file (unless nodump() is called).
  * Developers can view the messages in real time by calling
  *
- *    tail -f proc.debug
+ *    {@code tail -f stderr.<debug>}
  *
  * TODO:
  *
@@ -104,19 +107,24 @@
     private BufferedReader br;      // the stdout of a process
     private String launcher;        // Optional: the java program
 
-    private List<Permission> perms = new ArrayList<>();
     private List<String> args = new ArrayList<>();
     private Map<String,String> env = new HashMap<>();
     private Map<String,String> prop = new HashMap();
     private boolean inheritIO = false;
     private boolean noDump = false;
 
+    private List<String> cp;        // user-provided classpath
     private String clazz;           // Class to launch
     private String debug;           // debug flag, controller will show data
-                                    // transfer between procs
+                                    // transfer between procs. If debug is set,
+                                    // it MUST be different between Procs.
 
     final private static String PREFIX = "PROCISFUN:";
-    final private static String DFILE = "proc.debug";
+
+    // policy file
+    final private StringBuilder perms = new StringBuilder();
+    // temporary saving the grant line in a policy file
+    final private StringBuilder grant = new StringBuilder();
 
     // The following methods are called by controllers
 
@@ -168,10 +176,68 @@
         prop.put(a, b);
         return this;
     }
-    // Adds a perm to policy. Can be called multiple times. In order to make it
-    // effective, please also call prop("java.security.manager", "").
+    // Sets classpath. If not called, Proc will choose a classpath. If called
+    // with no arg, no classpath will be used. Can be called multiple times.
+    public Proc cp(String... s) {
+        if (cp == null) {
+            cp = new ArrayList<>();
+        }
+        cp.addAll(Arrays.asList(s));
+        return this;
+    }
+    // Adds a permission to policy. Can be called multiple times.
+    // All perm() calls after a series of grant() calls are grouped into
+    // a single grant block. perm() calls before any grant() call are grouped
+    // into a grant block with no restriction.
+    // Please note that in order to make permissions effective, also call
+    // prop("java.security.manager", "").
     public Proc perm(Permission p) {
-        perms.add(p);
+        if (grant.length() != 0) {      // Right after grant(s)
+            if (perms.length() != 0) {  // Not first block
+                perms.append("};\n");
+            }
+            perms.append("grant ").append(grant).append(" {\n");
+            grant.setLength(0);
+        } else {
+            if (perms.length() == 0) {  // First block w/o restriction
+                perms.append("grant {\n");
+            }
+        }
+        if (p.getActions().isEmpty()) {
+            String s = String.format("%s \"%s\"",
+                    p.getClass().getCanonicalName(),
+                    p.getName()
+                            .replace("\\", "\\\\").replace("\"", "\\\""));
+            perms.append("    permission ").append(s).append(";\n");
+        } else {
+            String s = String.format("%s \"%s\", \"%s\"",
+                    p.getClass().getCanonicalName(),
+                    p.getName()
+                            .replace("\\", "\\\\").replace("\"", "\\\""),
+                    p.getActions());
+            perms.append("    permission ").append(s).append(";\n");
+        }
+        return this;
+    }
+
+    // Adds a grant option to policy. If called in a row, a single grant block
+    // with all options will be created. If there are perm() call(s) between
+    // grant() calls, they belong to different grant blocks
+
+    // grant on a principal
+    public Proc grant(Principal p) {
+        grant.append("principal ").append(p.getClass().getName())
+                .append(" \"").append(p.getName()).append("\", ");
+        return this;
+    }
+    // grant on a codebase
+    public Proc grant(File f) {
+        grant.append("codebase \"").append(f.toURI()).append("\", ");
+        return this;
+    }
+    // arbitrary grant
+    public Proc grant(String v) {
+        grant.append(v).append(", ");
         return this;
     }
     // Starts the proc
@@ -191,30 +257,22 @@
         Collections.addAll(cmd, splitProperty("test.vm.opts"));
         Collections.addAll(cmd, splitProperty("test.java.opts"));
 
-        cmd.add("-cp");
-        cmd.add(System.getProperty("test.class.path") + File.pathSeparator +
-                System.getProperty("test.src.path"));
+        if (cp == null) {
+            cmd.add("-cp");
+            cmd.add(System.getProperty("test.class.path") + File.pathSeparator +
+                    System.getProperty("test.src.path"));
+        } else if (!cp.isEmpty()) {
+            cmd.add("-cp");
+            cmd.add(cp.stream().collect(Collectors.joining(File.pathSeparator)));
+        }
 
         for (Entry<String,String> e: prop.entrySet()) {
             cmd.add("-D" + e.getKey() + "=" + e.getValue());
         }
-        if (!perms.isEmpty()) {
-            Path p = Files.createTempFile(
-                    Paths.get(".").toAbsolutePath(), "policy", null);
-            StringBuilder sb = new StringBuilder();
-            sb.append("grant {\n");
-            for (Permission perm: perms) {
-                // Sometimes a permission has no name or actions.
-                // but it's safe to use an empty string.
-                String s = String.format("%s \"%s\", \"%s\"",
-                        perm.getClass().getCanonicalName(),
-                        perm.getName()
-                                .replace("\\", "\\\\").replace("\"", "\\\""),
-                        perm.getActions());
-                sb.append("    permission ").append(s).append(";\n");
-            }
-            sb.append("};\n");
-            Files.write(p, sb.toString().getBytes());
+        if (perms.length() > 0) {
+            Path p = Paths.get(getId("policy")).toAbsolutePath();
+            perms.append("};\n");
+            Files.write(p, perms.toString().getBytes());
             cmd.add("-Djava.security.policy=" + p.toString());
         }
         cmd.add(clazz);
@@ -223,6 +281,15 @@
         }
         if (debug != null) {
             System.out.println("PROC: " + debug + " cmdline: " + cmd);
+            for (String c : cmd) {
+                if (c.indexOf('\\') >= 0 || c.indexOf(' ') > 0) {
+                    System.out.print('\'' + c + '\'');
+                } else {
+                    System.out.print(c);
+                }
+                System.out.print(' ');
+            }
+            System.out.println();
         }
         ProcessBuilder pb = new ProcessBuilder(cmd);
         for (Entry<String,String> e: env.entrySet()) {
@@ -233,12 +300,17 @@
         } else if (noDump) {
             pb.redirectError(ProcessBuilder.Redirect.INHERIT);
         } else {
-            pb.redirectError(ProcessBuilder.Redirect.appendTo(new File(DFILE)));
+            pb.redirectError(ProcessBuilder.Redirect
+                    .appendTo(new File(getId("stderr"))));
         }
         p = pb.start();
         br = new BufferedReader(new InputStreamReader(p.getInputStream()));
         return this;
     }
+    String getId(String prefix) {
+        if (debug != null) return prefix + "." + debug;
+        else return prefix + "." + System.identityHashCode(this);
+    }
     // Reads a line from stdout of proc
     public String readLine() throws IOException {
         String s = br.readLine();
--- a/jdk/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java	Wed Jul 05 22:19:13 2017 +0200
@@ -49,7 +49,7 @@
 
 /*
  * @test
- * @bug 8081022 8151876
+ * @bug 8081022 8151876 8166875
  * @key randomness
  */
 
--- a/jdk/test/java/time/test/java/time/format/ZoneName.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/java/time/test/java/time/format/ZoneName.java	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -378,6 +378,7 @@
         "Europe/Helsinki", "Europe_Eastern", "Europe/Bucharest",
         "America/Nome", "Alaska", "America/Juneau",
         "Asia/Yakutsk", "Yakutsk", "Asia/Yakutsk",
+        "Asia/Yangon", "Myanmar", "Asia/Rangoon",
         "Africa/Conakry", "GMT", "Atlantic/Reykjavik",
         "Asia/Seoul", "Korea", "Asia/Seoul",
         "America/Antigua", "Atlantic", "America/Halifax",
@@ -747,6 +748,7 @@
         "NZ", "Pacific/Auckland",
         "Asia/Tel_Aviv", "Asia/Jerusalem",
         "Hongkong", "Asia/Hong_Kong",
+        "Asia/Rangoon", "Asia/Yangon",
     };
 
     private static final Map<String, String> zidToMzone = new HashMap<>();
--- a/jdk/test/java/util/TimeZone/TimeZoneTest.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/java/util/TimeZone/TimeZoneTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 4028006 4044013 4096694 4107276 4107570 4112869 4130885 7039469 7126465 7158483
- *      8008577 8077685 8098547 8133321 8138716 8148446 8151876 8159684
+ *      8008577 8077685 8098547 8133321 8138716 8148446 8151876 8159684 8166875
  * @modules java.base/sun.util.resources
  * @library /java/text/testlib
  * @summary test TimeZone
--- a/jdk/test/java/util/concurrent/tck/AtomicBoolean9Test.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/java/util/concurrent/tck/AtomicBoolean9Test.java	Wed Jul 05 22:19:13 2017 +0200
@@ -162,6 +162,19 @@
     }
 
     /**
+     * repeated weakCompareAndSetPlain succeeds in changing value when equal
+     * to expected
+     */
+    public void testWeakCompareAndSetPlain() {
+        AtomicBoolean ai = new AtomicBoolean(true);
+        do {} while (!ai.weakCompareAndSetPlain(true, false));
+        do {} while (!ai.weakCompareAndSetPlain(false, false));
+        assertFalse(ai.get());
+        do {} while (!ai.weakCompareAndSetPlain(false, true));
+        assertTrue(ai.get());
+    }
+
+    /**
      * repeated weakCompareAndSetVolatile succeeds in changing value when equal
      * to expected
      */
--- a/jdk/test/java/util/concurrent/tck/AtomicInteger9Test.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/java/util/concurrent/tck/AtomicInteger9Test.java	Wed Jul 05 22:19:13 2017 +0200
@@ -162,6 +162,19 @@
     }
 
     /**
+     * repeated weakCompareAndSetPlain succeeds in changing value when equal
+     * to expected
+     */
+    public void testWeakCompareAndSetPlain() {
+        AtomicInteger ai = new AtomicInteger(1);
+        do {} while (!ai.weakCompareAndSetPlain(1, 2));
+        do {} while (!ai.weakCompareAndSetPlain(2, -4));
+        assertEquals(-4, ai.get());
+        do {} while (!ai.weakCompareAndSetPlain(-4, 7));
+        assertEquals(7, ai.get());
+    }
+
+    /**
      * repeated weakCompareAndSetVolatile succeeds in changing value when equal
      * to expected
      */
--- a/jdk/test/java/util/concurrent/tck/AtomicIntegerArray9Test.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/java/util/concurrent/tck/AtomicIntegerArray9Test.java	Wed Jul 05 22:19:13 2017 +0200
@@ -62,6 +62,7 @@
                 () -> aa.compareAndExchange(j, 1, 2),
                 () -> aa.compareAndExchangeAcquire(j, 1, 2),
                 () -> aa.compareAndExchangeRelease(j, 1, 2),
+                () -> aa.weakCompareAndSetPlain(j, 1, 2),
                 () -> aa.weakCompareAndSetVolatile(j, 1, 2),
                 () -> aa.weakCompareAndSetAcquire(j, 1, 2),
                 () -> aa.weakCompareAndSetRelease(j, 1, 2),
@@ -216,6 +217,22 @@
     }
 
     /**
+     * repeated weakCompareAndSetPlain succeeds in changing value when equal
+     * to expected
+     */
+    public void testWeakCompareAndSetPlain() {
+        AtomicIntegerArray aa = new AtomicIntegerArray(SIZE);
+        for (int i = 0; i < SIZE; i++) {
+            aa.set(i, 1);
+            do {} while (!aa.weakCompareAndSetPlain(i, 1, 2));
+            do {} while (!aa.weakCompareAndSetPlain(i, 2, -4));
+            assertEquals(-4, aa.get(i));
+            do {} while (!aa.weakCompareAndSetPlain(i, -4, 7));
+            assertEquals(7, aa.get(i));
+        }
+    }
+
+    /**
      * repeated weakCompareAndSetVolatile succeeds in changing value when equal
      * to expected
      */
--- a/jdk/test/java/util/concurrent/tck/AtomicLong9Test.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/java/util/concurrent/tck/AtomicLong9Test.java	Wed Jul 05 22:19:13 2017 +0200
@@ -162,6 +162,19 @@
     }
 
     /**
+     * repeated weakCompareAndSetPlain succeeds in changing value when equal
+     * to expected
+     */
+    public void testWeakCompareAndSetPlain() {
+        AtomicLong ai = new AtomicLong(1);
+        do {} while (!ai.weakCompareAndSetPlain(1, 2));
+        do {} while (!ai.weakCompareAndSetPlain(2, -4));
+        assertEquals(-4, ai.get());
+        do {} while (!ai.weakCompareAndSetPlain(-4, 7));
+        assertEquals(7, ai.get());
+    }
+
+    /**
      * repeated weakCompareAndSetVolatile succeeds in changing value when equal
      * to expected
      */
--- a/jdk/test/java/util/concurrent/tck/AtomicLongArray9Test.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/java/util/concurrent/tck/AtomicLongArray9Test.java	Wed Jul 05 22:19:13 2017 +0200
@@ -61,6 +61,7 @@
                 () -> aa.compareAndExchange(j, 1, 2),
                 () -> aa.compareAndExchangeAcquire(j, 1, 2),
                 () -> aa.compareAndExchangeRelease(j, 1, 2),
+                () -> aa.weakCompareAndSetPlain(j, 1, 2),
                 () -> aa.weakCompareAndSetVolatile(j, 1, 2),
                 () -> aa.weakCompareAndSetAcquire(j, 1, 2),
                 () -> aa.weakCompareAndSetRelease(j, 1, 2),
@@ -215,6 +216,22 @@
     }
 
     /**
+     * repeated weakCompareAndSetPlain succeeds in changing value when equal
+     * to expected
+     */
+    public void testWeakCompareAndSetPlain() {
+        AtomicLongArray aa = new AtomicLongArray(SIZE);
+        for (int i = 0; i < SIZE; i++) {
+            aa.set(i, 1);
+            do {} while (!aa.weakCompareAndSetPlain(i, 1, 2));
+            do {} while (!aa.weakCompareAndSetPlain(i, 2, -4));
+            assertEquals(-4, aa.get(i));
+            do {} while (!aa.weakCompareAndSetPlain(i, -4, 7));
+            assertEquals(7, aa.get(i));
+        }
+    }
+
+    /**
      * repeated weakCompareAndSetVolatile succeeds in changing value when equal
      * to expected
      */
--- a/jdk/test/java/util/concurrent/tck/AtomicReference9Test.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/java/util/concurrent/tck/AtomicReference9Test.java	Wed Jul 05 22:19:13 2017 +0200
@@ -162,6 +162,19 @@
     }
 
     /**
+     * repeated weakCompareAndSetPlain succeeds in changing value when equal
+     * to expected
+     */
+    public void testWeakCompareAndSetPlain() {
+        AtomicReference<Integer> ai = new AtomicReference<>(one);
+        do {} while (!ai.weakCompareAndSetPlain(one, two));
+        do {} while (!ai.weakCompareAndSetPlain(two, m4));
+        assertEquals(m4, ai.get());
+        do {} while (!ai.weakCompareAndSetPlain(m4, seven));
+        assertEquals(seven, ai.get());
+    }
+
+    /**
      * repeated weakCompareAndSetVolatile succeeds in changing value when equal
      * to expected
      */
--- a/jdk/test/java/util/concurrent/tck/AtomicReferenceArray9Test.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/java/util/concurrent/tck/AtomicReferenceArray9Test.java	Wed Jul 05 22:19:13 2017 +0200
@@ -61,6 +61,7 @@
                 () -> aa.compareAndExchange(j, null, null),
                 () -> aa.compareAndExchangeAcquire(j, null, null),
                 () -> aa.compareAndExchangeRelease(j, null, null),
+                () -> aa.weakCompareAndSetPlain(j, null, null),
                 () -> aa.weakCompareAndSetVolatile(j, null, null),
                 () -> aa.weakCompareAndSetAcquire(j, null, null),
                 () -> aa.weakCompareAndSetRelease(j, null, null),
@@ -215,6 +216,22 @@
     }
 
     /**
+     * repeated weakCompareAndSetPlain succeeds in changing value when equal
+     * to expected
+     */
+    public void testWeakCompareAndSetPlain() {
+        AtomicReferenceArray<Integer> aa = new AtomicReferenceArray<>(SIZE);
+        for (int i = 0; i < SIZE; i++) {
+            aa.set(i, one);
+            do {} while (!aa.weakCompareAndSetPlain(i, one, two));
+            do {} while (!aa.weakCompareAndSetPlain(i, two, m4));
+            assertEquals(m4, aa.get(i));
+            do {} while (!aa.weakCompareAndSetPlain(i, m4, seven));
+            assertEquals(seven, aa.get(i));
+        }
+    }
+
+    /**
      * repeated weakCompareAndSetVolatile succeeds in changing value when equal
      * to expected
      */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/spi/ToolProviderTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 8159855
+ * @summary test ToolProvider SPI
+ * @run main/othervm ToolProviderTest
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.spi.ToolProvider;
+
+public class ToolProviderTest {
+    public static void main(String... args) throws Exception {
+        ToolProviderTest t = new ToolProviderTest();
+        t.run();
+    }
+
+    void run() throws Exception {
+        initServices();
+
+        System.out.println("test without security manager present:");
+        test();
+
+        System.setSecurityManager(new SecurityManager());
+
+        System.out.println("test with security manager present:");
+        test();
+    }
+
+    private void test() throws Exception {
+        ToolProvider testProvider = ToolProvider.findFirst("test").get();
+        int rc = testProvider.run(System.out, System.err, "hello test");
+        if (rc != 0) {
+            throw new Exception("unexpected exit code: " + rc);
+        }
+    }
+
+    private void initServices() throws IOException {
+        Path testClasses = Paths.get(System.getProperty("test.classes"));
+        Path services = testClasses.resolve(Paths.get("META-INF", "services"));
+        Files.createDirectories(services);
+        Files.write(services.resolve(ToolProvider.class.getName()),
+                Arrays.asList(TestProvider.class.getName()));
+    }
+
+    public static class TestProvider implements ToolProvider {
+        public TestProvider() {
+            checkPrivileges();
+        }
+
+        public String name() {
+            return "test";
+        }
+
+        public int run(PrintWriter out, PrintWriter err, String... args) {
+            out.println("Test: " + Arrays.toString(args));
+            return 0;
+        }
+
+        private void checkPrivileges() {
+            boolean haveSecurityManager = (System.getSecurityManager() != null);
+            try {
+                // validate appropriate privileges by checking access to a
+                // system property
+                System.getProperty("java.home");
+                if (haveSecurityManager) {
+                    throw new Error("exception exception not thrown");
+                }
+            } catch (SecurityException e) {
+                if (!haveSecurityManager) {
+                    throw new Error("unexpected exception: " + e);
+                }
+            }
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/WriteAbortTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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     8164931
+ * @summary Test verifies that if we call ImageWriter.abort() in
+ *          IIOWriteProgressListener.imageStarted() or
+ *          IIOWriteProgressListener.imageProgress() are we
+ *          calling IIOWriteProgressListener.readAborted() for all readers.
+ * @run     main WriteAbortTest
+ */
+import java.awt.image.BufferedImage;
+import java.io.File;
+import javax.imageio.ImageIO;
+import javax.imageio.stream.ImageInputStream;
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.nio.file.Files;
+import javax.imageio.ImageWriter;
+import javax.imageio.event.IIOWriteProgressListener;
+import javax.imageio.stream.ImageOutputStream;
+
+public class WriteAbortTest implements IIOWriteProgressListener {
+
+    ImageWriter writer = null;
+    ImageOutputStream ios = null;
+    BufferedImage bimg = null;
+    File file;
+    boolean startAbort = false;
+    boolean startAborted = false;
+    boolean progressAbort = false;
+    boolean progressAborted = false;
+    Color srccolor = Color.red;
+    int width = 100;
+    int heght = 100;
+
+    public WriteAbortTest(String format) throws Exception {
+        try {
+            System.out.println("Test for format " + format);
+            bimg = new BufferedImage(width, heght,
+                    BufferedImage.TYPE_INT_RGB);
+
+            Graphics2D g = bimg.createGraphics();
+            g.setColor(srccolor);
+            g.fillRect(0, 0, width, heght);
+            g.dispose();
+
+            file = File.createTempFile("src_", "." + format, new File("."));
+            ImageInputStream ios = ImageIO.createImageOutputStream(file);
+
+            ImageWriter writer =
+                    ImageIO.getImageWritersByFormatName(format).next();
+
+            writer.setOutput(ios);
+            writer.addIIOWriteProgressListener(this);
+
+            // Abort writing in IIOWriteProgressListener.imageStarted().
+            startAbort = true;
+            writer.write(bimg);
+            startAbort = false;
+
+            // Abort writing in IIOWriteProgressListener.imageProgress().
+            progressAbort = true;
+            writer.write(bimg);
+            progressAbort = false;
+
+            ios.close();
+            /*
+             * All abort requests from imageStarted,imageProgress
+             * from IIOWriteProgressListener should be reached
+             * otherwise throw RuntimeException.
+             */
+            if (!(startAborted
+                    && progressAborted)) {
+                throw new RuntimeException("All IIOWriteProgressListener abort"
+                        + " requests are not processed for format "
+                        + format);
+            }
+        } finally {
+            Files.delete(file.toPath());
+        }
+    }
+
+    /*
+     * Abstract methods that we need to implement from
+     * IIOWriteProgressListener, and relevant for this test case.
+     */
+    @Override
+    public void imageStarted(ImageWriter source, int imageIndex) {
+        System.out.println("imageStarted called");
+        if (startAbort) {
+            source.abort();
+        }
+    }
+
+    @Override
+    public void imageProgress(ImageWriter source, float percentageDone) {
+        System.out.println("imageProgress called");
+        if (progressAbort) {
+            source.abort();
+        }
+    }
+
+    @Override
+    public void writeAborted(ImageWriter source) {
+        System.out.println("writeAborted called");
+        // Verify IIOWriteProgressListener.imageStarted() abort request.
+        if (startAbort) {
+            System.out.println("imageStarted aborted ");
+            startAborted = true;
+        }
+
+        // Verify IIOWriteProgressListener.imageProgress() abort request.
+        if (progressAbort) {
+            System.out.println("imageProgress aborted ");
+            progressAborted = true;
+        }
+    }
+
+    public static void main(String args[]) throws Exception {
+        final String[] formats = {"bmp", "png", "gif", "jpg", "tif"};
+        for (String format : formats) {
+            new WriteAbortTest(format);
+        }
+    }
+
+    /*
+     * Remaining abstract methods that we need to implement from
+     * IIOWriteProgressListener, but not relevant for this test case.
+     */
+    @Override
+    public void imageComplete(ImageWriter source) {
+    }
+
+    @Override
+    public void thumbnailStarted(ImageWriter source, int imageIndex,
+                                 int thumbnailIndex) {
+    }
+
+    @Override
+    public void thumbnailProgress(ImageWriter source, float percentageDone) {
+    }
+
+    @Override
+    public void thumbnailComplete(ImageWriter source) {
+    }
+}
+
--- a/jdk/test/javax/sound/sampled/spi/AudioFileReader/ReadersExceptions.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/javax/sound/sampled/spi/AudioFileReader/ReadersExceptions.java	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -74,11 +74,56 @@
     // empty channels
     static byte[] wrongAUCh =
             {0x2e, 0x73, 0x6e, 0x64,//AiffFileFormat.AU_SUN_MAGIC
+             0, 0, 0, 24, // headerSize
+             0, 0, 0, 0, // dataSize
+             0, 0, 0, 1, // encoding_local AuFileFormat.AU_ULAW_8
+             0, 0, 0, 1, // sampleRate
+             0, 0, 0, 0 // channels
+            };
+    // empty sample rate
+    static byte[] wrongAUSR =
+            {0x2e, 0x73, 0x6e, 0x64,//AiffFileFormat.AU_SUN_MAGIC
+             0, 0, 0, 24, // headerSize
+             0, 0, 0, 0, // dataSize
+             0, 0, 0, 1, // encoding_local AuFileFormat.AU_ULAW_8
+             0, 0, 0, 0, // sampleRate
+             0, 0, 0, 1 // channels
+            };
+    // empty header size
+    static byte[] wrongAUEmptyHeader =
+            {0x2e, 0x73, 0x6e, 0x64,//AiffFileFormat.AU_SUN_MAGIC
              0, 0, 0, 0, // headerSize
              0, 0, 0, 0, // dataSize
              0, 0, 0, 1, // encoding_local AuFileFormat.AU_ULAW_8
-             0, 0, 0, 0, // sampleRate
-             0, 0, 0, 0 // channels
+             0, 0, 0, 1, // sampleRate
+             0, 0, 0, 1 // channels
+            };
+    // small header size
+    static byte[] wrongAUSmallHeader =
+            {0x2e, 0x73, 0x6e, 0x64,//AiffFileFormat.AU_SUN_MAGIC
+             0, 0, 0, 7, // headerSize
+             0, 0, 0, 0, // dataSize
+             0, 0, 0, 1, // encoding_local AuFileFormat.AU_ULAW_8
+             0, 0, 0, 1, // sampleRate
+             0, 0, 0, 1 // channels
+            };
+    // frame size overflow, when result negative
+    static byte[] wrongAUFrameSizeOverflowNegativeResult =
+            {0x2e, 0x73, 0x6e, 0x64,//AiffFileFormat.AU_SUN_MAGIC
+             0, 0, 0, 24, // headerSize
+             0, 0, 0, 0, // dataSize
+             0, 0, 0, 5, // encoding_local AuFileFormat.AU_LINEAR_32
+             0, 0, 0, 1, // sampleRate
+             0x7F, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF // channels
+            };
+    // frame size overflow, when result positive
+    static byte[] wrongAUFrameSizeOverflowPositiveResult =
+            {0x2e, 0x73, 0x6e, 0x64,//AiffFileFormat.AU_SUN_MAGIC
+             0, 0, 0, 24, // headerSize
+             0, 0, 0, 0, // dataSize
+             0, 0, 0, 4, // encoding_local AuFileFormat.AU_LINEAR_24
+             0, 0, 0, 1, // sampleRate
+             0x7F, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF // channels
             };
     // empty channels
     static byte[] wrongWAVCh =
@@ -113,8 +158,12 @@
              0, 0, 0, 0, // dataLength
             };
 
-    static byte[][] data = {wrongAIFFCh, wrongAIFFSSL, wrongAIFFSSH, wrongAUCh,
-                            wrongWAVCh, wrongWAVSSB};
+    static byte[][] data = {
+            wrongAIFFCh, wrongAIFFSSL, wrongAIFFSSH, wrongAUCh, wrongAUSR,
+            wrongAUEmptyHeader, wrongAUSmallHeader,
+            wrongAUFrameSizeOverflowNegativeResult,
+            wrongAUFrameSizeOverflowPositiveResult, wrongWAVCh, wrongWAVSSB
+    };
 
     public static void main(final String[] args) throws IOException {
         for (final byte[] bytes : data) {
--- a/jdk/test/javax/sound/sampled/spi/AudioFileReader/RepeatedFormatReader.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/javax/sound/sampled/spi/AudioFileReader/RepeatedFormatReader.java	Wed Jul 05 22:19:13 2017 +0200
@@ -45,10 +45,10 @@
     };
 
     private static byte[] headerAU = {0x2e, 0x73, 0x6e, 0x64, // AU_SUN_MAGIC
-                                      0, 0, 0, 0, // headerSize
+                                      0, 0, 0, 24, // headerSize
                                       0, 0, 0, 0, // dataSize
                                       0, 0, 0, 1, // encoding
-                                      0, 0, 0, 0, // sampleRate
+                                      0, 0, 0, 1, // sampleRate
                                       0, 0, 0, 1  // channels
     };
 
--- a/jdk/test/javax/swing/JMenuItem/8158566/CloseOnMouseClickPropertyTest.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/javax/swing/JMenuItem/8158566/CloseOnMouseClickPropertyTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -37,45 +37,67 @@
 
 /*
  * @test
- * @bug 8158566 8160879 8160977
+ * @bug 8158566 8160879 8160977 8158566
  * @summary Provide a Swing property which modifies MenuItemUI behaviour
  */
 public class CloseOnMouseClickPropertyTest {
 
+    private static final String CHECK_BOX_PROP = "CheckBoxMenuItem."
+            + "doNotCloseOnMouseClick";
+    private static final String RADIO_BUTTON_PROP = "RadioButtonMenuItem"
+            + ".doNotCloseOnMouseClick";
+
     private static JFrame frame;
     private static JMenu menu;
 
+    private static TestItem[] TEST_ITEMS = {
+        new TestItem(TestType.CHECK_BOX_MENU_ITEM, true, true),
+        new TestItem(TestType.CHECK_BOX_MENU_ITEM, true, false),
+        new TestItem(TestType.CHECK_BOX_MENU_ITEM, false, true),
+        new TestItem(TestType.CHECK_BOX_MENU_ITEM, false, false),
+
+        new TestItem(TestType.CHECK_BOX_MENU_ITEM, null, true),
+        new TestItem(TestType.CHECK_BOX_MENU_ITEM, null, false),
+        new TestItem(TestType.CHECK_BOX_MENU_ITEM, true, null),
+        new TestItem(TestType.CHECK_BOX_MENU_ITEM, false, null),
+
+
+        new TestItem(TestType.RADIO_BUTTON_MENU_ITEM, true, true),
+        new TestItem(TestType.RADIO_BUTTON_MENU_ITEM, true, false),
+        new TestItem(TestType.RADIO_BUTTON_MENU_ITEM, false, true),
+        new TestItem(TestType.RADIO_BUTTON_MENU_ITEM, false, false),
+
+        new TestItem(TestType.RADIO_BUTTON_MENU_ITEM, true, null),
+        new TestItem(TestType.RADIO_BUTTON_MENU_ITEM, false, null),
+        new TestItem(TestType.RADIO_BUTTON_MENU_ITEM, null, true),
+        new TestItem(TestType.RADIO_BUTTON_MENU_ITEM, null, false),
+
+        new TestItem(TestType.MENU_ITEM, true, true),
+        new TestItem(TestType.MENU_ITEM, true, false),
+        new TestItem(TestType.MENU_ITEM, false, true),
+        new TestItem(TestType.MENU_ITEM, false, false),
+
+        new TestItem(TestType.MENU_ITEM, true, null),
+        new TestItem(TestType.MENU_ITEM, false, null),
+        new TestItem(TestType.MENU_ITEM, null, true),
+        new TestItem(TestType.MENU_ITEM, null, false),
+    };
+
     public static void main(String[] args) throws Exception {
 
         for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
             UIManager.setLookAndFeel(info.getClassName());
-            test(true);
-
-            setProperty(false);
-            test(false);
-
-            setProperty(true);
-            test(true);
+            for (TestItem testItem : TEST_ITEMS) {
+                test(testItem);
+            }
         }
     }
 
-    private static void setProperty(boolean closeOnMouseClick) {
-        UIManager.put("CheckBoxMenuItem.closeOnMouseClick", closeOnMouseClick);
-        UIManager.put("RadioButtonMenuItem.closeOnMouseClick", closeOnMouseClick);
-    }
-
-    private static void test(boolean closeOnMouseClick) throws Exception {
-        for (TestType testType : TestType.values()) {
-            test(testType, closeOnMouseClick);
-        }
-    }
-
-    private static void test(TestType testType, boolean closeOnMouseClick)
-            throws Exception {
+    private static void test(TestItem item) throws Exception {
 
         Robot robot = new Robot();
         robot.setAutoDelay(50);
-        SwingUtilities.invokeAndWait(() -> createAndShowGUI(testType));
+        SwingUtilities.invokeAndWait(() -> createAndShowGUI(item));
         robot.waitForIdle();
 
         Point point = getClickPoint(true);
@@ -94,21 +116,13 @@
             JMenuItem menuItem = menu.getItem(0);
             boolean isShowing = menuItem.isShowing();
             frame.dispose();
-
-            if (TestType.MENU_ITEM.equals(testType)) {
-                if (isShowing) {
-                    throw new RuntimeException("Menu Item is not closed!");
-                }
-            } else {
-                if (isShowing ^ !closeOnMouseClick) {
-                    throw new RuntimeException("Property is not taken into account:"
-                            + " closeOnMouseClick");
-                }
+            if (isShowing ^ item.doNotCloseOnMouseClick()) {
+                throw new RuntimeException("Property is not taken into account!");
             }
         });
     }
 
-    private static void createAndShowGUI(TestType testType) {
+    private static void createAndShowGUI(TestItem testItem) {
 
         frame = new JFrame();
         frame.setSize(300, 300);
@@ -116,23 +130,15 @@
 
         JMenuBar menuBar = new JMenuBar();
         menu = new JMenu("Menu");
-        menu.add(getMenuItem(testType));
+        JMenuItem menuItem = testItem.getMenuItem();
+        testItem.setProperties(menuItem);
+        menu.add(menuItem);
         menuBar.add(menu);
+
         frame.setJMenuBar(menuBar);
         frame.setVisible(true);
     }
 
-    private static JMenuItem getMenuItem(TestType testType) {
-        switch (testType) {
-            case CHECK_BOX_MENU_ITEM:
-                return new JCheckBoxMenuItem("Check Box");
-            case RADIO_BUTTON_MENU_ITEM:
-                return new JRadioButtonMenuItem("Radio Button");
-            default:
-                return new JMenuItem("Menu Item");
-        }
-    }
-
     private static Point getClickPoint(boolean parent) throws Exception {
         Point points[] = new Point[1];
 
@@ -157,4 +163,60 @@
         CHECK_BOX_MENU_ITEM,
         RADIO_BUTTON_MENU_ITEM
     }
-}
+
+    static class TestItem {
+
+        TestType type;
+        Boolean compDoNotCloseOnMouseClick;
+        Boolean lafDoNotCloseOnMouseClick;
+
+        public TestItem(TestType type,
+                        Boolean compDoNotCloseOnMouseClick,
+                        Boolean lafDoNotCloseOnMouseClick)
+        {
+            this.type = type;
+            this.compDoNotCloseOnMouseClick = compDoNotCloseOnMouseClick;
+            this.lafDoNotCloseOnMouseClick = lafDoNotCloseOnMouseClick;
+        }
+
+        boolean doNotCloseOnMouseClick() {
+            switch (type) {
+                case MENU_ITEM:
+                    return false;
+                default:
+                    return compDoNotCloseOnMouseClick != null
+                            ? compDoNotCloseOnMouseClick
+                            : lafDoNotCloseOnMouseClick;
+            }
+        }
+
+        void setProperties(JMenuItem menuItem) {
+            switch (type) {
+                case CHECK_BOX_MENU_ITEM:
+                    menuItem.putClientProperty(CHECK_BOX_PROP, compDoNotCloseOnMouseClick);
+                    UIManager.put(CHECK_BOX_PROP, lafDoNotCloseOnMouseClick);
+                    break;
+                case RADIO_BUTTON_MENU_ITEM:
+                    menuItem.putClientProperty(RADIO_BUTTON_PROP, compDoNotCloseOnMouseClick);
+                    UIManager.put(RADIO_BUTTON_PROP, lafDoNotCloseOnMouseClick);
+                    break;
+                default:
+                    menuItem.putClientProperty(CHECK_BOX_PROP, compDoNotCloseOnMouseClick);
+                    menuItem.putClientProperty(RADIO_BUTTON_PROP, compDoNotCloseOnMouseClick);
+                    UIManager.put(CHECK_BOX_PROP, lafDoNotCloseOnMouseClick);
+                    UIManager.put(RADIO_BUTTON_PROP, lafDoNotCloseOnMouseClick);
+            }
+        }
+
+        JMenuItem getMenuItem() {
+            switch (type) {
+                case CHECK_BOX_MENU_ITEM:
+                    return new JCheckBoxMenuItem("Check Box");
+                case RADIO_BUTTON_MENU_ITEM:
+                    return new JRadioButtonMenuItem("Radio Button");
+                default:
+                    return new JMenuItem("Menu Item");
+            }
+        }
+    }
+}
\ No newline at end of file
--- a/jdk/test/javax/swing/JRadioButton/8033699/bug8033699.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/javax/swing/JRadioButton/8033699/bug8033699.java	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
  * @key headful
  * @library ../../regtesthelpers
  * @build Util
- * @bug 8033699
+ * @bug 8033699 8154043
  * @summary  Incorrect radio button behavior when pressing tab key
  * @author Vivi An
  * @run main bug8033699
@@ -135,6 +135,7 @@
     private static void runTest1() throws Exception{
         hitKey(robot, KeyEvent.VK_TAB);
         hitKey(robot, KeyEvent.VK_TAB);
+        hitKey(robot, KeyEvent.VK_TAB);
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
@@ -163,11 +164,12 @@
     private static void runTest3() throws Exception{
         hitKey(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB);
         hitKey(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB);
+        hitKey(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB);
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
-                if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn3) {
+                if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn1) {
                     System.out.println("Radio button Group/Non Grouped Radio Button SHIFT-Tab Key Test failed");
-                    throw new RuntimeException("Focus is not on Radio Button C as Expected");
+                    throw new RuntimeException("Focus is not on Radio Button A as Expected");
                 }
             }
         });
@@ -175,39 +177,39 @@
 
     // Using arrow key to move focus in radio button group
     private static void runTest4() throws Exception{
-        hitKey(robot, KeyEvent.VK_UP);
-        hitKey(robot, KeyEvent.VK_LEFT);
+        hitKey(robot, KeyEvent.VK_DOWN);
+        hitKey(robot, KeyEvent.VK_RIGHT);
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
-                if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn1) {
+                if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn3) {
                     System.out.println("Radio button Group UP/LEFT Arrow Key Move Focus Failed");
-                    throw new RuntimeException("Focus is not on Radio Button A as Expected");
+                    throw new RuntimeException("Focus is not on Radio Button C as Expected");
                 }
             }
         });
     }
 
     private static void runTest5() throws Exception{
-        hitKey(robot, KeyEvent.VK_DOWN);
-        hitKey(robot, KeyEvent.VK_RIGHT);
+        hitKey(robot, KeyEvent.VK_UP);
+        hitKey(robot, KeyEvent.VK_LEFT);
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
-                if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn3) {
+                if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn1) {
                     System.out.println("Radio button Group Left/Up Arrow Key Move Focus Failed");
-                    throw new RuntimeException("Focus is not on Radio Button C as Expected");
+                    throw new RuntimeException("Focus is not on Radio Button A as Expected");
                 }
             }
         });
     }
 
     private static void runTest6() throws Exception{
-        hitKey(robot, KeyEvent.VK_DOWN);
-        hitKey(robot, KeyEvent.VK_DOWN);
+        hitKey(robot, KeyEvent.VK_UP);
+        hitKey(robot, KeyEvent.VK_UP);
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn2) {
                     System.out.println("Radio button Group Circle Back To First Button Test");
-                    throw new RuntimeException("Focus is not on Radio Button A as Expected");
+                    throw new RuntimeException("Focus is not on Radio Button B as Expected");
                 }
             }
         });
@@ -229,9 +231,9 @@
         hitKey(robot, KeyEvent.VK_TAB);
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
-                if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn3) {
+                if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtnSingle) {
                     System.out.println("Separate Component added in button group layout");
-                    throw new RuntimeException("Focus is not on Radio Button C as Expected");
+                    throw new RuntimeException("Focus is not on Radio Button Single as Expected");
                 }
             }
         });
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/windows/8165594/WindowsClassicHiDPIIconsTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.awt.Color;
+import java.awt.FlowLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.ScrollPaneConstants;
+import javax.swing.SwingUtilities;
+
+/*
+ * @test
+ * @bug 8165594
+ * @key headful
+ * @requires (os.family == "windows")
+ * @summary Bad rendering of Swing UI controls with Windows Classic L&F on HiDPI
+ *          display
+ * @run main/manual/othervm -Dsun.java2d.uiScale=2
+ * -Dswing.defaultlaf=com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel
+ * WindowsClassicHiDPIIconsTest
+ */
+
+public class WindowsClassicHiDPIIconsTest {
+
+    private static volatile boolean testResult = false;
+    private static volatile CountDownLatch countDownLatch;
+    private static final String INSTRUCTIONS = "INSTRUCTIONS:\n"
+            + "Check that the icons are painted smoothly on Swing UI controls:\n"
+            + "  - JRadioButton\n"
+            + "  - JCheckBox\n"
+            + "  - JComboBox\n"
+            + "  - JScrollPane (vertical and horizontal scroll bars)\n"
+            + "\n"
+            + "If so, press PASS, else press FAIL.\n";
+
+    public static void main(String args[]) throws Exception {
+        countDownLatch = new CountDownLatch(1);
+
+        SwingUtilities.invokeLater(WindowsClassicHiDPIIconsTest::createUI);
+        countDownLatch.await(15, TimeUnit.MINUTES);
+
+        if (!testResult) {
+            throw new RuntimeException("Test fails!");
+        }
+    }
+
+    private static void createUI() {
+
+        final JFrame mainFrame = new JFrame("Windows Classic L&F icons test");
+        GridBagLayout layout = new GridBagLayout();
+        JPanel mainControlPanel = new JPanel(layout);
+        JPanel resultButtonPanel = new JPanel(layout);
+
+        GridBagConstraints gbc = new GridBagConstraints();
+
+
+        JPanel testPanel = createJPanel();
+
+        gbc.gridx = 0;
+        gbc.gridy = 0;
+        gbc.fill = GridBagConstraints.HORIZONTAL;
+        mainControlPanel.add(testPanel, gbc);
+
+        JTextArea instructionTextArea = new JTextArea();
+        instructionTextArea.setText(INSTRUCTIONS);
+        instructionTextArea.setEditable(false);
+        instructionTextArea.setBackground(Color.white);
+
+        gbc.gridx = 0;
+        gbc.gridy = 1;
+        gbc.fill = GridBagConstraints.HORIZONTAL;
+        mainControlPanel.add(instructionTextArea, gbc);
+
+        JButton passButton = new JButton("Pass");
+        passButton.setActionCommand("Pass");
+        passButton.addActionListener((ActionEvent e) -> {
+            testResult = true;
+            mainFrame.dispose();
+            countDownLatch.countDown();
+
+        });
+
+        JButton failButton = new JButton("Fail");
+        failButton.setActionCommand("Fail");
+        failButton.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                mainFrame.dispose();
+                countDownLatch.countDown();
+            }
+        });
+
+        gbc.gridx = 0;
+        gbc.gridy = 0;
+        resultButtonPanel.add(passButton, gbc);
+
+        gbc.gridx = 1;
+        gbc.gridy = 0;
+        resultButtonPanel.add(failButton, gbc);
+
+        gbc.gridx = 0;
+        gbc.gridy = 2;
+        mainControlPanel.add(resultButtonPanel, gbc);
+
+        mainFrame.add(mainControlPanel);
+        mainFrame.pack();
+
+        mainFrame.addWindowListener(new WindowAdapter() {
+
+            @Override
+            public void windowClosing(WindowEvent e) {
+                mainFrame.dispose();
+                countDownLatch.countDown();
+            }
+        });
+        mainFrame.setVisible(true);
+    }
+
+    private static JPanel createJPanel() {
+        JPanel panel = new JPanel();
+        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
+
+        JPanel iconPanel = new JPanel(new FlowLayout());
+        JRadioButton radioButton = new JRadioButton();
+        radioButton.setSelected(false);
+        iconPanel.add(radioButton);
+        radioButton = new JRadioButton();
+        radioButton.setSelected(true);
+        iconPanel.add(radioButton);
+        panel.add(iconPanel);
+
+        iconPanel = new JPanel(new FlowLayout());
+        JCheckBox checkBox = new JCheckBox();
+        checkBox.setSelected(false);
+        iconPanel.add(checkBox);
+        checkBox = new JCheckBox();
+        checkBox.setSelected(true);
+        iconPanel.add(checkBox);
+        panel.add(iconPanel);
+
+        iconPanel = new JPanel(new FlowLayout());
+        JComboBox<String> comboBox = new JComboBox(new String[]{"111", "222"});
+        iconPanel.add(comboBox);
+        panel.add(iconPanel);
+
+        iconPanel = new JPanel(new FlowLayout());
+        JTextArea textArea = new JTextArea(3, 7);
+        textArea.setText("AAA");
+        JScrollPane scrollPane = new JScrollPane(textArea);
+        scrollPane.setHorizontalScrollBarPolicy(
+                ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
+        scrollPane.setVerticalScrollBarPolicy(
+                ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
+        iconPanel.add(scrollPane);
+        panel.add(iconPanel);
+
+        return panel;
+    }
+}
--- a/jdk/test/jdk/internal/misc/Unsafe/CopyMemory.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/jdk/internal/misc/Unsafe/CopyMemory.java	Wed Jul 05 22:19:13 2017 +0200
@@ -22,7 +22,6 @@
  */
 
 import jdk.internal.misc.Unsafe;
-import java.lang.reflect.Field;
 
 /*
  * @test
@@ -40,7 +39,6 @@
      */
     private void testPositive() {
         testSmallCopy(false);
-        testLargeCopy(false);
     }
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/internal/misc/Unsafe/CopyMemoryLarge.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.internal.misc.Unsafe;
+
+/*
+ * @test
+ * @summary Test Unsafe.copyMemory
+ * @modules java.base/jdk.internal.misc
+ * @requires os.maxMemory > 8G
+ */
+public class CopyMemoryLarge extends CopyCommon {
+    private CopyMemoryLarge() {
+    }
+
+    /**
+     * Run positive tests
+     *
+     * @throws RuntimeException if an error is found
+     */
+    private void testPositive() {
+        testLargeCopy(false);
+    }
+
+    /**
+     * Run all tests
+     *
+     * @throws RuntimeException if an error is found
+     */
+    private void test() {
+        testPositive();
+    }
+
+    public static void main(String[] args) {
+        CopyMemoryLarge cs = new CopyMemoryLarge();
+        cs.test();
+    }
+}
--- a/jdk/test/jdk/internal/misc/Unsafe/CopySwap.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/jdk/internal/misc/Unsafe/CopySwap.java	Wed Jul 05 22:19:13 2017 +0200
@@ -22,7 +22,6 @@
  */
 
 import jdk.internal.misc.Unsafe;
-import java.lang.reflect.Field;
 
 /*
  * @test
@@ -40,7 +39,6 @@
      */
     private void testPositive() {
         testSmallCopy(true);
-        testLargeCopy(true);
     }
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/internal/misc/Unsafe/CopySwapLarge.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.internal.misc.Unsafe;
+
+/*
+ * @test
+ * @summary Test Unsafe.copySwapMemory
+ * @modules java.base/jdk.internal.misc
+ * @requires os.maxMemory > 8G
+ */
+public class CopySwapLarge extends CopyCommon {
+    private CopySwapLarge() {
+    }
+
+    /**
+     * Run positive tests
+     *
+     * @throws RuntimeException if an error is found
+     */
+    private void testPositive() {
+        testLargeCopy(true);
+    }
+
+    /**
+     * Run all tests
+     *
+     * @throws RuntimeException if an error is found
+     */
+    private void test() {
+        testPositive();
+    }
+
+    public static void main(String[] args) {
+        CopySwapLarge cs = new CopySwapLarge();
+        cs.test();
+    }
+}
--- a/jdk/test/sun/java2d/cmm/ColorConvertOp/RGBColorConvertTest.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/sun/java2d/cmm/ColorConvertOp/RGBColorConvertTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -26,7 +26,6 @@
  * @bug 6279846
  * @summary Verifies that transform between the same ICC color spaces does not
  * change pixels
- * @run main ColorConvertTest
  */
 
 import java.awt.image.*;
--- a/jdk/test/sun/java2d/pipe/hw/RSLAPITest/RSLAPITest.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/sun/java2d/pipe/hw/RSLAPITest/RSLAPITest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -47,7 +47,6 @@
 import sun.java2d.Surface;
 import sun.java2d.pipe.BufferedContext;
 import sun.java2d.pipe.RenderQueue;
-import sun.java2d.pipe.hw.AccelDeviceEventListener;
 import sun.java2d.pipe.hw.AccelGraphicsConfig;
 import sun.java2d.pipe.hw.AccelSurface;
 import static java.awt.Transparency.*;
@@ -254,16 +253,6 @@
 
     private static void testContext(final AccelGraphicsConfig agc) {
         BufferedContext c = agc.getContext();
-        final AccelDeviceEventListener l = new AccelDeviceEventListener() {
-            public void onDeviceDispose() {
-                System.out.println("onDeviceDispose invoked");
-                agc.removeDeviceEventListener(this);
-            }
-            public void onDeviceReset() {
-                System.out.println("onDeviceReset invoked");
-            }
-        };
-        agc.addDeviceEventListener(l);
 
         RenderQueue rq = c.getRenderQueue();
         rq.lock();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/java2d/xrender/HugeGradientTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.image.*;
+import javax.swing.*;
+
+/**
+ * @test
+ * @bug 8162591
+ * @summary tests gradients with start/endpoints exceeding Short.MAX coordinates
+ * @author ceisserer
+ */
+public class HugeGradientTest extends Frame {
+        public static volatile boolean success = false;
+
+        public HugeGradientTest() {
+                Image dstImg = getGraphicsConfiguration()
+                        .createCompatibleVolatileImage(30, 30);
+                Graphics2D g = (Graphics2D) dstImg.getGraphics();
+
+                g.setPaint(new LinearGradientPaint(0f, Short.MAX_VALUE, 0f, Short.MAX_VALUE +31,
+                        new float[]{0f, 1f}, new Color[]{Color.BLACK, Color.RED}));
+                g.translate(0, -Short.MAX_VALUE);
+                g.fillRect (0, 0, Short.MAX_VALUE*2 , Short.MAX_VALUE*2);
+
+                BufferedImage readBackImg = new BufferedImage(dstImg.getWidth(null),
+                dstImg.getHeight(null), BufferedImage.TYPE_INT_RGB);
+                readBackImg.getGraphics().drawImage(dstImg, 0, 0, null);
+
+                for (int x = 0; x < readBackImg.getWidth(); x++) {
+                        for (int y = 0; y < readBackImg.getHeight(); y++) {
+                                int redVal = (readBackImg.getRGB(x, y) & 0x00FF0000) >> 16;
+
+                                if (redVal > 127) {
+                                        return;
+                                }
+                        }
+                }
+
+                throw new RuntimeException("Test Failed");
+        }
+
+        public static void main(String[] args) throws Exception {
+                SwingUtilities.invokeLater(new Runnable() {
+                        public void run() {
+                                new HugeGradientTest();
+                        }
+                });
+        }
+}
--- a/jdk/test/sun/net/www/protocol/jar/MultiReleaseJarURLConnection.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/sun/net/www/protocol/jar/MultiReleaseJarURLConnection.java	Wed Jul 05 22:19:13 2017 +0200
@@ -27,6 +27,7 @@
  * @summary Test that URL connections to multi-release jars can be runtime versioned
  * @library /lib/testlibrary/java/util/jar
  * @modules java.compiler
+ *          jdk.compiler
  *          jdk.httpserver
  *          jdk.jartool
  * @build Compiler JarBuilder CreateMultiReleaseTestJars SimpleHttpServer
--- a/jdk/test/sun/security/provider/PolicyFile/CanonPath.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/sun/security/provider/PolicyFile/CanonPath.java	Wed Jul 05 22:19:13 2017 +0200
@@ -150,9 +150,9 @@
             //
             // on unix, /- implies everything
 
-            if (w.implies(u) || !u.implies(w)) {
-                throw new Exception("SLASH/- test failed");
-            }
+            //if (w.implies(u) || !u.implies(w)) {
+            //    throw new Exception("SLASH/- test failed");
+            //}
         }
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/util/FilePermCompat/CompatImpact.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,270 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * 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 8164705
+ * @summary check compatibility after FilePermission change
+ * @library /java/security/testlibrary/
+ * @modules java.base/jdk.internal.misc
+ * @run main CompatImpact prepare
+ * @run main CompatImpact builtin
+ * @run main CompatImpact mine
+ * @run main CompatImpact dopriv
+ */
+
+import java.io.File;
+import java.io.FilePermission;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.security.AccessController;
+import java.security.AllPermission;
+import java.security.CodeSource;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Policy;
+import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
+import java.security.SecurityPermission;
+
+public class CompatImpact {
+
+    public static void main(String[] args) throws Exception {
+        switch (args[0]) {
+            // copy class files to future classpath
+            case "prepare":
+                // cp in .
+                String cp = System.getProperty("test.classes");
+                Files.copy(Paths.get(cp, "CompatImpact.class"),
+                        Paths.get("CompatImpact.class"));
+                Files.copy(Paths.get(cp, "CompatImpact$MP.class"),
+                        Paths.get("CompatImpact$MP.class"));
+                Files.write(Paths.get("f"), new byte[10]);
+                // cp in ./sub
+                Files.createDirectory(Paths.get("sub"));
+                Files.copy(Paths.get(cp, "CompatImpact.class"),
+                        Paths.get("sub", "CompatImpact.class"));
+                Files.copy(Paths.get(cp, "CompatImpact$MP.class"),
+                        Paths.get("sub", "CompatImpact$MP.class"));
+                Files.write(Paths.get("sub", "f"), new byte[10]);
+                // cp in ./inner
+                Files.createDirectory(Paths.get("inner"));
+                Files.copy(Paths.get(cp, "CompatImpact$DoPrivInner.class"),
+                        Paths.get("inner", "CompatImpact$DoPrivInner.class"));
+                break;
+            // run tests with different policy impls
+            case "builtin":
+            case "mine":
+                cp = System.getProperty("test.classes");
+                Proc p;
+                String failed = "";
+                String testcase = "";
+                String cwd = System.getProperty("user.dir");
+
+                // Granting a FilePermission on an absolute path
+                testcase = "PonA";
+                p = p(args[0], cwd + "/f")
+                        .args("f", cwd + "/f")
+                        .debug(testcase)
+                        .start();
+                if (p.waitFor() != 0) {
+                    Files.copy(Paths.get("stderr." + testcase), System.out);
+                    failed += testcase + " ";
+                }
+
+                // Granting a FilePermission on a relative path
+                testcase = "PonR";
+                p = p(args[0], "f")
+                        .args("f", cwd + "/f")
+                        .debug(testcase)
+                        .start();
+                if (p.waitFor() != 0) {
+                    Files.copy(Paths.get("stderr." + testcase), System.out);
+                    failed += testcase + " ";
+                }
+
+                // Reading file on classpath, not cwd
+                testcase = "cp";
+                String cprel = Paths.get(cwd).relativize(Paths.get(cp))
+                        .normalize().toString();
+                p = p(args[0], "x")
+                        .args(cp + "/f", cprel + "/f")
+                        .debug(testcase)
+                        .start();
+                if (p.waitFor() != 0) {
+                    Files.copy(Paths.get("stderr." + testcase), System.out);
+                    failed += testcase + " ";
+                }
+
+                // Reading file on classpath, cwd
+                testcase = "cpHere";
+                p = p(args[0], "x")
+                        .args(cwd + "/f", "f", "RES")
+                        .cp(".")   // Must! cancel the old CLASSPATH.
+                        .debug(testcase)
+                        .start();
+                if (p.waitFor() != 0) {
+                    Files.copy(Paths.get("stderr." + testcase), System.out);
+                    failed += testcase + " ";
+                }
+
+                // Reading file on classpath, cwd
+                testcase = "cpSub";
+                p = p(args[0], "x")
+                        .args(cwd + "/sub/f", "sub/f", "RES")
+                        .cp("sub")   // Must! There's CLASSPATH.
+                        .debug(testcase)
+                        .start();
+                if (p.waitFor() != 0) {
+                    Files.copy(Paths.get("stderr." + testcase), System.out);
+                    failed += testcase + " ";
+                }
+
+                if (!failed.isEmpty()) {
+                    throw new Exception(failed + "failed");
+                }
+                break;
+            // test <policy_type> <grant> <read...>
+            case "test":
+                if (args[1].equals("mine")) {
+                    Policy.setPolicy(new MP(args[2]));
+                }
+                Exception e = null;
+                for (int i = 3; i < args.length; i++) {
+                    try {
+                        System.out.println(args[i]);
+                        if (args[i].equals("RES")) {
+                            CompatImpact.class.getResourceAsStream("f")
+                                    .close();
+                        } else {
+                            new File(args[i]).exists();
+                        }
+                    } catch (Exception e2) {
+                        e = e2;
+                        e2.printStackTrace(System.out);
+                    }
+                }
+                if (e != null) {
+                    System.err.println("====================");
+                    throw e;
+                }
+                break;
+            // doPrivWithPerm test launcher
+            case "dopriv":
+                cwd = System.getProperty("user.dir");
+                // caller (CompatImpact doprivouter, no permission) in sub,
+                // executor (DoPrivInner, AllPermission) in inner.
+                p = Proc.create("CompatImpact")
+                        .args("doprivouter")
+                        .prop("java.security.manager", "")
+                        .grant(new File("inner"))
+                        .perm(new AllPermission())
+                        .cp("sub", "inner")
+                        .debug("doPriv")
+                        .args(cwd)
+                        .start();
+                if (p.waitFor() != 0) {
+                    throw new Exception("dopriv test fails");
+                }
+                break;
+            // doprivouter <cwd>
+            case "doprivouter":
+                DoPrivInner.main(args);
+                break;
+            default:
+                throw new Exception("unknown " + args[0]);
+        }
+    }
+
+    // Call by CompatImpact doprivouter, with AllPermission
+    public static class DoPrivInner {
+        public static void main(String[] args) throws Exception {
+            AccessController.doPrivileged((PrivilegedAction<Boolean>)
+                            () -> new File("x").exists(),
+                    null,
+                    new FilePermission(args[1] + "/x", "read"));
+            AccessController.doPrivileged((PrivilegedAction<Boolean>)
+                            () -> new File(args[1] + "/x").exists(),
+                    null,
+                    new FilePermission("x", "read"));
+            try {
+                AccessController.doPrivileged((PrivilegedAction<Boolean>)
+                                () -> new File("x").exists(),
+                        null,
+                        new FilePermission("y", "read"));
+                throw new Exception("Should not read");
+            } catch (SecurityException se) {
+                // Expected
+            }
+        }
+    }
+
+    // Return a Proc object for different policy types
+    private static Proc p(String type, String f) throws Exception {
+        Proc p = Proc.create("CompatImpact")
+                .prop("java.security.manager", "");
+        p.args("test", type);
+        switch (type) {
+            case "builtin":
+                // For builtin policy, reading access to f can be
+                // granted as a permission
+                p.perm(new FilePermission(f, "read"));
+                p.args("-");
+                break;
+            case "mine":
+                // For my policy, f is passed into test and new MP(f)
+                // will be set as new policy
+                p.perm(new SecurityPermission("setPolicy"));
+                p.args(f);
+                break;
+            default:
+                throw new Exception("unknown " + type);
+        }
+        return p;
+    }
+
+    // My own Policy impl, with only one granted permission, also not smart
+    // enough to know whether ProtectionDomain grants any permission
+    static class MP extends Policy {
+        final PermissionCollection pc;
+        MP(String f) {
+            FilePermission p = new FilePermission(f, "read");
+            pc = p.newPermissionCollection();
+            pc.add(p);
+        }
+        @Override
+        public PermissionCollection getPermissions(CodeSource codesource) {
+            return pc;
+        }
+
+        @Override
+        public PermissionCollection getPermissions(ProtectionDomain domain) {
+            return pc;
+        }
+
+        @Override
+        public boolean implies(ProtectionDomain domain, Permission permission) {
+            return pc.implies(permission);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/util/FilePermCompat/Flag.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * 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 8164705
+ * @summary check jdk.filepermission.canonicalize
+ * @library /java/security/testlibrary/
+ * @modules java.base/jdk.internal.misc
+ * @run main/othervm -Djdk.io.permissionsUseCanonicalPath=true Flag truetrue
+ * @run main/othervm -Djdk.io.permissionsUseCanonicalPath=false Flag falsetrue
+ * @run main/othervm Flag falsetrue
+ */
+
+import java.io.File;
+import java.io.FilePermission;
+import java.lang.*;
+import java.security.Permission;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+
+public class Flag {
+    public static void main(String[] args) throws Exception {
+
+        boolean test1;
+        boolean test2;
+
+        String here = System.getProperty("user.dir");
+        File abs = new File(here, "x");
+        FilePermission fp1 = new FilePermission("x", "read");
+        FilePermission fp2 = new FilePermission(abs.toString(), "read");
+        test1 = fp1.equals(fp2);
+
+        Policy pol = new Policy() {
+            @java.lang.Override
+            public boolean implies(ProtectionDomain domain, Permission permission) {
+                return fp1.implies(permission);
+            }
+        };
+
+        Policy.setPolicy(pol);
+        System.setSecurityManager(new SecurityManager());
+        try {
+            System.getSecurityManager().checkPermission(fp2);
+            test2 = true;
+        } catch (SecurityException se) {
+            test2 = false;
+        }
+
+        if (!args[0].equals(test1 + "" + test2)) {
+            throw new Exception("Test failed: " + test1 + test2);
+        }
+    }
+}
--- a/jdk/test/sun/util/calendar/zi/tzdata/VERSION	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/sun/util/calendar/zi/tzdata/VERSION	Wed Jul 05 22:19:13 2017 +0200
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2016f
+tzdata2016g
--- a/jdk/test/sun/util/calendar/zi/tzdata/africa	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/sun/util/calendar/zi/tzdata/africa	Wed Jul 05 22:19:13 2017 +0200
@@ -487,7 +487,7 @@
 # http://www.libyaherald.com/2013/10/24/correction-no-time-change-tomorrow/
 #
 # From Paul Eggert (2013-10-25):
-# For now, assume they're reverting to the pre-2012 rules of permanent UTC+2.
+# For now, assume they're reverting to the pre-2012 rules of permanent UT +02.
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Libya	1951	only	-	Oct	14	2:00	1:00	S
--- a/jdk/test/sun/util/calendar/zi/tzdata/antarctica	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/sun/util/calendar/zi/tzdata/antarctica	Wed Jul 05 22:19:13 2017 +0200
@@ -33,9 +33,7 @@
 # http://www.spri.cam.ac.uk/bob/periant.htm
 # for information.
 # Unless otherwise specified, we have no time zone information.
-#
-# Except for the French entries,
-# I made up all time zone abbreviations mentioned here; corrections welcome!
+
 # FORMAT is '-00' and GMTOFF is 0 for locations while uninhabited.
 
 # Argentina - year-round bases
@@ -52,7 +50,7 @@
 #	previously sealers and scientific personnel wintered
 #	Margaret Turner reports
 #	http://web.archive.org/web/20021204222245/http://www.dstc.qut.edu.au/DST/marg/daylight.html
-#	(1999-09-30) that they're UTC+5, with no DST;
+#	(1999-09-30) that they're UT +05, with no DST;
 #	presumably this is when they have visitors.
 #
 # year-round bases
@@ -91,23 +89,22 @@
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Antarctica/Casey	0	-	-00	1969
-			8:00	-	AWST	2009 Oct 18  2:00
-						# Australian Western Std Time
-			11:00	-	CAST	2010 Mar  5  2:00  # Casey Time
-			8:00	-	AWST	2011 Oct 28  2:00
-			11:00	-	CAST	2012 Feb 21 17:00u
-			8:00	-	AWST
+			8:00	-	+08	2009 Oct 18  2:00
+			11:00	-	+11	2010 Mar  5  2:00
+			8:00	-	+08	2011 Oct 28  2:00
+			11:00	-	+11	2012 Feb 21 17:00u
+			8:00	-	+08
 Zone Antarctica/Davis	0	-	-00	1957 Jan 13
-			7:00	-	DAVT	1964 Nov    # Davis Time
+			7:00	-	+07	1964 Nov
 			0	-	-00	1969 Feb
-			7:00	-	DAVT	2009 Oct 18  2:00
-			5:00	-	DAVT	2010 Mar 10 20:00u
-			7:00	-	DAVT	2011 Oct 28  2:00
-			5:00	-	DAVT	2012 Feb 21 20:00u
-			7:00	-	DAVT
+			7:00	-	+07	2009 Oct 18  2:00
+			5:00	-	+05	2010 Mar 10 20:00u
+			7:00	-	+07	2011 Oct 28  2:00
+			5:00	-	+05	2012 Feb 21 20:00u
+			7:00	-	+07
 Zone Antarctica/Mawson	0	-	-00	1954 Feb 13
-			6:00	-	MAWT	2009 Oct 18  2:00 # Mawson Time
-			5:00	-	MAWT
+			6:00	-	+06	2009 Oct 18  2:00
+			5:00	-	+05
 # References:
 # Casey Weather (1998-02-26)
 # http://www.antdiv.gov.au/aad/exop/sfo/casey/casey_aws.html
@@ -161,7 +158,7 @@
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Indian/Kerguelen	0	-	-00	1950 # Port-aux-Français
-			5:00	-	TFT	# ISO code TF Time
+			5:00	-	+05
 #
 # year-round base in the main continent
 # Dumont d'Urville, Île des Pétrels, -6640+14001, since 1956-11
@@ -172,9 +169,9 @@
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Antarctica/DumontDUrville 0 -	-00	1947
-			10:00	-	PMT	1952 Jan 14 # Port-Martin Time
+			10:00	-	+10	1952 Jan 14
 			0	-	-00	1956 Nov
-			10:00	-	DDUT	# Dumont-d'Urville Time
+			10:00	-	+10
 
 # France & Italy - year-round base
 # Concordia, -750600+1232000, since 2005
@@ -200,7 +197,7 @@
 # station of Japan, it's appropriate for the principal location.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Antarctica/Syowa	0	-	-00	1957 Jan 29
-			3:00	-	SYOT	# Syowa Time
+			3:00	-	+03
 # See:
 # NIPR Antarctic Research Activities (1999-08-17)
 # http://www.nipr.ac.jp/english/ara01.html
@@ -237,17 +234,17 @@
 # correct, but they should be quite close to the actual dates.
 #
 # From Paul Eggert (2014-03-21):
-# The CET-switching Troll rules require zic from tzcode 2014b or later, so as
+# The CET-switching Troll rules require zic from tz 2014b or later, so as
 # suggested by Bengt-Inge Larsson comment them out for now, and approximate
 # with only UTC and CEST.  Uncomment them when 2014b is more prevalent.
 #
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
-#Rule	Troll	2005	max	-	Mar	 1	1:00u	1:00	CET
-Rule	Troll	2005	max	-	Mar	lastSun	1:00u	2:00	CEST
-#Rule	Troll	2005	max	-	Oct	lastSun	1:00u	1:00	CET
-#Rule	Troll	2004	max	-	Nov	 7	1:00u	0:00	UTC
+#Rule	Troll	2005	max	-	Mar	 1	1:00u	1:00	+01
+Rule	Troll	2005	max	-	Mar	lastSun	1:00u	2:00	+02
+#Rule	Troll	2005	max	-	Oct	lastSun	1:00u	1:00	+01
+#Rule	Troll	2004	max	-	Nov	 7	1:00u	0:00	+00
 # Remove the following line when uncommenting the above '#Rule' lines.
-Rule	Troll	2004	max	-	Oct	lastSun	1:00u	0:00	UTC
+Rule	Troll	2004	max	-	Oct	lastSun	1:00u	0:00	+00
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Antarctica/Troll	0	-	-00	2005 Feb 12
 			0:00	Troll	%s
@@ -288,10 +285,10 @@
 # changes during the year and does not necessarily correspond to mean
 # solar noon.  So the Vostok time might have been whatever the clocks
 # happened to be during their visit.  So we still don't really know what time
-# it is at Vostok.  But we'll guess UTC+6.
+# it is at Vostok.  But we'll guess +06.
 #
 Zone Antarctica/Vostok	0	-	-00	1957 Dec 16
-			6:00	-	VOST	# Vostok time
+			6:00	-	+06
 
 # S Africa - year-round bases
 # Marion Island, -4653+03752
@@ -324,7 +321,7 @@
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Antarctica/Rothera	0	-	-00	1976 Dec  1
-			-3:00	-	ROTT	# Rothera time
+			-3:00	-	-03
 
 # Uruguay - year round base
 # Artigas, King George Island, -621104-0585107
--- a/jdk/test/sun/util/calendar/zi/tzdata/asia	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/sun/util/calendar/zi/tzdata/asia	Wed Jul 05 22:19:13 2017 +0200
@@ -139,13 +139,11 @@
 # http://www.worldtimezone.com/dst_news/dst_news_armenia03.html
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Yerevan	2:58:00 -	LMT	1924 May  2
-			3:00	-	YERT	1957 Mar    # Yerevan Time
-			4:00 RussiaAsia YER%sT	1991 Mar 31  2:00s
-			3:00	1:00	YERST	1991 Sep 23 # independence
-			3:00 RussiaAsia	AM%sT	1995 Sep 24  2:00s
-			4:00	-	AMT	1997
-			4:00 RussiaAsia	AM%sT	2012 Feb  9
-			4:00	-	AMT
+			3:00	-	+03	1957 Mar
+			4:00 RussiaAsia +04/+05	1991 Mar 31  2:00s
+			3:00 RussiaAsia	+03/+04	1995 Sep 24  2:00s
+			4:00	-	+04	1997
+			4:00 RussiaAsia	+04/+05
 
 # Azerbaijan
 
@@ -166,13 +164,12 @@
 Rule	Azer	1997	2015	-	Oct	lastSun	 5:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Baku	3:19:24 -	LMT	1924 May  2
-			3:00	-	BAKT	1957 Mar    # Baku Time
-			4:00 RussiaAsia BAK%sT	1991 Mar 31  2:00s
-			3:00	1:00	BAKST	1991 Aug 30 # independence
-			3:00 RussiaAsia	AZ%sT	1992 Sep lastSun  2:00s
-			4:00	-	AZT	1996     # Azerbaijan Time
-			4:00	EUAsia	AZ%sT	1997
-			4:00	Azer	AZ%sT
+			3:00	-	+03	1957 Mar
+			4:00 RussiaAsia +04/+05	1991 Mar 31  2:00s
+			3:00 RussiaAsia	+03/+04	1992 Sep lastSun  2:00s
+			4:00	-	+04	1996
+			4:00	EUAsia	+04/+05	1997
+			4:00	Azer	+04/+05
 
 # Bahrain
 # See Asia/Qatar.
@@ -291,7 +288,7 @@
 # Milne says 6:24:40 was the meridian of the time ball observatory at Rangoon.
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Rangoon	6:24:40 -	LMT	1880        # or Yangon
+Zone	Asia/Yangon	6:24:40 -	LMT	1880        # or Rangoon
 			6:24:40	-	RMT	1920        # Rangoon Mean Time?
 			6:30	-	BURT	1942 May    # Burma Time
 			9:00	-	JST	1945 May  3
@@ -406,7 +403,7 @@
 # Lewiston (ME) Daily Sun (1939-05-29), p 17, said "Even the time is
 # different - the occupied districts going by Tokyo time, an hour
 # ahead of that prevailing in the rest of Shanghai."  Guess that the
-# Xujiahui Observatory was under French control and stuck with UT+8.
+# Xujiahui Observatory was under French control and stuck with UT +08.
 #
 # In earlier versions of this file, China had many separate Zone entries, but
 # this was based on what were apparently incorrect data in Shanks & Pottenger.
@@ -415,26 +412,26 @@
 # Proposed in 1918 and theoretically in effect until 1949 (although in practice
 # mainly observed in coastal areas), the five zones were:
 #
-# Changbai Time ("Long-white Time", Long-white = Heilongjiang area) UT+8.5
+# Changbai Time ("Long-white Time", Long-white = Heilongjiang area) UT +08:30
 # Asia/Harbin (currently a link to Asia/Shanghai)
 # Heilongjiang (except Mohe county), Jilin
 #
-# Zhongyuan Time ("Central plain Time") UT+8
+# Zhongyuan Time ("Central plain Time") UT +08
 # Asia/Shanghai
 # most of China
 # This currently represents most other zones as well,
 # as apparently these regions have been the same since 1970.
 # Milne gives 8:05:43.2 for Xujiahui Observatory time; round to nearest.
-# Guo says Shanghai switched to UT+8 "from the end of the 19th century".
+# Guo says Shanghai switched to UT +08 "from the end of the 19th century".
 #
-# Long-shu Time (probably due to Long and Shu being two names of that area) UT+7
+# Long-shu Time (probably due to Long and Shu being two names of the area) UT +07
 # Asia/Chongqing (currently a link to Asia/Shanghai)
 # Guangxi, Guizhou, Hainan, Ningxia, Sichuan, Shaanxi, and Yunnan;
 # most of Gansu; west Inner Mongolia; west Qinghai; and the Guangdong
 # counties Deqing, Enping, Kaiping, Luoding, Taishan, Xinxing,
 # Yangchun, Yangjiang, Yu'nan, and Yunfu.
 #
-# Xin-zang Time ("Xinjiang-Tibet Time") UT+6
+# Xin-zang Time ("Xinjiang-Tibet Time") UT +06
 # Asia/Urumqi
 # This currently represents Kunlun Time as well,
 # as apparently the two regions have been the same since 1970.
@@ -447,7 +444,7 @@
 # Shihezi, Changji, Yanqi, Heshuo, Tuokexun, Tulufan, Shanshan, Hami,
 # Fukang, Kuitun, Kumukuli, Miquan, Qitai, and Turfan.
 #
-# Kunlun Time UT+5.5
+# Kunlun Time UT +05:30
 # Asia/Kashgar (currently a link to Asia/Urumqi)
 # West Tibet, including Pulan, Aheqi, Shufu, Shule;
 # West Xinjiang, including Aksu, Atushi, Yining, Hetian, Cele, Luopu, Nileke,
@@ -463,7 +460,7 @@
 #
 # On the other hand, ethnic Uyghurs, who make up about half the
 # population of Xinjiang, typically use "Xinjiang time" which is two
-# hours behind Beijing time, or UTC +0600. The government of the Xinjiang
+# hours behind Beijing time, or UT +06. The government of the Xinjiang
 # Uyghur Autonomous Region, (XAUR, or just Xinjiang for short) as well as
 # local governments such as the Ürümqi city government use both times in
 # publications, referring to what is popularly called Xinjiang time as
@@ -519,8 +516,8 @@
 # having the same time as Beijing.
 
 # From Paul Eggert (2014-06-30):
-# In the early days of the PRC, Tibet was given its own time zone (UT+6) but
-# this was withdrawn in 1959 and never reinstated; see Tubten Khétsun,
+# In the early days of the PRC, Tibet was given its own time zone (UT +06)
+# but this was withdrawn in 1959 and never reinstated; see Tubten Khétsun,
 # Memories of life in Lhasa under Chinese Rule, Columbia U Press, ISBN
 # 978-0231142861 (2008), translator's introduction by Matthew Akester, p x.
 # As this is before our 1970 cutoff, Tibet doesn't need a separate zone.
@@ -534,12 +531,12 @@
 # Republics, the Soviet Union, the Kuomintang, and the People's Republic of
 # China, and tracking down all these organizations' timekeeping rules would be
 # quite a trick.  Approximate this lost history by a transition from LMT to
-# XJT at the start of 1928, the year of accession of the warlord Jin Shuren,
+# UT +06 at the start of 1928, the year of accession of the warlord Jin Shuren,
 # which happens to be the date given by Shanks & Pottenger (no doubt as a
-# guess) as the transition from LMT.  Ignore the usage of UT+8 before
-# 1986-02-01 under the theory that the transition date to UT+8 is unknown and
+# guess) as the transition from LMT.  Ignore the usage of +08 before
+# 1986-02-01 under the theory that the transition date to +08 is unknown and
 # that the sort of users who prefer Asia/Urumqi now typically ignored the
-# UT+8 mandate back then.
+# +08 mandate back then.
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 # Beijing time, used throughout China; represented by Shanghai.
@@ -744,7 +741,7 @@
 # be found from historical government announcement database.
 
 # From Paul Eggert (2014-07-03):
-# As per Yu-Cheng Chuang, say that Taiwan was at UT+9 from 1937-10-01
+# As per Yu-Cheng Chuang, say that Taiwan was at UT +09 from 1937-10-01
 # until 1945-09-21 at 01:00, overriding Shanks & Pottenger.
 # Likewise, use Yu-Cheng Chuang's data for DST in Taiwan.
 
@@ -858,16 +855,15 @@
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Tbilisi	2:59:11 -	LMT	1880
 			2:59:11	-	TBMT	1924 May  2 # Tbilisi Mean Time
-			3:00	-	TBIT	1957 Mar    # Tbilisi Time
-			4:00 RussiaAsia TBI%sT	1991 Mar 31  2:00s
-			3:00	1:00	TBIST	1991 Apr  9 # independence
-			3:00 RussiaAsia GE%sT	1992        # Georgia Time
-			3:00 E-EurAsia	GE%sT	1994 Sep lastSun
-			4:00 E-EurAsia	GE%sT	1996 Oct lastSun
-			4:00	1:00	GEST	1997 Mar lastSun
-			4:00 E-EurAsia	GE%sT	2004 Jun 27
-			3:00 RussiaAsia	GE%sT	2005 Mar lastSun  2:00
-			4:00	-	GET
+			3:00	-	+03	1957 Mar
+			4:00 RussiaAsia +04/+05	1991 Mar 31  2:00s
+			3:00 RussiaAsia +03/+04	1992
+			3:00 E-EurAsia	+03/+04	1994 Sep lastSun
+			4:00 E-EurAsia	+04/+05	1996 Oct lastSun
+			4:00	1:00	+05	1997 Mar lastSun
+			4:00 E-EurAsia	+04/+05	2004 Jun 27
+			3:00 RussiaAsia	+03/+04	2005 Mar lastSun  2:00
+			4:00	-	+04
 
 # East Timor
 
@@ -944,7 +940,7 @@
 # These would be the earliest possible times for a change.
 # Régimes horaires pour le monde entier, by Henri Le Corre, (Éditions
 # Traditionnelles, 1987, Paris) says that Java and Madura switched
-# from JST to UTC+07:30 on 1945-09-23, and gives 1944-09-01 for Jayapura
+# from UT +09 to +07:30 on 1945-09-23, and gives 1944-09-01 for Jayapura
 # (Hollandia).  For now, assume all Indonesian locations other than Jayapura
 # switched on 1945-09-23.
 #
@@ -955,11 +951,11 @@
 # summary published by the Time and Frequency Laboratory of the
 # Research Center for Calibration, Instrumentation and Metrology,
 # Indonesia, <http://time.kim.lipi.go.id/time-eng.php> (2006-09-29).
-# The abbreviations are:
+# The time zone abbreviations and UT offsets are:
 #
-# WIB  - UTC+7 - Waktu Indonesia Barat (Indonesia western time)
-# WITA - UTC+8 - Waktu Indonesia Tengah (Indonesia central time)
-# WIT  - UTC+9 - Waktu Indonesia Timur (Indonesia eastern time)
+# WIB  - +07 - Waktu Indonesia Barat (Indonesia western time)
+# WITA - +08 - Waktu Indonesia Tengah (Indonesia central time)
+# WIT  - +09 - Waktu Indonesia Timur (Indonesia eastern time)
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 # Java, Sumatra
@@ -1848,11 +1844,11 @@
 Rule	Kyrgyz	1997	2004	-	Oct	lastSun	2:30	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Bishkek	4:58:24 -	LMT	1924 May  2
-			5:00	-	FRUT	1930 Jun 21 # Frunze Time
-			6:00 RussiaAsia FRU%sT	1991 Mar 31  2:00s
-			5:00	1:00	FRUST	1991 Aug 31  2:00 # independence
-			5:00	Kyrgyz	KG%sT	2005 Aug 12 # Kyrgyzstan Time
-			6:00	-	KGT
+			5:00	-	+05	1930 Jun 21
+			6:00 RussiaAsia +06/+07	1991 Mar 31  2:00s
+			5:00 RussiaAsia	+05/+06	1991 Aug 31  2:00
+			5:00	Kyrgyz	+05/+06	2005 Aug 12
+			6:00	-	+06
 
 ###############################################################################
 
@@ -1891,25 +1887,24 @@
 Rule	ROK	1987	1988	-	May	Sun>=8	2:00	1:00	D
 Rule	ROK	1987	1988	-	Oct	Sun>=8	3:00	0	S
 
-# From Paul Eggert (2014-10-30):
+# From Paul Eggert (2016-08-23):
 # The Korean Wikipedia entry gives the following sources for UT offsets:
 #
-# 1908: Official Journal Article No. 3994 (Edict No. 5)
+# 1908: Official Journal Article No. 3994 (decree No. 5)
 # 1912: Governor-General of Korea Official Gazette Issue No. 367
 #       (Announcement No. 338)
 # 1954: Presidential Decree No. 876 (1954-03-17)
 # 1961: Law No. 676 (1961-08-07)
-# 1987: Law No. 3919 (1986-12-31)
 #
-# The Wikipedia entry also has confusing information about a change
-# to UT+9 in April 1910, but then what would be the point of the later change
-# to UT+9 on 1912-01-01?  Omit the 1910 change for now.
+# (Another source "1987: Law No. 3919 (1986-12-31)" was in the 2014-10-30
+# edition of the Korean Wikipedia entry.)
 #
 # I guessed that time zone abbreviations through 1945 followed the same
 # rules as discussed under Taiwan, with nominal switches from JST to KST
 # when the respective cities were taken over by the Allies after WWII.
 #
-# For Pyongyang we have no information; guess no changes since World War II.
+# For Pyongyang, guess no changes from World War II until 2015, as we
+# have no information otherwise.
 
 # From Steffen Thorsen (2015-08-07):
 # According to many news sources, North Korea is going to change to
@@ -2069,7 +2064,7 @@
 # Bill Bonnet (2005-05-19) reports that the US Embassy in Ulaanbaatar says
 # there is only one time zone and that DST is observed, citing Microsoft
 # Windows XP as the source.  Risto Nykänen (2005-05-16) reports that
-# travelmongolia.org says there are two time zones (UTC+7, UTC+8) with no DST.
+# travelmongolia.org says there are two time zones (UT +07, +08) with no DST.
 # Oscar van Vlijmen (2005-05-20) reports that the Mongolian Embassy in
 # Washington, DC says there are two time zones, with DST observed.
 # He also found
@@ -2705,7 +2700,7 @@
 # earlier date.
 #
 # Shanks & Pottenger also state that until 1968-05-01 Saudi Arabia had two
-# time zones; the other zone, at UTC+4, was in the far eastern part of
+# time zones; the other zone, at UT +04, was in the far eastern part of
 # the country.  Ignore this, as it's before our 1970 cutoff.
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -2974,10 +2969,10 @@
 # From Shanks & Pottenger.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Dushanbe	4:35:12 -	LMT	1924 May  2
-			5:00	-	DUST	1930 Jun 21 # Dushanbe Time
-			6:00 RussiaAsia DUS%sT	1991 Mar 31  2:00s
-			5:00	1:00	DUSST	1991 Sep  9  2:00s
-			5:00	-	TJT	# Tajikistan Time
+			5:00	-	+05	1930 Jun 21
+			6:00 RussiaAsia +06/+07	1991 Mar 31  2:00s
+			5:00	1:00	+05/+06	1991 Sep  9  2:00s
+			5:00	-	+05
 
 # Thailand
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -2991,11 +2986,10 @@
 # From Shanks & Pottenger.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Ashgabat	3:53:32 -	LMT	1924 May  2 # or Ashkhabad
-			4:00	-	ASHT	1930 Jun 21 # Ashkhabad Time
-			5:00 RussiaAsia	ASH%sT	1991 Mar 31  2:00
-			4:00 RussiaAsia	ASH%sT	1991 Oct 27 # independence
-			4:00 RussiaAsia	TM%sT	1992 Jan 19  2:00
-			5:00	-	TMT
+			4:00	-	+04	1930 Jun 21
+			5:00 RussiaAsia	+05/+06	1991 Mar 31  2:00
+			4:00 RussiaAsia	+04/+05	1992 Jan 19  2:00
+			5:00	-	+05
 
 # United Arab Emirates
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -3007,20 +3001,18 @@
 # Byalokoz 1919 says Uzbekistan was 4:27:53.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Samarkand	4:27:53 -	LMT	1924 May  2
-			4:00	-	SAMT	1930 Jun 21 # Samarkand Time
-			5:00	-	SAMT	1981 Apr  1
-			5:00	1:00	SAMST	1981 Oct  1
-			6:00	-	TAST	1982 Apr  1 # Tashkent Time
-			5:00 RussiaAsia	SAM%sT	1991 Sep  1 # independence
-			5:00 RussiaAsia	UZ%sT	1992
-			5:00	-	UZT
+			4:00	-	+04	1930 Jun 21
+			5:00	-	+05	1981 Apr  1
+			5:00	1:00	+06	1981 Oct  1
+			6:00	-	+06	1982 Apr  1
+			5:00 RussiaAsia	+05/+06	1992
+			5:00	-	+05
 # Milne says Tashkent was 4:37:10.8; round to nearest.
 Zone	Asia/Tashkent	4:37:11 -	LMT	1924 May  2
-			5:00	-	TAST	1930 Jun 21 # Tashkent Time
-			6:00 RussiaAsia	TAS%sT	1991 Mar 31  2:00
-			5:00 RussiaAsia	TAS%sT	1991 Sep  1 # independence
-			5:00 RussiaAsia	UZ%sT	1992
-			5:00	-	UZT
+			5:00	-	+05	1930 Jun 21
+			6:00 RussiaAsia	+06/+07	1991 Mar 31  2:00
+			5:00 RussiaAsia	+05/+06	1992
+			5:00	-	+05
 
 # Vietnam
 
--- a/jdk/test/sun/util/calendar/zi/tzdata/australasia	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/sun/util/calendar/zi/tzdata/australasia	Wed Jul 05 22:19:13 2017 +0200
@@ -568,7 +568,7 @@
 # Base the Bougainville entry on the Arawa-Kieta region, which appears to have
 # the most people even though it was devastated in the Bougainville Civil War.
 #
-# Although Shanks gives 1942-03-15 / 1943-11-01 for JST, these dates
+# Although Shanks gives 1942-03-15 / 1943-11-01 for UT +09, these dates
 # are apparently rough guesswork from the starts of military campaigns.
 # The World War II entries below are instead based on Arawa-Kieta.
 # The Japanese occupied Kieta in July 1942,
@@ -576,8 +576,8 @@
 # http://pwencycl.kgbudge.com/B/o/Bougainville.htm
 # and seem to have controlled it until their 1945-08-21 surrender.
 #
-# The Autonomous Region of Bougainville plans to switch from UTC+10 to UTC+11
-# on 2014-12-28 at 02:00.  They call UTC+11 "Bougainville Standard Time";
+# The Autonomous Region of Bougainville switched from UT +10 to +11
+# on 2014-12-28 at 02:00.  They call +11 "Bougainville Standard Time";
 # abbreviate this as BST.  See:
 # http://www.bougainville24.com/bougainville-issues/bougainville-gets-own-timezone/
 #
@@ -643,7 +643,7 @@
 # From Paul Eggert (2014-06-27):
 # The International Date Line Act 2011
 # http://www.parliament.gov.ws/images/ACTS/International_Date_Line_Act__2011_-_Eng.pdf
-# changed Samoa from UTC-11 to UTC+13, effective "12 o'clock midnight, on
+# changed Samoa from UT -11 to +13, effective "12 o'clock midnight, on
 # Thursday 29th December 2011".  The International Date Line was adjusted
 # accordingly.
 
@@ -738,7 +738,7 @@
 # 1886-1891; Baker was similar but exact dates are not known.
 # Inhabited by civilians 1935-1942; U.S. military bases 1943-1944;
 # uninhabited thereafter.
-# Howland observed Hawaii Standard Time (UT-10:30) in 1937;
+# Howland observed Hawaii Standard Time (UT -10:30) in 1937;
 # see page 206 of Elgen M. Long and Marie K. Long,
 # Amelia Earhart: the Mystery Solved, Simon & Schuster (2000).
 # So most likely Howland and Baker observed Hawaii Time from 1935
@@ -1496,7 +1496,7 @@
 # Zealand time.  I understand that is the time they keep locally, anyhow."
 # For now, assume this practice goes back to the introduction of standard time
 # in New Zealand, as this would make Chatham Islands time almost exactly match
-# LMT back when New Zealand was at UTC+11:30; also, assume Chatham Islands did
+# LMT back when New Zealand was at UT +11:30; also, assume Chatham Islands did
 # not observe New Zealand's prewar DST.
 
 ###############################################################################
@@ -1552,7 +1552,7 @@
 # For now, we assume the Ladrones switched at the same time as the Philippines;
 # see Asia/Manila.
 
-# US Public Law 106-564 (2000-12-23) made UTC+10 the official standard time,
+# US Public Law 106-564 (2000-12-23) made UT +10 the official standard time,
 # under the name "Chamorro Standard Time".  There is no official abbreviation,
 # but Congressman Robert A. Underwood, author of the bill that became law,
 # wrote in a press release (2000-12-27) that he will seek the use of "ChST".
@@ -1564,15 +1564,15 @@
 # "I am certain, having lived there for the past decade, that 'Truk'
 # (now properly known as Chuuk) ... is in the time zone GMT+10."
 #
-# Shanks & Pottenger write that Truk switched from UTC+10 to UTC+11
+# Shanks & Pottenger write that Truk switched from UT +10 to +11
 # on 1978-10-01; ignore this for now.
 
 # From Paul Eggert (1999-10-29):
 # The Federated States of Micronesia Visitors Board writes in
 # The Federated States of Micronesia - Visitor Information (1999-01-26)
 # http://www.fsmgov.org/info/clocks.html
-# that Truk and Yap are UTC+10, and Ponape and Kosrae are UTC+11.
-# We don't know when Kosrae switched from UTC+12; assume January 1 for now.
+# that Truk and Yap are UT +10, and Ponape and Kosrae are +11.
+# We don't know when Kosrae switched from +12; assume January 1 for now.
 
 
 # Midway
@@ -1638,11 +1638,11 @@
 # ordaining - by a masterpiece of diplomatic flattery - that
 # the Fourth of July should be celebrated twice in that year."
 
-# Although Shanks & Pottenger says they both switched to UTC-11:30
-# in 1911, and to UTC-11 in 1950. many earlier sources give UTC-11
+# Although Shanks & Pottenger says they both switched to UT -11:30
+# in 1911, and to -11 in 1950. many earlier sources give -11
 # for American Samoa, e.g., the US National Bureau of Standards
 # circular "Standard Time Throughout the World", 1932.
-# Assume American Samoa switched to UTC-11 in 1911, not 1950,
+# Assume American Samoa switched to -11 in 1911, not 1950,
 # and that after 1950 they agreed until (western) Samoa skipped a
 # day in 2011.  Assume also that the Samoas follow the US and New
 # Zealand's "ST"/"DT" style of daylight-saving abbreviations.
--- a/jdk/test/sun/util/calendar/zi/tzdata/backward	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/sun/util/calendar/zi/tzdata/backward	Wed Jul 05 22:19:13 2017 +0200
@@ -59,6 +59,7 @@
 Link	Asia/Urumqi		Asia/Kashgar
 Link	Asia/Kathmandu		Asia/Katmandu
 Link	Asia/Macau		Asia/Macao
+Link	Asia/Yangon		Asia/Rangoon
 Link	Asia/Ho_Chi_Minh	Asia/Saigon
 Link	Asia/Jerusalem		Asia/Tel_Aviv
 Link	Asia/Thimphu		Asia/Thimbu
--- a/jdk/test/sun/util/calendar/zi/tzdata/etcetera	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/sun/util/calendar/zi/tzdata/etcetera	Wed Jul 05 22:19:13 2017 +0200
@@ -31,6 +31,13 @@
 # need now for the entries that are not on UTC are for ships at sea
 # that cannot use POSIX TZ settings.
 
+# Starting with POSIX 1003.1-2001, the entries below are all
+# unnecessary as settings for the TZ environment variable.  E.g.,
+# instead of TZ='Etc/GMT+4' one can use the POSIX setting TZ='<-04>+4'.
+#
+# Do not use a POSIX TZ setting like TZ='GMT+4', which is four hours
+# behind GMT but uses the completely misleading abbreviation "GMT".
+
 Zone	Etc/GMT		0	-	GMT
 Zone	Etc/UTC		0	-	UTC
 Zone	Etc/UCT		0	-	UCT
@@ -49,23 +56,13 @@
 Link	Etc/GMT				Etc/GMT+0
 Link	Etc/GMT				Etc/GMT0
 
-# We use POSIX-style signs in the Zone names and the output abbreviations,
+# Be consistent with POSIX TZ settings in the Zone names,
 # even though this is the opposite of what many people expect.
 # POSIX has positive signs west of Greenwich, but many people expect
 # positive signs east of Greenwich.  For example, TZ='Etc/GMT+4' uses
-# the abbreviation "GMT+4" and corresponds to 4 hours behind UT
+# the abbreviation "-04" and corresponds to 4 hours behind UT
 # (i.e. west of Greenwich) even though many people would expect it to
 # mean 4 hours ahead of UT (i.e. east of Greenwich).
-#
-# In the draft 5 of POSIX 1003.1-200x, the angle bracket notation allows for
-# TZ='<GMT-4>+4'; if you want time zone abbreviations conforming to
-# ISO 8601 you can use TZ='<-0400>+4'.  Thus the commonly-expected
-# offset is kept within the angle bracket (and is used for display)
-# while the POSIX sign is kept outside the angle bracket (and is used
-# for calculation).
-#
-# Do not use a TZ setting like TZ='GMT+4', which is four hours behind
-# GMT but uses the completely misleading abbreviation "GMT".
 
 # Earlier incarnations of this package were not POSIX-compliant,
 # and had lines such as
@@ -74,30 +71,31 @@
 # way does a
 #		zic -l GMT-12
 # so we moved the names into the Etc subdirectory.
+# Also, the time zone abbreviations are now compatible with %z.
 
-Zone	Etc/GMT-14	14	-	GMT-14	# 14 hours ahead of GMT
-Zone	Etc/GMT-13	13	-	GMT-13
-Zone	Etc/GMT-12	12	-	GMT-12
-Zone	Etc/GMT-11	11	-	GMT-11
-Zone	Etc/GMT-10	10	-	GMT-10
-Zone	Etc/GMT-9	9	-	GMT-9
-Zone	Etc/GMT-8	8	-	GMT-8
-Zone	Etc/GMT-7	7	-	GMT-7
-Zone	Etc/GMT-6	6	-	GMT-6
-Zone	Etc/GMT-5	5	-	GMT-5
-Zone	Etc/GMT-4	4	-	GMT-4
-Zone	Etc/GMT-3	3	-	GMT-3
-Zone	Etc/GMT-2	2	-	GMT-2
-Zone	Etc/GMT-1	1	-	GMT-1
-Zone	Etc/GMT+1	-1	-	GMT+1
-Zone	Etc/GMT+2	-2	-	GMT+2
-Zone	Etc/GMT+3	-3	-	GMT+3
-Zone	Etc/GMT+4	-4	-	GMT+4
-Zone	Etc/GMT+5	-5	-	GMT+5
-Zone	Etc/GMT+6	-6	-	GMT+6
-Zone	Etc/GMT+7	-7	-	GMT+7
-Zone	Etc/GMT+8	-8	-	GMT+8
-Zone	Etc/GMT+9	-9	-	GMT+9
-Zone	Etc/GMT+10	-10	-	GMT+10
-Zone	Etc/GMT+11	-11	-	GMT+11
-Zone	Etc/GMT+12	-12	-	GMT+12
+Zone	Etc/GMT-14	14	-	+14
+Zone	Etc/GMT-13	13	-	+13
+Zone	Etc/GMT-12	12	-	+12
+Zone	Etc/GMT-11	11	-	+11
+Zone	Etc/GMT-10	10	-	+10
+Zone	Etc/GMT-9	9	-	+09
+Zone	Etc/GMT-8	8	-	+08
+Zone	Etc/GMT-7	7	-	+07
+Zone	Etc/GMT-6	6	-	+06
+Zone	Etc/GMT-5	5	-	+05
+Zone	Etc/GMT-4	4	-	+04
+Zone	Etc/GMT-3	3	-	+03
+Zone	Etc/GMT-2	2	-	+02
+Zone	Etc/GMT-1	1	-	+01
+Zone	Etc/GMT+1	-1	-	-01
+Zone	Etc/GMT+2	-2	-	-02
+Zone	Etc/GMT+3	-3	-	-03
+Zone	Etc/GMT+4	-4	-	-04
+Zone	Etc/GMT+5	-5	-	-05
+Zone	Etc/GMT+6	-6	-	-06
+Zone	Etc/GMT+7	-7	-	-07
+Zone	Etc/GMT+8	-8	-	-08
+Zone	Etc/GMT+9	-9	-	-09
+Zone	Etc/GMT+10	-10	-	-10
+Zone	Etc/GMT+11	-11	-	-11
+Zone	Etc/GMT+12	-12	-	-12
--- a/jdk/test/sun/util/calendar/zi/tzdata/europe	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/sun/util/calendar/zi/tzdata/europe	Wed Jul 05 22:19:13 2017 +0200
@@ -98,8 +98,7 @@
 #        1:00       CET CEST CEMT Central Europe
 #        1:00:14    SET           Swedish (1879-1899)*
 #        2:00       EET EEST      Eastern Europe
-#        3:00       FET           Further-eastern Europe (2011-2014)*
-#        3:00       MSK MSD  MSM* Minsk, Moscow
+#        3:00       MSK MSD       Moscow
 
 # From Peter Ilieve (1994-12-04),
 # The original six [EU members]: Belgium, France, (West) Germany, Italy,
@@ -606,16 +605,33 @@
 Rule	E-Eur	1981	max	-	Mar	lastSun	 0:00	1:00	S
 Rule	E-Eur	1996	max	-	Oct	lastSun	 0:00	0	-
 
+
+# Daylight saving time for Russia and the Soviet Union
+#
+# The 1917-1921 decree URLs are from Alexander Belopolsky (2016-08-23).
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Russia	1917	only	-	Jul	 1	23:00	1:00	MST  # Moscow Summer Time
+#
+# Decree No. 142 (1917-12-22) http://istmat.info/node/28137
 Rule	Russia	1917	only	-	Dec	28	 0:00	0	MMT  # Moscow Mean Time
+#
+# Decree No. 497 (1918-05-30) http://istmat.info/node/30001
 Rule	Russia	1918	only	-	May	31	22:00	2:00	MDST # Moscow Double Summer Time
 Rule	Russia	1918	only	-	Sep	16	 1:00	1:00	MST
+#
+# Decree No. 258 (1919-05-29) http://istmat.info/node/37949
 Rule	Russia	1919	only	-	May	31	23:00	2:00	MDST
-Rule	Russia	1919	only	-	Jul	 1	 2:00	1:00	MSD
+#
+Rule	Russia	1919	only	-	Jul	 1	 0:00u	1:00	MSD
 Rule	Russia	1919	only	-	Aug	16	 0:00	0	MSK
+#
+# Decree No. 63 (1921-02-03) http://istmat.info/node/45840
 Rule	Russia	1921	only	-	Feb	14	23:00	1:00	MSD
-Rule	Russia	1921	only	-	Mar	20	23:00	2:00	MSM  # Midsummer
+#
+# Decree No. 121 (1921-03-07) http://istmat.info/node/45949
+Rule	Russia	1921	only	-	Mar	20	23:00	2:00	+05
+#
 Rule	Russia	1921	only	-	Sep	 1	 0:00	1:00	MSD
 Rule	Russia	1921	only	-	Oct	 1	 0:00	0	-
 # Act No. 925 of the Council of Ministers of the USSR (1980-10-24):
@@ -798,8 +814,6 @@
 # From Alexander Bokovoy (2014-10-09):
 # Belarussian government decided against changing to winter time....
 # http://eng.belta.by/all_news/society/Belarus-decides-against-adjusting-time-in-Russias-wake_i_76335.html
-# From Paul Eggert (2014-10-08):
-# Hence Belarus can share time zone abbreviations with Moscow again.
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Europe/Minsk	1:50:16 -	LMT	1880
@@ -810,8 +824,7 @@
 			3:00	Russia	MSK/MSD	1990
 			3:00	-	MSK	1991 Mar 31  2:00s
 			2:00	Russia	EE%sT	2011 Mar 27  2:00s
-			3:00	-	FET	2014 Oct 26  1:00s
-			3:00	-	MSK
+			3:00	-	+03
 
 # Belgium
 #
@@ -1319,7 +1332,7 @@
 # http://www.parlament-berlin.de/pds-fraktion.nsf/727459127c8b66ee8525662300459099/defc77cb784f180ac1256c2b0030274b/$FILE/bersarint.pdf
 # says that Bersarin issued an order to use Moscow time on May 20.
 # However, Moscow did not observe daylight saving in 1945, so
-# this was equivalent to CEMT (GMT+3), not GMT+4.
+# this was equivalent to UT +03, not +04.
 
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
@@ -2283,7 +2296,6 @@
 # http://www.worldtimezone.com/dst_news/dst_news_russia-map-2014-07.html
 
 # From Paul Eggert (2006-03-22):
-# Except for Moscow after 1919-07-01, I invented the time zone abbreviations.
 # Moscow time zone abbreviations after 1919-07-01, and Moscow rules after 1991,
 # are from Andrey A. Chernov.  The rest is from Shanks & Pottenger,
 # except we follow Chernov's report that 1992 DST transitions were Sat
@@ -2359,7 +2371,7 @@
 			 2:00	Poland	CE%sT	1946
 			 3:00	Russia	MSK/MSD	1989 Mar 26  2:00s
 			 2:00	Russia	EE%sT	2011 Mar 27  2:00s
-			 3:00	-	FET	2014 Oct 26  2:00s
+			 3:00	-	+03	2014 Oct 26  2:00s
 			 2:00	-	EET
 
 
@@ -2412,6 +2424,16 @@
 # 78	RU-SPE	Saint Petersburg
 # 83	RU-NEN	Nenets Autonomous Okrug
 
+# From Paul Eggert (2016-08-23):
+# The Soviets switched to UT-based time in 1919.  Decree No. 59
+# (1919-02-08) http://istmat.info/node/35567 established UT-based time
+# zones, and Decree No. 147 (1919-03-29) http://istmat.info/node/35854
+# specified a transition date of 1919-07-01, apparently at 00:00 UT.
+# No doubt only the Soviet-controlled regions switched on that date;
+# later transitions to UT-based time in other parts of Russia are
+# taken from what appear to be guesses by Shanks.
+# (Thanks to Alexander Belopolsky for pointers to the decrees.)
+
 # From Stepan Golosunov (2016-03-07):
 # 11. Regions-violators, 1981-1982.
 # Wikipedia refers to
@@ -2453,7 +2475,7 @@
 # attributes the 1982 changes to the Act of the Council of Ministers
 # of the USSR No. 126 from 18.02.1982.  1980-925.txt also adds
 # Udmurtia to the list of affected territories and lists Khatangsky
-# district separately from Taymyr Autonomous Okurg.  Probably erroneously.
+# district separately from Taymyr Autonomous Okrug.  Probably erroneously.
 #
 # The affected territories are currently listed under Europe/Moscow,
 # Asia/Yekaterinburg and Asia/Krasnoyarsk.
@@ -2513,7 +2535,7 @@
 
 Zone Europe/Moscow	 2:30:17 -	LMT	1880
 			 2:30:17 -	MMT	1916 Jul  3 # Moscow Mean Time
-			 2:31:19 Russia	%s	1919 Jul  1  2:00
+			 2:31:19 Russia	%s	1919 Jul  1  0:00u
 			 3:00	Russia	%s	1921 Oct
 			 3:00	Russia	MSK/MSD	1922 Oct
 			 2:00	-	EET	1930 Jun 21
@@ -2596,22 +2618,21 @@
 # The 1988 transition is from USSR act No. 5 (1988-01-04).
 
 Zone Europe/Volgograd	 2:57:40 -	LMT	1920 Jan  3
-			 3:00	-	TSAT	1925 Apr  6 # Tsaritsyn Time
-			 3:00	-	STAT	1930 Jun 21 # Stalingrad Time
-			 4:00	-	STAT	1961 Nov 11
-			 4:00	Russia	VOL%sT	1988 Mar 27  2:00s # Volgograd T
-			 3:00	Russia	VOL%sT	1991 Mar 31  2:00s
-			 4:00	-	VOLT	1992 Mar 29  2:00s
-			 3:00	Russia	MSK/MSD	2011 Mar 27  2:00s
-			 4:00	-	MSK	2014 Oct 26  2:00s
-			 3:00	-	MSK
+			 3:00	-	+03	1930 Jun 21
+			 4:00	-	+04	1961 Nov 11
+			 4:00	Russia	+04/+05	1988 Mar 27  2:00s
+			 3:00	Russia	+03/+04	1991 Mar 31  2:00s
+			 4:00	-	+04	1992 Mar 29  2:00s
+			 3:00	Russia	+03/+04	2011 Mar 27  2:00s
+			 4:00	-	+04	2014 Oct 26  2:00s
+			 3:00	-	+03
 
 # From Paul Eggert (2016-03-18):
 # Europe/Kirov covers:
 # 43	RU-KIR	Kirov Oblast
 # The 1989 transition is from USSR act No. 227 (1989-03-14).
 #
-Zone Europe/Kirov	 3:18:48 -	LMT	1919 Jul  1  2:00
+Zone Europe/Kirov	 3:18:48 -	LMT	1919 Jul  1  0:00u
 			 3:00	-	+03	1930 Jun 21
 			 4:00	Russia	+04/+05	1989 Mar 26  2:00s
 			 3:00	Russia	+03/+04	1991 Mar 31  2:00s
@@ -2629,16 +2650,16 @@
 # Byalokoz 1919 says Samara was 3:20:20.
 # The 1989 transition is from USSR act No. 227 (1989-03-14).
 
-Zone Europe/Samara	 3:20:20 -	LMT	1919 Jul  1  2:00
-			 3:00	-	SAMT	1930 Jun 21 # Samara Time
-			 4:00	-	SAMT	1935 Jan 27
-			 4:00	Russia	KUY%sT	1989 Mar 26  2:00s # Kuybyshev
-			 3:00	Russia	MSK/MSD	1991 Mar 31  2:00s
-			 2:00	Russia	EE%sT	1991 Sep 29  2:00s
-			 3:00	-	SAMT	1991 Oct 20  3:00
-			 4:00	Russia	SAM%sT	2010 Mar 28  2:00s
-			 3:00	Russia	SAM%sT	2011 Mar 27  2:00s
-			 4:00	-	SAMT
+Zone Europe/Samara	 3:20:20 -	LMT	1919 Jul  1  0:00u
+			 3:00	-	+03	1930 Jun 21
+			 4:00	-	+04	1935 Jan 27
+			 4:00	Russia	+04/+05	1989 Mar 26  2:00s
+			 3:00	Russia	+03/+04	1991 Mar 31  2:00s
+			 2:00	Russia	+02/+03	1991 Sep 29  2:00s
+			 3:00	-	+03	1991 Oct 20  3:00
+			 4:00	Russia	+04/+05	2010 Mar 28  2:00s
+			 3:00	Russia	+03/+04	2011 Mar 27  2:00s
+			 4:00	-	+04
 
 # From Paul Eggert (2016-03-18):
 # Europe/Ulyanovsk covers:
@@ -2653,7 +2674,7 @@
 # From Matt Johnson (2016-03-09):
 # http://publication.pravo.gov.ru/Document/View/0001201603090051
 
-Zone Europe/Ulyanovsk	 3:13:36 -	LMT	1919 Jul  1  2:00
+Zone Europe/Ulyanovsk	 3:13:36 -	LMT	1919 Jul  1  0:00u
 			 3:00	-	+03	1930 Jun 21
 			 4:00	Russia	+04/+05	1989 Mar 26  2:00s
 			 3:00	Russia	+03/+04	1991 Mar 31  2:00s
@@ -2685,12 +2706,12 @@
 
 Zone Asia/Yekaterinburg	 4:02:33 -	LMT	1916 Jul  3
 			 3:45:05 -	PMT	1919 Jul 15  4:00
-			 4:00	-	SVET	1930 Jun 21 # Sverdlovsk Time
-			 5:00	Russia	SVE%sT	1991 Mar 31  2:00s
-			 4:00	Russia	SVE%sT	1992 Jan 19  2:00s
-			 5:00	Russia	YEK%sT	2011 Mar 27  2:00s
-			 6:00	-	YEKT	2014 Oct 26  2:00s
-			 5:00	-	YEKT
+			 4:00	-	+04	1930 Jun 21
+			 5:00	Russia	+05/+06	1991 Mar 31  2:00s
+			 4:00	Russia	+04/+05	1992 Jan 19  2:00s
+			 5:00	Russia	+05/+06	2011 Mar 27  2:00s
+			 6:00	-	+06	2014 Oct 26  2:00s
+			 5:00	-	+05
 
 
 # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2001-08-25):
@@ -2700,12 +2721,12 @@
 # Byalokoz 1919 says Omsk was 4:53:30.
 
 Zone Asia/Omsk		 4:53:30 -	LMT	1919 Nov 14
-			 5:00	-	OMST	1930 Jun 21 # Omsk Time
-			 6:00	Russia	OMS%sT	1991 Mar 31  2:00s
-			 5:00	Russia	OMS%sT	1992 Jan 19  2:00s
-			 6:00	Russia	OMS%sT	2011 Mar 27  2:00s
-			 7:00	-	OMST	2014 Oct 26  2:00s
-			 6:00	-	OMST
+			 5:00	-	+05	1930 Jun 21
+			 6:00	Russia	+06/+07	1991 Mar 31  2:00s
+			 5:00	Russia	+05/+06	1992 Jan 19  2:00s
+			 6:00	Russia	+06/+07	2011 Mar 27  2:00s
+			 7:00	-	+07	2014 Oct 26  2:00s
+			 6:00	-	+06
 
 # From Paul Eggert (2016-02-22):
 # Asia/Barnaul covers:
@@ -2785,7 +2806,7 @@
 # Note that time belts (numbered from 2 (Moscow) to 12 according to their
 # GMT/UTC offset and having too many exceptions like regions formally
 # belonging to one belt but using time from another) were replaced
-# with time zones in 2011 with different numberings (there was a
+# with time zones in 2011 with different numbering (there was a
 # 2-hour gap between second and third zones in 2011-2014).
 
 # From Stepan Golosunov (2016-04-12):
@@ -2868,12 +2889,12 @@
 # Byalokoz 1919 says Krasnoyarsk was 6:11:26.
 
 Zone Asia/Krasnoyarsk	 6:11:26 -	LMT	1920 Jan  6
-			 6:00	-	KRAT	1930 Jun 21 # Krasnoyarsk Time
-			 7:00	Russia	KRA%sT	1991 Mar 31  2:00s
-			 6:00	Russia	KRA%sT	1992 Jan 19  2:00s
-			 7:00	Russia	KRA%sT	2011 Mar 27  2:00s
-			 8:00	-	KRAT	2014 Oct 26  2:00s
-			 7:00	-	KRAT
+			 6:00	-	+06	1930 Jun 21
+			 7:00	Russia	+07/+08	1991 Mar 31  2:00s
+			 6:00	Russia	+06/+07	1992 Jan 19  2:00s
+			 7:00	Russia	+07/+08	2011 Mar 27  2:00s
+			 8:00	-	+08	2014 Oct 26  2:00s
+			 7:00	-	+07
 
 
 # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2001-08-25):
@@ -2890,12 +2911,12 @@
 
 Zone Asia/Irkutsk	 6:57:05 -	LMT	1880
 			 6:57:05 -	IMT	1920 Jan 25 # Irkutsk Mean Time
-			 7:00	-	IRKT	1930 Jun 21 # Irkutsk Time
-			 8:00	Russia	IRK%sT	1991 Mar 31  2:00s
-			 7:00	Russia	IRK%sT	1992 Jan 19  2:00s
-			 8:00	Russia	IRK%sT	2011 Mar 27  2:00s
-			 9:00	-	IRKT	2014 Oct 26  2:00s
-			 8:00	-	IRKT
+			 7:00	-	+07	1930 Jun 21
+			 8:00	Russia	+08/+09	1991 Mar 31  2:00s
+			 7:00	Russia	+07/+08	1992 Jan 19  2:00s
+			 8:00	Russia	+08/+09	2011 Mar 27  2:00s
+			 9:00	-	+09	2014 Oct 26  2:00s
+			 8:00	-	+08
 
 
 # From Tim Parenti (2014-07-06):
@@ -2912,13 +2933,13 @@
 # http://publication.pravo.gov.ru/Document/View/0001201512300107
 
 Zone Asia/Chita	 7:33:52 -	LMT	1919 Dec 15
-			 8:00	-	YAKT	1930 Jun 21 # Yakutsk Time
-			 9:00	Russia	YAK%sT	1991 Mar 31  2:00s
-			 8:00	Russia	YAK%sT	1992 Jan 19  2:00s
-			 9:00	Russia	YAK%sT	2011 Mar 27  2:00s
-			10:00	-	YAKT	2014 Oct 26  2:00s
-			 8:00	-	IRKT	2016 Mar 27  2:00
-			 9:00	-	YAKT
+			 8:00	-	+08	1930 Jun 21
+			 9:00	Russia	+09/+10	1991 Mar 31  2:00s
+			 8:00	Russia	+08/+09	1992 Jan 19  2:00s
+			 9:00	Russia	+09/+10	2011 Mar 27  2:00s
+			10:00	-	+10	2014 Oct 26  2:00s
+			 8:00	-	+08	2016 Mar 27  2:00
+			 9:00	-	+09
 
 
 # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2009-11-29):
@@ -2958,12 +2979,12 @@
 # Byalokoz 1919 says Yakutsk was 8:38:58.
 
 Zone Asia/Yakutsk	 8:38:58 -	LMT	1919 Dec 15
-			 8:00	-	YAKT	1930 Jun 21 # Yakutsk Time
-			 9:00	Russia	YAK%sT	1991 Mar 31  2:00s
-			 8:00	Russia	YAK%sT	1992 Jan 19  2:00s
-			 9:00	Russia	YAK%sT	2011 Mar 27  2:00s
-			10:00	-	YAKT	2014 Oct 26  2:00s
-			 9:00	-	YAKT
+			 8:00	-	+08	1930 Jun 21
+			 9:00	Russia	+09/+10	1991 Mar 31  2:00s
+			 8:00	Russia	+08/+09	1992 Jan 19  2:00s
+			 9:00	Russia	+09/+10	2011 Mar 27  2:00s
+			10:00	-	+10	2014 Oct 26  2:00s
+			 9:00	-	+09
 
 
 # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2009-11-29):
@@ -2981,12 +3002,12 @@
 # Go with Byalokoz.
 
 Zone Asia/Vladivostok	 8:47:31 -	LMT	1922 Nov 15
-			 9:00	-	VLAT	1930 Jun 21 # Vladivostok Time
-			10:00	Russia	VLA%sT	1991 Mar 31  2:00s
-			 9:00	Russia	VLA%sT	1992 Jan 19  2:00s
-			10:00	Russia	VLA%sT	2011 Mar 27  2:00s
-			11:00	-	VLAT	2014 Oct 26  2:00s
-			10:00	-	VLAT
+			 9:00	-	+09	1930 Jun 21
+			10:00	Russia	+10/+11	1991 Mar 31  2:00s
+			 9:00	Russia	+09/+10	1992 Jan 19  2:00s
+			10:00	Russia	+10/+11	2011 Mar 27  2:00s
+			11:00	-	+11	2014 Oct 26  2:00s
+			10:00	-	+10
 
 
 # From Tim Parenti (2014-07-03):
@@ -3004,14 +3025,14 @@
 # This transition is no doubt wrong, but we have no better info.
 
 Zone Asia/Khandyga	 9:02:13 -	LMT	1919 Dec 15
-			 8:00	-	YAKT	1930 Jun 21 # Yakutsk Time
-			 9:00	Russia	YAK%sT	1991 Mar 31  2:00s
-			 8:00	Russia	YAK%sT	1992 Jan 19  2:00s
-			 9:00	Russia	YAK%sT	2004
-			10:00	Russia	VLA%sT	2011 Mar 27  2:00s
-			11:00	-	VLAT	2011 Sep 13  0:00s # Decree 725?
-			10:00	-	YAKT	2014 Oct 26  2:00s
-			 9:00	-	YAKT
+			 8:00	-	+08	1930 Jun 21
+			 9:00	Russia	+09/+10	1991 Mar 31  2:00s
+			 8:00	Russia	+08/+09	1992 Jan 19  2:00s
+			 9:00	Russia	+09/+10	2004
+			10:00	Russia	+10/+11	2011 Mar 27  2:00s
+			11:00	-	+11	2011 Sep 13  0:00s # Decree 725?
+			10:00	-	+10	2014 Oct 26  2:00s
+			 9:00	-	+09
 
 
 # From Tim Parenti (2014-07-03):
@@ -3027,15 +3048,14 @@
 
 # The Zone name should be Asia/Yuzhno-Sakhalinsk, but that's too long.
 Zone Asia/Sakhalin	 9:30:48 -	LMT	1905 Aug 23
-			 9:00	-	JCST	1937 Oct  1
-			 9:00	-	JST	1945 Aug 25
-			11:00	Russia	SAK%sT	1991 Mar 31  2:00s # Sakhalin T
-			10:00	Russia	SAK%sT	1992 Jan 19  2:00s
-			11:00	Russia	SAK%sT	1997 Mar lastSun  2:00s
-			10:00	Russia	SAK%sT	2011 Mar 27  2:00s
-			11:00	-	SAKT	2014 Oct 26  2:00s
-			10:00	-	SAKT	2016 Mar 27  2:00s
-			11:00	-	SAKT
+			 9:00	-	+09	1945 Aug 25
+			11:00	Russia	+11/+12	1991 Mar 31  2:00s # Sakhalin T
+			10:00	Russia	+10/+11	1992 Jan 19  2:00s
+			11:00	Russia	+11/+12	1997 Mar lastSun  2:00s
+			10:00	Russia	+10/+11	2011 Mar 27  2:00s
+			11:00	-	+11	2014 Oct 26  2:00s
+			10:00	-	+10	2016 Mar 27  2:00s
+			11:00	-	+11
 
 
 # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2009-11-29):
@@ -3058,13 +3078,13 @@
 # http://publication.pravo.gov.ru/Document/View/0001201604050038
 
 Zone Asia/Magadan	10:03:12 -	LMT	1924 May  2
-			10:00	-	MAGT	1930 Jun 21 # Magadan Time
-			11:00	Russia	MAG%sT	1991 Mar 31  2:00s
-			10:00	Russia	MAG%sT	1992 Jan 19  2:00s
-			11:00	Russia	MAG%sT	2011 Mar 27  2:00s
-			12:00	-	MAGT	2014 Oct 26  2:00s
-			10:00	-	MAGT	2016 Apr 24  2:00s
-			11:00	-	MAGT
+			10:00	-	+10	1930 Jun 21 # Magadan Time
+			11:00	Russia	+11/+12	1991 Mar 31  2:00s
+			10:00	Russia	+10/+11	1992 Jan 19  2:00s
+			11:00	Russia	+11/+12	2011 Mar 27  2:00s
+			12:00	-	+12	2014 Oct 26  2:00s
+			10:00	-	+10	2016 Apr 24  2:00s
+			11:00	-	+11
 
 
 # From Tim Parenti (2014-07-06):
@@ -3107,17 +3127,14 @@
 # in Russian.)  In addition, Srednekolymsk appears to be a much older
 # settlement and the population of Zyryanka seems to be declining.
 # Go with Srednekolymsk.
-#
-# Since Magadan Oblast moves to UTC+10 on 2014-10-26, we cannot keep using MAGT
-# as the abbreviation.  Use SRET instead.
 
 Zone Asia/Srednekolymsk	10:14:52 -	LMT	1924 May  2
-			10:00	-	MAGT	1930 Jun 21 # Magadan Time
-			11:00	Russia	MAG%sT	1991 Mar 31  2:00s
-			10:00	Russia	MAG%sT	1992 Jan 19  2:00s
-			11:00	Russia	MAG%sT	2011 Mar 27  2:00s
-			12:00	-	MAGT	2014 Oct 26  2:00s
-			11:00	-	SRET	# Srednekolymsk Time
+			10:00	-	+10	1930 Jun 21
+			11:00	Russia	+11/+12	1991 Mar 31  2:00s
+			10:00	Russia	+10/+11	1992 Jan 19  2:00s
+			11:00	Russia	+11/+12	2011 Mar 27  2:00s
+			12:00	-	+12	2014 Oct 26  2:00s
+			11:00	-	+11
 
 
 # From Tim Parenti (2014-07-03):
@@ -3135,14 +3152,14 @@
 # UTC+12 since at least then, too.
 
 Zone Asia/Ust-Nera	 9:32:54 -	LMT	1919 Dec 15
-			 8:00	-	YAKT	1930 Jun 21 # Yakutsk Time
-			 9:00	Russia	YAKT	1981 Apr  1
-			11:00	Russia	MAG%sT	1991 Mar 31  2:00s
-			10:00	Russia	MAG%sT	1992 Jan 19  2:00s
-			11:00	Russia	MAG%sT	2011 Mar 27  2:00s
-			12:00	-	MAGT	2011 Sep 13  0:00s # Decree 725?
-			11:00	-	VLAT	2014 Oct 26  2:00s
-			10:00	-	VLAT
+			 8:00	-	+08	1930 Jun 21
+			 9:00	Russia	+09/+10	1981 Apr  1
+			11:00	Russia	+11/+12	1991 Mar 31  2:00s
+			10:00	Russia	+10/+11	1992 Jan 19  2:00s
+			11:00	Russia	+11/+12	2011 Mar 27  2:00s
+			12:00	-	+12	2011 Sep 13  0:00s # Decree 725?
+			11:00	-	+11	2014 Oct 26  2:00s
+			10:00	-	+10
 
 
 # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2001-08-25):
@@ -3155,12 +3172,12 @@
 # The Zone name should be Asia/Petropavlovsk-Kamchatski or perhaps
 # Asia/Petropavlovsk-Kamchatsky, but these are too long.
 Zone Asia/Kamchatka	10:34:36 -	LMT	1922 Nov 10
-			11:00	-	PETT	1930 Jun 21 # P-K Time
-			12:00	Russia	PET%sT	1991 Mar 31  2:00s
-			11:00	Russia	PET%sT	1992 Jan 19  2:00s
-			12:00	Russia	PET%sT	2010 Mar 28  2:00s
-			11:00	Russia	PET%sT	2011 Mar 27  2:00s
-			12:00	-	PETT
+			11:00	-	+11	1930 Jun 21
+			12:00	Russia	+12/+13	1991 Mar 31  2:00s
+			11:00	Russia	+11/+12	1992 Jan 19  2:00s
+			12:00	Russia	+12/+13	2010 Mar 28  2:00s
+			11:00	Russia	+11/+12	2011 Mar 27  2:00s
+			12:00	-	+12
 
 
 # From Tim Parenti (2014-07-03):
@@ -3168,13 +3185,13 @@
 # 87	RU-CHU	Chukotka Autonomous Okrug
 
 Zone Asia/Anadyr	11:49:56 -	LMT	1924 May  2
-			12:00	-	ANAT	1930 Jun 21 # Anadyr Time
-			13:00	Russia	ANA%sT	1982 Apr  1  0:00s
-			12:00	Russia	ANA%sT	1991 Mar 31  2:00s
-			11:00	Russia	ANA%sT	1992 Jan 19  2:00s
-			12:00	Russia	ANA%sT	2010 Mar 28  2:00s
-			11:00	Russia	ANA%sT	2011 Mar 27  2:00s
-			12:00	-	ANAT
+			12:00	-	+12	1930 Jun 21
+			13:00	Russia	+13/+14	1982 Apr  1  0:00s
+			12:00	Russia	+12/+13	1991 Mar 31  2:00s
+			11:00	Russia	+11/+12	1992 Jan 19  2:00s
+			12:00	Russia	+12/+13	2010 Mar 28  2:00s
+			11:00	Russia	+11/+12	2011 Mar 27  2:00s
+			12:00	-	+12
 
 
 # San Marino
@@ -3495,6 +3512,14 @@
 # Engineered Standard Time," said Twitter user @aysekarahasan.
 # http://www.bbc.com/news/world-europe-34631326
 
+# From Burak AYDIN (2016-09-08):
+# Turkey will stay in Daylight Saving Time even in winter....
+# http://www.resmigazete.gov.tr/eskiler/2016/09/20160908-2.pdf
+#
+# From Paul Eggert (2016-09-07):
+# The change is permanent, so this is the new standard time in Turkey.
+# It takes effect today, which is not much notice.
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Turkey	1916	only	-	May	 1	0:00	1:00	S
 Rule	Turkey	1916	only	-	Oct	 1	0:00	0	-
@@ -3558,7 +3583,7 @@
 Zone	Europe/Istanbul	1:55:52 -	LMT	1880
 			1:56:56	-	IMT	1910 Oct # Istanbul Mean Time?
 			2:00	Turkey	EE%sT	1978 Oct 15
-			3:00	Turkey	TR%sT	1985 Apr 20 # Turkey Time
+			3:00	Turkey	+03/+04	1985 Apr 20
 			2:00	Turkey	EE%sT	2007
 			2:00	EU	EE%sT	2011 Mar 27  1:00u
 			2:00	-	EET	2011 Mar 28  1:00u
@@ -3566,7 +3591,8 @@
 			2:00	-	EET	2014 Mar 31  1:00u
 			2:00	EU	EE%sT	2015 Oct 25  1:00u
 			2:00	1:00	EEST	2015 Nov  8  1:00u
-			2:00	EU	EE%sT
+			2:00	EU	EE%sT	2016 Sep  7
+			3:00	-	+03
 Link	Europe/Istanbul	Asia/Istanbul	# Istanbul is in both continents.
 
 # Ukraine
--- a/jdk/test/sun/util/calendar/zi/tzdata/factory	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/sun/util/calendar/zi/tzdata/factory	Wed Jul 05 22:19:13 2017 +0200
@@ -24,9 +24,10 @@
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
-# For companies who don't want to put time zone specification in
-# their installation procedures.  When users run date, they'll get the message.
-# Also useful for the "comp.sources" version.
+# For distributors who don't want to put time zone specification in
+# their installation procedures.  Users that run 'date' will get the
+# time zone abbreviation "-00", indicating that the actual time zone
+# is unknown.
 
 # Zone	NAME	GMTOFF	RULES	FORMAT
-Zone	Factory	0	- "Local time zone must be set--see zic manual page"
+Zone	Factory	0	-	-00
--- a/jdk/test/sun/util/calendar/zi/tzdata/leapseconds	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/sun/util/calendar/zi/tzdata/leapseconds	Wed Jul 05 22:19:13 2017 +0200
@@ -79,6 +79,7 @@
 Leap	2008	Dec	31	23:59:60	+	S
 Leap	2012	Jun	30	23:59:60	+	S
 Leap	2015	Jun	30	23:59:60	+	S
+Leap	2016	Dec	31	23:59:60	+	S
 
-#	Updated through IERS Bulletin C51
-#	File expires on:  28 December 2016
+#	Updated through IERS Bulletin C52
+#	File expires on:  28 June 2017
--- a/jdk/test/sun/util/calendar/zi/tzdata/northamerica	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/sun/util/calendar/zi/tzdata/northamerica	Wed Jul 05 22:19:13 2017 +0200
@@ -436,11 +436,42 @@
 # north of the Salmon River, and the towns of Burgdorf and Warren),
 # Nevada (except West Wendover), Oregon (except the northern 3/4 of
 # Malheur county), and Washington
+
+# From Paul Eggert (2016-08-20):
+# In early February 1948, in response to California's electricity shortage,
+# PG&E changed power frequency from 60 to 59.5 Hz during daylight hours,
+# causing electric clocks to lose six minutes per day.  (This did not change
+# legal time, and is not part of the data here.)  See:
+# Ross SA. An energy crisis from the past: Northern California in 1948.
+# Working Paper No. 8, Institute of Governmental Studies, UC Berkeley,
+# 1973-11.  http://escholarship.org/uc/item/8x22k30c
+#
+# In another measure to save electricity, DST was instituted from 1948-03-14
+# at 02:01 to 1949-01-16 at 02:00, with the governor having the option to move
+# the fallback transition earlier.  See pages 3-4 of:
+# http://clerk.assembly.ca.gov/sites/clerk.assembly.ca.gov/files/archive/Statutes/1948/48Vol1_Chapters.pdf
+#
+# In response:
+#
+#   Governor Warren received a torrent of objecting mail, and it is not too much
+#   to speculate that the objections to Daylight Saving Time were one important
+#   factor in the defeat of the Dewey-Warren Presidential ticket in California.
+#     -- Ross, p 25
+#
+# On December 8 the governor exercised the option, setting the date to January 1
+# (LA Times 1948-12-09).  The transition time was 02:00 (LA Times 1949-01-01).
+#
+# Despite the controversy, in 1949 California voters approved Proposition 12,
+# which established DST from April's last Sunday at 01:00 until September's
+# last Sunday at 02:00. This was amended by 1962's Proposition 6, which changed
+# the fall-back date to October's last Sunday. See:
+# http://repository.uchastings.edu/cgi/viewcontent.cgi?article=1501&context=ca_ballot_props
+# http://repository.uchastings.edu/cgi/viewcontent.cgi?article=1636&context=ca_ballot_props
 #
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
-Rule	CA	1948	only	-	Mar	14	2:00	1:00	D
+Rule	CA	1948	only	-	Mar	14	2:01	1:00	D
 Rule	CA	1949	only	-	Jan	 1	2:00	0	S
-Rule	CA	1950	1966	-	Apr	lastSun	2:00	1:00	D
+Rule	CA	1950	1966	-	Apr	lastSun	1:00	1:00	D
 Rule	CA	1950	1961	-	Sep	lastSun	2:00	0	S
 Rule	CA	1962	1966	-	Oct	lastSun	2:00	0	S
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -3304,7 +3335,7 @@
 # indicating that the normal ET rules are followed.
 #
 # From Paul Eggert (2014-08-19):
-# The 2014-08-13 Cabinet meeting decided to stay on UTC-4 year-round.  See:
+# The 2014-08-13 Cabinet meeting decided to stay on UT -04 year-round.  See:
 # http://tcweeklynews.com/daylight-savings-time-to-be-maintained-p5353-127.htm
 # Model this as a switch from EST/EDT to AST ...
 # From Chris Walton (2014-11-04):
--- a/jdk/test/sun/util/calendar/zi/tzdata/southamerica	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/sun/util/calendar/zi/tzdata/southamerica	Wed Jul 05 22:19:13 2017 +0200
@@ -433,9 +433,9 @@
 # stuck on Summer daylight savings time even though the summer is over.
 
 # From Paul Eggert (2013-09-05):
-# Perhaps San Luis operates on the legal fiction that it is at UTC-4
+# Perhaps San Luis operates on the legal fiction that it is at -04
 # with perpetual summer time, but ordinary usage typically seems to
-# just say it's at UTC-3; see, for example,
+# just say it's at -03; see, for example,
 # http://es.wikipedia.org/wiki/Hora_oficial_argentina
 # We've documented similar situations as being plain changes to
 # standard time, so let's do that here too.  This does not change UTC
--- a/jdk/test/sun/util/calendar/zi/tzdata/zone.tab	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/sun/util/calendar/zi/tzdata/zone.tab	Wed Jul 05 22:19:13 2017 +0200
@@ -284,7 +284,7 @@
 MH	+0905+16720	Pacific/Kwajalein	Kwajalein
 MK	+4159+02126	Europe/Skopje
 ML	+1239-00800	Africa/Bamako
-MM	+1647+09610	Asia/Rangoon
+MM	+1647+09610	Asia/Yangon
 MN	+4755+10653	Asia/Ulaanbaatar	Mongolia (most areas)
 MN	+4801+09139	Asia/Hovd	Bayan-Olgiy, Govi-Altai, Hovd, Uvs, Zavkhan
 MN	+4804+11430	Asia/Choibalsan	Dornod, Sukhbaatar
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jjs/addmodulesrepeat.js	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,17 @@
+/*
+ * This is the test JavaScript program used in jjs-modulepathTest.sh
+ */
+
+print("--module-path passed: " + $OPTIONS._module_path);
+print("--add-modules passed: " + $OPTIONS._add_modules);
+
+if ($OPTIONS._add_modules != "java.base,com.greetings") {
+    throw new Error("--add-modules values are not merged!");
+}
+
+var Hello = com.greetings.Hello;
+
+var moduleName = Hello.class.module.name;
+if (moduleName != "com.greetings") {
+    throw new Error("Expected module name to be com.greetings");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jjs/com.greetings/com/greetings/Hello.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.greetings;
+
+public class Hello {
+    public static String greet() {
+        return "Hello World!";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jjs/com.greetings/module-info.java	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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.
+ */
+
+module com.greetings {
+    exports com.greetings;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jjs/jjs-modulepathTest.sh	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,68 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+# 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 8167018
+# @summary Nashorn and jjs should support --module-path and --add-modules options
+# @run shell jjs-modulepathTest.sh
+# Tests --module-path option to set the module path for jjs
+
+. ${TESTSRC-.}/common.sh
+
+setup
+
+mkdir -p ${TESTCLASSES}/com.greetings
+rm -rf ${TESTCLASSES}/com.greetings
+
+${JAVAC} ${TESTSRC}/com.greetings/module-info.java \
+    ${TESTSRC}/com.greetings/com/greetings/*.java   \
+     -d ${TESTCLASSES}/com.greetings
+
+# no --add-modules passed. This should result in error.
+${JJS} -scripting --module-path ${TESTCLASSES} ${TESTSRC}/modulepath.js
+
+if [ $? -ne 0 ]; then
+   echo "Error thrown as expected when --add-modules is missing!"
+else
+   echo "Should have thrown error for missing --add-modules!"
+   exit 1
+fi
+
+# proper usage of --module-path with --add-modules
+${JJS} -scripting --module-path ${TESTCLASSES} --add-modules com.greetings ${TESTSRC}/modulepath.js
+if [ $? -ne 0 ]; then
+   exit 1
+fi
+
+# check that repeated --add-modules values are combined
+${JJS} -scripting --module-path ${TESTCLASSES} --add-modules java.base --add-modules com.greetings ${TESTSRC}/addmodulesrepeat.js
+if [ $? -ne 0 ]; then
+   exit 1
+fi
+
+rm -rf ${TESTCLASSES}/com.greetings
+echo "Passed"
+exit 0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jjs/modulepath.js	Wed Jul 05 22:19:13 2017 +0200
@@ -0,0 +1,21 @@
+/*
+ * This is the test JavaScript program used in jjs-modulepathTest.sh
+ */
+
+print("--module-path passed: " + $OPTIONS._module_path);
+print("--add-modules passed: " + $OPTIONS._add_modules);
+
+var Hello = com.greetings.Hello;
+var moduleName = Hello.class.module.name;
+if (moduleName != "com.greetings") {
+    throw new Error("Expected module name to be com.greetings");
+} else {
+    print("Module name is " + moduleName);
+}
+
+var msg = Hello.greet();
+if (msg != "Hello World!") {
+    throw new Error("Expected 'Hello World!'");
+} else {
+    print(msg);
+}
--- a/jdk/test/tools/jlink/JLinkNegativeTest.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/tools/jlink/JLinkNegativeTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -191,7 +191,7 @@
                     .output(imageFile)
                     .addMods("not_zip")
                     .modulePath(helper.defaultModulePath())
-                    .call().assertFailure("Error: java.util.zip.ZipException: zip file is empty");
+                    .call().assertFailure("Error: java.io.IOException: Invalid jmod file");
         } finally {
             deleteDirectory(jmod);
         }
@@ -236,13 +236,10 @@
         JImageGenerator.addFiles(module, new InMemoryFile("unknown/A.class", new byte[0]));
         try {
             Result result = helper.generateDefaultImage(moduleName);
-            if (result.getExitCode() != 4) {
+            System.err.println(result.getMessage());
+            if (result.getExitCode() == 0) {
                 throw new AssertionError("Crash expected");
             }
-            if (!result.getMessage().contains("java.lang.InternalError: unexpected entry: unknown")) {
-                System.err.println(result.getMessage());
-                throw new AssertionError("InternalError expected");
-            }
         } finally {
             deleteDirectory(module);
         }
@@ -250,7 +247,7 @@
 
     @Test(enabled = true)
     public void testSectionsAreFiles() throws IOException {
-        String moduleName = "module";
+        String moduleName = "hacked4";
         Path jmod = helper.generateDefaultJModule(moduleName).assertSuccess();
         JImageGenerator.addFiles(jmod,
                 new InMemoryFile("/native", new byte[0]),
@@ -258,13 +255,10 @@
                 new InMemoryFile("/bin", new byte[0]));
         try {
             Result result = helper.generateDefaultImage(moduleName);
-            if (result.getExitCode() != 4) {
+            System.err.println(result.getMessage());
+            if (result.getExitCode() == 0) {
                 throw new AssertionError("Crash expected");
             }
-            if (!result.getMessage().contains("java.lang.InternalError: unexpected entry: ")) {
-                System.err.println(result.getMessage());
-                throw new AssertionError("InternalError expected");
-            }
         } finally {
             deleteDirectory(jmod);
         }
--- a/jdk/test/tools/jlink/JLinkTest.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/tools/jlink/JLinkTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -122,15 +122,6 @@
         }
 
         {
-            String moduleName = "filter";
-            Path jmod = helper.generateDefaultJModule(moduleName).assertSuccess();
-            String className = "_A.class";
-            JImageGenerator.addFiles(jmod, new InMemoryFile(className, new byte[0]));
-            Path image = helper.generateDefaultImage(moduleName).assertSuccess();
-            helper.checkImage(image, moduleName, new String[] {"/" + moduleName + "/" + className}, null);
-        }
-
-        {
             String moduleName = "m"; // 8163382
             Path jmod = helper.generateDefaultJModule(moduleName).assertSuccess();
             JImageGenerator.getJLinkTask()
--- a/jdk/test/tools/launcher/modules/addexports/AddExportsTest.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/tools/launcher/modules/addexports/AddExportsTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -202,7 +202,7 @@
 
 
     /**
-     * --add-exports can only be specified once
+     * --add-exports allows duplicates
      */
     public void testWithDuplicateOption() throws Exception {
 
@@ -212,10 +212,40 @@
                                "-version")
                 .outputTo(System.out)
                 .errorTo(System.out)
-                .shouldContain("specified more than once")
                 .getExitValue();
 
-        assertTrue(exitValue != 0);
+        assertTrue(exitValue == 0);
+    }
+
+
+    /**
+     * Exercise --add-exports with unknown values.  Warning is emitted.
+     */
+    @Test(dataProvider = "unknownvalues")
+    public void testWithUnknownValue(String value, String ignore) throws Exception {
+
+        //  --add-exports $VALUE -version
+        int exitValue =
+            executeTestJava("--add-exports", value,
+                            "-version")
+                .stderrShouldMatch("WARNING: .*.monkey.*")
+                .outputTo(System.out)
+                .errorTo(System.out)
+                .getExitValue();
+
+        assertTrue(exitValue == 0);
+    }
+
+    @DataProvider(name = "unknownvalues")
+    public Object[][] unknownValues() {
+        return new Object[][]{
+
+            { "java.base/jdk.internal.misc=sun.monkey", null }, // unknown target
+            { "java.monkey/sun.monkey=ALL-UNNAMED",     null }, // unknown module
+            { "java.base/sun.monkey=ALL-UNNAMED",       null }, // unknown package
+            { "java.monkey/sun.monkey=ALL-UNNAMED",     null }, // unknown module/package
+
+        };
     }
 
 
@@ -241,10 +271,6 @@
         return new Object[][]{
 
             { "java.base/jdk.internal.misc",            null }, // missing target
-            { "java.base/jdk.internal.misc=sun.monkey", null }, // unknown target
-            { "java.monkey/sun.monkey=ALL-UNNAMED",     null }, // unknown module
-            { "java.base/sun.monkey=ALL-UNNAMED",       null }, // unknown package
-            { "java.monkey/sun.monkey=ALL-UNNAMED",     null }, // unknown module/package
             { "java.base=ALL-UNNAMED",                  null }, // missing package
             { "java.base/=ALL-UNNAMED",                 null }  // missing package
 
--- a/jdk/test/tools/launcher/modules/addreads/AddReadsTest.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/jdk/test/tools/launcher/modules/addreads/AddReadsTest.java	Wed Jul 05 22:19:13 2017 +0200
@@ -182,28 +182,43 @@
                   "--add-reads", "m1=java.xml",
                   "--add-reads", "m1=junit",
                   "-m", MAIN)
-                  .shouldContain("specified more than once")
                  .getExitValue();
 
-        assertTrue(exitValue != 0);
+        assertTrue(exitValue == 0);
     }
 
 
     /**
-     * Exercise --add-reads with bad values
+     * Exercise --add-reads with missing source
+     */
+    public void testWithMissingSource() throws Exception {
+
+        //  --add-exports $VALUE -version
+        assertTrue(run("--add-reads", "java.base", "-version").getExitValue() != 0);
+    }
+
+
+    /**
+     * Exercise --add-reads with unknown source/target module.
+     * Warning is emitted.
      */
     @Test(dataProvider = "badvalues")
     public void testWithBadValue(String value, String ignore) throws Exception {
 
         //  --add-exports $VALUE -version
-        assertTrue(run("--add-reads", value, "-version").getExitValue() != 0);
+        int exitValue = run("--add-reads", value, "-version")
+                            .stderrShouldMatch("WARNING: Unknown module: .*.monkey")
+                            .outputTo(System.out)
+                            .errorTo(System.out)
+                            .getExitValue();
+
+        assertTrue(exitValue == 0);
     }
 
     @DataProvider(name = "badvalues")
     public Object[][] badValues() {
         return new Object[][]{
 
-            { "java.base",                  null }, // missing source
             { "java.monkey=java.base",      null }, // unknown module
             { "java.base=sun.monkey",       null }, // unknown source
 
--- a/make/CompileJavaModules.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/make/CompileJavaModules.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -95,7 +95,7 @@
 ################################################################################
 
 java.desktop_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference \
-    '-Xdoclint/package:java.*,javax.*' -Xlint:-deprecation 
+    '-Xdoclint/package:java.*,javax.*' -Xlint:-deprecation,-exports
 java.desktop_COPY := .gif .png .wav .txt .xml .css .pf
 java.desktop_CLEAN := iio-plugin.properties cursors.properties
 
@@ -316,7 +316,7 @@
 
 ################################################################################
 
-java.naming_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
+java.naming_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*' -Xlint:-exports
 java.naming_CLEAN := jndiprovider.properties
 
 ################################################################################
@@ -344,6 +344,10 @@
 
 ################################################################################
 
+jdk.accessibility_ADD_JAVAC_FLAGS := -Xlint:-exports
+
+################################################################################
+
 jdk.compiler_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:-com.sun.tools.*' \
     -XDstringConcat=inline
 jdk.compiler_CLEAN_FILES := $(wildcard \
@@ -352,6 +356,10 @@
 
 ################################################################################
 
+jdk.jshell_ADD_JAVAC_FLAGS := -Xlint:-exports
+
+################################################################################
+
 jdk.hotspot.agent_ADD_JAVAC_FLAGS := $(DISABLE_WARNINGS),-overrides
 jdk.hotspot.agent_COPY := .gif .png sa.js .properties
 
@@ -428,6 +436,10 @@
 
 ################################################################################
 
+jdk.jsobject_ADD_JAVAC_FLAGS := -Xlint:-exports
+
+################################################################################
+
 jdk.dev_CLEAN_FILES := $(wildcard \
     $(patsubst %, $(JDK_TOPDIR)/src/jdk.dev/share/classes/%/*.properties, \
         com/sun/tools/script/shell))
@@ -440,6 +452,10 @@
 
 ################################################################################
 
+jdk.vm.ci_ADD_JAVAC_FLAGS := -Xlint:-exports
+
+################################################################################
+
 jdk.xml.bind_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
 jdk.xml.bind_CLEAN := .properties
 jdk.xml.bind_COPY := .xsd JAXBContextFactory.java ZeroOneBooleanAdapter.java
--- a/make/CopyImportModules.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/make/CopyImportModules.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -59,9 +59,24 @@
     $(eval $(call SetupCopyFiles, COPY_LIBS, \
         SRC := $(LIBS_DIR), \
         DEST := $(JDK_OUTPUTDIR)/lib, \
-        FILES := $(call CacheFind, $(LIBS_DIR)), \
+        FILES := $(filter %$(SHARED_LIBRARY_SUFFIX), $(call CacheFind, $(LIBS_DIR))), \
     ))
-    TARGETS += $(COPY_LIBS)
+
+    # Use relative links if the import dir is inside the OUTPUT_ROOT, otherwise
+    # copy to avoid having automated systems following symlinks when deleting files,
+    # or risk invalidating the build output from external changes.
+    ifeq ($(filter $(OUTPUT_ROOT)/%, $(LIBS_DIR)), )
+      LINK_MACRO := install-file
+    else
+      LINK_MACRO := link-file-relative
+    endif
+    $(eval $(call SetupCopyFiles, LINK_LIBS, \
+        SRC := $(LIBS_DIR), \
+        DEST := $(JDK_OUTPUTDIR)/lib, \
+        FILES := $(filter-out %$(SHARED_LIBRARY_SUFFIX), $(call CacheFind, $(LIBS_DIR))), \
+        MACRO := $(LINK_MACRO), \
+    ))
+    TARGETS += $(COPY_LIBS) $(LINK_LIBS)
   endif
 endif
 
--- a/make/CreateJmods.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/make/CreateJmods.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -38,9 +38,9 @@
 JMODS_DIR := $(IMAGES_OUTPUTDIR)/jmods
 
 LIBS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
-    $(SUPPORT_OUTPUTDIR)/modules_libs-stripped $(IMPORT_MODULES_LIBS))))
+    $(SUPPORT_OUTPUTDIR)/modules_libs $(IMPORT_MODULES_LIBS))))
 CMDS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
-    $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped $(IMPORT_MODULES_CMDS))))
+    $(SUPPORT_OUTPUTDIR)/modules_cmds $(IMPORT_MODULES_CMDS))))
 CONF_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
     $(SUPPORT_OUTPUTDIR)/modules_conf $(IMPORT_MODULES_CONF))))
 CLASSES_DIR := $(wildcard $(JDK_OUTPUTDIR)/modules/$(MODULE))
@@ -103,7 +103,7 @@
             --os-arch $(OPENJDK_TARGET_CPU_LEGACY) \
             --os-version $(REQUIRED_OS_VERSION) \
             --module-path $(JMODS_DIR) \
-            --exclude '**{_the.*,*.diz,*.debuginfo,*.dSYM/**,*.pdb,*.map}' \
+            --exclude '**{_the.*,*.diz,*.debuginfo,*.dSYM/**,*.dSYM,*.pdb,*.map}' \
 	    $(JMOD_FLAGS) $(SUPPORT_OUTPUTDIR)/jmods/$(notdir $@)
 	$(MV) $(SUPPORT_OUTPUTDIR)/jmods/$(notdir $@) $@
 
--- a/make/Help.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/make/Help.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,8 @@
 	$(info $(_) make [default]         # Compile all modules in langtools, hotspot, jdk, jaxws,)
 	$(info $(_)                        # jaxp and corba, and create a runnable "exploded" image)
 	$(info $(_) make all               # Compile everything, all repos, docs and images)
-	$(info $(_) make images            # Create complete jdk and jre images)
+	$(info $(_) make images            # Create complete jdk and jre images (alias for product-images))
+	$(info $(_) make <name>-image      # Build just the image (jdk, jre, test, docs etc))
 	$(info $(_) make <phase>           # Build the specified phase and everything it depends on)
 	$(info $(_)                        # (gensrc, java, copy, libs, launchers, gendata, rmic))
 	$(info $(_) make *-only            # Applies to most targets and disables compling the)
--- a/make/Images.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/make/Images.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -382,14 +382,28 @@
 
 ################################################################################
 # /demo dir
-ifneq ($(findstring images, $(MAKECMDGOALS)), )
+# Avoid doing the expensive find unless called with "jdk" as target.
+ifneq ($(filter jdk, $(MAKECMDGOALS)), )
+
+  DEMO_FILES := \
+      $(if $(wildcard $(SUPPORT_OUTPUTDIR)/demos/image), \
+        $(call DoubleDollar, $(call DoubleDollar, \
+        $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/demos/image \
+            -type f -a ! \( -name "_the*" -o -name "javac_state" \) ))) \
+      )
+
+  ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
+    ifeq ($(OPENJDK_TARGET_OS), macosx)
+      DEMO_FILES := $(call not-containing, .dSYM, $(DEMO_FILES))
+    else
+      DEMO_FILES := $(filter-out %.debuginfo %.pdb %.map, $(DEMO_FILES))
+    endif
+  endif
+
   $(eval $(call SetupCopyFiles, JDK_COPY_DEMOS, \
       SRC := $(SUPPORT_OUTPUTDIR)/demos/image, \
       DEST := $(JDK_IMAGE_DIR)/demo, \
-      FILES := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/demos/image), \
-          $(call DoubleDollar, $(call DoubleDollar, \
-      $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/demos/image \
-          -type f -a ! \( -name "_the*" -o -name "javac_state" \) )))), \
+      FILES := $(DEMO_FILES), \
   ))
 
   JDK_TARGETS += $(JDK_COPY_DEMOS)
@@ -454,21 +468,25 @@
   LIBS_TARGET_SUBDIR := lib
 endif
 
-DEBUGINFO_SUFFIXES := .diz .debuginfo .pdb .map
-
 # Param 1 - dir to find debuginfo files in
 FindDebuginfoFiles = \
     $(wildcard $(addprefix $1/*, $(DEBUGINFO_SUFFIXES)) \
         $(addprefix $1/*/*, $(DEBUGINFO_SUFFIXES)) \
         $(addprefix $1/*/*/*, $(DEBUGINFO_SUFFIXES)))
 
-# On Macosx, if debug symbols have not been zipped, find all files inside *.dSYM
-# dirs.
-ifeq ($(OPENJDK_TARGET_OS)-$(ZIP_EXTERNAL_DEBUG_SYMBOLS), macosx-false)
-  $(eval $(call FillCacheFind, \
-      $(SUPPORT_OUTPUTDIR)/modules_cmds $(SUPPORT_OUTPUTDIR)/modules_libs/))
-  FindDebuginfoFiles = \
-      $(if $(wildcard $1), $(call containing, .dSYM/, $(call CacheFind, $1)))
+# Pick the correct debug info files to copy, either zipped or not.
+ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
+  DEBUGINFO_SUFFIXES += .diz
+else
+  DEBUGINFO_SUFFIXES := .debuginfo .pdb .map
+  # On Macosx, if debug symbols have not been zipped, find all files inside *.dSYM
+  # dirs.
+  ifeq ($(OPENJDK_TARGET_OS), macosx)
+    $(eval $(call FillCacheFind, \
+        $(SUPPORT_OUTPUTDIR)/modules_cmds $(SUPPORT_OUTPUTDIR)/modules_libs))
+    FindDebuginfoFiles = \
+        $(if $(wildcard $1), $(call containing, .dSYM/, $(call CacheFind, $1)))
+  endif
 endif
 
 # Param 1 - either JDK or JRE
@@ -499,8 +517,11 @@
 $(JRE_TARGETS): $(TOOL_JRE_TARGETS)
 $(JDK_TARGETS): $(TOOL_JDK_TARGETS)
 
-jimages: $(TOOL_JRE_TARGETS) $(TOOL_JDK_TARGETS) $(JRE_TARGETS) $(JDK_TARGETS) \
-    $(SYMBOLS_TARGETS)
+jdk: $(JDK_TARGETS)
+jre: $(JRE_TARGETS)
+symbols: $(SYMBOLS_TARGETS)
+
+all: jdk jre symbols
 
 $(JRE_COMPACT1_TARGETS): $(TOOL_JRE_COMPACT1_TARGETS)
 $(JRE_COMPACT2_TARGETS): $(TOOL_JRE_COMPACT2_TARGETS)
@@ -513,4 +534,4 @@
     $(JRE_COMPACT2_TARGETS) \
     $(JRE_COMPACT3_TARGETS)
 
-.PHONY: default all jimages profiles
+.PHONY: default all jdk jre symbols profiles
--- a/make/Javadoc.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/make/Javadoc.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -773,19 +773,17 @@
 # jvmtidocs
 #
 
-ALL_OTHER_TARGETS += jvmtidocs
-
-JVMTI_DOCDIR = $(PLATFORM_DOCSDIR)/jvmti
-JVMTI_HTML = $(HOTSPOT_DIST)/docs/platform/jvmti/jvmti.html
+JVMTI_DOCDIR := $(PLATFORM_DOCSDIR)/jvmti
+# Pick jvmti.html from any jvm variant, they are all the same.
+JVMTI_HTML := $(firstword \
+    $(wildcard $(HOTSPOT_OUTPUTDIR)/variant-*/gensrc/jvmtifiles/jvmti.html))
 
-jvmtidocs: $(JVMTI_DOCDIR)/jvmti.html
-$(JVMTI_DOCDIR)/jvmti.html:
-	@$(prep-javadoc)
-	@if [ -f $(JVMTI_HTML) ] ; then \
-	  $(CP) $(JVMTI_HTML) $@; \
-	else \
-	  $(ECHO) "WARNING: Generated file does not exist: $(JVMTI_HTML)"; \
-	fi
+$(eval $(call SetupCopyFiles, COPY_JVMTI_HTML, \
+    FILES := $(JVMTI_HTML), \
+    DEST := $(PLATFORM_DOCSDIR)/jvmti, \
+))
+
+jvmtidocs: $(COPY_JVMTI_HTML)
 
 #############################################################
 #
--- a/make/Main.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/make/Main.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -93,16 +93,13 @@
 ################################################################################
 # Special targets for certain modules
 
-import-hotspot:
-	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Import.gmk)
-
 unpack-sec:
 	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk)
 
 generate-exported-symbols:
 	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildStatic.gmk)
 
-ALL_TARGETS += import-hotspot unpack-sec generate-exported-symbols
+ALL_TARGETS += unpack-sec generate-exported-symbols
 
 ################################################################################
 # Gensrc targets, generating source before java compilation can be done
@@ -269,23 +266,6 @@
 ALL_TARGETS += generate-summary
 
 ################################################################################
-# Strip binaries targets
-
-STRIP_MODULES := $(sort $(LIBS_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES) \
-    $(GENDATA_MODULES))
-STRIP_TARGETS := $(addsuffix -strip, $(STRIP_MODULES))
-
-define DeclareStripRecipe
-  $1-strip:
-	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f StripBinaries.gmk \
-	    MODULE=$1)
-endef
-
-$(foreach m, $(STRIP_MODULES), $(eval $(call DeclareStripRecipe,$m)))
-
-ALL_TARGETS += $(STRIP_TARGETS)
-
-################################################################################
 # Jmod targets
 
 JMOD_MODULES := $(ALL_MODULES)
@@ -334,8 +314,14 @@
 jrtfs-jar:
 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk)
 
-jimages:
-	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jimages)
+jdk-image:
+	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jdk)
+
+jre-image:
+	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jre)
+
+symbols-image:
+	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk symbols)
 
 profiles:
 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles)
@@ -347,7 +333,8 @@
 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ExplodedImageOptimize.gmk)
 
 ALL_TARGETS += source-tips create-hgtip-files bootcycle-images zip-security \
-    zip-source jrtfs-jar jimages profiles mac-bundles-jdk \
+    zip-source jrtfs-jar jdk-image jre-image \
+    symbols-image profiles mac-bundles-jdk \
     exploded-image-optimize
 
 ################################################################################
@@ -386,7 +373,7 @@
 ALL_TARGETS += create-buildjdk-copy create-buildjdk-interim-image
 
 ################################################################################
-# The interim-image is a small jlinked image that is used to generate artifacts 
+# The interim-image is a small jlinked image that is used to generate artifacts
 # at build time for use when linking the real images.
 
 interim-image:
@@ -548,11 +535,9 @@
 
   hotspot-ide-project: hotspot exploded-image
 
-  import-hotspot: hotspot
-
   generate-exported-symbols: java.base-libs jdk.jdwp.agent-libs
 
-  $(LIBS_TARGETS): import-hotspot
+  $(LIBS_TARGETS): hotspot
 
   $(LAUNCHER_TARGETS): java.base-libs
 
@@ -607,17 +592,8 @@
   # Explicitly add dependencies for special targets
   java.base-java: unpack-sec
 
-  # The copy target copies files generated by gensrc
-  java.base-copy-hotspot: java.base-gensrc-hotspot
-
   jdk.jdeps-gendata: java rmic
 
-  # Declare dependencies from <module>-strip to libs, launchers, gendata and copy
-  $(foreach m, $(LIBS_MODULES), $(eval $m-strip: $m-libs))
-  $(foreach m, $(LAUNCHER_MODULES), $(eval $m-strip: $m-launchers))
-  $(foreach m, $(GENDATA_MODULES), $(eval $m-strip: $m-gendata))
-  $(foreach m, $(COPY_MODULES), $(eval $m-strip: $m-copy))
-
   # Declare dependencies between jmod targets. Only java.base jmod needs access
   # to the other jmods to be built.
   # When creating a BUILDJDK, we don't need to add hashes to java.base, thus
@@ -628,7 +604,6 @@
   endif
 
   # Declare dependencies from <module>-jmod to all other module targets
-  $(foreach m, $(STRIP_MODULES), $(eval $m-jmod: $m-strip))
   # When creating a BUILDJDK, the java compilation has already been done by the
   # normal build and copied in.
   ifneq ($(CREATING_BUILDJDK), true)
@@ -640,23 +615,33 @@
   $(foreach m, $(LAUNCHER_MODULES), $(eval $m-jmod: $m-launchers))
   $(foreach m, $(COPY_MODULES), $(eval $m-jmod: $m-copy))
 
-  # Jmods cannot be created until we have the jlink tool ready to run, which requires
-  # all java modules to be compiled and jdk.jlink-launchers.
-  # And we also need to copy jvm.cfg (done in java.base-copy) and tzdb.dat (done in
-  # java.base-gendata) to the appropriate location otherwise jimage, jlink and jmod won't start.
-  $(JMOD_TARGETS): java.base-libs java.base-copy java.base-gendata jdk.jlink-launchers
-  # When creating a BUILDJDK, the java compilation has already been done by the
-  # normal build and copied in.
-  ifneq ($(CREATING_BUILDJDK), true)
-    $(JMOD_TARGETS): java
-  endif
-
+  # Jmods cannot be created until we have the jmod tool ready to run. During
+  # a normal build we run it from the exploded image, but when cross compiling
+  # it's run from the buildjdk, which is either created at build time or user
+  # supplied.
+  #
+  # For the exploded image to be runnable, all java modules and
+  # jdk.jlink-launchers need to be built. We also need to copy jvm.cfg (done
+  # in java.base-copy) and tzdb.dat (done in java.base-gendata) to the
+  # appropriate location otherwise jimage, jlink and jmod won't start. This
+  # also applies when creating the buildjdk.
+  DEFAULT_JMOD_DEPS := java.base-libs java.base-copy java.base-gendata \
+      jdk.jlink-launchers
+  # When cross compiling and buildjdk is to be created, depend on creating the
+  # buildjdk instead of the default dependencies.
   ifeq ($(CREATE_BUILDJDK), true)
-    # Avoid calling create-buildjdk from within a create-buildjdk call
+    # Avoid calling create-buildjdk from within a create-buildjdk call.
     ifneq ($(CREATING_BUILDJDK), true)
       $(JMOD_TARGETS): create-buildjdk
       buildtools-modules: create-buildjdk
+    else
+      # While actually creating the buildjdk, the default deps applies.
+      $(JMOD_TARGETS): $(DEFAULT_JMOD_DEPS)
     endif
+  else
+    # The normal non cross compilation case uses the default deps.
+    # To avoid races with the optimize target, that also needs to happen first.
+    $(JMOD_TARGETS): $(DEFAULT_JMOD_DEPS) exploded-image-optimize
   endif
 
   zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \
@@ -678,18 +663,23 @@
     endif
     generate-classlist: buildtools-jdk
 
-    jimages: generate-classlist
+    jdk-image jre-image: generate-classlist
   endif
 
-  jimages: jmods zip-source source-tips demos samples jrtfs-jar
+  jdk-image: jmods zip-source source-tips demos samples jrtfs-jar
+  jre-image: jmods source-tips jrtfs-jar
 
   profiles: jmods zip-source source-tips jrtfs-jar
 
-  mac-bundles-jdk: jimages
+  mac-bundles-jdk: jdk-image jre-image
 
-  exploded-image-optimize: exploded-image-base buildtools-modules
+  # The optimize target can run as soon as the modules dir has been completely
+  # populated (java, copy and gendata targets) and the basic libs and launchers
+  # have been built.
+  exploded-image-optimize: java copy gendata java.base-libs java.base-launchers \
+      buildtools-modules
 
-  bootcycle-images: jimages
+  bootcycle-images: jdk-image
 
   docs-javadoc: $(GENSRC_TARGETS) rmic
 
@@ -697,7 +687,7 @@
 
   zip-docs: docs-javadoc docs-jvmtidoc
 
-  test: jimages test-image
+  test: jdk-image test-image
 
   create-buildjdk-copy: jdk.jlink-java java.base-gendata \
       $(addsuffix -java, $(INTERIM_IMAGE_MODULES))
@@ -716,7 +706,7 @@
 
   test-image-failure-handler: build-test-failure-handler
 
-  build-test-hotspot-jtreg-native: buildtools-jdk import-hotspot
+  build-test-hotspot-jtreg-native: buildtools-jdk hotspot
 
   build-test-jdk-jtreg-native: buildtools-jdk
 
@@ -728,7 +718,7 @@
 
   test-hotspot-internal: exploded-image
 
-  test-hotspot-jtreg: jimages test-image
+  test-hotspot-jtreg: jdk-image test-image
 
   test-hotspot-gtest: exploded-image test-image-hotspot-gtest
 
@@ -766,8 +756,6 @@
 
 jmods: $(JMOD_TARGETS)
 
-strip-binaries: $(STRIP_TARGETS)
-
 # Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which
 # is actually handled by jdk.jdi-gensrc
 jdk.jdwp.agent-gensrc: jdk.jdi-gensrc
@@ -787,7 +775,12 @@
 
 # The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk.
 exploded-image-base: $(ALL_MODULES)
-exploded-image: exploded-image-base exploded-image-optimize
+exploded-image: exploded-image-base
+# When cross compiling, no need to optimize the exploded image since it won't
+# be runnable on the host platform anyway.
+ifneq ($(COMPILE_TYPE), cross)
+  exploded-image: exploded-image-optimize
+endif
 
 create-buildjdk: create-buildjdk-copy create-buildjdk-interim-image
 
@@ -798,7 +791,11 @@
 
 # This target builds the product images, e.g. the JRE and JDK image
 # (and possibly other, more specific versions)
-product-images: jimages demos samples zip-security exploded-image
+product-images: jdk-image jre-image symbols-image exploded-image
+
+# zip-security is actually a bundle, but for now it needs to be considered
+# an image until this can be cleaned up properly.
+product-images: zip-security
 
 # The module summary cannot be run when:
 # * Cross compiling and building a partial BUILDJDK for the build host
--- a/make/MainSupport.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/make/MainSupport.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -88,9 +88,7 @@
 	@$(PRINTF) "\n" $(LOG_DEBUG)
 	$(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1)
 	$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
-	$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs-stripped/$(strip $1)
 	$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1)
-	$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped/$(strip $1)
 	@$(PRINTF) " done\n"
 endef
 
--- a/make/ModuleWrapper.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/make/ModuleWrapper.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -45,44 +45,59 @@
 ifeq ($(OPENJDK_TARGET_OS), windows)
   TO_BIN_FILTER := %$(SHARED_LIBRARY_SUFFIX) %.diz %.pdb %.map
 
-  $(eval $(call SetupCopyFiles,COPY_LIBS_TO_BIN, \
+  $(eval $(call SetupCopyFiles, COPY_LIBS_TO_BIN, \
       SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
       DEST := $(JDK_OUTPUTDIR)/bin, \
       FILES := $(filter $(TO_BIN_FILTER), \
           $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
-          $(TARGETS)))))
+          $(TARGETS))), \
+  ))
 
-  $(eval $(call SetupCopyFiles,COPY_LIBS_TO_LIB, \
+  $(eval $(call SetupCopyFiles, COPY_LIBS_TO_LIB, \
       SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
       DEST := $(JDK_OUTPUTDIR)/lib, \
       FILES := $(filter-out $(TO_BIN_FILTER), \
           $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
-          $(TARGETS)))))
+          $(TARGETS))), \
+  ))
 
 else
-  $(eval $(call SetupCopyFiles,COPY_LIBS_TO_LIB, \
+  $(eval $(call SetupCopyFiles, COPY_LIBS_TO_LIB, \
       SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
       DEST := $(JDK_OUTPUTDIR)/lib, \
-      FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
-          $(TARGETS))))
+      FILES := $(filter %$(SHARED_LIBRARY_SUFFIX), \
+          $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
+          $(TARGETS))), \
+  ))
+  $(eval $(call SetupCopyFiles, LINK_LIBS_TO_LIB, \
+      SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
+      DEST := $(JDK_OUTPUTDIR)/lib, \
+      FILES := $(filter-out %$(SHARED_LIBRARY_SUFFIX), \
+          $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
+          $(TARGETS))), \
+      MACRO := link-file-relative, \
+  ))
 endif
 
-$(eval $(call SetupCopyFiles,COPY_INCLUDE, \
+$(eval $(call SetupCopyFiles, COPY_INCLUDE, \
     SRC := $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE), \
     DEST := $(JDK_OUTPUTDIR)/include, \
     FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE)/%, \
-          $(TARGETS))))
+        $(TARGETS)), \
+))
 
-$(eval $(call SetupCopyFiles,COPY_CMDS, \
+$(eval $(call SetupCopyFiles, COPY_CMDS, \
     SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE), \
     DEST := $(JDK_OUTPUTDIR)/bin, \
-    FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)/%, $(TARGETS))))
+    FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)/%, $(TARGETS)), \
+))
 
-$(eval $(call SetupCopyFiles,COPY_CONF, \
+$(eval $(call SetupCopyFiles, COPY_CONF, \
     SRC := $(SUPPORT_OUTPUTDIR)/modules_conf/$(MODULE), \
     DEST := $(JDK_OUTPUTDIR)/conf, \
     FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_conf/$(MODULE)/%, \
-          $(TARGETS))))
+        $(TARGETS)), \
+))
 
 all: $(TARGETS) $(COPY_LIBS_TO_BIN) $(COPY_LIBS_TO_LIB) \
-    $(COPY_INCLUDE) $(COPY_CMDS) $(COPY_CONF)
+    $(COPY_INCLUDE) $(COPY_CMDS) $(COPY_CONF) $(LINK_LIBS_TO_LIB)
--- a/make/StripBinaries.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-#
-# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , StripBinaries.gmk))
-
-################################################################################
-# Copy native libraries and executables to a secondary location to strip them
-# and filter out files that shouldn't go into the image.
-
-MODULES_CMDS_STRIPPED := $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped
-MODULES_LIBS_STRIPPED := $(SUPPORT_OUTPUTDIR)/modules_libs-stripped
-
-ifneq ($(STRIP), )
-  define StripRecipe
-	$(call LogInfo, Stripping $(patsubst $(OUTPUT_ROOT)/%,%,$<))
-	$(call MakeDir, $(@D))
-	$(CP) $< $@.tmp
-	$(CHMOD) u+w $@.tmp
-	$(STRIP) $(STRIPFLAGS) $@.tmp
-	$(CHMOD) go-w $@.tmp
-	$(MV) $@.tmp $@
-  endef
-else
-  define StripRecipe
-    $(call install-file)
-  endef
-endif
-
-NO_STRIP_CMDS_FILTER += %.cgi
-
-# Don't include debug info for executables.
-ifneq ($(wildcard $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)), )
-  # OS X stores symbol information in a .dylib file inside a .dSYM directory -
-  # that file should not be stripped, so we prune the tree at the .dSYM directory.
-  ALL_CMDS_SRC := $(filter-out %.bc %.debuginfo %.diz %.map %.pdb, \
-      $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE) \( -type f -o -type l \) \
-      -print -o -name "*.dSYM" -prune))
-  COPY_CMDS_SRC := $(filter $(NO_STRIP_CMDS_FILTER), $(ALL_CMDS_SRC))
-  STRIP_CMDS_SRC := $(filter-out $(NO_STRIP_CMDS_FILTER), $(ALL_CMDS_SRC))
-endif
-
-ifneq ($(wildcard $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)), )
-  # OS X stores symbol information in a .dylib file inside a .dSYM directory -
-  # that file should not be stripped, so we prune the tree at the .dSYM directory.
-  # Example: support/modules_libs/java.base/libjsig.dylib.dSYM/Contents/Resources/DWARF/libjsig.dylib
-  STRIP_LIBS_SRC := \
-      $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE) \
-        -name '*$(SHARED_LIBRARY_SUFFIX)' -type f -print -o -name "*.dSYM" -prune)
-
-  # Make sure symbolic links are copied and not stripped.
-  COPY_LIBS_SRC := \
-      $(filter-out $(STRIP_LIBS_SRC), \
-      $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE) -type f -o -type l))
-endif
-
-$(eval $(call SetupCopyFiles,STRIP_MODULES_CMDS, \
-    SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds, \
-    DEST := $(MODULES_CMDS_STRIPPED), \
-    FILES := $(STRIP_CMDS_SRC), \
-    MACRO := StripRecipe))
-
-$(eval $(call SetupCopyFiles,COPY_MODULES_CMDS, \
-    SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds, \
-    DEST := $(MODULES_CMDS_STRIPPED), \
-    FILES := $(COPY_CMDS_SRC)))
-
-$(eval $(call SetupCopyFiles,STRIP_MODULES_LIBS, \
-    SRC := $(SUPPORT_OUTPUTDIR)/modules_libs, \
-    DEST := $(MODULES_LIBS_STRIPPED), \
-    FILES := $(STRIP_LIBS_SRC), \
-    MACRO := StripRecipe))
-
-$(eval $(call SetupCopyFiles,COPY_MODULES_LIBS, \
-    SRC := $(SUPPORT_OUTPUTDIR)/modules_libs, \
-    DEST := $(MODULES_LIBS_STRIPPED), \
-    FILES := $(COPY_LIBS_SRC)))
-
-TARGETS += $(STRIP_MODULES_CMDS) $(COPY_MODULES_CMDS) \
-    $(STRIP_MODULES_LIBS) $(COPY_MODULES_LIBS)
-
-all: $(TARGETS)
--- a/make/common/MakeBase.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/make/common/MakeBase.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -535,6 +535,67 @@
 endif
 
 ################################################################################
+# Take two paths and return the path of the last common directory.
+# Ex: /foo/bar/baz, /foo/bar/banan -> /foo/bar
+#     foo/bar/baz, /foo/bar -> <empty>
+#
+# The x prefix is used to preserve the presence of the initial slash
+#
+# $1 - Path to compare
+# $2 - Other path to compare
+FindCommonPathPrefix = \
+    $(patsubst x%,%,$(subst $(SPACE),/,$(strip \
+        $(call FindCommonPathPrefixHelper, \
+            $(subst /,$(SPACE),x$(strip $1)), $(subst /,$(SPACE),x$(strip $2))) \
+    )))
+
+FindCommonPathPrefixHelper = \
+    $(if $(call equals, $(firstword $1), $(firstword $2)), \
+      $(firstword $1) \
+      $(call FindCommonPathPrefixHelper, \
+          $(wordlist 2, $(words $1), $1), $(wordlist 2, $(words $2), $2) \
+      ) \
+    )
+
+# Convert a partial path into as many directory levels of ../, removing
+# leading and following /.
+# Ex: foo/bar/baz/ -> ../../..
+#     foo/bar -> ../..
+#     /foo -> ..
+DirToDotDot = \
+    $(subst $(SPACE),/,$(foreach d, $(subst /,$(SPACE),$1),..))
+
+# Computes the relative path from a directory to a file
+# $1 - File to compute the relative path to
+# $2 - Directory to compute the relative path from
+RelativePath = \
+    $(eval $1_prefix := $(call FindCommonPathPrefix, $1, $2)) \
+    $(eval $1_dotdots := $(call DirToDotDot, $(patsubst $($(strip $1)_prefix)/%, %, $2))) \
+    $(eval $1_suffix := $(patsubst $($(strip $1)_prefix)/%, %, $1)) \
+    $($(strip $1)_dotdots)/$($(strip $1)_suffix)
+
+################################################################################
+# link-file-* works similarly to install file but creates a symlink instead on
+# platforms that support it. There are two versions, either creating a relative
+# or an absolute link.
+ifeq ($(OPENJDK_BUILD_OS), windows)
+  link-file-absolute = $(install-file)
+  link-file-relative = $(install-file)
+else
+  define link-file-relative
+	$(call MakeDir, $(@D))
+	$(RM) $@
+	$(LN) -s $(call RelativePath, $<, $(@D)) $@
+  endef
+
+  define link-file-absolute
+	$(call MakeDir, $(@D))
+	$(RM) $@
+	$(LN) -s $< $@
+  endef
+endif
+
+################################################################################
 # Filter out duplicate sub strings while preserving order. Keeps the first occurance.
 uniq = \
     $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
--- a/make/common/NativeCompilation.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/make/common/NativeCompilation.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -346,6 +346,7 @@
 #   LIBS the libraries to link to
 #   ARFLAGS the archiver flags to be used
 #   OBJECT_DIR the directory where we store the object files
+#   OUTPUT_DIR the directory where the resulting binary is put
 #   LIBRARY the resulting library file
 #   PROGRAM the resulting exec file
 #   INCLUDES only pick source from these directories
@@ -829,67 +830,58 @@
     ifneq ($$($1_DEBUG_SYMBOLS), false)
       # Only copy debug symbols for dynamic libraries and programs.
       ifeq ($$($1_STATIC_LIBRARY), )
-        ifneq ($$($1_OUTPUT_DIR), $$($1_OBJECT_DIR))
-          # The dependency on TARGET is needed on windows for debuginfo files
-          # to be rebuilt properly.
-          $$($1_OUTPUT_DIR)/% : $$($1_OBJECT_DIR)/% $$($1_TARGET)
-                # Use cp -r since on macosx, the dSYM is a directory
-		$(CP) -r $$< $$@
-        endif
-
         # Generate debuginfo files.
         ifeq ($(OPENJDK_TARGET_OS), windows)
-          $1_EXTRA_LDFLAGS += -debug "-pdb:$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).pdb" \
-              "-map:$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map"
-          $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).pdb \
-              $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map
+          $1_EXTRA_LDFLAGS += -debug "-pdb:$$($1_OUTPUT_DIR)/$$($1_NOSUFFIX).pdb" \
+              "-map:$$($1_OUTPUT_DIR)/$$($1_NOSUFFIX).map"
+          $1_DEBUGINFO_FILES := $$($1_OUTPUT_DIR)/$$($1_NOSUFFIX).pdb \
+              $$($1_OUTPUT_DIR)/$$($1_NOSUFFIX).map
           # No separate command is needed for debuginfo on windows, instead
           # touch target to make sure it has a later time stamp than the debug
           # symbol files to avoid unnecessary relinking on rebuild.
           $1_CREATE_DEBUGINFO_CMDS := $(TOUCH) $$($1_TARGET)
 
         else ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), )
-          $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).debuginfo
+          $1_DEBUGINFO_FILES := $$($1_OUTPUT_DIR)/$$($1_NOSUFFIX).debuginfo
           # Setup the command line creating debuginfo files, to be run after linking.
           # It cannot be run separately since it updates the original target file
           $1_CREATE_DEBUGINFO_CMDS := \
-            $$($1_OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
-            $(CD) $$($1_OUTPUT_DIR) && \
-                $$($1_OBJCOPY) --add-gnu-debuglink=$$($1_DEBUGINFO_FILES) $$($1_TARGET)
+              $$($1_OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
+              $(CD) $$($1_OUTPUT_DIR) && \
+                  $$($1_OBJCOPY) --add-gnu-debuglink=$$($1_DEBUGINFO_FILES) $$($1_TARGET)
 
         else ifeq ($(OPENJDK_TARGET_OS), macosx)
-          $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_BASENAME).dSYM
+          $1_DEBUGINFO_FILES := \
+              $$($1_OUTPUT_DIR)/$$($1_BASENAME).dSYM/Contents/Info.plist \
+              $$($1_OUTPUT_DIR)/$$($1_BASENAME).dSYM/Contents/Resources/DWARF/$$($1_BASENAME)
           # On Macosx, the debuginfo generation doesn't touch the linked binary, but
           # to avoid always relinking, touch it anyway to force a later timestamp than
           # the dSYM files.
           $1_CREATE_DEBUGINFO_CMDS := \
-              $(DSYMUTIL) --out $$($1_DEBUGINFO_FILES) $$($1_TARGET) $$(NEWLINE) \
+              $(DSYMUTIL) --out $$($1_OUTPUT_DIR)/$$($1_BASENAME).dSYM $$($1_TARGET) $$(NEWLINE) \
               $(TOUCH) $$($1_TARGET)
         endif # OPENJDK_TARGET_OS
 
-        # This dependency dance ensures that debug info files get rebuilt
-        # properly if deleted.
-        $$($1_TARGET): $$($1_DEBUGINFO_FILES)
-        $$($1_DEBUGINFO_FILES): $$($1_ALL_OBJS)
+        $$($1_DEBUGINFO_FILES): $$($1_TARGET)
+
+        $1 += $$($1_DEBUGINFO_FILES)
 
         ifeq ($$($1_ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
-          $1_DEBUGINFO_ZIP := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).diz
-          $1 += $$(subst $$($1_OBJECT_DIR),$$($1_OUTPUT_DIR),$$($1_DEBUGINFO_ZIP))
+          $1_DEBUGINFO_ZIP := $$($1_OUTPUT_DIR)/$$($1_NOSUFFIX).diz
+          $1 += $$($1_DEBUGINFO_ZIP)
 
           # The dependency on TARGET is needed for debuginfo files
           # to be rebuilt properly.
           $$($1_DEBUGINFO_ZIP): $$($1_DEBUGINFO_FILES) $$($1_TARGET)
-		$(CD) $$($1_OBJECT_DIR) \
-		&& $(ZIP) -q -r $$@ $$(notdir $$($1_DEBUGINFO_FILES))
+		$(CD) $$($1_OUTPUT_DIR) && \
+		    $(ZIP) -q -r $$@ $$(subst $$($1_OUTPUT_DIR)/,, $$($1_DEBUGINFO_FILES))
 
-        else
-          $1 += $$(subst $$($1_OBJECT_DIR),$$($1_OUTPUT_DIR),$$($1_DEBUGINFO_FILES))
         endif
-      endif # !STATIC_LIBRARY
+       endif # !STATIC_LIBRARY
     endif # $1_DEBUG_SYMBOLS != false
   endif # COPY_DEBUG_SYMBOLS
 
-  ifeq ($$($1_STRIP_SYMBOLS), true)
+  ifneq ($$($1_STRIP_SYMBOLS), false)
     ifneq ($$($1_STRIP), )
       # Default to using the global STRIPFLAGS. Allow for overriding with an empty value
       $1_STRIPFLAGS ?= $(STRIPFLAGS)
@@ -902,6 +894,8 @@
     $1_EXTRA_LDFLAGS += $$(call SET_SHARED_LIBRARY_NAME,$$($1_BASENAME))
     ifeq ($(OPENJDK_TARGET_OS), windows)
       $1_EXTRA_LDFLAGS += "-implib:$$($1_OBJECT_DIR)/$$($1_LIBRARY).lib"
+      # Create a rule for the import lib so that other rules may depend on it
+      $$($1_OBJECT_DIR)/$$($1_LIBRARY).lib: $$($1_TARGET)
     endif
 
     # Create loadmap on AIX. Helps in diagnosing some problems.
--- a/make/common/TestFilesCompilation.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/make/common/TestFilesCompilation.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -88,6 +88,8 @@
         LDFLAGS := $$($1_LDFLAGS) $$($1_LDFLAGS_$$($1_PREFIX)$$(name)), \
         LIBS := $$($1_LIBS_$$($1_PREFIX)$$(name)), \
         OPTIMIZATION := LOW, \
+        COPY_DEBUG_SYMBOLS := false, \
+        STRIP_SYMBOLS := false, \
     )) \
     $$(eval $1 += $$(BUILD_TEST_$$(name)) )  \
   )
--- a/make/common/TextFileProcessing.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/make/common/TextFileProcessing.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
 # 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/test/fmw/gtest/include/gtest/internal/gtest-port.h	Fri Oct 07 21:28:20 2016 +0530
+++ b/test/fmw/gtest/include/gtest/internal/gtest-port.h	Wed Jul 05 22:19:13 2017 +0200
@@ -1586,12 +1586,13 @@
 GTEST_API_ size_t GetThreadCount();
 
 // Passing non-POD classes through ellipsis (...) crashes the ARM
-// compiler and generates a warning in Sun Studio.  The Nokia Symbian
+// compiler and generates a warning in Sun Studio before 12u4. The Nokia Symbian
 // and the IBM XL C/C++ compiler try to instantiate a copy constructor
 // for objects passed through ellipsis (...), failing for uncopyable
 // objects.  We define this to ensure that only POD is passed through
 // ellipsis on these systems.
-#if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC)
+#if defined(__SYMBIAN32__) || defined(__IBMCPP__) || \
+     (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x5130)
 // We lose support for NULL detection where the compiler doesn't like
 // passing non-POD classes through ellipsis (...).
 # define GTEST_ELLIPSIS_NEEDS_POD_ 1
--- a/test/lib/jdk/test/lib/Platform.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/test/lib/jdk/test/lib/Platform.java	Wed Jul 05 22:19:13 2017 +0200
@@ -28,6 +28,9 @@
 public class Platform {
     public  static final String vmName      = System.getProperty("java.vm.name");
     public  static final String vmInfo      = System.getProperty("java.vm.info");
+    private static final String osVersion   = System.getProperty("os.version");
+    private static       int osVersionMajor = -1;
+    private static       int osVersionMinor = -1;
     private static final String osName      = System.getProperty("os.name");
     private static final String dataModel   = System.getProperty("sun.arch.data.model");
     private static final String vmVersion   = System.getProperty("java.vm.version");
@@ -112,6 +115,35 @@
         return osName;
     }
 
+    // Os version support.
+    private static void init_version() {
+        try {
+            final String[] tokens = osVersion.split("\\.");
+            if (tokens.length > 0) {
+                osVersionMajor = Integer.parseInt(tokens[0]);
+                if (tokens.length > 1) {
+                    osVersionMinor = Integer.parseInt(tokens[1]);
+                }
+            }
+        } catch (NumberFormatException e) {
+            osVersionMajor = osVersionMinor = 0;
+        }
+    }
+
+    // Returns major version number from os.version system property.
+    // E.g. 5 on Solaris 10 and 3 on SLES 11.3 (for the linux kernel version).
+    public static int getOsVersionMajor() {
+        if (osVersionMajor == -1) init_version();
+        return osVersionMajor;
+    }
+
+    // Returns minor version number from os.version system property.
+    // E.g. 10 on Solaris 10 and 0 on SLES 11.3 (for the linux kernel version).
+    public static int getOsVersionMinor() {
+        if (osVersionMinor == -1) init_version();
+        return osVersionMinor;
+    }
+
     public static boolean isDebugBuild() {
         return (jdkDebug.toLowerCase().contains("debug"));
     }
--- a/test/lib/jdk/test/lib/cli/predicate/AndPredicate.java	Fri Oct 07 21:28:20 2016 +0530
+++ b/test/lib/jdk/test/lib/cli/predicate/AndPredicate.java	Wed Jul 05 22:19:13 2017 +0200
@@ -28,14 +28,22 @@
 public class AndPredicate implements BooleanSupplier {
     private final BooleanSupplier a;
     private final BooleanSupplier b;
+    private final BooleanSupplier c;
 
     public AndPredicate(BooleanSupplier a, BooleanSupplier b) {
         this.a = a;
         this.b = b;
+        this.c = () -> true; // Boolean.TRUE::booleanValue
+    }
+
+    public AndPredicate(BooleanSupplier a, BooleanSupplier b, BooleanSupplier c) {
+        this.a = a;
+        this.b = b;
+        this.c = c;
     }
 
     @Override
     public boolean getAsBoolean() {
-        return a.getAsBoolean() && b.getAsBoolean();
+        return a.getAsBoolean() && b.getAsBoolean() && c.getAsBoolean();
     }
 }
--- a/test/make/TestMakeBase.gmk	Fri Oct 07 21:28:20 2016 +0530
+++ b/test/make/TestMakeBase.gmk	Wed Jul 05 22:19:13 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -264,4 +264,81 @@
     $(call PathList, $(PATHLIST_INPUT)), \
     PathList call not safe for calling twice))
 
+################################################################################
+# Test FindCommonPathPrefix
+
+$(eval $(call assert-equals, \
+    $(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar/banan), \
+    /foo/bar, \
+    FindCommonPathPrefix, \
+))
+
+$(eval $(call assert-equals, \
+    $(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar), \
+    /foo/bar, \
+    FindCommonPathPrefix, \
+))
+
+$(eval $(call assert-equals, \
+    $(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar/), \
+    /foo/bar, \
+    FindCommonPathPrefix, \
+))
+
+$(eval $(call assert-equals, \
+    $(call FindCommonPathPrefix, foo/bar/baz, foo/bar/banan), \
+    foo/bar, \
+    FindCommonPathPrefix, \
+))
+
+$(eval $(call assert-equals, \
+    $(call FindCommonPathPrefix, foo/bar/baz, /foo/bar/banan), \
+    , \
+    FindCommonPathPrefix, \
+))
+
+################################################################################
+# DirToDotDot
+
+$(eval $(call assert-equals, \
+    $(call DirToDotDot, foo/bar/baz/), \
+    ../../.., \
+    DirToDotDot, \
+))
+
+$(eval $(call assert-equals, \
+    $(call DirToDotDot, foo/bar), \
+    ../.., \
+    DirToDotDot, \
+))
+
+$(eval $(call assert-equals, \
+    $(call DirToDotDot, /foo), \
+    .., \
+    DirToDotDot, \
+))
+
+################################################################################
+# RelativePath
+
+$(eval $(call assert-equals, \
+    $(call RelativePath, foo/bar/baz, foo/bar/banan), \
+    ../baz, \
+    RelativePath, \
+))
+
+$(eval $(call assert-equals, \
+    $(call RelativePath, foo/bar/baz/banan/kung, foo/bar/banan/kung), \
+    ../../baz/banan/kung, \
+    RelativePath, \
+))
+
+$(eval $(call assert-equals, \
+    $(call RelativePath, /foo/bar/baz/banan/kung, /foo/bar/banan/kung/), \
+    ../../baz/banan/kung, \
+    RelativePath, \
+))
+
+################################################################################
+
 all: $(TEST_TARGETS)