Merge
authorduke
Wed, 05 Jul 2017 18:36:58 +0200
changeset 15158 e6f2fe5e0386
parent 15157 6ab75b6a0432 (current diff)
parent 15152 0192a121f3ed (diff)
child 15164 265b23a33c4e
Merge
common/autoconf/closed.version.numbers
common/autoconf/version.numbers
jdk/make/tools/swing-beans/beaninfo/BeanInfoUtils.java
jdk/make/tools/swing-beans/beaninfo/SwingBeanInfoBase.java
jdk/src/share/demo/jfc/CodePointIM/CodePointInputMethod.java
jdk/src/share/demo/jfc/CodePointIM/CodePointInputMethodDescriptor.java
--- a/.hgtags-top-repo	Wed Jan 16 22:17:36 2013 -0800
+++ b/.hgtags-top-repo	Wed Jul 05 18:36:58 2017 +0200
@@ -194,3 +194,4 @@
 105a25ffa4a4f0af70188d4371b4a0385009b7ce jdk8-b70
 51ad2a34342055333eb5f36e2fb514b027895708 jdk8-b71
 c1be681d80a1f1c848dc671d664fccb19e046a12 jdk8-b72
+93b9664f97eeb6f89397a8842318ebacaac9feb9 jdk8-b73
--- a/Makefile	Wed Jan 16 22:17:36 2013 -0800
+++ b/Makefile	Wed Jul 05 18:36:58 2017 +0200
@@ -26,6 +26,11 @@
 # If NEWBUILD is defined, use the new build-infra Makefiles and configure.
 #     See NewMakefile.gmk for more information.
 
+# If not specified, select what the default build is
+ifndef NEWBUILD
+  NEWBUILD=true
+endif
+
 ifeq ($(NEWBUILD),true)
 
   # The new top level Makefile
--- a/NewMakefile.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/NewMakefile.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -23,273 +23,109 @@
 # questions.
 #
 
-# Utilities used in this Makefile
-BASENAME=basename
-CAT=cat
-CD=cd
-CMP=cmp
-CP=cp
-ECHO=echo
-MKDIR=mkdir
-PRINTF=printf
-PWD=pwd
-TAR=tar
-ifeq ($(PLATFORM),windows)
-  ZIP=zip
-else
-  # store symbolic links as the link
-  ZIP=zip -y
-endif
-# Insure we have a path that looks like it came from pwd
-#   (This is mostly for Windows sake and drive letters)
-define UnixPath # path
-$(shell (cd "$1" && $(PWD)))
-endef
-
-# Current root directory
-CURRENT_DIRECTORY := $(shell $(PWD))
-
-# Build directory root
-BUILD_DIR_ROOT = $(CURRENT_DIRECTORY)/build
-
-# All configured Makefiles to run
-ALL_MAKEFILES = $(wildcard $(BUILD_DIR_ROOT)/*-*/Makefile)
-
-# All bundles to create
-ALL_IMAGE_DIRS = $(wildcard $(BUILD_DIR_ROOT)/*-*/images/*-image)
+# This must be the first rule
+default:
 
-# Build all the standard 'all', 'images', and 'clean' targets
-all images clean: checks
-	@if [ "$(ALL_MAKEFILES)" = "" ] ; then \
-	  $(ECHO) "ERROR: No configurations to build"; exit 1; \
-	fi
-	@for bdir in $(dir $(ALL_MAKEFILES)) ; do \
-	  $(ECHO) "$(CD) $${bdir} && $(MAKE) $@" ; \
-	  $(CD) $${bdir} && $(MAKE) $@ ; \
-	done
-
-# TBD: Deploy input
-$(BUILD_DIR_ROOT)/.deploy_input:
-	@if [ "$(ALL_MAKEFILES)" = "" ] ; then \
-	  $(ECHO) "ERROR: No configurations to build"; exit 1; \
-	fi
-	@for bdir in $(dir $(ALL_MAKEFILES)) ; do \
-	  if [ deploy/make/Makefile ] ; then \
-	    echo "Attempting deploy build." ; \
-	    ( \
-	      $(RM) -r $${bdir}/deploy_input ; \
-	      $(MKDIR) -p $${bdir}/deploy_input ; \
-	      ( $(CD) $${bdir}/images && $(TAR) -cf - j2sdk-image j2re-image ) \
-	        | ( $(CD) $${bdir}/deploy_input && $(TAR) -xf - ) ; \
-	    ) ; \
-	  fi; \
-	done
-	touch $@
-
-# TBD: Deploy images
-deploy: $(BUILD_DIR_ROOT)/.deploy_input
-	@if [ "$(ALL_MAKEFILES)" = "" ] ; then \
-	  $(ECHO) "ERROR: No configurations to build"; exit 1; \
-	fi
-	@for bdir in $(dir $(ALL_MAKEFILES)) ; do \
-	  if [ deploy/make/Makefile ] ; then \
-	    echo "Attempting deploy build." ; \
-	    ( \
-	      $(CD) deploy/make && \
-	      $(MAKE) \
-	        ABS_OUTPUTDIR=$${bdir}/deploy_input \
-	        OUTPUTDIR=$${bdir}/deploy_input \
-	    ) ; \
-	  fi; \
-	done
-
-# TBD: Install bundles
-install:
+# Inclusion of this pseudo-target will cause make to execute this file
+# serially, regardless of -j. Recursively called makefiles will not be
+# affected, however. This is required for correct dependency management.
+.NOTPARALLEL:
 
-# Bundle creation
-bundles:
-	@if [ "$(ALL_IMAGE_DIRS)" = "" ] ; then \
-	  $(ECHO) "ERROR: No images to bundle"; exit 1; \
-	fi
-	@for i in $(ALL_IMAGE_DIRS) ; do \
-          $(MKDIR) -p $${i}/../../bundles && \
-          $(RM) $${i}/../../bundles/`$(BASENAME) $${i}`.zip && \
-	  $(ECHO) "$(CD) $${i} && $(ZIP) -q -r ../../bundles/`$(BASENAME) $${i}`.zip ."  && \
-	  $(CD) $${i} && $(ZIP) -q -r ../../bundles/`$(BASENAME) $${i}`.zip . ; \
-	done
-
-# Clobber all the built files
-clobber::
-	$(RM) -r $(BUILD_DIR_ROOT)
-
-# Make various checks to insure the build will be successful
-#   Possibilities:
-#     * Check that if any closed repo is provided, they all must be.
-#     * Check that all open repos exist, at least until we are ready for some
-#       kind of partial build.
-checks:
-	@$(ECHO) "No checks yet"
-
-# Keep track of user targets
-USER_TARGETS += all deploy install images clean clobber checks
-
-###########################################################################
-# To help in adoption of the new configure&&make build process, a bridge
-#   build will use the old settings to run configure and do the build.
-
-# Build with the configure bridge
-bridgeBuild: bridge2configure images
-
-# Bridge from old Makefile ALT settings to configure options
-bridge2configure: $(BUILD_DIR_ROOT)/.bridge2configureOpts
-	bash ./configure $(strip $(shell $(CAT) $<))
-
-# Create a file with configure options created from old Makefile mechanisms.
-$(BUILD_DIR_ROOT)/.bridge2configureOpts: $(BUILD_DIR_ROOT)/.bridge2configureOptsLatest
-	$(RM) $@
-	$(CP) $< $@
+# The shell code below will be executed on /usr/ccs/bin/make on Solaris, but not in GNU make.
+# /usr/ccs/bin/make lacks basically every other flow control mechanism.
+TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU make/gmake, this is a requirement. Check your path. 1>&2 && exit 1
 
-# Use this file to only change when obvious things have changed
-$(BUILD_DIR_ROOT)/.bridge2configureOptsLatest: FRC
-	$(RM) $@.tmp
-	$(MKDIR) -p $(BUILD_DIR_ROOT)
-	@$(ECHO) " --with-debug-level=$(if $(DEBUG_LEVEL),$(DEBUG_LEVEL),release) " >> $@.tmp
-ifdef ARCH_DATA_MODEL
-	@$(ECHO) " --with-target-bits=$(ARCH_DATA_MODEL) " >> $@.tmp
-endif
-ifdef ALT_PARALLEL_COMPILE_JOBS
-	@$(ECHO) " --with-num-cores=$(ALT_PARALLEL_COMPILE_JOBS) " >> $@.tmp
-endif
-ifdef ALT_BOOTDIR
-	@$(ECHO) " --with-boot-jdk=$(call UnixPath,$(ALT_BOOTDIR)) " >> $@.tmp
-endif
-ifdef ALT_CUPS_HEADERS_PATH
-	@$(ECHO) " --with-cups-include=$(call UnixPath,$(ALT_CUPS_HEADERS_PATH)) " >> $@.tmp
-endif
-ifdef ALT_FREETYPE_HEADERS_PATH
-	@$(ECHO) " --with-freetype=$(call UnixPath,$(ALT_FREETYPE_HEADERS_PATH)/..) " >> $@.tmp
-endif
-	@if [ -f $@ ] ; then \
-          if ! $(CMP) $@ $@.tmp > /dev/null ; then \
-            $(CP) $@.tmp $@ ; \
-          fi ; \
-        else \
-          $(CP) $@.tmp $@ ; \
-        fi
-	$(RM) $@.tmp
-
-# Clobber all the built files
-clobber:: bridge2clobber
-bridge2clobber::
-	$(RM) $(BUILD_DIR_ROOT)/.bridge2*
-	$(RM) $(BUILD_DIR_ROOT)/.deploy_input
-
-# Keep track of phony targets
-PHONY_LIST += bridge2configure bridgeBuild bridge2clobber
-
-###########################################################################
-# Sanity checks (history target)
-#
-
-sanity: checks
-
-# Keep track of user targets
-USER_TARGETS += sanity
-
-###########################################################################
-# Javadocs
-#
-
-javadocs:
-	cd common/makefiles && $(MAKE) -f MakefileJavadoc.gmk
-
-# Keep track of user targets
-USER_TARGETS += javadocs
-
-###########################################################################
-# JPRT targets
-
-ifndef JPRT_ARCHIVE_BUNDLE
-  JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/j2sdk-image.zip
+# Assume we have GNU make, but check version.
+ifeq (,$(findstring 3.81,$(MAKE_VERSION)))
+    ifeq (,$(findstring 3.82,$(MAKE_VERSION)))
+        $(error This version of GNU Make is too low ($(MAKE_VERSION)). Check your path, or upgrade to 3.81 or newer.)
+    endif
 endif
 
-jprt_build_product: DEBUG_LEVEL=release
-jprt_build_product: BUILD_DIRNAME=*-release
-jprt_build_product: jprt_build_generic
+# Locate this Makefile
+ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),)
+    makefile_path:=$(CURDIR)/$(lastword $(MAKEFILE_LIST))
+else
+    makefile_path:=$(lastword $(MAKEFILE_LIST))
+endif
+root_dir:=$(dir $(makefile_path))
 
-jprt_build_fastdebug: DEBUG_LEVEL=fastdebug
-jprt_build_fastdebug: BUILD_DIRNAME=*-fastdebug
-jprt_build_fastdebug: jprt_build_generic
+# ... and then we can include our helper functions
+include $(root_dir)/common/makefiles/MakeHelpers.gmk
 
-jprt_build_debug: DEBUG_LEVEL=slowdebug
-jprt_build_debug: BUILD_DIRNAME=*-debug
-jprt_build_debug: jprt_build_generic
-
-jprt_build_generic: $(JPRT_ARCHIVE_BUNDLE)
+$(eval $(call ParseLogLevel))
+$(eval $(call ParseConfAndSpec))
 
-$(JPRT_ARCHIVE_BUNDLE): bridgeBuild bundles
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(CP) $(BUILD_DIR_ROOT)/$(BUILD_DIRNAME)/bundles/j2sdk-image.zip $@
+# Now determine if we have zero, one or several configurations to build.
+ifeq ($(SPEC),)
+    # Since we got past ParseConfAndSpec, we must be building a global target. Do nothing.
+else
+    ifeq ($(words $(SPEC)),1)
+        # We are building a single configuration. This is the normal case. Execute the Main.gmk file.
+        include $(root_dir)/common/makefiles/Main.gmk
+    else
+        # We are building multiple configurations.
+        # First, find out the valid targets
+        # Run the makefile with an arbitraty SPEC using -p -q (quiet dry-run and dump rules) to find
+        # available PHONY targets. Use this list as valid targets to pass on to the repeated calls.
+        all_phony_targets=$(filter-out $(global_targets), $(strip $(shell \
+            $(MAKE) -p -q -f common/makefiles SPEC=$(firstword $(SPEC)) | \
+            grep ^.PHONY: | head -n 1 | cut -d " " -f 2-)))
 
-# Keep track of phony targets
-PHONY_LIST += jprt_build_product jprt_build_fastdebug jprt_build_debug \
-              jprt_build_generic
+$(all_phony_targets):
+	@$(foreach spec,$(SPEC),($(MAKE) -f NewMakefile.gmk SPEC=$(spec) $(VERBOSE) VERBOSE=$(VERBOSE) $@) &&) true
+
+    endif
+endif
 
-###########################################################################
-# Help target
+# Include this after a potential spec file has been included so that the bundles target
+# has access to the spec variables.
+include $(root_dir)/common/makefiles/Jprt.gmk
 
-HELP_FORMAT=%12s%s\n
+# Here are "global" targets, i.e. targets that can be executed without specifying a single configuration.
+# If you addd more global targets, please update the variable global_targets in MakeHelpers.
 
 help:
-	@$(PRINTF) "# JDK Makefile\n"
-	@$(PRINTF) "#\n"
-	@$(PRINTF) "# Usage: make [Target]\n"
-	@$(PRINTF) "#\n"
-	@$(PRINTF) "#   $(HELP_FORMAT)" "Target   " "Description"
-	@$(PRINTF) "#   $(HELP_FORMAT)" "------   " "-----------"
-	@for i in $(USER_TARGETS) ; do \
-	  $(MAKE) help_$${i} ; \
-	done
-	@$(PRINTF) "#\n"
+	$(info )
+	$(info OpenJDK Makefile help)
+	$(info =====================)
+	$(info )
+	$(info Common make targets)
+	$(info .  make [default]         # Compile all product in langtools, hotspot, jaxp, jaxws,)
+	$(info .                         # corba and jdk)
+	$(info .  make all               # Compile everything, all repos and images)
+	$(info .  make images            # Create complete j2sdk and j2re images)
+	$(info .  make overlay-images    # Create limited images for sparc 64 bit platforms)
+	$(info .  make bootcycle-images  # Build images twice, second time with newly build JDK)
+	$(info .  make install           # Install the generated images locally)
+	$(info .  make clean             # Remove all files generated by make, but not those)
+	$(info .                         # generated by configure)
+	$(info .  make dist-clean        # Remove all files, including configuration)
+	$(info .  make help              # Give some help on using make)
+	$(info .  make test              # Run tests, default is all tests (see TEST below))
+	$(info )
+	$(info Targets for specific components)
+	$(info (Component is any of langtools, corba, jaxp, jaxws, hotspot, jdk, images or overlay-images))
+	$(info .  make <component>       # Build <component> and everything it depends on. )
+	$(info .  make <component>-only  # Build <component> only, without dependencies. This)
+	$(info .                         # is faster but can result in incorrect build results!)
+	$(info .  make clean-<component> # Remove files generated by make for <component>)
+	$(info )
+	$(info Useful make variables)
+	$(info .  make CONF=             # Build all configurations (note, assignment is empty))
+	$(info .  make CONF=<substring>  # Build the configuration(s) with a name matching)
+	$(info .                         # <substring>)
+	$(info )
+	$(info .  make LOG=<loglevel>    # Change the log level from warn to <loglevel>)
+	$(info .                         # Available log levels are:)
+	$(info .                         # 'warn' (default), 'info', 'debug' and 'trace')
+	$(info .                         # To see executed command lines, use LOG=debug)
+	$(info )
+	$(info .  make JOBS=<n>          # Run <n> parallel make jobs)
+	$(info .                         # Note that -jN does not work as expected!)
+	$(info )
+	$(info .  make test TEST=<test>  # Only run the given test or tests, e.g.)
+	$(info .                         # make test TEST="jdk_lang jdk_net")
+	$(info )
 
-help_all:
-	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
-	"Build the entire jdk but not the images"
-help_images:
-	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
-	"Create the jdk images for the builds"
-help_deploy:
-	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
-	"Create the jdk deploy images from the jdk images"
-help_install:
-	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
-	"Create the jdk install bundles from the deploy images"
-help_clean:
-	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
-	"Clean and prepare for a fresh build from scratch"
-help_clobber:
-	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
-	"Clean and also purge any hidden derived data"
-help_checks:
-	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
-	"Perform various checks to make sure we can build"
-help_sanity:
-	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
-	"Same as 'make checks'"
-help_javadocs:
-	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
-	"Build the javadocs"
-help_help:
-	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
-	"Print out the help messages"
-
-# Keep track of user targets
-USER_TARGETS += help
-
-###########################################################################
-# Phony targets
-.PHONY: $(PHONY_LIST) $(USER_TARGETS)
-
-# Force target
-FRC:
+.PHONY: help
--- a/common/autoconf/Makefile.in	Wed Jan 16 22:17:36 2013 -0800
+++ b/common/autoconf/Makefile.in	Wed Jul 05 18:36:58 2017 +0200
@@ -24,4 +24,4 @@
 # This Makefile was generated by configure @DATE_WHEN_CONFIGURED@
 # GENERATED FILE, DO NOT EDIT
 SPEC:=@OUTPUT_ROOT@/spec.gmk
-include @SRC_ROOT@/common/makefiles/Makefile
+include @SRC_ROOT@/NewMakefile.gmk
--- a/common/autoconf/autogen.sh	Wed Jan 16 22:17:36 2013 -0800
+++ b/common/autoconf/autogen.sh	Wed Jul 05 18:36:58 2017 +0200
@@ -26,9 +26,11 @@
 
 # Create a timestamp as seconds since epoch
 if test "x`uname -s`" = "xSunOS"; then
-  # date +%s is not available on Solaris, use this workaround
-  # from http://solarisjedi.blogspot.co.uk/2006/06/solaris-date-command-and-epoch-time.html
-  TIMESTAMP=`/usr/bin/truss /usr/bin/date 2>&1 |  nawk -F= '/^time\(\)/ {gsub(/ /,"",$2);print $2}'`
+  TIMESTAMP=`date +%s`
+  if test "x$TIMESTAMP" = "x%s"; then
+    # date +%s not available on this Solaris, use workaround from nawk(1):
+    TIMESTAMP=`nawk 'BEGIN{print srand()}'`
+  fi
 else
   TIMESTAMP=`date +%s`
 fi
--- a/common/autoconf/basics.m4	Wed Jan 16 22:17:36 2013 -0800
+++ b/common/autoconf/basics.m4	Wed Jul 05 18:36:58 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 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
@@ -234,7 +234,9 @@
 BASIC_REQUIRE_PROG(CAT, cat)
 BASIC_REQUIRE_PROG(CHMOD, chmod)
 BASIC_REQUIRE_PROG(CMP, cmp)
+BASIC_REQUIRE_PROG(COMM, comm)
 BASIC_REQUIRE_PROG(CP, cp)
+BASIC_REQUIRE_PROG(CPIO, cpio)
 BASIC_REQUIRE_PROG(CUT, cut)
 BASIC_REQUIRE_PROG(DATE, date)
 BASIC_REQUIRE_PROG(DIFF, [gdiff diff])
@@ -633,6 +635,18 @@
   fi
 ])
 
+# Check that source files have basic read permissions set. This might
+# not be the case in cygwin in certain conditions.
+AC_DEFUN_ONCE([BASIC_CHECK_SRC_PERMS],
+[
+  if test x"$OPENJDK_BUILD_OS" = xwindows; then
+    file_to_test="$SRC_ROOT/LICENSE"
+    if test `$STAT -c '%a' "$file_to_test"` -lt 400; then
+      AC_MSG_ERROR([Bad file permissions on src files. This is usually caused by cloning the repositories with a non cygwin hg in a directory not created in cygwin.])
+    fi
+  fi
+])
+
 AC_DEFUN_ONCE([BASIC_TEST_USABILITY_ISSUES],
 [
 
@@ -642,6 +656,8 @@
   [OUTPUT_DIR_IS_LOCAL="no"])
 AC_MSG_RESULT($OUTPUT_DIR_IS_LOCAL)
 
+BASIC_CHECK_SRC_PERMS
+
 # Check if the user has any old-style ALT_ variables set.
 FOUND_ALT_VARIABLES=`env | grep ^ALT_`
 
--- a/common/autoconf/basics_windows.m4	Wed Jan 16 22:17:36 2013 -0800
+++ b/common/autoconf/basics_windows.m4	Wed Jul 05 18:36:58 2017 +0200
@@ -175,7 +175,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -191,7 +191,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
--- a/common/autoconf/build-aux/autoconf-config.guess	Wed Jan 16 22:17:36 2013 -0800
+++ b/common/autoconf/build-aux/autoconf-config.guess	Wed Jul 05 18:36:58 2017 +0200
@@ -1,4 +1,29 @@
 #! /bin/sh
+#
+# Copyright (c) 2012, 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.
+#
+
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
--- a/common/autoconf/build-aux/config.sub	Wed Jan 16 22:17:36 2013 -0800
+++ b/common/autoconf/build-aux/config.sub	Wed Jul 05 18:36:58 2017 +0200
@@ -1,4 +1,30 @@
 #! /bin/sh
+
+#
+# Copyright (c) 2012, 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.
+#
+
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
--- a/common/autoconf/build-aux/pkg.m4	Wed Jan 16 22:17:36 2013 -0800
+++ b/common/autoconf/build-aux/pkg.m4	Wed Jul 05 18:36:58 2017 +0200
@@ -1,4 +1,30 @@
 # pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
+
+#
+# Copyright (c) 2012, 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.
+#
+
 # 
 # Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
 #
--- a/common/autoconf/closed.version.numbers	Wed Jan 16 22:17:36 2013 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-#
-# Copyright (c) 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.
-#
-
-LAUNCHER_NAME=java
-PRODUCT_NAME="Java(TM)"
-PRODUCT_SUFFIX="SE Runtime Environment"
-JDK_RC_PLATFORM_NAME="Platform SE"
-COMPANY_NAME="Oracle Corporation"
-
-# Might need better names for these
-MACOSX_BUNDLE_NAME_BASE="Java SE"
-MACOSX_BUNDLE_ID_BASE="com.oracle.java"
--- a/common/autoconf/compare.sh.in	Wed Jan 16 22:17:36 2013 -0800
+++ b/common/autoconf/compare.sh.in	Wed Jul 05 18:36:58 2017 +0200
@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 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
@@ -48,6 +48,7 @@
 JAVAP="@FIXPATH@ @BOOT_JDK@/bin/javap"
 LDD="@LDD@"
 MKDIR="@MKDIR@"
+NAWK="@NAWK@"
 NM="@NM@"
 OBJDUMP="@OBJDUMP@"
 OTOOL="@OTOOL@"
--- a/common/autoconf/configure.ac	Wed Jan 16 22:17:36 2013 -0800
+++ b/common/autoconf/configure.ac	Wed Jul 05 18:36:58 2017 +0200
@@ -83,6 +83,9 @@
 BASIC_SETUP_PATHS
 BASIC_SETUP_LOGGING
 
+# Check if it's a pure open build or if custom sources are to be used.
+JDKOPT_SETUP_OPEN_OR_CUSTOM
+
 # These are needed to be able to create a configuration name (and thus the output directory)
 JDKOPT_SETUP_JDK_VARIANT
 JDKOPT_SETUP_JVM_VARIANTS
--- a/common/autoconf/generated-configure.sh	Wed Jan 16 22:17:36 2013 -0800
+++ b/common/autoconf/generated-configure.sh	Wed Jul 05 18:36:58 2017 +0200
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for OpenJDK jdk8.
+# Generated by GNU Autoconf 2.67 for OpenJDK jdk8.
 #
 # Report bugs to <build-dev@openjdk.java.net>.
 #
@@ -91,7 +91,6 @@
 IFS=" ""	$as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
-as_myself=
 case $0 in #((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -217,18 +216,11 @@
   # We cannot yet assume a decent shell, so we have to provide a
 	# neutralization value for shells without unset; and this also
 	# works around shells that cannot unset nonexistent variables.
-	# Preserve -v and -x to the replacement shell.
 	BASH_ENV=/dev/null
 	ENV=/dev/null
 	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
 	export CONFIG_SHELL
-	case $- in # ((((
-	  *v*x* | *x*v* ) as_opts=-vx ;;
-	  *v* ) as_opts=-v ;;
-	  *x* ) as_opts=-x ;;
-	  * ) as_opts= ;;
-	esac
-	exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
+	exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
 fi
 
     if test x$as_have_required = xno; then :
@@ -760,10 +752,7 @@
 JAVA_CHECK
 JAVAC_CHECK
 COOKED_BUILD_NUMBER
-FULL_VERSION
-RELEASE
 JDK_VERSION
-RUNTIME_NAME
 COPYRIGHT_YEAR
 MACOSX_BUNDLE_ID_BASE
 MACOSX_BUNDLE_NAME_BASE
@@ -778,6 +767,7 @@
 JDK_MICRO_VERSION
 JDK_MINOR_VERSION
 JDK_MAJOR_VERSION
+USER_RELEASE_SUFFIX
 COMPRESS_JARS
 UNLIMITED_CRYPTO
 CACERTS_FILE
@@ -785,14 +775,12 @@
 BUILD_HEADLESS
 SUPPORT_HEADFUL
 SUPPORT_HEADLESS
-SET_OPENJDK
 BDEPS_FTP
 BDEPS_UNZIP
 OS_VERSION_MICRO
 OS_VERSION_MINOR
 OS_VERSION_MAJOR
 PKG_CONFIG
-COMM
 TIME
 STAT
 HG
@@ -825,6 +813,7 @@
 JVM_VARIANT_SERVER
 JVM_VARIANTS
 JDK_VARIANT
+SET_OPENJDK
 BUILD_LOG_WRAPPER
 BUILD_LOG_PREVIOUS
 BUILD_LOG
@@ -908,7 +897,9 @@
 DIFF
 DATE
 CUT
+CPIO
 CP
+COMM
 CMP
 CHMOD
 CAT
@@ -963,6 +954,7 @@
 with_sys_root
 with_tools_dir
 with_devkit
+enable_openjdk_only
 with_jdk_variant
 with_jvm_variants
 enable_debug
@@ -972,11 +964,13 @@
 with_builddeps_server
 with_builddeps_dir
 with_builddeps_group
-enable_openjdk_only
 enable_headful
 enable_hotspot_test_in_build
 with_cacerts_file
 enable_unlimited_crypto
+with_milestone
+with_build_number
+with_user_release_suffix
 with_boot_jdk
 with_boot_jdk_jvmargs
 with_add_source_root
@@ -1439,7 +1433,7 @@
     $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
     expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
       $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
-    : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
+    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
     ;;
 
   esac
@@ -1655,10 +1649,10 @@
   --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-openjdk-only   suppress building custom source even if present
+                          [disabled]
   --enable-debug          set the debug level to fastdebug (shorthand for
                           --with-debug-level=fastdebug) [disabled]
-  --enable-openjdk-only   supress building closed source even if present
-                          [disabled]
   --disable-headful       disable building headful support (graphical UI
                           support) [enabled]
   --enable-hotspot-test-in-build
@@ -1706,6 +1700,11 @@
   --with-builddeps-group  chgrp the downloaded build dependencies to this
                           group
   --with-cacerts-file     specify alternative cacerts file
+  --with-milestone        Set milestone value for build [internal]
+  --with-build-number     Set build number value for build [b00]
+  --with-user-release-suffix
+                          Add a custom string to the version string if build
+                          number isn't set.[username_builddateb00]
   --with-boot-jdk         path to Boot JDK (used to bootstrap build) [probed]
   --with-boot-jdk-jvmargs specify JVM arguments to be passed to all
                           invocations of the Boot JDK, overriding the default
@@ -1859,7 +1858,7 @@
 if $ac_init_version; then
   cat <<\_ACEOF
 OpenJDK configure jdk8
-generated by GNU Autoconf 2.68
+generated by GNU Autoconf 2.67
 
 Copyright (C) 2010 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
@@ -1905,7 +1904,7 @@
 
 	ac_retval=1
 fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
   as_fn_set_status $ac_retval
 
 } # ac_fn_c_try_compile
@@ -1943,7 +1942,7 @@
 
 	ac_retval=1
 fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
   as_fn_set_status $ac_retval
 
 } # ac_fn_cxx_try_compile
@@ -1981,7 +1980,7 @@
 
 	ac_retval=1
 fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
   as_fn_set_status $ac_retval
 
 } # ac_fn_objc_try_compile
@@ -2018,7 +2017,7 @@
 
     ac_retval=1
 fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
   as_fn_set_status $ac_retval
 
 } # ac_fn_c_try_cpp
@@ -2055,7 +2054,7 @@
 
     ac_retval=1
 fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
   as_fn_set_status $ac_retval
 
 } # ac_fn_cxx_try_cpp
@@ -2068,10 +2067,10 @@
 ac_fn_cxx_check_header_mongrel ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if eval \${$3+:} false; then :
+  if eval "test \"\${$3+set}\"" = set; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 fi
 eval ac_res=\$$3
@@ -2138,7 +2137,7 @@
 esac
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=\$ac_header_compiler"
@@ -2147,7 +2146,7 @@
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
 fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
 } # ac_fn_cxx_check_header_mongrel
 
@@ -2188,7 +2187,7 @@
        ac_retval=$ac_status
 fi
   rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
   as_fn_set_status $ac_retval
 
 } # ac_fn_cxx_try_run
@@ -2202,7 +2201,7 @@
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2220,7 +2219,7 @@
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
 } # ac_fn_cxx_check_header_compile
 
@@ -2397,7 +2396,7 @@
 rm -f conftest.val
 
   fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
   as_fn_set_status $ac_retval
 
 } # ac_fn_cxx_compute_int
@@ -2443,7 +2442,7 @@
   # interfere with the next link command; also delete a directory that is
   # left behind by Apple's compiler.  We do this before executing the actions.
   rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
   as_fn_set_status $ac_retval
 
 } # ac_fn_cxx_try_link
@@ -2456,7 +2455,7 @@
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2511,7 +2510,7 @@
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
 } # ac_fn_cxx_check_func
 
@@ -2524,7 +2523,7 @@
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2542,7 +2541,7 @@
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
 } # ac_fn_c_check_header_compile
 cat >config.log <<_ACEOF
@@ -2550,7 +2549,7 @@
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by OpenJDK $as_me jdk8, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+generated by GNU Autoconf 2.67.  Invocation command line was
 
   $ $0 $@
 
@@ -2808,7 +2807,7 @@
       || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "failed to load site script $ac_site_file
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
   fi
 done
 
@@ -2928,6 +2927,32 @@
 
 
 # pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
+
+#
+# Copyright (c) 2012, 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.
+#
+
 #
 # Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
 #
@@ -2991,7 +3016,7 @@
 
 # Include these first...
 #
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 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
@@ -3088,6 +3113,10 @@
 # Argument 3: what to do otherwise (remote disk or failure)
 
 
+# Check that source files have basic read permissions set. This might
+# not be the case in cygwin in certain conditions.
+
+
 
 
 #
@@ -3402,7 +3431,7 @@
 
 
 #
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 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
@@ -3433,7 +3462,18 @@
 
 
 
-
+###############################################################################
+#
+# Should we build only OpenJDK even if closed sources are present?
+#
+
+
+
+
+###############################################################################
+#
+# Setup version numbers
+#
 
 
 
@@ -3683,7 +3723,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1355963953
+DATE_WHEN_GENERATED=1358499442
 
 ###############################################################################
 #
@@ -3721,7 +3761,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_BASENAME+:} false; then :
+if test "${ac_cv_path_BASENAME+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $BASENAME in
@@ -3780,7 +3820,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_BASH+:} false; then :
+if test "${ac_cv_path_BASH+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $BASH in
@@ -3839,7 +3879,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_CAT+:} false; then :
+if test "${ac_cv_path_CAT+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $CAT in
@@ -3898,7 +3938,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_CHMOD+:} false; then :
+if test "${ac_cv_path_CHMOD+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $CHMOD in
@@ -3957,7 +3997,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_CMP+:} false; then :
+if test "${ac_cv_path_CMP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $CMP in
@@ -4010,13 +4050,72 @@
 
 
 
+    for ac_prog in comm
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_COMM+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $COMM in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_COMM="$COMM" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_COMM="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+COMM=$ac_cv_path_COMM
+if test -n "$COMM"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $COMM" >&5
+$as_echo "$COMM" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$COMM" && break
+done
+
+
+    if test "x$COMM" = x; then
+        if test "xcomm" = x; then
+          PROG_NAME=comm
+        else
+          PROG_NAME=comm
+        fi
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $PROG_NAME!" >&5
+$as_echo "$as_me: Could not find $PROG_NAME!" >&6;}
+        as_fn_error $? "Cannot continue" "$LINENO" 5
+    fi
+
+
+
     for ac_prog in cp
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_CP+:} false; then :
+if test "${ac_cv_path_CP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $CP in
@@ -4069,13 +4168,72 @@
 
 
 
+    for ac_prog in cpio
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_CPIO+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $CPIO in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CPIO="$CPIO" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_CPIO="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+CPIO=$ac_cv_path_CPIO
+if test -n "$CPIO"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPIO" >&5
+$as_echo "$CPIO" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$CPIO" && break
+done
+
+
+    if test "x$CPIO" = x; then
+        if test "xcpio" = x; then
+          PROG_NAME=cpio
+        else
+          PROG_NAME=cpio
+        fi
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $PROG_NAME!" >&5
+$as_echo "$as_me: Could not find $PROG_NAME!" >&6;}
+        as_fn_error $? "Cannot continue" "$LINENO" 5
+    fi
+
+
+
     for ac_prog in cut
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_CUT+:} false; then :
+if test "${ac_cv_path_CUT+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $CUT in
@@ -4134,7 +4292,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_DATE+:} false; then :
+if test "${ac_cv_path_DATE+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $DATE in
@@ -4193,7 +4351,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_DIFF+:} false; then :
+if test "${ac_cv_path_DIFF+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $DIFF in
@@ -4252,7 +4410,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_DIRNAME+:} false; then :
+if test "${ac_cv_path_DIRNAME+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $DIRNAME in
@@ -4311,7 +4469,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_ECHO+:} false; then :
+if test "${ac_cv_path_ECHO+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $ECHO in
@@ -4370,7 +4528,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_EXPR+:} false; then :
+if test "${ac_cv_path_EXPR+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $EXPR in
@@ -4429,7 +4587,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_FILE+:} false; then :
+if test "${ac_cv_path_FILE+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $FILE in
@@ -4488,7 +4646,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_FIND+:} false; then :
+if test "${ac_cv_path_FIND+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $FIND in
@@ -4547,7 +4705,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_HEAD+:} false; then :
+if test "${ac_cv_path_HEAD+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $HEAD in
@@ -4606,7 +4764,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_LN+:} false; then :
+if test "${ac_cv_path_LN+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $LN in
@@ -4665,7 +4823,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_LS+:} false; then :
+if test "${ac_cv_path_LS+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $LS in
@@ -4724,7 +4882,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_MKDIR+:} false; then :
+if test "${ac_cv_path_MKDIR+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $MKDIR in
@@ -4783,7 +4941,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_MKTEMP+:} false; then :
+if test "${ac_cv_path_MKTEMP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $MKTEMP in
@@ -4842,7 +5000,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_MV+:} false; then :
+if test "${ac_cv_path_MV+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $MV in
@@ -4901,7 +5059,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_PRINTF+:} false; then :
+if test "${ac_cv_path_PRINTF+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $PRINTF in
@@ -4960,7 +5118,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_THEPWDCMD+:} false; then :
+if test "${ac_cv_path_THEPWDCMD+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $THEPWDCMD in
@@ -5019,7 +5177,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_RM+:} false; then :
+if test "${ac_cv_path_RM+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $RM in
@@ -5078,7 +5236,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_SH+:} false; then :
+if test "${ac_cv_path_SH+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $SH in
@@ -5137,7 +5295,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_SORT+:} false; then :
+if test "${ac_cv_path_SORT+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $SORT in
@@ -5196,7 +5354,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_TAIL+:} false; then :
+if test "${ac_cv_path_TAIL+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $TAIL in
@@ -5255,7 +5413,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_TAR+:} false; then :
+if test "${ac_cv_path_TAR+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $TAR in
@@ -5314,7 +5472,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_TEE+:} false; then :
+if test "${ac_cv_path_TEE+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $TEE in
@@ -5373,7 +5531,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_TOUCH+:} false; then :
+if test "${ac_cv_path_TOUCH+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $TOUCH in
@@ -5432,7 +5590,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_TR+:} false; then :
+if test "${ac_cv_path_TR+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $TR in
@@ -5491,7 +5649,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_UNAME+:} false; then :
+if test "${ac_cv_path_UNAME+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $UNAME in
@@ -5550,7 +5708,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_UNIQ+:} false; then :
+if test "${ac_cv_path_UNIQ+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $UNIQ in
@@ -5609,7 +5767,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_WC+:} false; then :
+if test "${ac_cv_path_WC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $WC in
@@ -5668,7 +5826,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_WHICH+:} false; then :
+if test "${ac_cv_path_WHICH+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $WHICH in
@@ -5727,7 +5885,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_XARGS+:} false; then :
+if test "${ac_cv_path_XARGS+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $XARGS in
@@ -5787,7 +5945,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_AWK+:} false; then :
+if test "${ac_cv_prog_AWK+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$AWK"; then
@@ -5837,7 +5995,7 @@
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
 $as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if ${ac_cv_path_GREP+:} false; then :
+if test "${ac_cv_path_GREP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$GREP"; then
@@ -5912,7 +6070,7 @@
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
 $as_echo_n "checking for egrep... " >&6; }
-if ${ac_cv_path_EGREP+:} false; then :
+if test "${ac_cv_path_EGREP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
@@ -5991,7 +6149,7 @@
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
 $as_echo_n "checking for fgrep... " >&6; }
-if ${ac_cv_path_FGREP+:} false; then :
+if test "${ac_cv_path_FGREP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
@@ -6070,7 +6228,7 @@
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
 $as_echo_n "checking for a sed that does not truncate output... " >&6; }
-if ${ac_cv_path_SED+:} false; then :
+if test "${ac_cv_path_SED+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
             ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
@@ -6156,7 +6314,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_NAWK+:} false; then :
+if test "${ac_cv_path_NAWK+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $NAWK in
@@ -6216,7 +6374,7 @@
 set dummy cygpath; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_CYGPATH+:} false; then :
+if test "${ac_cv_path_CYGPATH+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $CYGPATH in
@@ -6256,7 +6414,7 @@
 set dummy readlink; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_READLINK+:} false; then :
+if test "${ac_cv_path_READLINK+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $READLINK in
@@ -6296,7 +6454,7 @@
 set dummy df; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_DF+:} false; then :
+if test "${ac_cv_path_DF+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $DF in
@@ -6336,7 +6494,7 @@
 set dummy SetFile; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_SETFILE+:} false; then :
+if test "${ac_cv_path_SETFILE+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $SETFILE in
@@ -6382,7 +6540,7 @@
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
 $as_echo_n "checking build system type... " >&6; }
-if ${ac_cv_build+:} false; then :
+if test "${ac_cv_build+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_build_alias=$build_alias
@@ -6398,7 +6556,7 @@
 $as_echo "$ac_cv_build" >&6; }
 case $ac_cv_build in
 *-*-*) ;;
-*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;;
 esac
 build=$ac_cv_build
 ac_save_IFS=$IFS; IFS='-'
@@ -6416,7 +6574,7 @@
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
 $as_echo_n "checking host system type... " >&6; }
-if ${ac_cv_host+:} false; then :
+if test "${ac_cv_host+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test "x$host_alias" = x; then
@@ -6431,7 +6589,7 @@
 $as_echo "$ac_cv_host" >&6; }
 case $ac_cv_host in
 *-*-*) ;;
-*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;;
 esac
 host=$ac_cv_host
 ac_save_IFS=$IFS; IFS='-'
@@ -6449,7 +6607,7 @@
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5
 $as_echo_n "checking target system type... " >&6; }
-if ${ac_cv_target+:} false; then :
+if test "${ac_cv_target+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test "x$target_alias" = x; then
@@ -6464,7 +6622,7 @@
 $as_echo "$ac_cv_target" >&6; }
 case $ac_cv_target in
 *-*-*) ;;
-*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5 ;;
 esac
 target=$ac_cv_target
 ac_save_IFS=$IFS; IFS='-'
@@ -7355,6 +7513,53 @@
 
 
 
+# Check if it's a pure open build or if custom sources are to be used.
+
+  # Check whether --enable-openjdk-only was given.
+if test "${enable_openjdk_only+set}" = set; then :
+  enableval=$enable_openjdk_only;
+else
+  enable_openjdk_only="no"
+fi
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for presence of closed sources" >&5
+$as_echo_n "checking for presence of closed sources... " >&6; }
+  if test -d "$SRC_ROOT/jdk/src/closed"; then
+    CLOSED_SOURCE_PRESENT=yes
+  else
+    CLOSED_SOURCE_PRESENT=no
+  fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CLOSED_SOURCE_PRESENT" >&5
+$as_echo "$CLOSED_SOURCE_PRESENT" >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if closed source is suppressed (openjdk-only)" >&5
+$as_echo_n "checking if closed source is suppressed (openjdk-only)... " >&6; }
+  SUPPRESS_CLOSED_SOURCE="$enable_openjdk_only"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SUPPRESS_CLOSED_SOURCE" >&5
+$as_echo "$SUPPRESS_CLOSED_SOURCE" >&6; }
+
+  if test "x$CLOSED_SOURCE_PRESENT" = xno; then
+    OPENJDK=true
+    if test "x$SUPPRESS_CLOSED_SOURCE" = "xyes"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: No closed source present, --enable-openjdk-only makes no sense" >&5
+$as_echo "$as_me: WARNING: No closed source present, --enable-openjdk-only makes no sense" >&2;}
+    fi
+  else
+    if test "x$SUPPRESS_CLOSED_SOURCE" = "xyes"; then
+      OPENJDK=true
+    else
+      OPENJDK=false
+    fi
+  fi
+
+  if test "x$OPENJDK" = "xtrue"; then
+    SET_OPENJDK="OPENJDK=true"
+  fi
+
+
+
+
 # These are needed to be able to create a configuration name (and thus the output directory)
 
 ###############################################################################
@@ -7584,7 +7789,7 @@
 # from configure, but only server is valid anyway. Fix this
 # when hotspot makefiles are rewritten.
 if test "x$MACOSX_UNIVERSAL" = xtrue; then
-    HOTSPOT_TARGET=universal_product
+    HOTSPOT_TARGET=universal_${HOTSPOT_EXPORT}
 fi
 
 #####
@@ -7883,7 +8088,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_PKGHANDLER+:} false; then :
+if test "${ac_cv_prog_PKGHANDLER+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$PKGHANDLER"; then
@@ -7985,7 +8190,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -8001,7 +8206,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -8248,7 +8453,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_CHECK_GMAKE+:} false; then :
+if test "${ac_cv_path_CHECK_GMAKE+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $CHECK_GMAKE in
@@ -8342,7 +8547,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -8358,7 +8563,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -8602,7 +8807,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_CHECK_MAKE+:} false; then :
+if test "${ac_cv_path_CHECK_MAKE+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $CHECK_MAKE in
@@ -8696,7 +8901,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -8712,7 +8917,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -8961,7 +9166,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_CHECK_TOOLSDIR_GMAKE+:} false; then :
+if test "${ac_cv_path_CHECK_TOOLSDIR_GMAKE+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $CHECK_TOOLSDIR_GMAKE in
@@ -9055,7 +9260,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -9071,7 +9276,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -9314,7 +9519,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_CHECK_TOOLSDIR_MAKE+:} false; then :
+if test "${ac_cv_path_CHECK_TOOLSDIR_MAKE+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $CHECK_TOOLSDIR_MAKE in
@@ -9408,7 +9613,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -9424,7 +9629,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -9710,7 +9915,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_UNZIP+:} false; then :
+if test "${ac_cv_path_UNZIP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $UNZIP in
@@ -9769,7 +9974,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_ZIP+:} false; then :
+if test "${ac_cv_path_ZIP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $ZIP in
@@ -9828,7 +10033,7 @@
 set dummy ldd; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_LDD+:} false; then :
+if test "${ac_cv_path_LDD+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $LDD in
@@ -9874,7 +10079,7 @@
 set dummy otool; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_OTOOL+:} false; then :
+if test "${ac_cv_path_OTOOL+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $OTOOL in
@@ -9919,7 +10124,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_READELF+:} false; then :
+if test "${ac_cv_path_READELF+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $READELF in
@@ -9962,7 +10167,7 @@
 set dummy hg; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_HG+:} false; then :
+if test "${ac_cv_path_HG+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $HG in
@@ -10002,7 +10207,7 @@
 set dummy stat; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_STAT+:} false; then :
+if test "${ac_cv_path_STAT+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $STAT in
@@ -10042,7 +10247,7 @@
 set dummy time; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_TIME+:} false; then :
+if test "${ac_cv_path_TIME+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $TIME in
@@ -10087,7 +10292,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_COMM+:} false; then :
+if test "${ac_cv_path_COMM+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $COMM in
@@ -10151,7 +10356,7 @@
 set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_PKG_CONFIG+:} false; then :
+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $PKG_CONFIG in
@@ -10194,7 +10399,7 @@
 set dummy pkg-config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
+if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $ac_pt_PKG_CONFIG in
@@ -10367,7 +10572,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_BDEPS_UNZIP+:} false; then :
+if test "${ac_cv_prog_BDEPS_UNZIP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$BDEPS_UNZIP"; then
@@ -10413,7 +10618,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_BDEPS_FTP+:} false; then :
+if test "${ac_cv_prog_BDEPS_FTP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$BDEPS_FTP"; then
@@ -10462,54 +10667,6 @@
 
 ###############################################################################
 #
-# Should we build only OpenJDK even if closed sources are present?
-#
-# Check whether --enable-openjdk-only was given.
-if test "${enable_openjdk_only+set}" = set; then :
-  enableval=$enable_openjdk_only;
-else
-  enable_openjdk_only="no"
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for presence of closed sources" >&5
-$as_echo_n "checking for presence of closed sources... " >&6; }
-if test -d "$SRC_ROOT/jdk/src/closed"; then
-    CLOSED_SOURCE_PRESENT=yes
-else
-    CLOSED_SOURCE_PRESENT=no
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CLOSED_SOURCE_PRESENT" >&5
-$as_echo "$CLOSED_SOURCE_PRESENT" >&6; }
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if closed source is supressed (openjdk-only)" >&5
-$as_echo_n "checking if closed source is supressed (openjdk-only)... " >&6; }
-SUPRESS_CLOSED_SOURCE="$enable_openjdk_only"
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SUPRESS_CLOSED_SOURCE" >&5
-$as_echo "$SUPRESS_CLOSED_SOURCE" >&6; }
-
-if test "x$CLOSED_SOURCE_PRESENT" = xno; then
-  OPENJDK=true
-  if test "x$SUPRESS_CLOSED_SOURCE" = "xyes"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: No closed source present, --enable-openjdk-only makes no sense" >&5
-$as_echo "$as_me: WARNING: No closed source present, --enable-openjdk-only makes no sense" >&2;}
-  fi
-else
-  if test "x$SUPRESS_CLOSED_SOURCE" = "xyes"; then
-    OPENJDK=true
-  else
-    OPENJDK=false
-  fi
-fi
-
-if test "x$OPENJDK" = "xtrue"; then
-    SET_OPENJDK="OPENJDK=true"
-fi
-
-
-
-###############################################################################
-#
 # Should we build a JDK/JVM with headful support (ie a graphical ui)?
 # We always build headless support.
 #
@@ -10608,10 +10765,56 @@
 
 
 # Source the version numbers
-. $AUTOCONF_DIR/version.numbers
-if test "x$OPENJDK" = "xfalse"; then
-    . $AUTOCONF_DIR/closed.version.numbers
-fi
+. $AUTOCONF_DIR/version-numbers
+
+# Get the settings from parameters
+
+# Check whether --with-milestone was given.
+if test "${with_milestone+set}" = set; then :
+  withval=$with_milestone;
+fi
+
+if test "x$with_milestone" = xyes; then
+  as_fn_error $? "Milestone must have a value" "$LINENO" 5
+elif test "x$with_milestone" != x; then
+    MILESTONE="$with_milestone"
+else
+  MILESTONE=internal
+fi
+
+
+# Check whether --with-build-number was given.
+if test "${with_build_number+set}" = set; then :
+  withval=$with_build_number;
+fi
+
+if test "x$with_build_number" = xyes; then
+  as_fn_error $? "Build number must have a value" "$LINENO" 5
+elif test "x$with_build_number" != x; then
+  JDK_BUILD_NUMBER="$with_build_number"
+fi
+if test "x$JDK_BUILD_NUMBER" = x; then
+  JDK_BUILD_NUMBER=b00
+fi
+
+
+# Check whether --with-user-release-suffix was given.
+if test "${with_user_release_suffix+set}" = set; then :
+  withval=$with_user_release_suffix;
+fi
+
+if test "x$with_user_release_suffix" = xyes; then
+  as_fn_error $? "Release suffix must have a value" "$LINENO" 5
+elif test "x$with_user_release_suffix" != x; then
+  USER_RELEASE_SUFFIX="$with_user_release_suffix"
+else
+  BUILD_DATE=`date '+%Y_%m_%d_%H_%M'`
+  # Avoid [:alnum:] since it depends on the locale.
+  CLEAN_USERNAME=`echo "$USER" | $TR -d -c 'abcdefghijklmnopqrstuvqxyz0123456789'`
+  USER_RELEASE_SUFFIX=`echo "${CLEAN_USERNAME}_${BUILD_DATE}" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+fi
+
+
 # Now set the JDK version, milestone, build number etc.
 
 
@@ -10630,33 +10833,12 @@
 COPYRIGHT_YEAR=`date +'%Y'`
 
 
-RUNTIME_NAME="$PRODUCT_NAME $PRODUCT_SUFFIX"
-
-
 if test "x$JDK_UPDATE_VERSION" != x; then
-    JDK_VERSION="${JDK_MAJOR_VERSION}.${JDK_MINOR_VERSION}.${JDK_MICRO_VERSION}_${JDK_UPDATE_VERSION}"
-else
-    JDK_VERSION="${JDK_MAJOR_VERSION}.${JDK_MINOR_VERSION}.${JDK_MICRO_VERSION}"
-fi
-
-
-if test "x$MILESTONE" != x; then
-    RELEASE="${JDK_VERSION}-${MILESTONE}${BUILD_VARIANT_RELEASE}"
-else
-    RELEASE="${JDK_VERSION}${BUILD_VARIANT_RELEASE}"
-fi
-
-
-if test "x$JDK_BUILD_NUMBER" != x; then
-    FULL_VERSION="${RELEASE}-${JDK_BUILD_NUMBER}"
-else
-    JDK_BUILD_NUMBER=b00
-    BUILD_DATE=`date '+%Y_%m_%d_%H_%M'`
-    # Avoid [:alnum:] since it depends on the locale.
-    CLEAN_USERNAME=`echo "$USER" | $TR -d -c 'abcdefghijklmnopqrstuvqxyz0123456789'`
-    USER_RELEASE_SUFFIX=`echo "${CLEAN_USERNAME}_${BUILD_DATE}" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-    FULL_VERSION="${RELEASE}-${USER_RELEASE_SUFFIX}-${JDK_BUILD_NUMBER}"
-fi
+  JDK_VERSION="${JDK_MAJOR_VERSION}.${JDK_MINOR_VERSION}.${JDK_MICRO_VERSION}_${JDK_UPDATE_VERSION}"
+else
+  JDK_VERSION="${JDK_MAJOR_VERSION}.${JDK_MINOR_VERSION}.${JDK_MICRO_VERSION}"
+fi
+
 
 COOKED_BUILD_NUMBER=`$ECHO $JDK_BUILD_NUMBER | $SED -e 's/^b//' -e 's/^0//'`
 
@@ -11702,7 +11884,7 @@
 set dummy javac; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_JAVAC_CHECK+:} false; then :
+if test "${ac_cv_path_JAVAC_CHECK+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $JAVAC_CHECK in
@@ -11742,7 +11924,7 @@
 set dummy java; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_JAVA_CHECK+:} false; then :
+if test "${ac_cv_path_JAVA_CHECK+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $JAVA_CHECK in
@@ -15801,7 +15983,7 @@
 set dummy link; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_CYGWIN_LINK+:} false; then :
+if test "${ac_cv_path_CYGWIN_LINK+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $CYGWIN_LINK in
@@ -16248,7 +16430,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -16264,7 +16446,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -16790,7 +16972,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_BUILD_CC+:} false; then :
+if test "${ac_cv_path_BUILD_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $BUILD_CC in
@@ -16848,7 +17030,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -16864,7 +17046,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -17101,7 +17283,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_BUILD_CXX+:} false; then :
+if test "${ac_cv_path_BUILD_CXX+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $BUILD_CXX in
@@ -17159,7 +17341,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -17175,7 +17357,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -17410,7 +17592,7 @@
 set dummy ld; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_BUILD_LD+:} false; then :
+if test "${ac_cv_path_BUILD_LD+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $BUILD_LD in
@@ -17465,7 +17647,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -17481,7 +17663,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -17922,7 +18104,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_TOOLS_DIR_CC+:} false; then :
+if test "${ac_cv_path_TOOLS_DIR_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $TOOLS_DIR_CC in
@@ -17974,7 +18156,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_POTENTIAL_CC+:} false; then :
+if test "${ac_cv_path_POTENTIAL_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $POTENTIAL_CC in
@@ -18063,7 +18245,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -18079,7 +18261,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -18387,7 +18569,7 @@
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_PROPER_COMPILER_CC+:} false; then :
+if test "${ac_cv_prog_PROPER_COMPILER_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$PROPER_COMPILER_CC"; then
@@ -18431,7 +18613,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_PROPER_COMPILER_CC+:} false; then :
+if test "${ac_cv_prog_ac_ct_PROPER_COMPILER_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_PROPER_COMPILER_CC"; then
@@ -18499,7 +18681,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -18515,7 +18697,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -18881,7 +19063,7 @@
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
+if test "${ac_cv_prog_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -18925,7 +19107,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -18978,7 +19160,7 @@
 test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 
 # Provide some information about the compiler.
 $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
@@ -19093,7 +19275,7 @@
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error 77 "C compiler cannot create executables
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
@@ -19136,7 +19318,7 @@
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 rm -f conftest conftest$ac_cv_exeext
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
@@ -19195,7 +19377,7 @@
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot run C compiled programs.
 If you meant to cross compile, use \`--host'.
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
     fi
   fi
 fi
@@ -19206,7 +19388,7 @@
 ac_clean_files=$ac_clean_files_save
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
 $as_echo_n "checking for suffix of object files... " >&6; }
-if ${ac_cv_objext+:} false; then :
+if test "${ac_cv_objext+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -19247,7 +19429,7 @@
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
@@ -19257,7 +19439,7 @@
 ac_objext=$OBJEXT
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if ${ac_cv_c_compiler_gnu+:} false; then :
+if test "${ac_cv_c_compiler_gnu+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -19294,7 +19476,7 @@
 ac_save_CFLAGS=$CFLAGS
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
 $as_echo_n "checking whether $CC accepts -g... " >&6; }
-if ${ac_cv_prog_cc_g+:} false; then :
+if test "${ac_cv_prog_cc_g+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_save_c_werror_flag=$ac_c_werror_flag
@@ -19372,7 +19554,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if ${ac_cv_prog_cc_c89+:} false; then :
+if test "${ac_cv_prog_cc_c89+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_prog_cc_c89=no
@@ -19491,7 +19673,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_TOOLS_DIR_CXX+:} false; then :
+if test "${ac_cv_path_TOOLS_DIR_CXX+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $TOOLS_DIR_CXX in
@@ -19543,7 +19725,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_POTENTIAL_CXX+:} false; then :
+if test "${ac_cv_path_POTENTIAL_CXX+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $POTENTIAL_CXX in
@@ -19632,7 +19814,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -19648,7 +19830,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -19956,7 +20138,7 @@
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_PROPER_COMPILER_CXX+:} false; then :
+if test "${ac_cv_prog_PROPER_COMPILER_CXX+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$PROPER_COMPILER_CXX"; then
@@ -20000,7 +20182,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_PROPER_COMPILER_CXX+:} false; then :
+if test "${ac_cv_prog_ac_ct_PROPER_COMPILER_CXX+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_PROPER_COMPILER_CXX"; then
@@ -20068,7 +20250,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -20084,7 +20266,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -20454,7 +20636,7 @@
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CXX+:} false; then :
+if test "${ac_cv_prog_CXX+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CXX"; then
@@ -20498,7 +20680,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CXX+:} false; then :
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CXX"; then
@@ -20576,7 +20758,7 @@
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
-if ${ac_cv_cxx_compiler_gnu+:} false; then :
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -20613,7 +20795,7 @@
 ac_save_CXXFLAGS=$CXXFLAGS
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
 $as_echo_n "checking whether $CXX accepts -g... " >&6; }
-if ${ac_cv_prog_cxx_g+:} false; then :
+if test "${ac_cv_prog_cxx_g+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_save_cxx_werror_flag=$ac_cxx_werror_flag
@@ -20711,7 +20893,7 @@
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_OBJC+:} false; then :
+if test "${ac_cv_prog_OBJC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OBJC"; then
@@ -20755,7 +20937,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_OBJC+:} false; then :
+if test "${ac_cv_prog_ac_ct_OBJC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OBJC"; then
@@ -20831,7 +21013,7 @@
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU Objective C compiler" >&5
 $as_echo_n "checking whether we are using the GNU Objective C compiler... " >&6; }
-if ${ac_cv_objc_compiler_gnu+:} false; then :
+if test "${ac_cv_objc_compiler_gnu+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -20868,7 +21050,7 @@
 ac_save_OBJCFLAGS=$OBJCFLAGS
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $OBJC accepts -g" >&5
 $as_echo_n "checking whether $OBJC accepts -g... " >&6; }
-if ${ac_cv_prog_objc_g+:} false; then :
+if test "${ac_cv_prog_objc_g+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_save_objc_werror_flag=$ac_objc_werror_flag
@@ -20969,7 +21151,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -20985,7 +21167,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -21244,7 +21426,7 @@
 set dummy ${ac_tool_prefix}ar; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_AR+:} false; then :
+if test "${ac_cv_prog_AR+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$AR"; then
@@ -21284,7 +21466,7 @@
 set dummy ar; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_AR+:} false; then :
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_AR"; then
@@ -21350,7 +21532,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -21366,7 +21548,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -21626,7 +21808,7 @@
 set dummy link; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_WINLD+:} false; then :
+if test "${ac_cv_prog_WINLD+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$WINLD"; then
@@ -21697,7 +21879,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -21713,7 +21895,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -21965,7 +22147,7 @@
 set dummy mt; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_MT+:} false; then :
+if test "${ac_cv_prog_MT+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$MT"; then
@@ -22034,7 +22216,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -22050,7 +22232,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -22286,7 +22468,7 @@
 set dummy rc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_RC+:} false; then :
+if test "${ac_cv_prog_RC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$RC"; then
@@ -22355,7 +22537,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -22371,7 +22553,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -22677,7 +22859,7 @@
 set dummy lib; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_WINAR+:} false; then :
+if test "${ac_cv_prog_WINAR+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$WINAR"; then
@@ -22729,7 +22911,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -22745,7 +22927,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -22983,7 +23165,7 @@
 set dummy dumpbin; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_DUMPBIN+:} false; then :
+if test "${ac_cv_prog_DUMPBIN+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$DUMPBIN"; then
@@ -23035,7 +23217,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -23051,7 +23233,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -23302,7 +23484,7 @@
   CPP=
 fi
 if test -z "$CPP"; then
-  if ${ac_cv_prog_CPP+:} false; then :
+  if test "${ac_cv_prog_CPP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
       # Double quotes because CPP needs to be expanded
@@ -23418,7 +23600,7 @@
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 
 ac_ext=cpp
@@ -23446,7 +23628,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -23462,7 +23644,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -23702,7 +23884,7 @@
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5
 $as_echo_n "checking how to run the C++ preprocessor... " >&6; }
 if test -z "$CXXCPP"; then
-  if ${ac_cv_prog_CXXCPP+:} false; then :
+  if test "${ac_cv_prog_CXXCPP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
       # Double quotes because CXXCPP needs to be expanded
@@ -23818,7 +24000,7 @@
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 
 ac_ext=cpp
@@ -23846,7 +24028,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -23862,7 +24044,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -24120,7 +24302,7 @@
 set dummy as; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_AS+:} false; then :
+if test "${ac_cv_path_AS+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $AS in
@@ -24175,7 +24357,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -24191,7 +24373,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -24434,7 +24616,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_NM+:} false; then :
+if test "${ac_cv_path_NM+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $NM in
@@ -24492,7 +24674,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -24508,7 +24690,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -24743,7 +24925,7 @@
 set dummy strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_STRIP+:} false; then :
+if test "${ac_cv_path_STRIP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $STRIP in
@@ -24798,7 +24980,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -24814,7 +24996,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -25049,7 +25231,7 @@
 set dummy mcs; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_MCS+:} false; then :
+if test "${ac_cv_path_MCS+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $MCS in
@@ -25104,7 +25286,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -25120,7 +25302,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -25357,7 +25539,7 @@
 set dummy ${ac_tool_prefix}nm; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_NM+:} false; then :
+if test "${ac_cv_prog_NM+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$NM"; then
@@ -25397,7 +25579,7 @@
 set dummy nm; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_NM+:} false; then :
+if test "${ac_cv_prog_ac_ct_NM+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_NM"; then
@@ -25463,7 +25645,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -25479,7 +25661,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -25715,7 +25897,7 @@
 set dummy ${ac_tool_prefix}strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_STRIP+:} false; then :
+if test "${ac_cv_prog_STRIP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$STRIP"; then
@@ -25755,7 +25937,7 @@
 set dummy strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_STRIP"; then
@@ -25821,7 +26003,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -25837,7 +26019,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -26080,7 +26262,7 @@
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_OBJCOPY+:} false; then :
+if test "${ac_cv_prog_OBJCOPY+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OBJCOPY"; then
@@ -26124,7 +26306,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_OBJCOPY+:} false; then :
+if test "${ac_cv_prog_ac_ct_OBJCOPY+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OBJCOPY"; then
@@ -26194,7 +26376,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -26210,7 +26392,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -26451,7 +26633,7 @@
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_OBJDUMP+:} false; then :
+if test "${ac_cv_prog_OBJDUMP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OBJDUMP"; then
@@ -26495,7 +26677,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
+if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OBJDUMP"; then
@@ -26565,7 +26747,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -26581,7 +26763,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -26819,7 +27001,7 @@
 set dummy lipo; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_LIPO+:} false; then :
+if test "${ac_cv_path_LIPO+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $LIPO in
@@ -26874,7 +27056,7 @@
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
-           && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+           && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
            && test "x`$LS \"$path\" 2>/dev/null`" != x; then
     new_path=`$CYGPATH -u "$path"`
   fi
@@ -26890,7 +27072,7 @@
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
-             && test "x`$ECHO \"$path\" | $GREP -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+             && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
              && test "x`$LS \"$path\" 2>/dev/null`" != x; then
       new_path=`$CYGPATH -u "$path"`
     fi
@@ -27134,7 +27316,7 @@
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
 $as_echo_n "checking for ANSI C header files... " >&6; }
-if ${ac_cv_header_stdc+:} false; then :
+if test "${ac_cv_header_stdc+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -27310,7 +27492,7 @@
 for ac_header in stdio.h
 do :
   ac_fn_cxx_check_header_mongrel "$LINENO" "stdio.h" "ac_cv_header_stdio_h" "$ac_includes_default"
-if test "x$ac_cv_header_stdio_h" = xyes; then :
+if test "x$ac_cv_header_stdio_h" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_STDIO_H 1
 _ACEOF
@@ -27339,7 +27521,7 @@
 # This bug is HP SR number 8606223364.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int *" >&5
 $as_echo_n "checking size of int *... " >&6; }
-if ${ac_cv_sizeof_int_p+:} false; then :
+if test "${ac_cv_sizeof_int_p+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (int *))" "ac_cv_sizeof_int_p"        "$ac_includes_default"; then :
@@ -27349,7 +27531,7 @@
      { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error 77 "cannot compute sizeof (int *)
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
    else
      ac_cv_sizeof_int_p=0
    fi
@@ -27396,7 +27578,7 @@
 #
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
 $as_echo_n "checking whether byte ordering is bigendian... " >&6; }
-if ${ac_cv_c_bigendian+:} false; then :
+if test "${ac_cv_c_bigendian+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_c_bigendian=unknown
@@ -28396,8 +28578,8 @@
   have_x=disabled
 else
   case $x_includes,$x_libraries in #(
-    *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #(
-    *,NONE | NONE,*) if ${ac_cv_have_x+:} false; then :
+    *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5 ;; #(
+    *,NONE | NONE,*) if test "${ac_cv_have_x+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   # One or both of the vars are not set, and there is no cached value.
@@ -28674,7 +28856,7 @@
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet" >&5
 $as_echo_n "checking for dnet_ntoa in -ldnet... " >&6; }
-if ${ac_cv_lib_dnet_dnet_ntoa+:} false; then :
+if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -28708,14 +28890,14 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_dnet_ntoa" >&5
 $as_echo "$ac_cv_lib_dnet_dnet_ntoa" >&6; }
-if test "x$ac_cv_lib_dnet_dnet_ntoa" = xyes; then :
+if test "x$ac_cv_lib_dnet_dnet_ntoa" = x""yes; then :
   X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"
 fi
 
     if test $ac_cv_lib_dnet_dnet_ntoa = no; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet_stub" >&5
 $as_echo_n "checking for dnet_ntoa in -ldnet_stub... " >&6; }
-if ${ac_cv_lib_dnet_stub_dnet_ntoa+:} false; then :
+if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -28749,7 +28931,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5
 $as_echo "$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; }
-if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = xyes; then :
+if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = x""yes; then :
   X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"
 fi
 
@@ -28768,14 +28950,14 @@
     # The functions gethostbyname, getservbyname, and inet_addr are
     # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking.
     ac_fn_cxx_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname"
-if test "x$ac_cv_func_gethostbyname" = xyes; then :
+if test "x$ac_cv_func_gethostbyname" = x""yes; then :
 
 fi
 
     if test $ac_cv_func_gethostbyname = no; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5
 $as_echo_n "checking for gethostbyname in -lnsl... " >&6; }
-if ${ac_cv_lib_nsl_gethostbyname+:} false; then :
+if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -28809,14 +28991,14 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5
 $as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; }
-if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then :
+if test "x$ac_cv_lib_nsl_gethostbyname" = x""yes; then :
   X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"
 fi
 
       if test $ac_cv_lib_nsl_gethostbyname = no; then
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lbsd" >&5
 $as_echo_n "checking for gethostbyname in -lbsd... " >&6; }
-if ${ac_cv_lib_bsd_gethostbyname+:} false; then :
+if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -28850,7 +29032,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_gethostbyname" >&5
 $as_echo "$ac_cv_lib_bsd_gethostbyname" >&6; }
-if test "x$ac_cv_lib_bsd_gethostbyname" = xyes; then :
+if test "x$ac_cv_lib_bsd_gethostbyname" = x""yes; then :
   X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd"
 fi
 
@@ -28865,14 +29047,14 @@
     # must be given before -lnsl if both are needed.  We assume that
     # if connect needs -lnsl, so does gethostbyname.
     ac_fn_cxx_check_func "$LINENO" "connect" "ac_cv_func_connect"
-if test "x$ac_cv_func_connect" = xyes; then :
+if test "x$ac_cv_func_connect" = x""yes; then :
 
 fi
 
     if test $ac_cv_func_connect = no; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5
 $as_echo_n "checking for connect in -lsocket... " >&6; }
-if ${ac_cv_lib_socket_connect+:} false; then :
+if test "${ac_cv_lib_socket_connect+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -28906,7 +29088,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect" >&5
 $as_echo "$ac_cv_lib_socket_connect" >&6; }
-if test "x$ac_cv_lib_socket_connect" = xyes; then :
+if test "x$ac_cv_lib_socket_connect" = x""yes; then :
   X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS"
 fi
 
@@ -28914,14 +29096,14 @@
 
     # Guillermo Gomez says -lposix is necessary on A/UX.
     ac_fn_cxx_check_func "$LINENO" "remove" "ac_cv_func_remove"
-if test "x$ac_cv_func_remove" = xyes; then :
+if test "x$ac_cv_func_remove" = x""yes; then :
 
 fi
 
     if test $ac_cv_func_remove = no; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for remove in -lposix" >&5
 $as_echo_n "checking for remove in -lposix... " >&6; }
-if ${ac_cv_lib_posix_remove+:} false; then :
+if test "${ac_cv_lib_posix_remove+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -28955,7 +29137,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix_remove" >&5
 $as_echo "$ac_cv_lib_posix_remove" >&6; }
-if test "x$ac_cv_lib_posix_remove" = xyes; then :
+if test "x$ac_cv_lib_posix_remove" = x""yes; then :
   X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix"
 fi
 
@@ -28963,14 +29145,14 @@
 
     # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
     ac_fn_cxx_check_func "$LINENO" "shmat" "ac_cv_func_shmat"
-if test "x$ac_cv_func_shmat" = xyes; then :
+if test "x$ac_cv_func_shmat" = x""yes; then :
 
 fi
 
     if test $ac_cv_func_shmat = no; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shmat in -lipc" >&5
 $as_echo_n "checking for shmat in -lipc... " >&6; }
-if ${ac_cv_lib_ipc_shmat+:} false; then :
+if test "${ac_cv_lib_ipc_shmat+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -29004,7 +29186,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ipc_shmat" >&5
 $as_echo "$ac_cv_lib_ipc_shmat" >&6; }
-if test "x$ac_cv_lib_ipc_shmat" = xyes; then :
+if test "x$ac_cv_lib_ipc_shmat" = x""yes; then :
   X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"
 fi
 
@@ -29022,7 +29204,7 @@
   # John Interrante, Karl Berry
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IceConnectionNumber in -lICE" >&5
 $as_echo_n "checking for IceConnectionNumber in -lICE... " >&6; }
-if ${ac_cv_lib_ICE_IceConnectionNumber+:} false; then :
+if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -29056,7 +29238,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5
 $as_echo "$ac_cv_lib_ICE_IceConnectionNumber" >&6; }
-if test "x$ac_cv_lib_ICE_IceConnectionNumber" = xyes; then :
+if test "x$ac_cv_lib_ICE_IceConnectionNumber" = x""yes; then :
   X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"
 fi
 
@@ -30063,7 +30245,7 @@
             LDFLAGS="$FREETYPE2_LIBS"
             { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FT_Init_FreeType in -lfreetype" >&5
 $as_echo_n "checking for FT_Init_FreeType in -lfreetype... " >&6; }
-if ${ac_cv_lib_freetype_FT_Init_FreeType+:} false; then :
+if test "${ac_cv_lib_freetype_FT_Init_FreeType+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -30097,7 +30279,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_freetype_FT_Init_FreeType" >&5
 $as_echo "$ac_cv_lib_freetype_FT_Init_FreeType" >&6; }
-if test "x$ac_cv_lib_freetype_FT_Init_FreeType" = xyes; then :
+if test "x$ac_cv_lib_freetype_FT_Init_FreeType" = x""yes; then :
   FREETYPE2_FOUND=true
 else
   as_fn_error $? "Could not find freetype2! $HELP_MSG " "$LINENO" 5
@@ -30385,7 +30567,7 @@
 	    for ac_header in alsa/asoundlib.h
 do :
   ac_fn_cxx_check_header_mongrel "$LINENO" "alsa/asoundlib.h" "ac_cv_header_alsa_asoundlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_alsa_asoundlib_h" = xyes; then :
+if test "x$ac_cv_header_alsa_asoundlib_h" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_ALSA_ASOUNDLIB_H 1
 _ACEOF
@@ -30444,7 +30626,7 @@
 USE_EXTERNAL_LIBJPEG=true
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -ljpeg" >&5
 $as_echo_n "checking for main in -ljpeg... " >&6; }
-if ${ac_cv_lib_jpeg_main+:} false; then :
+if test "${ac_cv_lib_jpeg_main+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -30472,7 +30654,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_main" >&5
 $as_echo "$ac_cv_lib_jpeg_main" >&6; }
-if test "x$ac_cv_lib_jpeg_main" = xyes; then :
+if test "x$ac_cv_lib_jpeg_main" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBJPEG 1
 _ACEOF
@@ -30496,7 +30678,7 @@
 USE_EXTERNAL_LIBJPEG=true
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lgif" >&5
 $as_echo_n "checking for main in -lgif... " >&6; }
-if ${ac_cv_lib_gif_main+:} false; then :
+if test "${ac_cv_lib_gif_main+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -30524,7 +30706,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gif_main" >&5
 $as_echo "$ac_cv_lib_gif_main" >&6; }
-if test "x$ac_cv_lib_gif_main" = xyes; then :
+if test "x$ac_cv_lib_gif_main" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBGIF 1
 _ACEOF
@@ -30554,7 +30736,7 @@
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compress in -lz" >&5
 $as_echo_n "checking for compress in -lz... " >&6; }
-if ${ac_cv_lib_z_compress+:} false; then :
+if test "${ac_cv_lib_z_compress+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -30588,7 +30770,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_compress" >&5
 $as_echo "$ac_cv_lib_z_compress" >&6; }
-if test "x$ac_cv_lib_z_compress" = xyes; then :
+if test "x$ac_cv_lib_z_compress" = x""yes; then :
    ZLIB_FOUND=yes
 else
    ZLIB_FOUND=no
@@ -30681,7 +30863,7 @@
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
 $as_echo_n "checking for cos in -lm... " >&6; }
-if ${ac_cv_lib_m_cos+:} false; then :
+if test "${ac_cv_lib_m_cos+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -30715,7 +30897,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
 $as_echo "$ac_cv_lib_m_cos" >&6; }
-if test "x$ac_cv_lib_m_cos" = xyes; then :
+if test "x$ac_cv_lib_m_cos" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBM 1
 _ACEOF
@@ -30739,7 +30921,7 @@
 LIBS=""
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
 $as_echo_n "checking for dlopen in -ldl... " >&6; }
-if ${ac_cv_lib_dl_dlopen+:} false; then :
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -30773,7 +30955,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
 $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBDL 1
 _ACEOF
@@ -31010,7 +31192,7 @@
 # The name of the Service Agent jar.
 SALIB_NAME="${LIBRARY_PREFIX}saproc${SHARED_LIBRARY_SUFFIX}"
 if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
-    SALIB_NAME="${LIBRARY_PREFIX}sawindbg${SHARED_LIBRARY_SUFFIX}"
+  SALIB_NAME="${LIBRARY_PREFIX}sawindbg${SHARED_LIBRARY_SUFFIX}"
 fi
 
 
@@ -31417,7 +31599,7 @@
 set dummy ccache; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_CCACHE+:} false; then :
+if test "${ac_cv_path_CCACHE+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $CCACHE in
@@ -31546,6 +31728,14 @@
 
 # Check for some common pitfalls
 
+  if test x"$OPENJDK_BUILD_OS" = xwindows; then
+    file_to_test="$SRC_ROOT/LICENSE"
+    if test `$STAT -c '%a' "$file_to_test"` -lt 400; then
+      as_fn_error $? "Bad file permissions on src files. This is usually caused by cloning the repositories with a non cygwin hg in a directory not created in cygwin." "$LINENO" 5
+    fi
+  fi
+
+
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if build directory is on local disk" >&5
 $as_echo_n "checking if build directory is on local disk... " >&6; }
@@ -31576,6 +31766,8 @@
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OUTPUT_DIR_IS_LOCAL" >&5
 $as_echo "$OUTPUT_DIR_IS_LOCAL" >&6; }
 
+
+
 # Check if the user has any old-style ALT_ variables set.
 FOUND_ALT_VARIABLES=`env | grep ^ALT_`
 
@@ -31668,21 +31860,10 @@
      :end' >>confcache
 if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
   if test -w "$cache_file"; then
-    if test "x$cache_file" != "x/dev/null"; then
+    test "x$cache_file" != "x/dev/null" &&
       { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
 $as_echo "$as_me: updating cache $cache_file" >&6;}
-      if test ! -f "$cache_file" || test -h "$cache_file"; then
-	cat confcache >"$cache_file"
-      else
-        case $cache_file in #(
-        */* | ?:*)
-	  mv -f confcache "$cache_file"$$ &&
-	  mv -f "$cache_file"$$ "$cache_file" ;; #(
-        *)
-	  mv -f confcache "$cache_file" ;;
-	esac
-      fi
-    fi
+    cat confcache >$cache_file
   else
     { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
@@ -31714,7 +31895,7 @@
 
 
 
-: "${CONFIG_STATUS=./config.status}"
+: ${CONFIG_STATUS=./config.status}
 ac_write_fail=0
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
@@ -31815,7 +31996,6 @@
 IFS=" ""	$as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
-as_myself=
 case $0 in #((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -32123,7 +32303,7 @@
 # values after options handling.
 ac_log="
 This file was extended by OpenJDK $as_me jdk8, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+generated by GNU Autoconf 2.67.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -32186,7 +32366,7 @@
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
 OpenJDK config.status jdk8
-configured by $0, generated by GNU Autoconf 2.68,
+configured by $0, generated by GNU Autoconf 2.67,
   with options \\"\$ac_cs_config\\"
 
 Copyright (C) 2010 Free Software Foundation, Inc.
@@ -32315,7 +32495,7 @@
     "$OUTPUT_ROOT/spec.sh") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/spec.sh:$AUTOCONF_DIR/spec.sh.in" ;;
     "$OUTPUT_ROOT/Makefile") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/Makefile:$AUTOCONF_DIR/Makefile.in" ;;
 
-  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;;
   esac
 done
 
@@ -32337,10 +32517,9 @@
 # after its creation but before its name has been assigned to `$tmp'.
 $debug ||
 {
-  tmp= ac_tmp=
+  tmp=
   trap 'exit_status=$?
-  : "${ac_tmp:=$tmp}"
-  { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
 ' 0
   trap 'as_fn_exit 1' 1 2 13 15
 }
@@ -32348,13 +32527,12 @@
 
 {
   tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
-  test -d "$tmp"
+  test -n "$tmp" && test -d "$tmp"
 }  ||
 {
   tmp=./conf$$-$RANDOM
   (umask 077 && mkdir "$tmp")
 } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
-ac_tmp=$tmp
 
 # Set up the scripts for CONFIG_FILES section.
 # No need to generate them if there are no CONFIG_FILES.
@@ -32376,7 +32554,7 @@
   ac_cs_awk_cr=$ac_cr
 fi
 
-echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+echo 'BEGIN {' >"$tmp/subs1.awk" &&
 _ACEOF
 
 
@@ -32404,7 +32582,7 @@
 rm -f conf$$subs.sh
 
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
 _ACEOF
 sed -n '
 h
@@ -32452,7 +32630,7 @@
 rm -f conf$$subs.awk
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 _ACAWK
-cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+cat >>"\$tmp/subs1.awk" <<_ACAWK &&
   for (key in S) S_is_set[key] = 1
   FS = ""
 
@@ -32484,7 +32662,7 @@
   sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
 else
   cat
-fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
   || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
 _ACEOF
 
@@ -32518,7 +32696,7 @@
 # No need to generate them if there are no CONFIG_HEADERS.
 # This happens for instance with `./config.status Makefile'.
 if test -n "$CONFIG_HEADERS"; then
-cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
+cat >"$tmp/defines.awk" <<\_ACAWK ||
 BEGIN {
 _ACEOF
 
@@ -32530,8 +32708,8 @@
 # handling of long lines.
 ac_delim='%!_!# '
 for ac_last_try in false false :; do
-  ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
-  if test -z "$ac_tt"; then
+  ac_t=`sed -n "/$ac_delim/p" confdefs.h`
+  if test -z "$ac_t"; then
     break
   elif $ac_last_try; then
     as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
@@ -32632,7 +32810,7 @@
   esac
   case $ac_mode$ac_tag in
   :[FHL]*:*);;
-  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;;
   :[FH]-) ac_tag=-:-;;
   :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
   esac
@@ -32651,7 +32829,7 @@
     for ac_f
     do
       case $ac_f in
-      -) ac_f="$ac_tmp/stdin";;
+      -) ac_f="$tmp/stdin";;
       *) # Look for the file first in the build tree, then in the source tree
 	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
 	 # because $ac_f cannot contain `:'.
@@ -32660,7 +32838,7 @@
 	   [\\/$]*) false;;
 	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
 	   esac ||
-	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;;
       esac
       case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
       as_fn_append ac_file_inputs " '$ac_f'"
@@ -32686,8 +32864,8 @@
     esac
 
     case $ac_tag in
-    *:-:* | *:-) cat >"$ac_tmp/stdin" \
-      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+    *:-:* | *:-) cat >"$tmp/stdin" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5  ;;
     esac
     ;;
   esac
@@ -32812,22 +32990,21 @@
 s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
 $ac_datarootdir_hack
 "
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
-  >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
+  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
 
 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
-  { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
-  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' \
-      "$ac_tmp/out"`; test -z "$ac_out"; } &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined" >&5
 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined" >&2;}
 
-  rm -f "$ac_tmp/stdin"
+  rm -f "$tmp/stdin"
   case $ac_file in
-  -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
-  *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+  -) cat "$tmp/out" && rm -f "$tmp/out";;
+  *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
   esac \
   || as_fn_error $? "could not create $ac_file" "$LINENO" 5
  ;;
@@ -32838,20 +33015,20 @@
   if test x"$ac_file" != x-; then
     {
       $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
-    } >"$ac_tmp/config.h" \
+      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
+    } >"$tmp/config.h" \
       || as_fn_error $? "could not create $ac_file" "$LINENO" 5
-    if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
+    if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
 $as_echo "$as_me: $ac_file is unchanged" >&6;}
     else
       rm -f "$ac_file"
-      mv "$ac_tmp/config.h" "$ac_file" \
+      mv "$tmp/config.h" "$ac_file" \
 	|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
     fi
   else
     $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
       || as_fn_error $? "could not create -" "$LINENO" 5
   fi
  ;;
--- a/common/autoconf/jdk-options.m4	Wed Jan 16 22:17:36 2013 -0800
+++ b/common/autoconf/jdk-options.m4	Wed Jul 05 18:36:58 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 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
@@ -235,7 +235,7 @@
 # from configure, but only server is valid anyway. Fix this
 # when hotspot makefiles are rewritten.
 if test "x$MACOSX_UNIVERSAL" = xtrue; then
-    HOTSPOT_TARGET=universal_product
+    HOTSPOT_TARGET=universal_${HOTSPOT_EXPORT}
 fi
 
 #####
@@ -247,46 +247,50 @@
 AC_SUBST(BUILD_VARIANT_RELEASE)
 ])
 
-AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
-[
 
 ###############################################################################
 #
 # Should we build only OpenJDK even if closed sources are present?
 #
-AC_ARG_ENABLE([openjdk-only], [AS_HELP_STRING([--enable-openjdk-only],
-    [supress building closed source even if present @<:@disabled@:>@])],,[enable_openjdk_only="no"])
+AC_DEFUN_ONCE([JDKOPT_SETUP_OPEN_OR_CUSTOM],
+[
+  AC_ARG_ENABLE([openjdk-only], [AS_HELP_STRING([--enable-openjdk-only],
+    [suppress building custom source even if present @<:@disabled@:>@])],,[enable_openjdk_only="no"])
 
-AC_MSG_CHECKING([for presence of closed sources])
-if test -d "$SRC_ROOT/jdk/src/closed"; then
+  AC_MSG_CHECKING([for presence of closed sources])
+  if test -d "$SRC_ROOT/jdk/src/closed"; then
     CLOSED_SOURCE_PRESENT=yes
-else
+  else
     CLOSED_SOURCE_PRESENT=no
-fi
-AC_MSG_RESULT([$CLOSED_SOURCE_PRESENT])
+  fi
+  AC_MSG_RESULT([$CLOSED_SOURCE_PRESENT])
 
-AC_MSG_CHECKING([if closed source is supressed (openjdk-only)])
-SUPRESS_CLOSED_SOURCE="$enable_openjdk_only"
-AC_MSG_RESULT([$SUPRESS_CLOSED_SOURCE])
+  AC_MSG_CHECKING([if closed source is suppressed (openjdk-only)])
+  SUPPRESS_CLOSED_SOURCE="$enable_openjdk_only"
+  AC_MSG_RESULT([$SUPPRESS_CLOSED_SOURCE])
 
-if test "x$CLOSED_SOURCE_PRESENT" = xno; then
-  OPENJDK=true
-  if test "x$SUPRESS_CLOSED_SOURCE" = "xyes"; then
-    AC_MSG_WARN([No closed source present, --enable-openjdk-only makes no sense])
-  fi
-else
-  if test "x$SUPRESS_CLOSED_SOURCE" = "xyes"; then
+  if test "x$CLOSED_SOURCE_PRESENT" = xno; then
     OPENJDK=true
+    if test "x$SUPPRESS_CLOSED_SOURCE" = "xyes"; then
+      AC_MSG_WARN([No closed source present, --enable-openjdk-only makes no sense])
+    fi
   else
-    OPENJDK=false
+    if test "x$SUPPRESS_CLOSED_SOURCE" = "xyes"; then
+      OPENJDK=true
+    else
+      OPENJDK=false
+    fi
   fi
-fi
 
-if test "x$OPENJDK" = "xtrue"; then
+  if test "x$OPENJDK" = "xtrue"; then
     SET_OPENJDK="OPENJDK=true"
-fi
+  fi
 
-AC_SUBST(SET_OPENJDK)
+  AC_SUBST(SET_OPENJDK)
+])
+
+AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
+[
 
 ###############################################################################
 #
@@ -369,13 +373,51 @@
 AC_SUBST(COMPRESS_JARS)
 ])
 
+###############################################################################
+#
+# Setup version numbers
+#
 AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_VERSION_NUMBERS],
 [
 # Source the version numbers
-. $AUTOCONF_DIR/version.numbers
-if test "x$OPENJDK" = "xfalse"; then
-    . $AUTOCONF_DIR/closed.version.numbers
+. $AUTOCONF_DIR/version-numbers
+
+# Get the settings from parameters
+AC_ARG_WITH(milestone, [AS_HELP_STRING([--with-milestone], 
+                       [Set milestone value for build @<:@internal@:>@])])
+if test "x$with_milestone" = xyes; then
+  AC_MSG_ERROR([Milestone must have a value])
+elif test "x$with_milestone" != x; then
+    MILESTONE="$with_milestone"
+else
+  MILESTONE=internal
 fi
+
+AC_ARG_WITH(build-number, [AS_HELP_STRING([--with-build-number], 
+                          [Set build number value for build @<:@b00@:>@])])
+if test "x$with_build_number" = xyes; then
+  AC_MSG_ERROR([Build number must have a value])
+elif test "x$with_build_number" != x; then
+  JDK_BUILD_NUMBER="$with_build_number"
+fi
+if test "x$JDK_BUILD_NUMBER" = x; then
+  JDK_BUILD_NUMBER=b00
+fi
+
+AC_ARG_WITH(user-release-suffix, [AS_HELP_STRING([--with-user-release-suffix], 
+        [Add a custom string to the version string if build number isn't set.@<:@username_builddateb00@:>@])])
+if test "x$with_user_release_suffix" = xyes; then
+  AC_MSG_ERROR([Release suffix must have a value])
+elif test "x$with_user_release_suffix" != x; then
+  USER_RELEASE_SUFFIX="$with_user_release_suffix"
+else
+  BUILD_DATE=`date '+%Y_%m_%d_%H_%M'`
+  # Avoid [:alnum:] since it depends on the locale.
+  CLEAN_USERNAME=`echo "$USER" | $TR -d -c 'abcdefghijklmnopqrstuvqxyz0123456789'`
+  USER_RELEASE_SUFFIX=`echo "${CLEAN_USERNAME}_${BUILD_DATE}" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+fi
+AC_SUBST(USER_RELEASE_SUFFIX)
+
 # Now set the JDK version, milestone, build number etc.
 AC_SUBST(JDK_MAJOR_VERSION)
 AC_SUBST(JDK_MINOR_VERSION)
@@ -394,34 +436,13 @@
 COPYRIGHT_YEAR=`date +'%Y'`
 AC_SUBST(COPYRIGHT_YEAR)
 
-RUNTIME_NAME="$PRODUCT_NAME $PRODUCT_SUFFIX"
-AC_SUBST(RUNTIME_NAME)
-
 if test "x$JDK_UPDATE_VERSION" != x; then
-    JDK_VERSION="${JDK_MAJOR_VERSION}.${JDK_MINOR_VERSION}.${JDK_MICRO_VERSION}_${JDK_UPDATE_VERSION}"
+  JDK_VERSION="${JDK_MAJOR_VERSION}.${JDK_MINOR_VERSION}.${JDK_MICRO_VERSION}_${JDK_UPDATE_VERSION}"
 else
-    JDK_VERSION="${JDK_MAJOR_VERSION}.${JDK_MINOR_VERSION}.${JDK_MICRO_VERSION}"
+  JDK_VERSION="${JDK_MAJOR_VERSION}.${JDK_MINOR_VERSION}.${JDK_MICRO_VERSION}"
 fi
 AC_SUBST(JDK_VERSION)
 
-if test "x$MILESTONE" != x; then
-    RELEASE="${JDK_VERSION}-${MILESTONE}${BUILD_VARIANT_RELEASE}"
-else
-    RELEASE="${JDK_VERSION}${BUILD_VARIANT_RELEASE}"
-fi
-AC_SUBST(RELEASE)
-
-if test "x$JDK_BUILD_NUMBER" != x; then
-    FULL_VERSION="${RELEASE}-${JDK_BUILD_NUMBER}"
-else
-    JDK_BUILD_NUMBER=b00
-    BUILD_DATE=`date '+%Y_%m_%d_%H_%M'`
-    # Avoid [:alnum:] since it depends on the locale.
-    CLEAN_USERNAME=`echo "$USER" | $TR -d -c 'abcdefghijklmnopqrstuvqxyz0123456789'`
-    USER_RELEASE_SUFFIX=`echo "${CLEAN_USERNAME}_${BUILD_DATE}" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-    FULL_VERSION="${RELEASE}-${USER_RELEASE_SUFFIX}-${JDK_BUILD_NUMBER}"
-fi
-AC_SUBST(FULL_VERSION)
 COOKED_BUILD_NUMBER=`$ECHO $JDK_BUILD_NUMBER | $SED -e 's/^b//' -e 's/^0//'`
 AC_SUBST(COOKED_BUILD_NUMBER)
 ])
@@ -434,7 +455,7 @@
 # The name of the Service Agent jar.
 SALIB_NAME="${LIBRARY_PREFIX}saproc${SHARED_LIBRARY_SUFFIX}"
 if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
-    SALIB_NAME="${LIBRARY_PREFIX}sawindbg${SHARED_LIBRARY_SUFFIX}"
+  SALIB_NAME="${LIBRARY_PREFIX}sawindbg${SHARED_LIBRARY_SUFFIX}"
 fi
 AC_SUBST(SALIB_NAME)
 
--- a/common/autoconf/spec.gmk.in	Wed Jan 16 22:17:36 2013 -0800
+++ b/common/autoconf/spec.gmk.in	Wed Jul 05 18:36:58 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 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
@@ -163,11 +163,22 @@
 
 # Different version strings generated from the above information.
 JDK_VERSION:=@JDK_VERSION@
-RUNTIME_NAME:=@RUNTIME_NAME@
-FULL_VERSION:=@FULL_VERSION@
-JRE_RELEASE_VERSION:=@FULL_VERSION@
-RELEASE:=@RELEASE@
+RUNTIME_NAME=$(PRODUCT_NAME) $(PRODUCT_SUFFIX)
 COOKED_BUILD_NUMBER:=@COOKED_BUILD_NUMBER@
+# These variables need to be generated here so that MILESTONE and
+# JDK_BUILD_NUMBER can be overridden on the make command line.
+ifeq ($(MILESTONE),)
+  RELEASE=$(JDK_VERSION)$(BUILD_VARIANT_RELEASE)
+else
+  RELEASE=$(JDK_VERSION)-$(MILESTONE)$(BUILD_VARIANT_RELEASE)
+endif
+ifeq ($(JDK_BUILD_NUMBER),b00)
+  USER_RELEASE_SUFFIX=@USER_RELEASE_SUFFIX@
+  FULL_VERSION=$(RELEASE)-$(USER_RELEASE_SUFFIX)-$(JDK_BUILD_NUMBER)
+else
+  FULL_VERSION=$(RELEASE)-$(JDK_BUILD_NUMBER)
+endif
+JRE_RELEASE_VERSION:=$(FULL_VERSION)
 
 # How to compile the code: release, fastdebug or slowdebug
 DEBUG_LEVEL:=@DEBUG_LEVEL@
@@ -220,6 +231,7 @@
 HOTSPOT_OUTPUTDIR=$(BUILD_OUTPUT)/hotspot
 JDK_OUTPUTDIR=$(BUILD_OUTPUT)/jdk
 IMAGES_OUTPUTDIR=$(BUILD_OUTPUT)/images
+JCE_OUTPUTDIR=$(BUILD_OUTPUT)/jce-release
 
 LANGTOOLS_DIST=$(LANGTOOLS_OUTPUTDIR)/dist
 CORBA_DIST=$(CORBA_OUTPUTDIR)/dist
@@ -420,6 +432,8 @@
 
 NATIVE2ASCII=@FIXPATH@ $(BOOT_JDK)/bin/native2ascii
 
+JARSIGNER=@FIXPATH@ $(BOOT_JDK)/bin/jarsigner
+
 # Base flags for RC
 # Guarding this against resetting value. Legacy make files include spec multiple
 # times.
@@ -440,10 +454,13 @@
 # CD is going away, but remains to cater for legacy makefiles.
 CD:=cd
 CHMOD:=@CHMOD@
+COMM:=@COMM@
 CP:=@CP@
+CPIO:=@CPIO@
 CUT:=@CUT@
 DATE:=@DATE@
 DIFF:=@DIFF@
+DIRNAME:=@DIRNAME@
 FIND:=@FIND@
 FIND_DELETE:=@FIND_DELETE@
 ECHO:=@ECHO@
@@ -468,6 +485,7 @@
 TIME:=@TIME@
 TR:=@TR@
 TOUCH:=@TOUCH@
+UNIQ:=@UNIQ@
 WC:=@WC@
 XARGS:=@XARGS@
 ZIPEXE:=@ZIP@
@@ -600,5 +618,21 @@
 OS_VERSION_MINOR:=@OS_VERSION_MINOR@
 OS_VERSION_MICRO:=@OS_VERSION_MICRO@
 
+# Images directory definitions
+JDK_IMAGE_SUBDIR:=j2sdk-image
+JRE_IMAGE_SUBDIR:=j2re-image
+JDK_OVERLAY_IMAGE_SUBDIR:=j2sdk-overlay-image
+JRE_OVERLAY_IMAGE_SUBDIR:=j2re-overlay-image
+JDK_IMAGE_DIR:=$(IMAGES_OUTPUTDIR)/$(JDK_IMAGE_SUBDIR)
+JRE_IMAGE_DIR:=$(IMAGES_OUTPUTDIR)/$(JRE_IMAGE_SUBDIR)
+JDK_OVERLAY_IMAGE_DIR:=$(IMAGES_OUTPUTDIR)/$(JDK_OVERLAY_IMAGE_SUBDIR)
+JRE_OVERLAY_IMAGE_DIR:=$(IMAGES_OUTPUTDIR)/$(JRE_OVERLAY_IMAGE_SUBDIR)
+
+# Macosx bundles directory definitions
+JDK_BUNDLE_SUBDIR:=j2sdk-bundle/jdk$(JDK_VERSION).jdk/Contents
+JRE_BUNDLE_SUBDIR:=j2re-bundle/jre$(JDK_VERSION).jre/Contents
+JDK_BUNDLE_DIR:=$(IMAGES_OUTPUTDIR)/$(JDK_BUNDLE_SUBDIR)
+JRE_BUNDLE_DIR:=$(IMAGES_OUTPUTDIR)/$(JRE_BUNDLE_SUBDIR)
+
 # Include the custom-spec.gmk file if it exists
 -include $(dir @SPEC@)/custom-spec.gmk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/autoconf/version-numbers	Wed Jul 05 18:36:58 2017 +0200
@@ -0,0 +1,38 @@
+#
+# Copyright (c) 2011, 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.
+#
+
+JDK_MAJOR_VERSION=1
+JDK_MINOR_VERSION=8
+JDK_MICRO_VERSION=0
+JDK_UPDATE_VERSION=
+LAUNCHER_NAME=openjdk
+PRODUCT_NAME=OpenJDK
+PRODUCT_SUFFIX="Runtime Environment"
+JDK_RC_PLATFORM_NAME=Platform
+COMPANY_NAME=N/A
+
+# Might need better names for these
+MACOSX_BUNDLE_NAME_BASE="OpenJDK"
+MACOSX_BUNDLE_ID_BASE="net.java.openjdk"
--- a/common/autoconf/version.numbers	Wed Jan 16 22:17:36 2013 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-#
-# Copyright (c) 2011, 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.  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.
-#
-
-JDK_MAJOR_VERSION=1
-JDK_MINOR_VERSION=8
-JDK_MICRO_VERSION=0
-JDK_UPDATE_VERSION=
-JDK_BUILD_NUMBER=
-MILESTONE=internal
-LAUNCHER_NAME=openjdk
-PRODUCT_NAME=OpenJDK
-PRODUCT_SUFFIX="Runtime Environment"
-JDK_RC_PLATFORM_NAME=Platform
-COMPANY_NAME=N/A
-
-# Might need better names for these
-MACOSX_BUNDLE_NAME_BASE="OpenJDK"
-MACOSX_BUNDLE_ID_BASE="net.java.openjdk"
--- a/common/bin/compare.sh	Wed Jan 16 22:17:36 2013 -0800
+++ b/common/bin/compare.sh	Wed Jul 05 18:36:58 2017 +0200
@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 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
@@ -98,24 +98,30 @@
     if test "x$SUFFIX" = "xclass"; then
         # To improve performance when large diffs are found, do a rough filtering of classes
         # elibeble for these exceptions
-        if $GREP -R -e '[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}' -e thePoint -e aPoint -e setItemsPtr ${THIS_FILE} > /dev/null; then
+        if $GREP -R -e '[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}' \
+	        -e '[0-9]\{2\}/[0-9]\{2\}/[0-9]\{4\}' \
+	        -e thePoint -e aPoint -e setItemsPtr ${THIS_FILE} > /dev/null; then
             $JAVAP -c -constants -l -p ${OTHER_FILE} >  ${OTHER_FILE}.javap
             $JAVAP -c -constants -l -p ${THIS_FILE} > ${THIS_FILE}.javap
             TMP=$($DIFF ${OTHER_FILE}.javap ${THIS_FILE}.javap | \
                 $GREP '^[<>]' | \
                 $SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \
+		     -e '/[0-9]\{2\}\/[0-9]\{2\}\/[0-9]\{4\}/d' \
  	             -e '/[<>].*Point   Lcom\/apple\/jobjc\/foundation\/NSPoint;/d' \
 	             -e '/[<>].*public com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*itemsPtr();/d' \
 	             -e '/[<>].*public void setItemsPtr(com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*);/d')
         fi
     fi
     if test "x$SUFFIX" = "xproperties"; then
-        $CAT $OTHER_FILE | $SED -e 's/\([^\\]\):/\1\\:/g' -e  's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \
-            | $SED -f "$SRC_ROOT/common/makefiles/support/unicode2x.sed" \
-  	    | $SED -e '/^#/d' -e '/^$/d' \
-            -e :a -e '/\\$/N; s/\\\n//; ta' \
-  	    -e 's/^[ \t]*//;s/[ \t]*$//' \
-	    -e 's/\\=/=/' | LANG=C $SORT > $OTHER_FILE.cleaned
+        # Run through nawk to add possibly missing newline at end of file.
+        $CAT $OTHER_FILE | $NAWK '{ print }' > $OTHER_FILE.cleaned
+# Disable this exception since we aren't changing the properties cleaning method yet.
+#        $CAT $OTHER_FILE | $SED -e 's/\([^\\]\):/\1\\:/g' -e  's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \
+#            | $SED -f "$SRC_ROOT/common/makefiles/support/unicode2x.sed" \
+#  	    | $SED -e '/^#/d' -e '/^$/d' \
+#            -e :a -e '/\\$/N; s/\\\n//; ta' \
+#  	    -e 's/^[ \t]*//;s/[ \t]*$//' \
+#	    -e 's/\\=/=/' | LANG=C $SORT > $OTHER_FILE.cleaned
         TMP=$(LANG=C $DIFF $OTHER_FILE.cleaned $THIS_FILE)
     fi
     if test -n "$TMP"; then
@@ -305,14 +311,17 @@
                 THIS_FILE=$WORK_DIR/$f.this
                 $MKDIR -p $(dirname $OTHER_FILE)
                 $MKDIR -p $(dirname $THIS_FILE)
+                #Note that | doesn't work on mac sed.
                 $CAT $OTHER_DIR/$f | $SED -e 's/\(-- Generated by javadoc \).*\( --\)/\1(removed)\2/' \
                                           -e 's/\(<meta name="date" content="\).*\(">\)/\1(removed)\2/' \
-                                          -e 's/\(Monday\|Tuesday\|Wednesday\|Thursday\|Friday\|Saturday\|Sunday\), [A-Z][a-z]* [0-9][0-9]*, [12][0-9]* [0-9][0-9:]* \(AM\|PM\) [A-Z][A-Z]*/(removed)/' \
+                                          -e 's/[A-Z][a-z]*, [A-Z][a-z]* [0-9][0-9]*, [12][0-9]* [0-9][0-9:]* [AMP]\{2,2\} [A-Z][A-Z]*/(removed)/' \
+                                          -e 's/[A-Z][a-z]* [A-Z][a-z]* [0-9][0-9] [0-9][0-9:]* [A-Z][A-Z]* [12][0-9]*/(removed)/' \
                                           -e 's/^\( from \).*\(\.idl\)$/\1(removed)\2/' \
                     > $OTHER_FILE
                 $CAT $THIS_DIR/$f  | $SED -e 's/\(-- Generated by javadoc \).*\( --\)/\1(removed)\2/' \
                                           -e 's/\(<meta name="date" content="\).*\(">\)/\1(removed)\2/' \
-                                          -e 's/\(Monday\|Tuesday\|Wednesday\|Thursday\|Friday\|Saturday\|Sunday\), [A-Z][a-z]* [0-9][0-9]*, [12][0-9]* [0-9][0-9:]* \(AM\|PM\) [A-Z][A-Z]*/(removed)/' \
+                                          -e 's/[A-Z][a-z]*, [A-Z][a-z]* [0-9][0-9]*, [12][0-9]* [0-9][0-9:]* [AMP]\{2,2\} [A-Z][A-Z]*/(removed)/' \
+                                          -e 's/[A-Z][a-z]* [A-Z][a-z]* [0-9][0-9] [0-9][0-9:]* [A-Z][A-Z]* [12][0-9]*/(removed)/' \
                                           -e 's/^\( from \).*\(\.idl\)$/\1(removed)\2/' \
                     > $THIS_FILE
             else
@@ -370,14 +379,14 @@
     (cd $OTHER_UNZIPDIR && $UNARCHIVE $OTHER_ZIP)
 
     # Find all archives inside and unzip them as well to compare the contents rather than
-    # the archives.
-    EXCEPTIONS=""
-    for pack in $($FIND $THIS_UNZIPDIR -name "*.pack" -o -name "*.pack.gz"); do
+    # the archives. pie.jar.pack.gz i app3.war is corrupt, skip it.
+    EXCEPTIONS="pie.jar.pack.gz"
+    for pack in $($FIND $THIS_UNZIPDIR \( -name "*.pack" -o -name "*.pack.gz" \) -a ! -name pie.jar.pack.gz); do
         ($UNPACK200 $pack $pack.jar)
         # Filter out the unzipped archives from the diff below.
         EXCEPTIONS="$EXCEPTIONS $pack $pack.jar"
     done
-    for pack in $($FIND $OTHER_UNZIPDIR -name "*.pack" -o -name "*.pack.gz"); do
+    for pack in $($FIND $OTHER_UNZIPDIR \( -name "*.pack" -o -name "*.pack.gz" \) -a ! -name pie.jar.pack.gz); do
         ($UNPACK200 $pack $pack.jar)
         EXCEPTIONS="$EXCEPTIONS $pack $pack.jar"
     done
@@ -1073,7 +1082,11 @@
 
 
 # Figure out the layout of the this build. Which kinds of images have been produced
-if [ -d "$THIS/deploy/j2sdk-image" ]; then
+if [ -d "$THIS/install/j2sdk-image" ]; then
+    THIS_J2SDK="$THIS/install/j2sdk-image"
+    THIS_J2RE="$THIS/install/j2re-image"
+    echo "Comparing install images"
+elif [ -d "$THIS/deploy/j2sdk-image" ]; then
     THIS_J2SDK="$THIS/deploy/j2sdk-image"
     THIS_J2RE="$THIS/deploy/j2re-image"
     echo "Comparing deploy images"
@@ -1081,9 +1094,16 @@
     THIS_J2SDK="$THIS/images/j2sdk-image"
     THIS_J2RE="$THIS/images/j2re-image"
 fi
+
 if [ -d "$THIS/images/j2sdk-overlay-image" ]; then
-    THIS_J2SDK_OVERLAY="$THIS/images/j2sdk-overlay-image"
-    THIS_J2RE_OVERLAY="$THIS/images/j2re-overlay-image"
+    if [ -d "$THIS/install/j2sdk-image" ]; then
+        # If there is an install image, prefer that, it's also overlay
+        THIS_J2SDK_OVERLAY="$THIS/install/j2sdk-image"
+        THIS_J2RE_OVERLAY="$THIS/install/j2re-image"
+    else
+        THIS_J2SDK_OVERLAY="$THIS/images/j2sdk-overlay-image"
+        THIS_J2RE_OVERLAY="$THIS/images/j2re-overlay-image"
+    fi
 fi
 
 if [ -d "$THIS/images/j2sdk-bundle" ]; then
@@ -1100,7 +1120,9 @@
         OTHER_J2SDK_OVERLAY="$OTHER/j2sdk-image"
         OTHER_J2RE_OVERLAY="$OTHER/j2re-image"
     fi
-
+elif [ -d "$OTHER/images/j2sdk-image" ]; then
+    OTHER_J2SDK="$OTHER/images/j2sdk-image"
+    OTHER_J2RE="$OTHER/images/j2re-image"
 fi
 
 if [ -d "$OTHER/j2sdk-bundle" ]; then
@@ -1144,6 +1166,26 @@
     echo "WARNING! Other build doesn't contain docs, skipping doc compare."
 fi
 
+if [ -d "$OTHER/images" ]; then
+    OTHER_SEC_DIR="$OTHER/images"
+else
+    OTHER_SEC_DIR="$OTHER/tmp"
+fi
+OTHER_SEC_BIN="$OTHER_SEC_DIR/sec-bin.zip"
+THIS_SEC_DIR="$THIS/images"
+THIS_SEC_BIN="$THIS_SEC_DIR/sec-bin.zip"
+if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
+    if [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
+        JGSS_WINDOWS_BIN="jgss-windows-x64-bin.zip"
+    else
+        JGSS_WINDOWS_BIN="jgss-windows-i586-bin.zip"
+    fi
+    OTHER_SEC_WINDOWS_BIN="$OTHER_SEC_DIR/sec-windows-bin.zip"
+    OTHER_JGSS_WINDOWS_BIN="$OTHER_SEC_DIR/$JGSS_WINDOWS_BIN"
+    THIS_SEC_WINDOWS_BIN="$THIS_SEC_DIR/sec-windows-bin.zip"
+    THIS_JGSS_WINDOWS_BIN="$THIS_SEC_DIR/$JGSS_WINDOWS_BIN"
+fi
+
 ##########################################################################################
 # Do the work
 
@@ -1260,6 +1302,24 @@
     if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
         compare_all_zip_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
     fi
+    if [ -n "$THIS_SEC_BIN" ] && [ -n "$OTHER_SEC_BIN" ]; then
+        if [ -n "$(echo $THIS_SEC_BIN | $FILTER)" ]; then
+            echo "sec-bin.zip..."
+            compare_zip_file $THIS_SEC_DIR $OTHER_SEC_DIR $COMPARE_ROOT/sec-bin sec-bin.zip
+        fi
+    fi
+    if [ -n "$THIS_SEC_WINDOWS_BIN" ] && [ -n "$OTHER_SEC_WINDOWS_BIN" ]; then
+        if [ -n "$(echo $THIS_SEC_WINDOWS_BIN | $FILTER)" ]; then
+            echo "sec-windows-bin.zip..."
+            compare_zip_file $THIS_SEC_DIR $OTHER_SEC_DIR $COMPARE_ROOT/sec-bin sec-windows-bin.zip
+        fi
+    fi
+    if [ -n "$THIS_JGSS_WINDOWS_BIN" ] && [ -n "$OTHER_JGSS_WINDOWS_BIN" ]; then
+        if [ -n "$(echo $THIS_JGSS_WINDOWS_BIN | $FILTER)" ]; then
+            echo "$JGSS_WINDOWS_BIN..."
+            compare_zip_file $THIS_SEC_DIR $OTHER_SEC_DIR $COMPARE_ROOT/sec-bin $JGSS_WINDOWS_BIN
+        fi
+    fi
 fi
 
 if [ "$CMP_JARS" = "true" ]; then
--- a/common/bin/compare_exceptions.sh.incl	Wed Jan 16 22:17:36 2013 -0800
+++ b/common/bin/compare_exceptions.sh.incl	Wed Jul 05 18:36:58 2017 +0200
@@ -813,6 +813,10 @@
 
 if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
 
+ACCEPTED_JARZIP_CONTENTS="
+/bin/w2k_lsa_auth.dll
+"
+
 # Probably should add all libs here
 ACCEPTED_SMALL_SIZE_DIFF="
 ./demo/jvmti/gctest/lib/gctest.dll
@@ -821,6 +825,7 @@
 ./jre/bin/attach.dll
 ./jre/bin/java_crw_demo.dll
 ./jre/bin/jsoundds.dll
+./jre/bin/server/jvm.dll
 ./bin/appletviewer.exe
 ./bin/extcheck.exe
 ./bin/idlj.exe
--- a/common/makefiles/IdlCompilation.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/common/makefiles/IdlCompilation.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -87,7 +87,7 @@
 $1_SRC := $$(abspath $$($1_SRC))
 $1_BIN := $$(abspath $$($1_BIN))
 # Find all existing java files and existing class files.
-$$(shell $(MKDIR) -p $$($1_SRC) $$($1_BIN))
+$$(eval $$(call MakeDir,$$($1_BIN)))
 $1_SRCS     := $$(shell find $$($1_SRC) -name "*.idl")
 $1_BINS     := $$(shell find $$($1_BIN) -name "*.java")
 # Prepend the source/bin path to the filter expressions.
--- a/common/makefiles/JavaCompilation.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/common/makefiles/JavaCompilation.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -111,9 +111,9 @@
         ifeq ($$(word 20,$$($1_GREP_INCLUDE_PATTERNS)),)
             $1_GREP_INCLUDES:=| $(GREP) $$(patsubst %,$(SPACE)-e$(SPACE)$(DQUOTE)%$(DQUOTE),$$($1_GREP_INCLUDE_PATTERNS))
         else
-            $$(shell $(MKDIR) -p $$($1_BIN) && $(RM) $$($1_BIN)/_the.$$($1_JARNAME)_include)
-            $$(eval $$(call ListPathsSafelyNow,$1_GREP_INCLUDE_PATTERNS,\n, \
-			>> $$($1_BIN)/_the.$$($1_JARNAME)_include))
+            $1_GREP_INCLUDE_OUTPUT:=$(RM) $$($1_BIN)/_the.$$($1_JARNAME)_include && \
+                                    $$(strip $$(call ListPathsSafely,$1_GREP_INCLUDE_PATTERNS,\n, \
+                                        >> $$($1_BIN)/_the.$$($1_JARNAME)_include))
             $1_GREP_INCLUDES:=| $(GREP) -f $$($1_BIN)/_the.$$($1_JARNAME)_include
         endif
     endif
@@ -124,9 +124,9 @@
         ifeq ($$(word 20,$$($1_GREP_EXCLUDE_PATTERNS)),)
             $1_GREP_EXCLUDES:=| $(GREP) -v $$(patsubst %,$(SPACE)-e$(SPACE)$(DQUOTE)%$(DQUOTE),$$($1_GREP_EXCLUDE_PATTERNS))
         else
-            $$(shell $(MKDIR) -p $$($1_BIN) && $(RM) $$($1_BIN)/_the.$$($1_JARNAME)_exclude)
-            $$(eval $$(call ListPathsSafelyNow,$1_GREP_EXCLUDE_PATTERNS,\n, \
-			>> $$($1_BIN)/_the.$$($1_JARNAME)_exclude))
+            $1_GREP_EXCLUDE_OUTPUT=$(RM) $$($1_BIN)/_the.$$($1_JARNAME)_exclude && \
+                                    $$(strip $$(call ListPathsSafely,$1_GREP_EXCLUDE_PATTERNS,\n, \
+                                        >> $$($1_BIN)/_the.$$($1_JARNAME)_exclude))
             $1_GREP_EXCLUDES:=| $(GREP) -v -f $$($1_BIN)/_the.$$($1_JARNAME)_exclude
         endif
     endif
@@ -137,19 +137,25 @@
     else
       $1_JARINDEX = true
     endif
-    # When this macro is run in the same makefile as the java compilation, dependencies are transfered
-    # in make variables. When the macro is run in a different makefile than the java compilation, the 
-    # dependencies need to be found in the filesystem.
+    # When this macro is run in the same makefile as the java compilation, dependencies are 
+    # transfered in make variables. When the macro is run in a different makefile than the 
+    # java compilation, the dependencies need to be found in the filesystem.
     ifneq (,$2)
         $1_DEPS:=$2
     else
+        $1_DEPS:=$$(filter $$(addprefix %,$$($1_FIND_PATTERNS)),\
+                    $$(call CacheFind $$($1_SRCS)))
+        ifneq (,$$($1_GREP_INCLUDE_PATTERNS))
+            $1_DEPS:=$$(filter $$(addsuffix %,$$($1_GREP_INCLUDE_PATTERNS)),$$($1_DEPS))
+        endif
+        ifneq (,$$($1_GREP_EXCLUDE_PATTERNS))
+            $1_DEPS:=$$(filter-out $$(addsuffix %,$$($1_GREP_EXCLUDE_PATTERNS)),$$($1_DEPS))
+        endif
         # The subst of \ is needed because $ has to be escaped with \ in EXTRA_FILES for the command 
         # lines, but not here for use in make dependencies.
-        $1_DEPS:=$$(shell $(FIND) $$($1_SRCS) -type f -a \( $$($1_FIND_PATTERNS) \) \
-			  $$($1_GREP_INCLUDES) $$($1_GREP_EXCLUDES)) \
-		 $$(subst \,,$$(foreach src,$$($1_SRCS),$$(addprefix $$(src)/,$$($1_EXTRA_FILES))))
+        $1_DEPS+=$$(subst \,,$$(foreach src,$$($1_SRCS),$$(addprefix $$(src)/,$$($1_EXTRA_FILES))))
         ifeq (,$$($1_SKIP_METAINF))
-            $1_DEPS+=$$(shell $(FIND) $$(addsuffix /META-INF,$$($1_SRCS)) -type f 2> /dev/null)
+            $1_DEPS+=$$(call CacheFind $$(wildcard $$(addsuffix /META-INF,$$($1_SRCS))))
         endif
     endif
 
@@ -210,6 +216,8 @@
     # Here is the rule that creates/updates the jar file.
     $$($1_JAR) : $$($1_DEPS)
 	$(MKDIR) -p $$($1_BIN)
+	$$($1_GREP_INCLUDE_OUTPUT)
+	$$($1_GREP_EXCLUDE_OUTPUT)
 	$$(if $$($1_MANIFEST),\
 		$(SED) -e "s#@@RELEASE@@#$(RELEASE)#"           \
 		       -e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" $$($1_MANIFEST) > $$($1_MANIFEST_FILE) \
@@ -242,14 +250,14 @@
 define SetupZipArchive
     # param 1 is for example ZIP_MYSOURCE
     # param 2,3,4,5,6,7,8,9 are named args.
-    #    SRC,ZIP,INCLUDES,EXCLUDES,EXCLUDE_FILES,SUFFIXES,EXTRA_DEPS
+    #    SRC,ZIP,INCLUDES,INCLUDE_FILES,EXCLUDES,EXCLUDE_FILES,SUFFIXES,EXTRA_DEPS
     $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
     $(call LogSetupMacroEntry,SetupZipArchive($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
     $(if $(16),$(error Internal makefile error: Too many arguments to SetupZipArchive, please update JavaCompilation.gmk))
 
     # Find all files in the source tree.
-    $1_SUFFIX_FILTER := $$(patsubst %,-o -name $(DQUOTE)*%$(DQUOTE),$$($1_SUFFIXES))
-    $1_ALL_SRCS := $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i -type f -a ! -name "_the.*" \( -name FALSE_DUMMY  $$($1_SUFFIX_FILTER) \) ))
+    $1_ALL_SRCS := $$(call not-containing,_the.,\
+            $$(filter $$(addprefix %,$$($1_SUFFIXES)),$$(call CacheFind $$($1_SRC))))
 
     ifneq ($$($1_INCLUDES),)
         $1_SRC_INCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_INCLUDES))))
@@ -259,6 +267,12 @@
         else
             $1_ZIP_INCLUDES := $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_INCLUDES)))
         endif
+    endif
+    ifneq ($$($1_INCLUDE_FILES),)
+        $1_SRC_INCLUDES += $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_INCLUDE_FILES)))
+        $1_ZIP_INCLUDES += $$(addprefix -i$(SPACE),$$($1_INCLUDE_FILES))
+    endif
+    ifneq ($$($1_SRC_INCLUDES),)
         $1_ALL_SRCS     := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_SRCS))
     endif
     ifneq ($$($1_EXCLUDES),)
@@ -376,7 +390,7 @@
     $$(foreach d,$$($1_SRC), $$(if $$(wildcard $$d),,$$(error SRC specified to SetupJavaCompilation $1 contains missing directory $$d)))
     $$(eval $$(call MakeDir,$$($1_BIN)))
     # Find all files in the source trees.
-    $1_ALL_SRCS := $$(filter-out $(OVR_SRCS),$$(shell $(FIND) $$($1_SRC) -type f))
+    $1_ALL_SRCS += $$(filter-out $(OVR_SRCS),$$(call CacheFind,$$($1_SRC)))
     # Extract the java files.
     ifneq ($$($1_EXCLUDE_FILES),)
         $1_EXCLUDE_FILES_PATTERN:=$$(addprefix %,$$($1_EXCLUDE_FILES))
@@ -408,8 +422,6 @@
 
     # Find all files to be copied from source to bin.
     ifneq (,$$($1_COPY))
-        # Rewrite list of patterns into a find statement.
-        $1_COPY_PATTERN:=$(FALSE_FIND_PATTERN) $$(patsubst %,$(SPACE)-o$(SPACE)-name$(SPACE)$(DQUOTE)*%$(DQUOTE),$$($1_COPY))
         # Search for all files to be copied.
         $1_ALL_COPIES := $$(filter $$(addprefix %,$$($1_COPY)),$$($1_ALL_SRCS))
         # Copy these explicitly
@@ -436,8 +448,6 @@
 
     # Find all property files to be copied and cleaned from source to bin.
     ifneq (,$$($1_CLEAN))
-        # Rewrite list of patterns into a find statement.
-        $1_CLEAN_PATTERN:=$(FALSE_FIND_PATTERN) $$(patsubst %,$(SPACE)-o$(SPACE)-name$(SPACE)$(DQUOTE)*%$(DQUOTE),$$($1_CLEAN))
         # Search for all files to be copied.
         $1_ALL_CLEANS := $$(filter $$(addprefix %,$$($1_CLEAN)),$$($1_ALL_SRCS))
         # Copy and clean must also respect filters.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/makefiles/Jprt.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -0,0 +1,209 @@
+#
+# Copyright (c) 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.  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.
+#
+
+# This file is included by the root NewerMakefile and contains targets 
+# and utilities needed by JPRT.
+
+# Utilities used in this Makefile. Most of this makefile executes without
+# the context of a spec file from configure.
+CAT=cat
+CMP=cmp
+CP=cp
+ECHO=echo
+MKDIR=mkdir
+PRINTF=printf
+PWD=pwd
+# Insure we have a path that looks like it came from pwd
+#   (This is mostly for Windows sake and drive letters)
+define UnixPath # path
+$(shell (cd "$1" && $(PWD)))
+endef
+
+BUILD_DIR_ROOT:=$(root_dir)/build
+
+ifdef OPENJDK
+  OPEN_BUILD=true
+else
+  OPEN_BUILD := $(if $(or $(wildcard $(root_dir)/jdk/src/closed), \
+                          $(wildcard $(root_dir)/jdk/make/closed), \
+                          $(wildcard $(root_dir)/jdk/test/closed), \
+                          $(wildcard $(root_dir)/hotspot/src/closed), \
+                          $(wildcard $(root_dir)/hotspot/make/closed), \
+                          $(wildcard $(root_dir)/hotspot/test/closed)), \
+                     false,true)
+endif
+
+HOTSPOT_AVAILABLE := $(if $(wildcard $(root_dir)/hotspot),true,false)
+
+###########################################################################
+# To help in adoption of the new configure&&make build process, a bridge
+#   build will use the old settings to run configure and do the build.
+
+# Build with the configure bridge. After running configure, restart make
+# to parse the new spec file.
+BRIDGE_TARGETS := all
+bridgeBuild: bridge2configure
+	@cd $(root_dir) && $(MAKE) -f NewMakefile.gmk $(BRIDGE_TARGETS)
+
+# Bridge from old Makefile ALT settings to configure options
+bridge2configure: $(BUILD_DIR_ROOT)/.bridge2configureOpts
+	bash ./configure $(strip $(shell $(CAT) $<))
+
+# Create a file with configure options created from old Makefile mechanisms.
+$(BUILD_DIR_ROOT)/.bridge2configureOpts: $(BUILD_DIR_ROOT)/.bridge2configureOptsLatest
+	$(RM) $@
+	$(CP) $< $@
+
+# Use this file to only change when obvious things have changed
+$(BUILD_DIR_ROOT)/.bridge2configureOptsLatest: FRC
+	$(RM) $@.tmp
+	$(MKDIR) -p $(BUILD_DIR_ROOT)
+	@$(ECHO) " --with-debug-level=$(if $(DEBUG_LEVEL),$(DEBUG_LEVEL),release) " >> $@.tmp
+ifdef ARCH_DATA_MODEL
+	@$(ECHO) " --with-target-bits=$(ARCH_DATA_MODEL) " >> $@.tmp
+endif
+ifeq ($(ARCH_DATA_MODEL),32)
+	@$(ECHO) " --with-jvm-variants=client,server " >> $@.tmp
+endif
+ifdef ALT_PARALLEL_COMPILE_JOBS
+	@$(ECHO) " --with-num-cores=$(ALT_PARALLEL_COMPILE_JOBS) " >> $@.tmp
+endif
+ifdef ALT_BOOTDIR
+	@$(ECHO) " --with-boot-jdk=$(call UnixPath,$(ALT_BOOTDIR)) " >> $@.tmp
+endif
+ifdef ALT_CUPS_HEADERS_PATH
+	@$(ECHO) " --with-cups-include=$(call UnixPath,$(ALT_CUPS_HEADERS_PATH)) " >> $@.tmp
+endif
+ifdef ALT_FREETYPE_HEADERS_PATH
+	@$(ECHO) " --with-freetype=$(call UnixPath,$(ALT_FREETYPE_HEADERS_PATH)/..) " >> $@.tmp
+endif
+ifeq ($(HOTSPOT_AVAILABLE),false)
+  ifdef ALT_JDK_IMPORT_PATH
+	@$(ECHO) " --with-import-hotspot=$(call UnixPath,$(ALT_JDK_IMPORT_PATH)) " >> $@.tmp
+  endif
+endif
+ifeq ($(OPEN_BUILD),true)
+	@$(ECHO) " --enable-openjdk-only " >> $@.tmp
+else
+  # Todo: move to closed?
+  ifdef ALT_MOZILLA_HEADERS_PATH
+	@$(ECHO) " --with-mozilla-headers=$(call UnixPath,$(ALT_MOZILLA_HEADERS_PATH)) " >> $@.tmp
+  endif
+  ifdef ALT_JUNIT_DIR
+	@$(ECHO) " --with-junit-dir=$(call UnixPath,$(ALT_JUNIT_DIR)) " >> $@.tmp
+  endif
+  ifdef ANT_HOME
+	@$(ECHO) " --with-ant-home=$(call UnixPath,$(ANT_HOME)) " >> $@.tmp
+  endif
+  ifdef ALT_JAVAFX_ZIP_DIR
+	@$(ECHO) " --with-javafx-zip-dir=$(call UnixPath,$(ALT_JAVAFX_ZIP_DIR)) " >> $@.tmp
+  endif
+  ifdef ALT_WIXDIR
+	@$(ECHO) " --with-wix=$(call UnixPath,$(ALT_WIXDIR)) " >> $@.tmp
+  endif
+  ifdef ALT_CCSS_SIGNING_DIR
+	@$(ECHO) " --with-ccss-signing=$(call UnixPath,$(ALT_CCSS_SIGNING_DIR)) " >> $@.tmp
+  endif
+  ifdef ALT_SLASH_JAVA
+	@$(ECHO) " --with-java-devtools=$(call UnixPath,$(ALT_SLASH_JAVA)/devtools) " >> $@.tmp
+  endif
+  ifdef ALT_SPARKLE_FRAMEWORK_DIR
+	@$(ECHO) " --with-sparkle-framework=$(call UnixPath,$(ALT_SPARKLE_FRAMEWORK_DIR)) " >> $@.tmp
+  endif 
+endif
+	@if [ -f $@ ] ; then \
+          if ! $(CMP) $@ $@.tmp > /dev/null ; then \
+            $(CP) $@.tmp $@ ; \
+          fi ; \
+        else \
+          $(CP) $@.tmp $@ ; \
+        fi
+	$(RM) $@.tmp
+
+PHONY_LIST += bridge2configure bridgeBuild
+
+###########################################################################
+# JPRT targets
+
+ifndef JPRT_ARCHIVE_BUNDLE
+  JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/j2sdk-image.zip
+endif
+ifndef JPRT_ARCHIVE_INSTALL_BUNDLE
+    JPRT_ARCHIVE_INSTALL_BUNDLE=/tmp/jprt_bundles/product-install.zip
+endif
+
+# These targets execute in a SPEC free context, before calling bridgeBuild
+# to generate the SPEC.
+jprt_build_product: DEBUG_LEVEL=release
+jprt_build_product: BUILD_DIRNAME=*-release
+jprt_build_product: jprt_build_generic
+
+jprt_build_fastdebug: DEBUG_LEVEL=fastdebug
+jprt_build_fastdebug: BUILD_DIRNAME=*-fastdebug
+jprt_build_fastdebug: jprt_build_generic
+
+jprt_build_debug: DEBUG_LEVEL=slowdebug
+jprt_build_debug: BUILD_DIRNAME=*-debug
+jprt_build_debug: jprt_build_generic
+
+jprt_build_generic: BRIDGE_TARGETS+=jprt_bundle
+jprt_build_generic: bridgeBuild
+
+# This target must be called in the context of a SPEC file
+jprt_bundle: $(JPRT_ARCHIVE_BUNDLE)
+	@$(call CheckIfMakeAtEnd)
+
+# This target must be called in the context of a SPEC file
+$(JPRT_ARCHIVE_BUNDLE): bundles
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(CP) $(BUILD_OUTPUT)/bundles/j2sdk-image.zip $@
+
+# This target must be called in the context of a SPEC file
+bundles: all
+	@$(call TargetEnter)
+	$(MKDIR) -p $(BUILD_OUTPUT)/bundles
+ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_BITS),solaris-64)
+	$(CD) $(JDK_OVERLAY_IMAGE_DIR) && $(ZIP) -q -r $(BUILD_OUTPUT)/bundles/j2sdk-image.zip .
+	$(CD) $(JRE_OVERLAY_IMAGE_DIR) && $(ZIP) -q -r $(BUILD_OUTPUT)/bundles/j2re-image.zip .
+else
+	$(CD) $(JDK_IMAGE_DIR) && $(ZIP) -q -r $(BUILD_OUTPUT)/bundles/j2sdk-image.zip .
+	$(CD) $(JRE_IMAGE_DIR) && $(ZIP) -q -r $(BUILD_OUTPUT)/bundles/j2re-image.zip .
+	if [ -d  $(BUILD_OUTPUT)/install/bundles ] ; then \
+           $(CD) $(BUILD_OUTPUT)/install/bundles && $(ZIP) -q -r $(JPRT_ARCHIVE_INSTALL_BUNDLE) . ; \
+        fi
+endif
+	@$(call TargetExit)
+
+# Keep track of phony targets
+PHONY_LIST += jprt_build_product jprt_build_fastdebug jprt_build_debug \
+              jprt_build_generic bundles jprt_bundle
+
+###########################################################################
+# Phony targets
+.PHONY: $(PHONY_LIST)
+
+# Force target
+FRC:
--- a/common/makefiles/Main.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/common/makefiles/Main.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -65,7 +65,15 @@
 
 ### Main targets
 
-all: jdk
+default: jdk
+	@$(call CheckIfMakeAtEnd)
+
+all: images docs
+	@$(call CheckIfMakeAtEnd)
+
+ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_BITS),solaris-64)
+  all: overlay-images
+endif
 
 start-make:
 	@$(call AtMakeStart)
@@ -126,12 +134,6 @@
 	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk overlay-images)
 	@$(call TargetExit)
 
-bundles: images bundles-only
-bundles-only: start-make
-	@$(call TargetEnter)
-	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk bundles)
-	@$(call TargetExit)
-
 install: images install-only
 install-only: start-make
 	@$(call TargetEnter)
@@ -144,6 +146,12 @@
 	@($(CD) $(SRC_ROOT)/common/makefiles/javadoc && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
 	@$(call TargetExit)
 
+sign-jars: jdk sign-jars-only
+sign-jars-only: start-make
+	@$(call TargetEnter)
+	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk sign-jars)
+	@$(call TargetExit)
+
 bootcycle-images:
 	@$(ECHO) Boot cycle build step 1: Building the JDK image normally
 	@($(CD) $(SRC_ROOT)/common/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) SPEC=$(SPEC) images)
--- a/common/makefiles/MakeBase.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/common/makefiles/MakeBase.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -391,4 +391,46 @@
 endef
 endif
 
+# Convenience functions for working around make's limitations with $(filter ).
+containing = $(foreach v,$2,$(if $(findstring $1,$v),$v))
+not-containing = $(foreach v,$2,$(if $(findstring $1,$v),,$v))
+
+################################################################################
+# In Cygwin, finds are very costly, both because of expensive forks and because
+# of bad file system caching. Find is used extensively in $(shell) commands to
+# find source files. This makes rerunning make with no or few changes rather 
+# expensive. To speed this up, these two macros are used to cache the results
+# of simple find commands for reuse.
+# 
+# Runs a find and stores both the directories where it was run and the results.
+# This macro can be called multiple times to add to the cache. Only finds files
+# with no filters.
+#
+# Needs to be called with $(eval )
+# 
+# Param 1 - Dir to find in
+ifeq ($(OPENJDK_BUILD_OS),windows)
+define FillCacheFind
+    FIND_CACHE_DIR += $1
+    FIND_CACHE := $$(sort $$(FIND_CACHE) $$(shell $(FIND) $1 -type f -o -type l))
+endef
+else
+define FillCacheFind
+endef
+endif
+
+# Mimics find by looking in the cache if all of the directories have been cached.
+# Otherwise reverts to shell find. This is safe to call on all platforms, even if
+# cache is deactivated.
+#
+# The extra - is needed when FIND_CACHE_DIR is empty but should be harmless.
+# Param 1 - Dirs to find in
+define CacheFind
+    $(if $(filter-out $(addsuffix %,- $(FIND_CACHE_DIR)),$1),\
+        $(shell $(FIND) $1 -type f -o -type l),\
+        $(filter $(addsuffix %,$1),$(FIND_CACHE)))
+endef
+
+################################################################################
+
 endif # _MAKEBASE_GMK
--- a/common/makefiles/MakeHelpers.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/common/makefiles/MakeHelpers.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -50,7 +50,7 @@
 
 # Global targets are possible to run either with or without a SPEC. The prototypical
 # global target is "help". 
-global_targets=help configure
+global_targets=help jprt% bridgeBuild
 
 ##############################
 # Functions
@@ -112,7 +112,7 @@
 
 # Do not indent this function, this will add whitespace at the start which the caller won't handle
 define GetRealTarget
-$(strip $(if $(MAKECMDGOALS),$(MAKECMDGOALS),all))
+$(strip $(if $(MAKECMDGOALS),$(MAKECMDGOALS),default))
 endef
 
 # Do not indent this function, this will add whitespace at the start which the caller won't handle
@@ -126,10 +126,7 @@
     # Check if the current target is the last goal
     $(if $(filter $@,$(call LastGoal)),$(call AtMakeEnd))
     # If the target is 'foo-only', check if our goal was stated as 'foo'
-    $(if $(filter $(patsubst %-only,%,$@),$(call LastGoal)),$(call AtMakeEnd))
-    # If no goal is given, 'all' is default, but the last target executed for all is 'jdk-only'. Check for that, too.
-    # At most one of the tests can be true.
-    $(if $(subst all,,$(call LastGoal)),,$(if $(filter $@,jdk-only),$(call AtMakeEnd)))
+    $(if $(filter $@,$(call LastGoal)-only),$(call AtMakeEnd))
 endef
 
 # Hook to be called when starting to execute a top-level target
--- a/common/makefiles/Makefile	Wed Jan 16 22:17:36 2013 -0800
+++ b/common/makefiles/Makefile	Wed Jul 05 18:36:58 2017 +0200
@@ -23,109 +23,4 @@
 # questions.
 #
 
-# This must be the first rule
-all:
-
-# Inclusion of this pseudo-target will cause make to execute this file
-# serially, regardless of -j. Recursively called makefiles will not be
-# affected, however. This is required for correct dependency management.
-.NOTPARALLEL:
-
-# The shell code below will be executed on /usr/ccs/bin/make on Solaris, but not in GNU make.
-# /usr/ccs/bin/make lacks basically every other flow control mechanism.
-TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU make/gmake, this is a requirement. Check your path. 1>&2 && exit 1
-
-# Assume we have GNU make, but check version.
-ifeq (,$(findstring 3.81,$(MAKE_VERSION)))
-    ifeq (,$(findstring 3.82,$(MAKE_VERSION)))
-        $(error This version of GNU Make is too low ($(MAKE_VERSION)). Check your path, or upgrade to 3.81 or newer.)
-    endif
-endif
-
-# Locate this Makefile
-ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),)
-    makefile_path:=$(CURDIR)/$(lastword $(MAKEFILE_LIST))
-else
-    makefile_path:=$(lastword $(MAKEFILE_LIST))
-endif
-root_dir:=$(patsubst %/common/makefiles/Makefile,%,$(makefile_path))
-
-# ... and then we can include our helper functions
-include $(dir $(makefile_path))/MakeHelpers.gmk
-
-$(eval $(call ParseLogLevel))
-$(eval $(call ParseConfAndSpec))
-
-# Now determine if we have zero, one or several configurations to build.
-ifeq ($(SPEC),)
-    # Since we got past ParseConfAndSpec, we must be building a global target. Do nothing.
-else
-    ifeq ($(words $(SPEC)),1)
-        # We are building a single configuration. This is the normal case. Execute the Main.gmk file.
-        include $(dir $(makefile_path))/Main.gmk
-    else
-        # We are building multiple configurations.
-        # First, find out the valid targets
-        # Run the makefile with an arbitraty SPEC using -p -q (quiet dry-run and dump rules) to find
-        # available PHONY targets. Use this list as valid targets to pass on to the repeated calls.
-        all_phony_targets=$(filter-out $(global_targets), $(strip $(shell \
-            $(MAKE) -p -q -f  $(makefile_path) SPEC=$(firstword $(SPEC)) | \
-            grep ^.PHONY: | head -n 1 | cut -d " " -f 2-)))
-
-$(all_phony_targets):
-	@$(foreach spec,$(SPEC),($(MAKE) -f $(makefile_path) SPEC=$(spec) $(VERBOSE) VERBOSE=$(VERBOSE) $@) &&) true
-
-    endif
-endif
-
-# Here are "global" targets, i.e. targets that can be executed without specifying a single configuration.
-# If you addd more global targets, please update the variable global_targets in MakeHelpers.
-
-help:
-	$(info )
-	$(info OpenJDK Makefile help)
-	$(info =====================)
-	$(info )
-	$(info Common make targets)
-	$(info .  make [all]             # Compile all code but do not create images)
-	$(info .  make images            # Create complete j2sdk and j2re images)
-	$(info .  make overlay-images    # Create limited images for sparc 64 bit platforms)
-	$(info .  make bootcycle-images  # Build images twice, second time with newly build JDK)
-	$(info .  make install           # Install the generated images locally)
-	$(info .  make clean             # Remove all files generated by make, but not those)
-	$(info .                         # generated by configure)
-	$(info .  make dist-clean        # Remove all files, including configuration)
-	$(info .  make help              # Give some help on using make)
-	$(info .  make test              # Run tests, default is all tests (see TEST below))
-	$(info )
-	$(info Targets for specific components)
-	$(info (Component is any of langtools, corba, jaxp, jaxws, hotspot, jdk, images or overlay-images))
-	$(info .  make <component>       # Build <component> and everything it depends on. )
-	$(info .  make <component>-only  # Build <component> only, without dependencies. This)
-	$(info .                         # is faster but can result in incorrect build results!)
-	$(info .  make clean-<component> # Remove files generated by make for <component>)
-	$(info )
-	$(info Useful make variables)
-	$(info .  make CONF=             # Build all configurations (note, assignment is empty))
-	$(info .  make CONF=<substring>  # Build the configuration(s) with a name matching)
-	$(info .                         # <substring>)
-	$(info )
-	$(info .  make LOG=<loglevel>    # Change the log level from warn to <loglevel>)
-	$(info .                         # Available log levels are:)
-	$(info .                         # 'warn' (default), 'info', 'debug' and 'trace')
-	$(info .                         # To see executed command lines, use LOG=debug)
-	$(info )
-	$(info .  make JOBS=<n>          # Run <n> parallel make jobs)
-	$(info .                         # Note that -jN does not work as expected!)
-	$(info )
-	$(info .  make test TEST=<test>  # Only run the given test or tests, e.g.)
-	$(info .                         # make test TEST="jdk_lang jdk_net")
-	$(info )
-
-configure:
-	@$(SHELL) $(root_dir)/configure $(CONFIGURE_ARGS)
-	@echo ====================================================
-	@echo "Note: This is a non-recommended way of running configure."
-	@echo "Instead, run 'sh configure' in the top-level directory"
-
-.PHONY: help configure
+include ../../NewMakefile.gmk
--- a/common/makefiles/NativeCompilation.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/common/makefiles/NativeCompilation.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -236,7 +236,7 @@
     $$(foreach d,$$($1_SRC), $$(if $$(wildcard $$d),,$$(error SRC specified to SetupNativeCompilation $1 contains missing directory $$d)))
 
     # Find all files in the source trees. Sort to remove duplicates.
-    $1_ALL_SRCS := $$(sort $$(shell $(FIND) $$($1_SRC) -type f))
+    $1_ALL_SRCS := $$(sort $$(call CacheFind,$$($1_SRC)))
     # Extract the C/C++ files.
     $1_EXCLUDE_FILES:=$$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_EXCLUDE_FILES)))
     $1_INCLUDE_FILES:=$$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_INCLUDE_FILES)))
--- a/common/makefiles/javadoc/Javadoc.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/common/makefiles/javadoc/Javadoc.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -32,8 +32,6 @@
 # Definitions for $(DOCSDIR), $(MKDIR), $(BINDIR), etc.
 #
 
-CLASSPATH_SEPARATOR = :
-
 DOCSDIR=$(OUTPUT_ROOT)/docs
 TEMPDIR=$(OUTPUT_ROOT)/docstemp
 
@@ -137,7 +135,7 @@
 # List of all possible directories for javadoc to look for sources
 #    NOTE: Quotes are required around sourcepath argument only on Windows.
 #          Otherwise, you get "No packages or classes specified." due 
-#          to $(CLASSPATH_SEPARATOR) being interpreted as an end of 
+#          to $(PATH_SEP) being interpreted as an end of 
 #          command (newline or shell ; character)
 ALL_SOURCE_DIRS = $(JDK_SHARE_CLASSES) \
                   $(JDK_IMPSRC) \
@@ -154,7 +152,7 @@
 EMPTY:=
 SPACE:= $(EMPTY) $(EMPTY)
 RELEASEDOCS_SOURCEPATH = \
-    $(subst $(SPACE),$(CLASSPATH_SEPARATOR),$(strip $(ALL_SOURCE_DIRS)))
+    $(subst $(SPACE),$(PATH_SEP),$(strip $(ALL_SOURCE_DIRS)))
 
 define prep-target
 $(MKDIR) -p $(@D)
--- a/common/src/fixpath.c	Wed Jan 16 22:17:36 2013 -0800
+++ b/common/src/fixpath.c	Wed Jul 05 18:36:58 2017 +0200
@@ -29,6 +29,29 @@
 #include <string.h>
 #include <malloc.h>
 
+void report_error()
+{
+  LPVOID lpMsgBuf;
+  DWORD dw = GetLastError();
+
+  FormatMessage(
+      FORMAT_MESSAGE_ALLOCATE_BUFFER |
+      FORMAT_MESSAGE_FROM_SYSTEM |
+      FORMAT_MESSAGE_IGNORE_INSERTS,
+      NULL,
+      dw,
+      MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+      (LPTSTR) &lpMsgBuf,
+      0,
+      NULL);
+
+  fprintf(stderr,
+          "Could not start process!  Failed with error %d: %s\n",
+          dw, lpMsgBuf);
+
+  LocalFree(lpMsgBuf);
+}
+
 /*
  * Test if pos points to /cygdrive/_/ where _ can
  * be any character.
@@ -256,7 +279,7 @@
     DWORD exitCode;
 
     if (argc<3 || argv[1][0] != '-' || (argv[1][1] != 'c' && argv[1][1] != 'm')) {
-        fprintf(stderr, "Usage: fixpath -c|m<path@path@...> /cygdrive/c/WINDOWS/notepad.exe /cygdrive/c/x/test.txt");
+        fprintf(stderr, "Usage: fixpath -c|m<path@path@...> /cygdrive/c/WINDOWS/notepad.exe /cygdrive/c/x/test.txt\n");
         exit(0);
     }
 
@@ -308,11 +331,10 @@
                        0,
                        &si,
                        &pi);
-    if(!rc)
-    {
-      //Could not start process;
-      fprintf(stderr, "Could not start process!\n");
-      exit(-1);
+    if(!rc) {
+      // Could not start process for some reason.  Try to report why:
+      report_error();
+      exit(rc);
     }
 
     WaitForSingleObject(pi.hProcess,INFINITE);
--- a/corba/.hgtags	Wed Jan 16 22:17:36 2013 -0800
+++ b/corba/.hgtags	Wed Jul 05 18:36:58 2017 +0200
@@ -194,3 +194,4 @@
 603cceb495c8133d47b26a7502d51c7d8a67d76b jdk8-b70
 8171d23e914d758836527b80b06debcfdb718f2d jdk8-b71
 cb40427f47145b01b7e53c3e02b38ff7625efbda jdk8-b72
+191afde59e7be0e1a1d76d06f2a32ff17444f0ec jdk8-b73
--- a/hotspot/.hgtags	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/.hgtags	Wed Jul 05 18:36:58 2017 +0200
@@ -306,3 +306,5 @@
 e94068d4ff52849c8aa0786a53a59b63d1312a39 jdk8-b70
 0847210f85480bf3848dc90bc2ab23c0a4791b55 jdk8-b71
 d5cb5830f570d1304ea4b196dde672a291b55f29 jdk8-b72
+1e129851479e4f5df439109fca2c7be1f1613522 hs25-b15
+11619f33cd683c2f1d6ef72f1c6ff3dacf5a9f1c jdk8-b73
--- a/hotspot/make/bsd/makefiles/mapfile-vers-debug	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/make/bsd/makefiles/mapfile-vers-debug	Wed Jul 05 18:36:58 2017 +0200
@@ -1,5 +1,5 @@
 #
-# @(#)mapfile-vers-debug	1.18 07/10/25 16:47:35
+# @(#)mapfile-vers-debug        1.18 07/10/25 16:47:35
 #
 
 #
@@ -126,8 +126,9 @@
                 JVM_GetClassModifiers;
                 JVM_GetClassName;
                 JVM_GetClassNameUTF;
-		JVM_GetClassSignature;
+                        JVM_GetClassSignature;
                 JVM_GetClassSigners;
+                JVM_GetClassTypeAnnotations;
                 JVM_GetComponentType;
                 JVM_GetDeclaredClasses;
                 JVM_GetDeclaringClass;
@@ -154,6 +155,7 @@
                 JVM_GetMethodIxNameUTF;
                 JVM_GetMethodIxSignatureUTF;
                 JVM_GetMethodParameterAnnotations;
+                JVM_GetMethodParameters;
                 JVM_GetPrimitiveArrayElement;
                 JVM_GetProtectionDomain;
                 JVM_GetSockName;
@@ -283,7 +285,7 @@
                 # This is for Forte Analyzer profiling support.
                 AsyncGetCallTrace;
 
-		# INSERT VTABLE SYMBOLS HERE
+                # INSERT VTABLE SYMBOLS HERE
 
         local:
                 *;
--- a/hotspot/make/bsd/makefiles/mapfile-vers-product	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/make/bsd/makefiles/mapfile-vers-product	Wed Jul 05 18:36:58 2017 +0200
@@ -128,6 +128,7 @@
                 JVM_GetClassNameUTF;
                 JVM_GetClassSignature;
                 JVM_GetClassSigners;
+                JVM_GetClassTypeAnnotations;
                 JVM_GetComponentType;
                 JVM_GetDeclaredClasses;
                 JVM_GetDeclaringClass;
@@ -154,6 +155,7 @@
                 JVM_GetMethodIxNameUTF;
                 JVM_GetMethodIxSignatureUTF;
                 JVM_GetMethodParameterAnnotations;
+                JVM_GetMethodParameters;
                 JVM_GetPrimitiveArrayElement;
                 JVM_GetProtectionDomain;
                 JVM_GetSockName;
--- a/hotspot/make/hotspot_version	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/make/hotspot_version	Wed Jul 05 18:36:58 2017 +0200
@@ -35,7 +35,7 @@
 
 HS_MAJOR_VER=25
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=14
+HS_BUILD_NUMBER=15
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=8
--- a/hotspot/make/linux/makefiles/mapfile-vers-debug	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/make/linux/makefiles/mapfile-vers-debug	Wed Jul 05 18:36:58 2017 +0200
@@ -124,6 +124,7 @@
                 JVM_GetClassNameUTF;
 		JVM_GetClassSignature;
                 JVM_GetClassSigners;
+                JVM_GetClassTypeAnnotations;
                 JVM_GetComponentType;
                 JVM_GetDeclaredClasses;
                 JVM_GetDeclaringClass;
@@ -150,6 +151,7 @@
                 JVM_GetMethodIxNameUTF;
                 JVM_GetMethodIxSignatureUTF;
                 JVM_GetMethodParameterAnnotations;
+                JVM_GetMethodParameters;
                 JVM_GetPrimitiveArrayElement;
                 JVM_GetProtectionDomain;
                 JVM_GetSockName;
--- a/hotspot/make/linux/makefiles/mapfile-vers-product	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/make/linux/makefiles/mapfile-vers-product	Wed Jul 05 18:36:58 2017 +0200
@@ -124,6 +124,7 @@
                 JVM_GetClassNameUTF;
                 JVM_GetClassSignature;
                 JVM_GetClassSigners;
+                JVM_GetClassTypeAnnotations;
                 JVM_GetComponentType;
                 JVM_GetDeclaredClasses;
                 JVM_GetDeclaringClass;
@@ -150,6 +151,7 @@
                 JVM_GetMethodIxNameUTF;
                 JVM_GetMethodIxSignatureUTF;
                 JVM_GetMethodParameterAnnotations;
+                JVM_GetMethodParameters;
                 JVM_GetPrimitiveArrayElement;
                 JVM_GetProtectionDomain;
                 JVM_GetSockName;
--- a/hotspot/make/solaris/makefiles/mapfile-vers	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/make/solaris/makefiles/mapfile-vers	Wed Jul 05 18:36:58 2017 +0200
@@ -26,235 +26,237 @@
 
 SUNWprivate_1.1 {
         global:
-		# JNI
+                # JNI
                 JNI_CreateJavaVM;
                 JNI_GetCreatedJavaVMs;
                 JNI_GetDefaultJavaVMInitArgs;
-	
-		# JVM
-		JVM_Accept;
-		JVM_ActiveProcessorCount;
-		JVM_AllocateNewArray;
-		JVM_AllocateNewObject;
-		JVM_ArrayCopy;
-		JVM_AssertionStatusDirectives;
-		JVM_Available;
-		JVM_Bind;
-		JVM_ClassDepth;
-		JVM_ClassLoaderDepth;
-		JVM_Clone;
-		JVM_Close;
-		JVM_CX8Field;
-		JVM_CompileClass;
-		JVM_CompileClasses;
-		JVM_CompilerCommand;
-		JVM_Connect;
-		JVM_ConstantPoolGetClassAt;
-		JVM_ConstantPoolGetClassAtIfLoaded;
-		JVM_ConstantPoolGetDoubleAt;
-		JVM_ConstantPoolGetFieldAt;
-		JVM_ConstantPoolGetFieldAtIfLoaded;
-		JVM_ConstantPoolGetFloatAt;
-		JVM_ConstantPoolGetIntAt;
-		JVM_ConstantPoolGetLongAt;
-		JVM_ConstantPoolGetMethodAt;
-		JVM_ConstantPoolGetMethodAtIfLoaded;
-		JVM_ConstantPoolGetMemberRefInfoAt;
-		JVM_ConstantPoolGetSize;
-		JVM_ConstantPoolGetStringAt;
-		JVM_ConstantPoolGetUTF8At;
-		JVM_CountStackFrames;
-		JVM_CurrentClassLoader;
-		JVM_CurrentLoadedClass;
-		JVM_CurrentThread;
-		JVM_CurrentTimeMillis;
-		JVM_DefineClass;
-		JVM_DefineClassWithSource;
-		JVM_DefineClassWithSourceCond;
-		JVM_DesiredAssertionStatus;
-		JVM_DisableCompiler;
-		JVM_DoPrivileged;
-		JVM_DTraceGetVersion;
-		JVM_DTraceActivate;
-		JVM_DTraceIsProbeEnabled;
-		JVM_DTraceIsSupported;
-		JVM_DTraceDispose;
-		JVM_DumpAllStacks;
-		JVM_DumpThreads;
-		JVM_EnableCompiler;
-		JVM_Exit;
-		JVM_FillInStackTrace;
-		JVM_FindClassFromClass;
-		JVM_FindClassFromClassLoader;
-		JVM_FindClassFromBootLoader;
-		JVM_FindLibraryEntry;
-		JVM_FindLoadedClass;
-		JVM_FindPrimitiveClass;
-		JVM_FindSignal;
-		JVM_FreeMemory;
-		JVM_GC;
-		JVM_GetAllThreads;
-		JVM_GetArrayElement;
-		JVM_GetArrayLength;
-		JVM_GetCPClassNameUTF;
-		JVM_GetCPFieldClassNameUTF;
-		JVM_GetCPFieldModifiers;
-		JVM_GetCPFieldNameUTF;
-		JVM_GetCPFieldSignatureUTF;
-		JVM_GetCPMethodClassNameUTF;
-		JVM_GetCPMethodModifiers;
-		JVM_GetCPMethodNameUTF;
-		JVM_GetCPMethodSignatureUTF;
-		JVM_GetCallerClass;
-		JVM_GetClassAccessFlags;
-		JVM_GetClassAnnotations;
-		JVM_GetClassCPEntriesCount;
-		JVM_GetClassCPTypes;
-		JVM_GetClassConstantPool;
-		JVM_GetClassContext;
-		JVM_GetClassDeclaredConstructors;
-		JVM_GetClassDeclaredFields;
-		JVM_GetClassDeclaredMethods;
-		JVM_GetClassFieldsCount;
-		JVM_GetClassInterfaces;
-		JVM_GetClassLoader;
-		JVM_GetClassMethodsCount;
-		JVM_GetClassModifiers;
-		JVM_GetClassName;
-		JVM_GetClassNameUTF;
-		JVM_GetClassSignature;
-		JVM_GetClassSigners;
-		JVM_GetComponentType;
-		JVM_GetDeclaredClasses;
-		JVM_GetDeclaringClass;
-		JVM_GetEnclosingMethodInfo;
-	        JVM_GetFieldAnnotations;
-		JVM_GetFieldIxModifiers;
-		JVM_GetHostName;
-		JVM_GetInheritedAccessControlContext;
-		JVM_GetInterfaceVersion;
-		JVM_GetLastErrorString;
-		JVM_GetManagement;
-	        JVM_GetMethodAnnotations;
-	        JVM_GetMethodDefaultAnnotationValue;
-		JVM_GetMethodIxArgsSize;
-		JVM_GetMethodIxByteCode;
-		JVM_GetMethodIxByteCodeLength;
-		JVM_GetMethodIxExceptionIndexes;
-		JVM_GetMethodIxExceptionTableEntry;
-		JVM_GetMethodIxExceptionTableLength;
-		JVM_GetMethodIxExceptionsCount;
-		JVM_GetMethodIxLocalsCount;
-		JVM_GetMethodIxMaxStack;
-		JVM_GetMethodIxModifiers;
-		JVM_GetMethodIxNameUTF;
-		JVM_GetMethodIxSignatureUTF;
-	        JVM_GetMethodParameterAnnotations;
-		JVM_GetPrimitiveArrayElement;
-		JVM_GetProtectionDomain;
-		JVM_GetSockName;
-		JVM_GetSockOpt;
-		JVM_GetStackAccessControlContext;
-		JVM_GetStackTraceDepth;
-		JVM_GetStackTraceElement;
-		JVM_GetSystemPackage;
-		JVM_GetSystemPackages;
-		JVM_GetThreadStateNames;
-		JVM_GetThreadStateValues;
-		JVM_GetVersionInfo;
-		JVM_Halt;
-		JVM_HoldsLock;
-		JVM_IHashCode;
-		JVM_InitAgentProperties;
-		JVM_InitProperties;
-		JVM_InitializeCompiler;
-		JVM_InitializeSocketLibrary;
-		JVM_InternString;
-		JVM_Interrupt;
-		JVM_InvokeMethod;
-		JVM_IsArrayClass;
-		JVM_IsConstructorIx;
-		JVM_IsInterface;
-		JVM_IsInterrupted;
-		JVM_IsNaN;
-		JVM_IsPrimitiveClass;
-		JVM_IsSameClassPackage;
-		JVM_IsSilentCompiler;
-		JVM_IsSupportedJNIVersion;
-		JVM_IsThreadAlive;
-		JVM_LatestUserDefinedLoader;
-		JVM_Listen;
-		JVM_LoadClass0;
-		JVM_LoadLibrary;
-		JVM_Lseek;
-		JVM_MaxObjectInspectionAge;
-		JVM_MaxMemory;
-		JVM_MonitorNotify;
-		JVM_MonitorNotifyAll;
-		JVM_MonitorWait;
-		JVM_NativePath;
-		JVM_NanoTime;
-		JVM_NewArray;
-		JVM_NewInstanceFromConstructor;
-		JVM_NewMultiArray;
-		JVM_OnExit;
-		JVM_Open;
-		JVM_PrintStackTrace;
-		JVM_RaiseSignal;
-		JVM_RawMonitorCreate;
-		JVM_RawMonitorDestroy;
-		JVM_RawMonitorEnter;
-		JVM_RawMonitorExit;
-		JVM_Read;
-		JVM_Recv;
-		JVM_RecvFrom;
-		JVM_RegisterSignal;
-		JVM_ReleaseUTF;
-		JVM_ResolveClass;
-		JVM_ResumeThread;
-		JVM_Send;
-		JVM_SendTo;
-		JVM_SetArrayElement;
-		JVM_SetClassSigners;
-		JVM_SetLength;
+        
+                # JVM
+                JVM_Accept;
+                JVM_ActiveProcessorCount;
+                JVM_AllocateNewArray;
+                JVM_AllocateNewObject;
+                JVM_ArrayCopy;
+                JVM_AssertionStatusDirectives;
+                JVM_Available;
+                JVM_Bind;
+                JVM_ClassDepth;
+                JVM_ClassLoaderDepth;
+                JVM_Clone;
+                JVM_Close;
+                JVM_CX8Field;
+                JVM_CompileClass;
+                JVM_CompileClasses;
+                JVM_CompilerCommand;
+                JVM_Connect;
+                JVM_ConstantPoolGetClassAt;
+                JVM_ConstantPoolGetClassAtIfLoaded;
+                JVM_ConstantPoolGetDoubleAt;
+                JVM_ConstantPoolGetFieldAt;
+                JVM_ConstantPoolGetFieldAtIfLoaded;
+                JVM_ConstantPoolGetFloatAt;
+                JVM_ConstantPoolGetIntAt;
+                JVM_ConstantPoolGetLongAt;
+                JVM_ConstantPoolGetMethodAt;
+                JVM_ConstantPoolGetMethodAtIfLoaded;
+                JVM_ConstantPoolGetMemberRefInfoAt;
+                JVM_ConstantPoolGetSize;
+                JVM_ConstantPoolGetStringAt;
+                JVM_ConstantPoolGetUTF8At;
+                JVM_CountStackFrames;
+                JVM_CurrentClassLoader;
+                JVM_CurrentLoadedClass;
+                JVM_CurrentThread;
+                JVM_CurrentTimeMillis;
+                JVM_DefineClass;
+                JVM_DefineClassWithSource;
+                JVM_DefineClassWithSourceCond;
+                JVM_DesiredAssertionStatus;
+                JVM_DisableCompiler;
+                JVM_DoPrivileged;
+                JVM_DTraceGetVersion;
+                JVM_DTraceActivate;
+                JVM_DTraceIsProbeEnabled;
+                JVM_DTraceIsSupported;
+                JVM_DTraceDispose;
+                JVM_DumpAllStacks;
+                JVM_DumpThreads;
+                JVM_EnableCompiler;
+                JVM_Exit;
+                JVM_FillInStackTrace;
+                JVM_FindClassFromClass;
+                JVM_FindClassFromClassLoader;
+                JVM_FindClassFromBootLoader;
+                JVM_FindLibraryEntry;
+                JVM_FindLoadedClass;
+                JVM_FindPrimitiveClass;
+                JVM_FindSignal;
+                JVM_FreeMemory;
+                JVM_GC;
+                JVM_GetAllThreads;
+                JVM_GetArrayElement;
+                JVM_GetArrayLength;
+                JVM_GetCPClassNameUTF;
+                JVM_GetCPFieldClassNameUTF;
+                JVM_GetCPFieldModifiers;
+                JVM_GetCPFieldNameUTF;
+                JVM_GetCPFieldSignatureUTF;
+                JVM_GetCPMethodClassNameUTF;
+                JVM_GetCPMethodModifiers;
+                JVM_GetCPMethodNameUTF;
+                JVM_GetCPMethodSignatureUTF;
+                JVM_GetCallerClass;
+                JVM_GetClassAccessFlags;
+                JVM_GetClassAnnotations;
+                JVM_GetClassCPEntriesCount;
+                JVM_GetClassCPTypes;
+                JVM_GetClassConstantPool;
+                JVM_GetClassContext;
+                JVM_GetClassDeclaredConstructors;
+                JVM_GetClassDeclaredFields;
+                JVM_GetClassDeclaredMethods;
+                JVM_GetClassFieldsCount;
+                JVM_GetClassInterfaces;
+                JVM_GetClassLoader;
+                JVM_GetClassMethodsCount;
+                JVM_GetClassModifiers;
+                JVM_GetClassName;
+                JVM_GetClassNameUTF;
+                JVM_GetClassSignature;
+                JVM_GetClassSigners;
+                JVM_GetComponentType;
+                JVM_GetClassTypeAnnotations;
+                JVM_GetDeclaredClasses;
+                JVM_GetDeclaringClass;
+                JVM_GetEnclosingMethodInfo;
+                JVM_GetFieldAnnotations;
+                JVM_GetFieldIxModifiers;
+                JVM_GetHostName;
+                JVM_GetInheritedAccessControlContext;
+                JVM_GetInterfaceVersion;
+                JVM_GetLastErrorString;
+                JVM_GetManagement;
+                JVM_GetMethodAnnotations;
+                JVM_GetMethodDefaultAnnotationValue;
+                JVM_GetMethodIxArgsSize;
+                JVM_GetMethodIxByteCode;
+                JVM_GetMethodIxByteCodeLength;
+                JVM_GetMethodIxExceptionIndexes;
+                JVM_GetMethodIxExceptionTableEntry;
+                JVM_GetMethodIxExceptionTableLength;
+                JVM_GetMethodIxExceptionsCount;
+                JVM_GetMethodIxLocalsCount;
+                JVM_GetMethodIxMaxStack;
+                JVM_GetMethodIxModifiers;
+                JVM_GetMethodIxNameUTF;
+                JVM_GetMethodIxSignatureUTF;
+                JVM_GetMethodParameterAnnotations;
+                JVM_GetMethodParameters;
+                JVM_GetPrimitiveArrayElement;
+                JVM_GetProtectionDomain;
+                JVM_GetSockName;
+                JVM_GetSockOpt;
+                JVM_GetStackAccessControlContext;
+                JVM_GetStackTraceDepth;
+                JVM_GetStackTraceElement;
+                JVM_GetSystemPackage;
+                JVM_GetSystemPackages;
+                JVM_GetThreadStateNames;
+                JVM_GetThreadStateValues;
+                JVM_GetVersionInfo;
+                JVM_Halt;
+                JVM_HoldsLock;
+                JVM_IHashCode;
+                JVM_InitAgentProperties;
+                JVM_InitProperties;
+                JVM_InitializeCompiler;
+                JVM_InitializeSocketLibrary;
+                JVM_InternString;
+                JVM_Interrupt;
+                JVM_InvokeMethod;
+                JVM_IsArrayClass;
+                JVM_IsConstructorIx;
+                JVM_IsInterface;
+                JVM_IsInterrupted;
+                JVM_IsNaN;
+                JVM_IsPrimitiveClass;
+                JVM_IsSameClassPackage;
+                JVM_IsSilentCompiler;
+                JVM_IsSupportedJNIVersion;
+                JVM_IsThreadAlive;
+                JVM_LatestUserDefinedLoader;
+                JVM_Listen;
+                JVM_LoadClass0;
+                JVM_LoadLibrary;
+                JVM_Lseek;
+                JVM_MaxObjectInspectionAge;
+                JVM_MaxMemory;
+                JVM_MonitorNotify;
+                JVM_MonitorNotifyAll;
+                JVM_MonitorWait;
+                JVM_NativePath;
+                JVM_NanoTime;
+                JVM_NewArray;
+                JVM_NewInstanceFromConstructor;
+                JVM_NewMultiArray;
+                JVM_OnExit;
+                JVM_Open;
+                JVM_PrintStackTrace;
+                JVM_RaiseSignal;
+                JVM_RawMonitorCreate;
+                JVM_RawMonitorDestroy;
+                JVM_RawMonitorEnter;
+                JVM_RawMonitorExit;
+                JVM_Read;
+                JVM_Recv;
+                JVM_RecvFrom;
+                JVM_RegisterSignal;
+                JVM_ReleaseUTF;
+                JVM_ResolveClass;
+                JVM_ResumeThread;
+                JVM_Send;
+                JVM_SendTo;
+                JVM_SetArrayElement;
+                JVM_SetClassSigners;
+                JVM_SetLength;
                 JVM_SetNativeThreadName;
-		JVM_SetPrimitiveArrayElement;
-		JVM_SetProtectionDomain;
-		JVM_SetSockOpt;
-		JVM_SetThreadPriority;
-		JVM_Sleep;
-		JVM_Socket;
-		JVM_SocketAvailable;
-		JVM_SocketClose;
-		JVM_SocketShutdown;
-		JVM_StartThread;
-		JVM_StopThread;
-		JVM_SuspendThread;
-		JVM_SupportsCX8;
-		JVM_Sync;
-		JVM_Timeout;
-		JVM_TotalMemory;
-		JVM_TraceInstructions;
-		JVM_TraceMethodCalls;
-		JVM_UnloadLibrary;
-		JVM_Write;
-		JVM_Yield;
-		JVM_handle_solaris_signal;
+                JVM_SetPrimitiveArrayElement;
+                JVM_SetProtectionDomain;
+                JVM_SetSockOpt;
+                JVM_SetThreadPriority;
+                JVM_Sleep;
+                JVM_Socket;
+                JVM_SocketAvailable;
+                JVM_SocketClose;
+                JVM_SocketShutdown;
+                JVM_StartThread;
+                JVM_StopThread;
+                JVM_SuspendThread;
+                JVM_SupportsCX8;
+                JVM_Sync;
+                JVM_Timeout;
+                JVM_TotalMemory;
+                JVM_TraceInstructions;
+                JVM_TraceMethodCalls;
+                JVM_UnloadLibrary;
+                JVM_Write;
+                JVM_Yield;
+                JVM_handle_solaris_signal;
 
-		# miscellaneous functions
-		jio_fprintf;
-		jio_printf;
-		jio_snprintf;
-		jio_vfprintf;
-		jio_vsnprintf;
+                # miscellaneous functions
+                jio_fprintf;
+                jio_printf;
+                jio_snprintf;
+                jio_vfprintf;
+                jio_vsnprintf;
 
-		# Needed because there is no JVM interface for this.
-		sysThreadAvailableStackWithSlack;
+                # Needed because there is no JVM interface for this.
+                sysThreadAvailableStackWithSlack;
 
-		# This is for Forte Analyzer profiling support.
-		AsyncGetCallTrace;
+                # This is for Forte Analyzer profiling support.
+                AsyncGetCallTrace;
 
-		# INSERT VTABLE SYMBOLS HERE
+                # INSERT VTABLE SYMBOLS HERE
 
         local:
                 *;
--- a/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -675,8 +675,8 @@
     AbstractAssembler::flush();
   }
 
-  inline void emit_long(int);  // shadows AbstractAssembler::emit_long
-  inline void emit_data(int x) { emit_long(x); }
+  inline void emit_int32(int);  // shadows AbstractAssembler::emit_int32
+  inline void emit_data(int x) { emit_int32(x); }
   inline void emit_data(int, RelocationHolder const&);
   inline void emit_data(int, relocInfo::relocType rtype);
   // helper for above fcns
@@ -691,12 +691,12 @@
   inline void add(Register s1, Register s2, Register d );
   inline void add(Register s1, int simm13a, Register d );
 
-  void addcc(  Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(add_op3  | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
-  void addcc(  Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(add_op3  | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void addc(   Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(addc_op3             ) | rs1(s1) | rs2(s2) ); }
-  void addc(   Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(addc_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void addccc( Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(addc_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
-  void addccc( Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(addc_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void addcc(  Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(add_op3  | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
+  void addcc(  Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(add_op3  | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void addc(   Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(addc_op3             ) | rs1(s1) | rs2(s2) ); }
+  void addc(   Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(addc_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void addccc( Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(addc_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
+  void addccc( Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(addc_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
 
   // pp 136
@@ -749,76 +749,76 @@
   // at address s1 is swapped with the data in d. If the values are not equal,
   // the the contents of memory at s1 is loaded into d, without the swap.
 
-  void casa(  Register s1, Register s2, Register d, int ia = -1 ) { v9_only();  emit_long( op(ldst_op) | rd(d) | op3(casa_op3 ) | rs1(s1) | (ia == -1  ? immed(true) : imm_asi(ia)) | rs2(s2)); }
-  void casxa( Register s1, Register s2, Register d, int ia = -1 ) { v9_only();  emit_long( op(ldst_op) | rd(d) | op3(casxa_op3) | rs1(s1) | (ia == -1  ? immed(true) : imm_asi(ia)) | rs2(s2)); }
+  void casa(  Register s1, Register s2, Register d, int ia = -1 ) { v9_only();  emit_int32( op(ldst_op) | rd(d) | op3(casa_op3 ) | rs1(s1) | (ia == -1  ? immed(true) : imm_asi(ia)) | rs2(s2)); }
+  void casxa( Register s1, Register s2, Register d, int ia = -1 ) { v9_only();  emit_int32( op(ldst_op) | rd(d) | op3(casxa_op3) | rs1(s1) | (ia == -1  ? immed(true) : imm_asi(ia)) | rs2(s2)); }
 
   // pp 152
 
-  void udiv(   Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(udiv_op3             ) | rs1(s1) | rs2(s2)); }
-  void udiv(   Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(udiv_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void sdiv(   Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(sdiv_op3             ) | rs1(s1) | rs2(s2)); }
-  void sdiv(   Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(sdiv_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void udivcc( Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(udiv_op3 | cc_bit_op3) | rs1(s1) | rs2(s2)); }
-  void udivcc( Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(udiv_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void sdivcc( Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(sdiv_op3 | cc_bit_op3) | rs1(s1) | rs2(s2)); }
-  void sdivcc( Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(sdiv_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void udiv(   Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(udiv_op3             ) | rs1(s1) | rs2(s2)); }
+  void udiv(   Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(udiv_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void sdiv(   Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(sdiv_op3             ) | rs1(s1) | rs2(s2)); }
+  void sdiv(   Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(sdiv_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void udivcc( Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(udiv_op3 | cc_bit_op3) | rs1(s1) | rs2(s2)); }
+  void udivcc( Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(udiv_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void sdivcc( Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(sdiv_op3 | cc_bit_op3) | rs1(s1) | rs2(s2)); }
+  void sdivcc( Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(sdiv_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 155
 
-  void done()  { v9_only();  cti();  emit_long( op(arith_op) | fcn(0) | op3(done_op3) ); }
-  void retry() { v9_only();  cti();  emit_long( op(arith_op) | fcn(1) | op3(retry_op3) ); }
+  void done()  { v9_only();  cti();  emit_int32( op(arith_op) | fcn(0) | op3(done_op3) ); }
+  void retry() { v9_only();  cti();  emit_int32( op(arith_op) | fcn(1) | op3(retry_op3) ); }
 
   // pp 156
 
-  void fadd( FloatRegisterImpl::Width w, FloatRegister s1, FloatRegister s2, FloatRegister d ) { emit_long( op(arith_op) | fd(d, w) | op3(fpop1_op3) | fs1(s1, w) | opf(0x40 + w) | fs2(s2, w)); }
-  void fsub( FloatRegisterImpl::Width w, FloatRegister s1, FloatRegister s2, FloatRegister d ) { emit_long( op(arith_op) | fd(d, w) | op3(fpop1_op3) | fs1(s1, w) | opf(0x44 + w) | fs2(s2, w)); }
+  void fadd( FloatRegisterImpl::Width w, FloatRegister s1, FloatRegister s2, FloatRegister d ) { emit_int32( op(arith_op) | fd(d, w) | op3(fpop1_op3) | fs1(s1, w) | opf(0x40 + w) | fs2(s2, w)); }
+  void fsub( FloatRegisterImpl::Width w, FloatRegister s1, FloatRegister s2, FloatRegister d ) { emit_int32( op(arith_op) | fd(d, w) | op3(fpop1_op3) | fs1(s1, w) | opf(0x44 + w) | fs2(s2, w)); }
 
   // pp 157
 
-  void fcmp(  FloatRegisterImpl::Width w, CC cc, FloatRegister s1, FloatRegister s2) { v8_no_cc(cc);  emit_long( op(arith_op) | cmpcc(cc) | op3(fpop2_op3) | fs1(s1, w) | opf(0x50 + w) | fs2(s2, w)); }
-  void fcmpe( FloatRegisterImpl::Width w, CC cc, FloatRegister s1, FloatRegister s2) { v8_no_cc(cc);  emit_long( op(arith_op) | cmpcc(cc) | op3(fpop2_op3) | fs1(s1, w) | opf(0x54 + w) | fs2(s2, w)); }
+  void fcmp(  FloatRegisterImpl::Width w, CC cc, FloatRegister s1, FloatRegister s2) { v8_no_cc(cc);  emit_int32( op(arith_op) | cmpcc(cc) | op3(fpop2_op3) | fs1(s1, w) | opf(0x50 + w) | fs2(s2, w)); }
+  void fcmpe( FloatRegisterImpl::Width w, CC cc, FloatRegister s1, FloatRegister s2) { v8_no_cc(cc);  emit_int32( op(arith_op) | cmpcc(cc) | op3(fpop2_op3) | fs1(s1, w) | opf(0x54 + w) | fs2(s2, w)); }
 
   // pp 159
 
-  void ftox( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) { v9_only();  emit_long( op(arith_op) | fd(d, FloatRegisterImpl::D) | op3(fpop1_op3) | opf(0x80 + w) | fs2(s, w)); }
-  void ftoi( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) {             emit_long( op(arith_op) | fd(d, FloatRegisterImpl::S) | op3(fpop1_op3) | opf(0xd0 + w) | fs2(s, w)); }
+  void ftox( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) { v9_only();  emit_int32( op(arith_op) | fd(d, FloatRegisterImpl::D) | op3(fpop1_op3) | opf(0x80 + w) | fs2(s, w)); }
+  void ftoi( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) {             emit_int32( op(arith_op) | fd(d, FloatRegisterImpl::S) | op3(fpop1_op3) | opf(0xd0 + w) | fs2(s, w)); }
 
   // pp 160
 
-  void ftof( FloatRegisterImpl::Width sw, FloatRegisterImpl::Width dw, FloatRegister s, FloatRegister d ) { emit_long( op(arith_op) | fd(d, dw) | op3(fpop1_op3) | opf(0xc0 + sw + dw*4) | fs2(s, sw)); }
+  void ftof( FloatRegisterImpl::Width sw, FloatRegisterImpl::Width dw, FloatRegister s, FloatRegister d ) { emit_int32( op(arith_op) | fd(d, dw) | op3(fpop1_op3) | opf(0xc0 + sw + dw*4) | fs2(s, sw)); }
 
   // pp 161
 
-  void fxtof( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) { v9_only();  emit_long( op(arith_op) | fd(d, w) | op3(fpop1_op3) | opf(0x80 + w*4) | fs2(s, FloatRegisterImpl::D)); }
-  void fitof( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) {             emit_long( op(arith_op) | fd(d, w) | op3(fpop1_op3) | opf(0xc0 + w*4) | fs2(s, FloatRegisterImpl::S)); }
+  void fxtof( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) { v9_only();  emit_int32( op(arith_op) | fd(d, w) | op3(fpop1_op3) | opf(0x80 + w*4) | fs2(s, FloatRegisterImpl::D)); }
+  void fitof( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) {             emit_int32( op(arith_op) | fd(d, w) | op3(fpop1_op3) | opf(0xc0 + w*4) | fs2(s, FloatRegisterImpl::S)); }
 
   // pp 162
 
-  void fmov( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) { v8_s_only(w);  emit_long( op(arith_op) | fd(d, w) | op3(fpop1_op3) | opf(0x00 + w) | fs2(s, w)); }
+  void fmov( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) { v8_s_only(w);  emit_int32( op(arith_op) | fd(d, w) | op3(fpop1_op3) | opf(0x00 + w) | fs2(s, w)); }
 
-  void fneg( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) { v8_s_only(w);  emit_long( op(arith_op) | fd(d, w) | op3(fpop1_op3) | opf(0x04 + w) | fs2(s, w)); }
+  void fneg( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) { v8_s_only(w);  emit_int32( op(arith_op) | fd(d, w) | op3(fpop1_op3) | opf(0x04 + w) | fs2(s, w)); }
 
   // page 144 sparc v8 architecture (double prec works on v8 if the source and destination registers are the same). fnegs is the only instruction available
   // on v8 to do negation of single, double and quad precision floats.
 
-  void fneg( FloatRegisterImpl::Width w, FloatRegister sd ) { if (VM_Version::v9_instructions_work()) emit_long( op(arith_op) | fd(sd, w) | op3(fpop1_op3) | opf(0x04 + w) | fs2(sd, w)); else emit_long( op(arith_op) | fd(sd, w) | op3(fpop1_op3) |  opf(0x05) | fs2(sd, w)); }
+  void fneg( FloatRegisterImpl::Width w, FloatRegister sd ) { if (VM_Version::v9_instructions_work()) emit_int32( op(arith_op) | fd(sd, w) | op3(fpop1_op3) | opf(0x04 + w) | fs2(sd, w)); else emit_int32( op(arith_op) | fd(sd, w) | op3(fpop1_op3) |  opf(0x05) | fs2(sd, w)); }
 
-  void fabs( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) { v8_s_only(w);  emit_long( op(arith_op) | fd(d, w) | op3(fpop1_op3) | opf(0x08 + w) | fs2(s, w)); }
+  void fabs( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) { v8_s_only(w);  emit_int32( op(arith_op) | fd(d, w) | op3(fpop1_op3) | opf(0x08 + w) | fs2(s, w)); }
 
   // page 144 sparc v8 architecture (double prec works on v8 if the source and destination registers are the same). fabss is the only instruction available
   // on v8 to do abs operation on single/double/quad precision floats.
 
-  void fabs( FloatRegisterImpl::Width w, FloatRegister sd ) { if (VM_Version::v9_instructions_work()) emit_long( op(arith_op) | fd(sd, w) | op3(fpop1_op3) | opf(0x08 + w) | fs2(sd, w)); else emit_long( op(arith_op) | fd(sd, w) | op3(fpop1_op3) | opf(0x09) | fs2(sd, w)); }
+  void fabs( FloatRegisterImpl::Width w, FloatRegister sd ) { if (VM_Version::v9_instructions_work()) emit_int32( op(arith_op) | fd(sd, w) | op3(fpop1_op3) | opf(0x08 + w) | fs2(sd, w)); else emit_int32( op(arith_op) | fd(sd, w) | op3(fpop1_op3) | opf(0x09) | fs2(sd, w)); }
 
   // pp 163
 
-  void fmul( FloatRegisterImpl::Width w,                            FloatRegister s1, FloatRegister s2, FloatRegister d ) { emit_long( op(arith_op) | fd(d, w)  | op3(fpop1_op3) | fs1(s1, w)  | opf(0x48 + w)         | fs2(s2, w)); }
-  void fmul( FloatRegisterImpl::Width sw, FloatRegisterImpl::Width dw,  FloatRegister s1, FloatRegister s2, FloatRegister d ) { emit_long( op(arith_op) | fd(d, dw) | op3(fpop1_op3) | fs1(s1, sw) | opf(0x60 + sw + dw*4) | fs2(s2, sw)); }
-  void fdiv( FloatRegisterImpl::Width w,                            FloatRegister s1, FloatRegister s2, FloatRegister d ) { emit_long( op(arith_op) | fd(d, w)  | op3(fpop1_op3) | fs1(s1, w)  | opf(0x4c + w)         | fs2(s2, w)); }
+  void fmul( FloatRegisterImpl::Width w,                            FloatRegister s1, FloatRegister s2, FloatRegister d ) { emit_int32( op(arith_op) | fd(d, w)  | op3(fpop1_op3) | fs1(s1, w)  | opf(0x48 + w)         | fs2(s2, w)); }
+  void fmul( FloatRegisterImpl::Width sw, FloatRegisterImpl::Width dw,  FloatRegister s1, FloatRegister s2, FloatRegister d ) { emit_int32( op(arith_op) | fd(d, dw) | op3(fpop1_op3) | fs1(s1, sw) | opf(0x60 + sw + dw*4) | fs2(s2, sw)); }
+  void fdiv( FloatRegisterImpl::Width w,                            FloatRegister s1, FloatRegister s2, FloatRegister d ) { emit_int32( op(arith_op) | fd(d, w)  | op3(fpop1_op3) | fs1(s1, w)  | opf(0x4c + w)         | fs2(s2, w)); }
 
   // pp 164
 
-  void fsqrt( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) { emit_long( op(arith_op) | fd(d, w) | op3(fpop1_op3) | opf(0x28 + w) | fs2(s, w)); }
+  void fsqrt( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) { emit_int32( op(arith_op) | fd(d, w) | op3(fpop1_op3) | opf(0x28 + w) | fs2(s, w)); }
 
   // pp 165
 
@@ -827,22 +827,22 @@
 
   // pp 167
 
-  void flushw() { v9_only();  emit_long( op(arith_op) | op3(flushw_op3) ); }
+  void flushw() { v9_only();  emit_int32( op(arith_op) | op3(flushw_op3) ); }
 
   // pp 168
 
-  void illtrap( int const22a) { if (const22a != 0) v9_only();  emit_long( op(branch_op) | u_field(const22a, 21, 0) ); }
+  void illtrap( int const22a) { if (const22a != 0) v9_only();  emit_int32( op(branch_op) | u_field(const22a, 21, 0) ); }
   // v8 unimp == illtrap(0)
 
   // pp 169
 
-  void impdep1( int id1, int const19a ) { v9_only();  emit_long( op(arith_op) | fcn(id1) | op3(impdep1_op3) | u_field(const19a, 18, 0)); }
-  void impdep2( int id1, int const19a ) { v9_only();  emit_long( op(arith_op) | fcn(id1) | op3(impdep2_op3) | u_field(const19a, 18, 0)); }
+  void impdep1( int id1, int const19a ) { v9_only();  emit_int32( op(arith_op) | fcn(id1) | op3(impdep1_op3) | u_field(const19a, 18, 0)); }
+  void impdep2( int id1, int const19a ) { v9_only();  emit_int32( op(arith_op) | fcn(id1) | op3(impdep2_op3) | u_field(const19a, 18, 0)); }
 
   // pp 149 (v8)
 
-  void cpop1( int opc, int cr1, int cr2, int crd ) { v8_only();  emit_long( op(arith_op) | fcn(crd) | op3(impdep1_op3) | u_field(cr1, 18, 14) | opf(opc) | u_field(cr2, 4, 0)); }
-  void cpop2( int opc, int cr1, int cr2, int crd ) { v8_only();  emit_long( op(arith_op) | fcn(crd) | op3(impdep2_op3) | u_field(cr1, 18, 14) | opf(opc) | u_field(cr2, 4, 0)); }
+  void cpop1( int opc, int cr1, int cr2, int crd ) { v8_only();  emit_int32( op(arith_op) | fcn(crd) | op3(impdep1_op3) | u_field(cr1, 18, 14) | opf(opc) | u_field(cr2, 4, 0)); }
+  void cpop2( int opc, int cr1, int cr2, int crd ) { v8_only();  emit_int32( op(arith_op) | fcn(crd) | op3(impdep2_op3) | u_field(cr1, 18, 14) | opf(opc) | u_field(cr2, 4, 0)); }
 
   // pp 170
 
@@ -872,8 +872,8 @@
 
   // 173
 
-  void ldfa(  FloatRegisterImpl::Width w, Register s1, Register s2, int ia, FloatRegister d ) { v9_only();  emit_long( op(ldst_op) | fd(d, w) | alt_op3(ldf_op3 | alt_bit_op3, w) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void ldfa(  FloatRegisterImpl::Width w, Register s1, int simm13a,         FloatRegister d ) { v9_only();  emit_long( op(ldst_op) | fd(d, w) | alt_op3(ldf_op3 | alt_bit_op3, w) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void ldfa(  FloatRegisterImpl::Width w, Register s1, Register s2, int ia, FloatRegister d ) { v9_only();  emit_int32( op(ldst_op) | fd(d, w) | alt_op3(ldf_op3 | alt_bit_op3, w) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void ldfa(  FloatRegisterImpl::Width w, Register s1, int simm13a,         FloatRegister d ) { v9_only();  emit_int32( op(ldst_op) | fd(d, w) | alt_op3(ldf_op3 | alt_bit_op3, w) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 175, lduw is ld on v8
 
@@ -896,22 +896,22 @@
 
   // pp 177
 
-  void ldsba(  Register s1, Register s2, int ia, Register d ) {             emit_long( op(ldst_op) | rd(d) | op3(ldsb_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void ldsba(  Register s1, int simm13a,         Register d ) {             emit_long( op(ldst_op) | rd(d) | op3(ldsb_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void ldsha(  Register s1, Register s2, int ia, Register d ) {             emit_long( op(ldst_op) | rd(d) | op3(ldsh_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void ldsha(  Register s1, int simm13a,         Register d ) {             emit_long( op(ldst_op) | rd(d) | op3(ldsh_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void ldswa(  Register s1, Register s2, int ia, Register d ) { v9_only();  emit_long( op(ldst_op) | rd(d) | op3(ldsw_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void ldswa(  Register s1, int simm13a,         Register d ) { v9_only();  emit_long( op(ldst_op) | rd(d) | op3(ldsw_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void lduba(  Register s1, Register s2, int ia, Register d ) {             emit_long( op(ldst_op) | rd(d) | op3(ldub_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void lduba(  Register s1, int simm13a,         Register d ) {             emit_long( op(ldst_op) | rd(d) | op3(ldub_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void lduha(  Register s1, Register s2, int ia, Register d ) {             emit_long( op(ldst_op) | rd(d) | op3(lduh_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void lduha(  Register s1, int simm13a,         Register d ) {             emit_long( op(ldst_op) | rd(d) | op3(lduh_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void lduwa(  Register s1, Register s2, int ia, Register d ) {             emit_long( op(ldst_op) | rd(d) | op3(lduw_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void lduwa(  Register s1, int simm13a,         Register d ) {             emit_long( op(ldst_op) | rd(d) | op3(lduw_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void ldxa(   Register s1, Register s2, int ia, Register d ) { v9_only();  emit_long( op(ldst_op) | rd(d) | op3(ldx_op3  | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void ldxa(   Register s1, int simm13a,         Register d ) { v9_only();  emit_long( op(ldst_op) | rd(d) | op3(ldx_op3  | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void ldda(   Register s1, Register s2, int ia, Register d ) { v9_dep();   emit_long( op(ldst_op) | rd(d) | op3(ldd_op3  | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void ldda(   Register s1, int simm13a,         Register d ) { v9_dep();   emit_long( op(ldst_op) | rd(d) | op3(ldd_op3  | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void ldsba(  Register s1, Register s2, int ia, Register d ) {             emit_int32( op(ldst_op) | rd(d) | op3(ldsb_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void ldsba(  Register s1, int simm13a,         Register d ) {             emit_int32( op(ldst_op) | rd(d) | op3(ldsb_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void ldsha(  Register s1, Register s2, int ia, Register d ) {             emit_int32( op(ldst_op) | rd(d) | op3(ldsh_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void ldsha(  Register s1, int simm13a,         Register d ) {             emit_int32( op(ldst_op) | rd(d) | op3(ldsh_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void ldswa(  Register s1, Register s2, int ia, Register d ) { v9_only();  emit_int32( op(ldst_op) | rd(d) | op3(ldsw_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void ldswa(  Register s1, int simm13a,         Register d ) { v9_only();  emit_int32( op(ldst_op) | rd(d) | op3(ldsw_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void lduba(  Register s1, Register s2, int ia, Register d ) {             emit_int32( op(ldst_op) | rd(d) | op3(ldub_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void lduba(  Register s1, int simm13a,         Register d ) {             emit_int32( op(ldst_op) | rd(d) | op3(ldub_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void lduha(  Register s1, Register s2, int ia, Register d ) {             emit_int32( op(ldst_op) | rd(d) | op3(lduh_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void lduha(  Register s1, int simm13a,         Register d ) {             emit_int32( op(ldst_op) | rd(d) | op3(lduh_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void lduwa(  Register s1, Register s2, int ia, Register d ) {             emit_int32( op(ldst_op) | rd(d) | op3(lduw_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void lduwa(  Register s1, int simm13a,         Register d ) {             emit_int32( op(ldst_op) | rd(d) | op3(lduw_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void ldxa(   Register s1, Register s2, int ia, Register d ) { v9_only();  emit_int32( op(ldst_op) | rd(d) | op3(ldx_op3  | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void ldxa(   Register s1, int simm13a,         Register d ) { v9_only();  emit_int32( op(ldst_op) | rd(d) | op3(ldx_op3  | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void ldda(   Register s1, Register s2, int ia, Register d ) { v9_dep();   emit_int32( op(ldst_op) | rd(d) | op3(ldd_op3  | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void ldda(   Register s1, int simm13a,         Register d ) { v9_dep();   emit_int32( op(ldst_op) | rd(d) | op3(ldd_op3  | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 179
 
@@ -920,111 +920,111 @@
 
   // pp 180
 
-  void ldstuba( Register s1, Register s2, int ia, Register d ) { emit_long( op(ldst_op) | rd(d) | op3(ldstub_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void ldstuba( Register s1, int simm13a,         Register d ) { emit_long( op(ldst_op) | rd(d) | op3(ldstub_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void ldstuba( Register s1, Register s2, int ia, Register d ) { emit_int32( op(ldst_op) | rd(d) | op3(ldstub_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void ldstuba( Register s1, int simm13a,         Register d ) { emit_int32( op(ldst_op) | rd(d) | op3(ldstub_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 181
 
-  void and3(    Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(and_op3              ) | rs1(s1) | rs2(s2) ); }
-  void and3(    Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(and_op3              ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void andcc(   Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(and_op3  | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
-  void andcc(   Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(and_op3  | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void andn(    Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(andn_op3             ) | rs1(s1) | rs2(s2) ); }
-  void andn(    Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(andn_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void andncc(  Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(andn_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
-  void andncc(  Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(andn_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void or3(     Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(or_op3               ) | rs1(s1) | rs2(s2) ); }
-  void or3(     Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(or_op3               ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void orcc(    Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(or_op3   | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
-  void orcc(    Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(or_op3   | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void orn(     Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(orn_op3) | rs1(s1) | rs2(s2) ); }
-  void orn(     Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(orn_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void orncc(   Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(orn_op3  | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
-  void orncc(   Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(orn_op3  | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void xor3(    Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(xor_op3              ) | rs1(s1) | rs2(s2) ); }
-  void xor3(    Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(xor_op3              ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void xorcc(   Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(xor_op3  | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
-  void xorcc(   Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(xor_op3  | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void xnor(    Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(xnor_op3             ) | rs1(s1) | rs2(s2) ); }
-  void xnor(    Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(xnor_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void xnorcc(  Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(xnor_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
-  void xnorcc(  Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(xnor_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void and3(    Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(and_op3              ) | rs1(s1) | rs2(s2) ); }
+  void and3(    Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(and_op3              ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void andcc(   Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(and_op3  | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
+  void andcc(   Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(and_op3  | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void andn(    Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(andn_op3             ) | rs1(s1) | rs2(s2) ); }
+  void andn(    Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(andn_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void andncc(  Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(andn_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
+  void andncc(  Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(andn_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void or3(     Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(or_op3               ) | rs1(s1) | rs2(s2) ); }
+  void or3(     Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(or_op3               ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void orcc(    Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(or_op3   | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
+  void orcc(    Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(or_op3   | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void orn(     Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(orn_op3) | rs1(s1) | rs2(s2) ); }
+  void orn(     Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(orn_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void orncc(   Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(orn_op3  | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
+  void orncc(   Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(orn_op3  | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void xor3(    Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(xor_op3              ) | rs1(s1) | rs2(s2) ); }
+  void xor3(    Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(xor_op3              ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void xorcc(   Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(xor_op3  | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
+  void xorcc(   Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(xor_op3  | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void xnor(    Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(xnor_op3             ) | rs1(s1) | rs2(s2) ); }
+  void xnor(    Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(xnor_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void xnorcc(  Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(xnor_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
+  void xnorcc(  Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(xnor_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 183
 
-  void membar( Membar_mask_bits const7a ) { v9_only(); emit_long( op(arith_op) | op3(membar_op3) | rs1(O7) | immed(true) | u_field( int(const7a), 6, 0)); }
+  void membar( Membar_mask_bits const7a ) { v9_only(); emit_int32( op(arith_op) | op3(membar_op3) | rs1(O7) | immed(true) | u_field( int(const7a), 6, 0)); }
 
   // pp 185
 
-  void fmov( FloatRegisterImpl::Width w, Condition c,  bool floatCC, CC cca, FloatRegister s2, FloatRegister d ) { v9_only();  emit_long( op(arith_op) | fd(d, w) | op3(fpop2_op3) | cond_mov(c) | opf_cc(cca, floatCC) | opf_low6(w) | fs2(s2, w)); }
+  void fmov( FloatRegisterImpl::Width w, Condition c,  bool floatCC, CC cca, FloatRegister s2, FloatRegister d ) { v9_only();  emit_int32( op(arith_op) | fd(d, w) | op3(fpop2_op3) | cond_mov(c) | opf_cc(cca, floatCC) | opf_low6(w) | fs2(s2, w)); }
 
   // pp 189
 
-  void fmov( FloatRegisterImpl::Width w, RCondition c, Register s1,  FloatRegister s2, FloatRegister d ) { v9_only();  emit_long( op(arith_op) | fd(d, w) | op3(fpop2_op3) | rs1(s1) | rcond(c) | opf_low5(4 + w) | fs2(s2, w)); }
+  void fmov( FloatRegisterImpl::Width w, RCondition c, Register s1,  FloatRegister s2, FloatRegister d ) { v9_only();  emit_int32( op(arith_op) | fd(d, w) | op3(fpop2_op3) | rs1(s1) | rcond(c) | opf_low5(4 + w) | fs2(s2, w)); }
 
   // pp 191
 
-  void movcc( Condition c, bool floatCC, CC cca, Register s2, Register d ) { v9_only();  emit_long( op(arith_op) | rd(d) | op3(movcc_op3) | mov_cc(cca, floatCC) | cond_mov(c) | rs2(s2) ); }
-  void movcc( Condition c, bool floatCC, CC cca, int simm11a, Register d ) { v9_only();  emit_long( op(arith_op) | rd(d) | op3(movcc_op3) | mov_cc(cca, floatCC) | cond_mov(c) | immed(true) | simm(simm11a, 11) ); }
+  void movcc( Condition c, bool floatCC, CC cca, Register s2, Register d ) { v9_only();  emit_int32( op(arith_op) | rd(d) | op3(movcc_op3) | mov_cc(cca, floatCC) | cond_mov(c) | rs2(s2) ); }
+  void movcc( Condition c, bool floatCC, CC cca, int simm11a, Register d ) { v9_only();  emit_int32( op(arith_op) | rd(d) | op3(movcc_op3) | mov_cc(cca, floatCC) | cond_mov(c) | immed(true) | simm(simm11a, 11) ); }
 
   // pp 195
 
-  void movr( RCondition c, Register s1, Register s2,  Register d ) { v9_only();  emit_long( op(arith_op) | rd(d) | op3(movr_op3) | rs1(s1) | rcond(c) | rs2(s2) ); }
-  void movr( RCondition c, Register s1, int simm10a,  Register d ) { v9_only();  emit_long( op(arith_op) | rd(d) | op3(movr_op3) | rs1(s1) | rcond(c) | immed(true) | simm(simm10a, 10) ); }
+  void movr( RCondition c, Register s1, Register s2,  Register d ) { v9_only();  emit_int32( op(arith_op) | rd(d) | op3(movr_op3) | rs1(s1) | rcond(c) | rs2(s2) ); }
+  void movr( RCondition c, Register s1, int simm10a,  Register d ) { v9_only();  emit_int32( op(arith_op) | rd(d) | op3(movr_op3) | rs1(s1) | rcond(c) | immed(true) | simm(simm10a, 10) ); }
 
   // pp 196
 
-  void mulx(  Register s1, Register s2, Register d ) { v9_only(); emit_long( op(arith_op) | rd(d) | op3(mulx_op3 ) | rs1(s1) | rs2(s2) ); }
-  void mulx(  Register s1, int simm13a, Register d ) { v9_only(); emit_long( op(arith_op) | rd(d) | op3(mulx_op3 ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void sdivx( Register s1, Register s2, Register d ) { v9_only(); emit_long( op(arith_op) | rd(d) | op3(sdivx_op3) | rs1(s1) | rs2(s2) ); }
-  void sdivx( Register s1, int simm13a, Register d ) { v9_only(); emit_long( op(arith_op) | rd(d) | op3(sdivx_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void udivx( Register s1, Register s2, Register d ) { v9_only(); emit_long( op(arith_op) | rd(d) | op3(udivx_op3) | rs1(s1) | rs2(s2) ); }
-  void udivx( Register s1, int simm13a, Register d ) { v9_only(); emit_long( op(arith_op) | rd(d) | op3(udivx_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void mulx(  Register s1, Register s2, Register d ) { v9_only(); emit_int32( op(arith_op) | rd(d) | op3(mulx_op3 ) | rs1(s1) | rs2(s2) ); }
+  void mulx(  Register s1, int simm13a, Register d ) { v9_only(); emit_int32( op(arith_op) | rd(d) | op3(mulx_op3 ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void sdivx( Register s1, Register s2, Register d ) { v9_only(); emit_int32( op(arith_op) | rd(d) | op3(sdivx_op3) | rs1(s1) | rs2(s2) ); }
+  void sdivx( Register s1, int simm13a, Register d ) { v9_only(); emit_int32( op(arith_op) | rd(d) | op3(sdivx_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void udivx( Register s1, Register s2, Register d ) { v9_only(); emit_int32( op(arith_op) | rd(d) | op3(udivx_op3) | rs1(s1) | rs2(s2) ); }
+  void udivx( Register s1, int simm13a, Register d ) { v9_only(); emit_int32( op(arith_op) | rd(d) | op3(udivx_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 197
 
-  void umul(   Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(umul_op3             ) | rs1(s1) | rs2(s2) ); }
-  void umul(   Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(umul_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void smul(   Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(smul_op3             ) | rs1(s1) | rs2(s2) ); }
-  void smul(   Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(smul_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void umulcc( Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(umul_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
-  void umulcc( Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(umul_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void smulcc( Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(smul_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
-  void smulcc( Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(smul_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void umul(   Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(umul_op3             ) | rs1(s1) | rs2(s2) ); }
+  void umul(   Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(umul_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void smul(   Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(smul_op3             ) | rs1(s1) | rs2(s2) ); }
+  void smul(   Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(smul_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void umulcc( Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(umul_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
+  void umulcc( Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(umul_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void smulcc( Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(smul_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
+  void smulcc( Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(smul_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 199
 
-  void mulscc(   Register s1, Register s2, Register d ) { v9_dep();  emit_long( op(arith_op) | rd(d) | op3(mulscc_op3) | rs1(s1) | rs2(s2) ); }
-  void mulscc(   Register s1, int simm13a, Register d ) { v9_dep();  emit_long( op(arith_op) | rd(d) | op3(mulscc_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void mulscc(   Register s1, Register s2, Register d ) { v9_dep();  emit_int32( op(arith_op) | rd(d) | op3(mulscc_op3) | rs1(s1) | rs2(s2) ); }
+  void mulscc(   Register s1, int simm13a, Register d ) { v9_dep();  emit_int32( op(arith_op) | rd(d) | op3(mulscc_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 201
 
-  void nop() { emit_long( op(branch_op) | op2(sethi_op2) ); }
+  void nop() { emit_int32( op(branch_op) | op2(sethi_op2) ); }
 
 
   // pp 202
 
-  void popc( Register s,  Register d) { v9_only();  emit_long( op(arith_op) | rd(d) | op3(popc_op3) | rs2(s)); }
-  void popc( int simm13a, Register d) { v9_only();  emit_long( op(arith_op) | rd(d) | op3(popc_op3) | immed(true) | simm(simm13a, 13)); }
+  void popc( Register s,  Register d) { v9_only();  emit_int32( op(arith_op) | rd(d) | op3(popc_op3) | rs2(s)); }
+  void popc( int simm13a, Register d) { v9_only();  emit_int32( op(arith_op) | rd(d) | op3(popc_op3) | immed(true) | simm(simm13a, 13)); }
 
   // pp 203
 
-  void prefetch(   Register s1, Register s2, PrefetchFcn f) { v9_only();  emit_long( op(ldst_op) | fcn(f) | op3(prefetch_op3) | rs1(s1) | rs2(s2) ); }
+  void prefetch(   Register s1, Register s2, PrefetchFcn f) { v9_only();  emit_int32( op(ldst_op) | fcn(f) | op3(prefetch_op3) | rs1(s1) | rs2(s2) ); }
   void prefetch(   Register s1, int simm13a, PrefetchFcn f) { v9_only();  emit_data( op(ldst_op) | fcn(f) | op3(prefetch_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
-  void prefetcha(  Register s1, Register s2, int ia, PrefetchFcn f ) { v9_only();  emit_long( op(ldst_op) | fcn(f) | op3(prefetch_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void prefetcha(  Register s1, int simm13a,         PrefetchFcn f ) { v9_only();  emit_long( op(ldst_op) | fcn(f) | op3(prefetch_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void prefetcha(  Register s1, Register s2, int ia, PrefetchFcn f ) { v9_only();  emit_int32( op(ldst_op) | fcn(f) | op3(prefetch_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void prefetcha(  Register s1, int simm13a,         PrefetchFcn f ) { v9_only();  emit_int32( op(ldst_op) | fcn(f) | op3(prefetch_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 208
 
   // not implementing read privileged register
 
-  inline void rdy(    Register d) { v9_dep();  emit_long( op(arith_op) | rd(d) | op3(rdreg_op3) | u_field(0, 18, 14)); }
-  inline void rdccr(  Register d) { v9_only(); emit_long( op(arith_op) | rd(d) | op3(rdreg_op3) | u_field(2, 18, 14)); }
-  inline void rdasi(  Register d) { v9_only(); emit_long( op(arith_op) | rd(d) | op3(rdreg_op3) | u_field(3, 18, 14)); }
-  inline void rdtick( Register d) { v9_only(); emit_long( op(arith_op) | rd(d) | op3(rdreg_op3) | u_field(4, 18, 14)); } // Spoon!
-  inline void rdpc(   Register d) { v9_only(); emit_long( op(arith_op) | rd(d) | op3(rdreg_op3) | u_field(5, 18, 14)); }
-  inline void rdfprs( Register d) { v9_only(); emit_long( op(arith_op) | rd(d) | op3(rdreg_op3) | u_field(6, 18, 14)); }
+  inline void rdy(    Register d) { v9_dep();  emit_int32( op(arith_op) | rd(d) | op3(rdreg_op3) | u_field(0, 18, 14)); }
+  inline void rdccr(  Register d) { v9_only(); emit_int32( op(arith_op) | rd(d) | op3(rdreg_op3) | u_field(2, 18, 14)); }
+  inline void rdasi(  Register d) { v9_only(); emit_int32( op(arith_op) | rd(d) | op3(rdreg_op3) | u_field(3, 18, 14)); }
+  inline void rdtick( Register d) { v9_only(); emit_int32( op(arith_op) | rd(d) | op3(rdreg_op3) | u_field(4, 18, 14)); } // Spoon!
+  inline void rdpc(   Register d) { v9_only(); emit_int32( op(arith_op) | rd(d) | op3(rdreg_op3) | u_field(5, 18, 14)); }
+  inline void rdfprs( Register d) { v9_only(); emit_int32( op(arith_op) | rd(d) | op3(rdreg_op3) | u_field(6, 18, 14)); }
 
   // pp 213
 
@@ -1033,47 +1033,47 @@
 
   // pp 214
 
-  void save(    Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(save_op3) | rs1(s1) | rs2(s2) ); }
+  void save(    Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(save_op3) | rs1(s1) | rs2(s2) ); }
   void save(    Register s1, int simm13a, Register d ) {
     // make sure frame is at least large enough for the register save area
     assert(-simm13a >= 16 * wordSize, "frame too small");
-    emit_long( op(arith_op) | rd(d) | op3(save_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) );
+    emit_int32( op(arith_op) | rd(d) | op3(save_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) );
   }
 
-  void restore( Register s1 = G0,  Register s2 = G0, Register d = G0 ) { emit_long( op(arith_op) | rd(d) | op3(restore_op3) | rs1(s1) | rs2(s2) ); }
-  void restore( Register s1,       int simm13a,      Register d      ) { emit_long( op(arith_op) | rd(d) | op3(restore_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void restore( Register s1 = G0,  Register s2 = G0, Register d = G0 ) { emit_int32( op(arith_op) | rd(d) | op3(restore_op3) | rs1(s1) | rs2(s2) ); }
+  void restore( Register s1,       int simm13a,      Register d      ) { emit_int32( op(arith_op) | rd(d) | op3(restore_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 216
 
-  void saved()    { v9_only();  emit_long( op(arith_op) | fcn(0) | op3(saved_op3)); }
-  void restored() { v9_only();  emit_long( op(arith_op) | fcn(1) | op3(saved_op3)); }
+  void saved()    { v9_only();  emit_int32( op(arith_op) | fcn(0) | op3(saved_op3)); }
+  void restored() { v9_only();  emit_int32( op(arith_op) | fcn(1) | op3(saved_op3)); }
 
   // pp 217
 
   inline void sethi( int imm22a, Register d, RelocationHolder const& rspec = RelocationHolder() );
   // pp 218
 
-  void sll(  Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(sll_op3) | rs1(s1) | sx(0) | rs2(s2) ); }
-  void sll(  Register s1, int imm5a,   Register d ) { emit_long( op(arith_op) | rd(d) | op3(sll_op3) | rs1(s1) | sx(0) | immed(true) | u_field(imm5a, 4, 0) ); }
-  void srl(  Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(srl_op3) | rs1(s1) | sx(0) | rs2(s2) ); }
-  void srl(  Register s1, int imm5a,   Register d ) { emit_long( op(arith_op) | rd(d) | op3(srl_op3) | rs1(s1) | sx(0) | immed(true) | u_field(imm5a, 4, 0) ); }
-  void sra(  Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(sra_op3) | rs1(s1) | sx(0) | rs2(s2) ); }
-  void sra(  Register s1, int imm5a,   Register d ) { emit_long( op(arith_op) | rd(d) | op3(sra_op3) | rs1(s1) | sx(0) | immed(true) | u_field(imm5a, 4, 0) ); }
+  void sll(  Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(sll_op3) | rs1(s1) | sx(0) | rs2(s2) ); }
+  void sll(  Register s1, int imm5a,   Register d ) { emit_int32( op(arith_op) | rd(d) | op3(sll_op3) | rs1(s1) | sx(0) | immed(true) | u_field(imm5a, 4, 0) ); }
+  void srl(  Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(srl_op3) | rs1(s1) | sx(0) | rs2(s2) ); }
+  void srl(  Register s1, int imm5a,   Register d ) { emit_int32( op(arith_op) | rd(d) | op3(srl_op3) | rs1(s1) | sx(0) | immed(true) | u_field(imm5a, 4, 0) ); }
+  void sra(  Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(sra_op3) | rs1(s1) | sx(0) | rs2(s2) ); }
+  void sra(  Register s1, int imm5a,   Register d ) { emit_int32( op(arith_op) | rd(d) | op3(sra_op3) | rs1(s1) | sx(0) | immed(true) | u_field(imm5a, 4, 0) ); }
 
-  void sllx( Register s1, Register s2, Register d ) { v9_only();  emit_long( op(arith_op) | rd(d) | op3(sll_op3) | rs1(s1) | sx(1) | rs2(s2) ); }
-  void sllx( Register s1, int imm6a,   Register d ) { v9_only();  emit_long( op(arith_op) | rd(d) | op3(sll_op3) | rs1(s1) | sx(1) | immed(true) | u_field(imm6a, 5, 0) ); }
-  void srlx( Register s1, Register s2, Register d ) { v9_only();  emit_long( op(arith_op) | rd(d) | op3(srl_op3) | rs1(s1) | sx(1) | rs2(s2) ); }
-  void srlx( Register s1, int imm6a,   Register d ) { v9_only();  emit_long( op(arith_op) | rd(d) | op3(srl_op3) | rs1(s1) | sx(1) | immed(true) | u_field(imm6a, 5, 0) ); }
-  void srax( Register s1, Register s2, Register d ) { v9_only();  emit_long( op(arith_op) | rd(d) | op3(sra_op3) | rs1(s1) | sx(1) | rs2(s2) ); }
-  void srax( Register s1, int imm6a,   Register d ) { v9_only();  emit_long( op(arith_op) | rd(d) | op3(sra_op3) | rs1(s1) | sx(1) | immed(true) | u_field(imm6a, 5, 0) ); }
+  void sllx( Register s1, Register s2, Register d ) { v9_only();  emit_int32( op(arith_op) | rd(d) | op3(sll_op3) | rs1(s1) | sx(1) | rs2(s2) ); }
+  void sllx( Register s1, int imm6a,   Register d ) { v9_only();  emit_int32( op(arith_op) | rd(d) | op3(sll_op3) | rs1(s1) | sx(1) | immed(true) | u_field(imm6a, 5, 0) ); }
+  void srlx( Register s1, Register s2, Register d ) { v9_only();  emit_int32( op(arith_op) | rd(d) | op3(srl_op3) | rs1(s1) | sx(1) | rs2(s2) ); }
+  void srlx( Register s1, int imm6a,   Register d ) { v9_only();  emit_int32( op(arith_op) | rd(d) | op3(srl_op3) | rs1(s1) | sx(1) | immed(true) | u_field(imm6a, 5, 0) ); }
+  void srax( Register s1, Register s2, Register d ) { v9_only();  emit_int32( op(arith_op) | rd(d) | op3(sra_op3) | rs1(s1) | sx(1) | rs2(s2) ); }
+  void srax( Register s1, int imm6a,   Register d ) { v9_only();  emit_int32( op(arith_op) | rd(d) | op3(sra_op3) | rs1(s1) | sx(1) | immed(true) | u_field(imm6a, 5, 0) ); }
 
   // pp 220
 
-  void sir( int simm13a ) { emit_long( op(arith_op) | fcn(15) | op3(sir_op3) | immed(true) | simm(simm13a, 13)); }
+  void sir( int simm13a ) { emit_int32( op(arith_op) | fcn(15) | op3(sir_op3) | immed(true) | simm(simm13a, 13)); }
 
   // pp 221
 
-  void stbar() { emit_long( op(arith_op) | op3(membar_op3) | u_field(15, 18, 14)); }
+  void stbar() { emit_int32( op(arith_op) | op3(membar_op3) | u_field(15, 18, 14)); }
 
   // pp 222
 
@@ -1087,8 +1087,8 @@
 
   //  pp 224
 
-  void stfa(  FloatRegisterImpl::Width w, FloatRegister d, Register s1, Register s2, int ia ) { v9_only();  emit_long( op(ldst_op) | fd(d, w) | alt_op3(stf_op3 | alt_bit_op3, w) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void stfa(  FloatRegisterImpl::Width w, FloatRegister d, Register s1, int simm13a         ) { v9_only();  emit_long( op(ldst_op) | fd(d, w) | alt_op3(stf_op3 | alt_bit_op3, w) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void stfa(  FloatRegisterImpl::Width w, FloatRegister d, Register s1, Register s2, int ia ) { v9_only();  emit_int32( op(ldst_op) | fd(d, w) | alt_op3(stf_op3 | alt_bit_op3, w) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void stfa(  FloatRegisterImpl::Width w, FloatRegister d, Register s1, int simm13a         ) { v9_only();  emit_int32( op(ldst_op) | fd(d, w) | alt_op3(stf_op3 | alt_bit_op3, w) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // p 226
 
@@ -1105,16 +1105,16 @@
 
   // pp 177
 
-  void stba(  Register d, Register s1, Register s2, int ia ) {             emit_long( op(ldst_op) | rd(d) | op3(stb_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void stba(  Register d, Register s1, int simm13a         ) {             emit_long( op(ldst_op) | rd(d) | op3(stb_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void stha(  Register d, Register s1, Register s2, int ia ) {             emit_long( op(ldst_op) | rd(d) | op3(sth_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void stha(  Register d, Register s1, int simm13a         ) {             emit_long( op(ldst_op) | rd(d) | op3(sth_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void stwa(  Register d, Register s1, Register s2, int ia ) {             emit_long( op(ldst_op) | rd(d) | op3(stw_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void stwa(  Register d, Register s1, int simm13a         ) {             emit_long( op(ldst_op) | rd(d) | op3(stw_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void stxa(  Register d, Register s1, Register s2, int ia ) { v9_only();  emit_long( op(ldst_op) | rd(d) | op3(stx_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void stxa(  Register d, Register s1, int simm13a         ) { v9_only();  emit_long( op(ldst_op) | rd(d) | op3(stx_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void stda(  Register d, Register s1, Register s2, int ia ) {             emit_long( op(ldst_op) | rd(d) | op3(std_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void stda(  Register d, Register s1, int simm13a         ) {             emit_long( op(ldst_op) | rd(d) | op3(std_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void stba(  Register d, Register s1, Register s2, int ia ) {             emit_int32( op(ldst_op) | rd(d) | op3(stb_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void stba(  Register d, Register s1, int simm13a         ) {             emit_int32( op(ldst_op) | rd(d) | op3(stb_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void stha(  Register d, Register s1, Register s2, int ia ) {             emit_int32( op(ldst_op) | rd(d) | op3(sth_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void stha(  Register d, Register s1, int simm13a         ) {             emit_int32( op(ldst_op) | rd(d) | op3(sth_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void stwa(  Register d, Register s1, Register s2, int ia ) {             emit_int32( op(ldst_op) | rd(d) | op3(stw_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void stwa(  Register d, Register s1, int simm13a         ) {             emit_int32( op(ldst_op) | rd(d) | op3(stw_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void stxa(  Register d, Register s1, Register s2, int ia ) { v9_only();  emit_int32( op(ldst_op) | rd(d) | op3(stx_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void stxa(  Register d, Register s1, int simm13a         ) { v9_only();  emit_int32( op(ldst_op) | rd(d) | op3(stx_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void stda(  Register d, Register s1, Register s2, int ia ) {             emit_int32( op(ldst_op) | rd(d) | op3(std_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void stda(  Register d, Register s1, int simm13a         ) {             emit_int32( op(ldst_op) | rd(d) | op3(std_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 97 (v8)
 
@@ -1129,15 +1129,15 @@
 
   // pp 230
 
-  void sub(    Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(sub_op3              ) | rs1(s1) | rs2(s2) ); }
-  void sub(    Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(sub_op3              ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void sub(    Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(sub_op3              ) | rs1(s1) | rs2(s2) ); }
+  void sub(    Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(sub_op3              ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
-  void subcc(  Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(sub_op3 | cc_bit_op3 ) | rs1(s1) | rs2(s2) ); }
-  void subcc(  Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(sub_op3 | cc_bit_op3 ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void subc(   Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(subc_op3             ) | rs1(s1) | rs2(s2) ); }
-  void subc(   Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(subc_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void subccc( Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(subc_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
-  void subccc( Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(subc_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void subcc(  Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(sub_op3 | cc_bit_op3 ) | rs1(s1) | rs2(s2) ); }
+  void subcc(  Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(sub_op3 | cc_bit_op3 ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void subc(   Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(subc_op3             ) | rs1(s1) | rs2(s2) ); }
+  void subc(   Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(subc_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void subccc( Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(subc_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
+  void subccc( Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(subc_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 231
 
@@ -1146,55 +1146,55 @@
 
   // pp 232
 
-  void swapa(   Register s1, Register s2, int ia, Register d ) { v9_dep();  emit_long( op(ldst_op) | rd(d) | op3(swap_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void swapa(   Register s1, int simm13a,         Register d ) { v9_dep();  emit_long( op(ldst_op) | rd(d) | op3(swap_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void swapa(   Register s1, Register s2, int ia, Register d ) { v9_dep();  emit_int32( op(ldst_op) | rd(d) | op3(swap_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void swapa(   Register s1, int simm13a,         Register d ) { v9_dep();  emit_int32( op(ldst_op) | rd(d) | op3(swap_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 234, note op in book is wrong, see pp 268
 
-  void taddcc(    Register s1, Register s2, Register d ) {            emit_long( op(arith_op) | rd(d) | op3(taddcc_op3  ) | rs1(s1) | rs2(s2) ); }
-  void taddcc(    Register s1, int simm13a, Register d ) {            emit_long( op(arith_op) | rd(d) | op3(taddcc_op3  ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void taddcctv(  Register s1, Register s2, Register d ) { v9_dep();  emit_long( op(arith_op) | rd(d) | op3(taddcctv_op3) | rs1(s1) | rs2(s2) ); }
-  void taddcctv(  Register s1, int simm13a, Register d ) { v9_dep();  emit_long( op(arith_op) | rd(d) | op3(taddcctv_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void taddcc(    Register s1, Register s2, Register d ) {            emit_int32( op(arith_op) | rd(d) | op3(taddcc_op3  ) | rs1(s1) | rs2(s2) ); }
+  void taddcc(    Register s1, int simm13a, Register d ) {            emit_int32( op(arith_op) | rd(d) | op3(taddcc_op3  ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void taddcctv(  Register s1, Register s2, Register d ) { v9_dep();  emit_int32( op(arith_op) | rd(d) | op3(taddcctv_op3) | rs1(s1) | rs2(s2) ); }
+  void taddcctv(  Register s1, int simm13a, Register d ) { v9_dep();  emit_int32( op(arith_op) | rd(d) | op3(taddcctv_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 235
 
-  void tsubcc(    Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(tsubcc_op3  ) | rs1(s1) | rs2(s2) ); }
-  void tsubcc(    Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(tsubcc_op3  ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void tsubcctv(  Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(tsubcctv_op3) | rs1(s1) | rs2(s2) ); }
-  void tsubcctv(  Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(tsubcctv_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void tsubcc(    Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(tsubcc_op3  ) | rs1(s1) | rs2(s2) ); }
+  void tsubcc(    Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(tsubcc_op3  ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void tsubcctv(  Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(tsubcctv_op3) | rs1(s1) | rs2(s2) ); }
+  void tsubcctv(  Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(tsubcctv_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 237
 
-  void trap( Condition c, CC cc, Register s1, Register s2 ) { v8_no_cc(cc);  emit_long( op(arith_op) | cond(c) | op3(trap_op3) | rs1(s1) | trapcc(cc) | rs2(s2)); }
-  void trap( Condition c, CC cc, Register s1, int trapa   ) { v8_no_cc(cc);  emit_long( op(arith_op) | cond(c) | op3(trap_op3) | rs1(s1) | trapcc(cc) | immed(true) | u_field(trapa, 6, 0)); }
+  void trap( Condition c, CC cc, Register s1, Register s2 ) { v8_no_cc(cc);  emit_int32( op(arith_op) | cond(c) | op3(trap_op3) | rs1(s1) | trapcc(cc) | rs2(s2)); }
+  void trap( Condition c, CC cc, Register s1, int trapa   ) { v8_no_cc(cc);  emit_int32( op(arith_op) | cond(c) | op3(trap_op3) | rs1(s1) | trapcc(cc) | immed(true) | u_field(trapa, 6, 0)); }
   // simple uncond. trap
   void trap( int trapa ) { trap( always, icc, G0, trapa ); }
 
   // pp 239 omit write priv register for now
 
-  inline void wry(    Register d) { v9_dep();  emit_long( op(arith_op) | rs1(d) | op3(wrreg_op3) | u_field(0, 29, 25)); }
-  inline void wrccr(Register s) { v9_only(); emit_long( op(arith_op) | rs1(s) | op3(wrreg_op3) | u_field(2, 29, 25)); }
-  inline void wrccr(Register s, int simm13a) { v9_only(); emit_long( op(arith_op) |
+  inline void wry(    Register d) { v9_dep();  emit_int32( op(arith_op) | rs1(d) | op3(wrreg_op3) | u_field(0, 29, 25)); }
+  inline void wrccr(Register s) { v9_only(); emit_int32( op(arith_op) | rs1(s) | op3(wrreg_op3) | u_field(2, 29, 25)); }
+  inline void wrccr(Register s, int simm13a) { v9_only(); emit_int32( op(arith_op) |
                                                                            rs1(s) |
                                                                            op3(wrreg_op3) |
                                                                            u_field(2, 29, 25) |
                                                                            immed(true) |
                                                                            simm(simm13a, 13)); }
-  inline void wrasi(Register d) { v9_only(); emit_long( op(arith_op) | rs1(d) | op3(wrreg_op3) | u_field(3, 29, 25)); }
+  inline void wrasi(Register d) { v9_only(); emit_int32( op(arith_op) | rs1(d) | op3(wrreg_op3) | u_field(3, 29, 25)); }
   // wrasi(d, imm) stores (d xor imm) to asi
-  inline void wrasi(Register d, int simm13a) { v9_only(); emit_long( op(arith_op) | rs1(d) | op3(wrreg_op3) |
+  inline void wrasi(Register d, int simm13a) { v9_only(); emit_int32( op(arith_op) | rs1(d) | op3(wrreg_op3) |
                                                u_field(3, 29, 25) | immed(true) | simm(simm13a, 13)); }
-  inline void wrfprs( Register d) { v9_only(); emit_long( op(arith_op) | rs1(d) | op3(wrreg_op3) | u_field(6, 29, 25)); }
+  inline void wrfprs( Register d) { v9_only(); emit_int32( op(arith_op) | rs1(d) | op3(wrreg_op3) | u_field(6, 29, 25)); }
 
 
   // VIS3 instructions
 
-  void movstosw( FloatRegister s, Register d ) { vis3_only();  emit_long( op(arith_op) | rd(d) | op3(mftoi_op3) | opf(mstosw_opf) | fs2(s, FloatRegisterImpl::S)); }
-  void movstouw( FloatRegister s, Register d ) { vis3_only();  emit_long( op(arith_op) | rd(d) | op3(mftoi_op3) | opf(mstouw_opf) | fs2(s, FloatRegisterImpl::S)); }
-  void movdtox(  FloatRegister s, Register d ) { vis3_only();  emit_long( op(arith_op) | rd(d) | op3(mftoi_op3) | opf(mdtox_opf) | fs2(s, FloatRegisterImpl::D)); }
+  void movstosw( FloatRegister s, Register d ) { vis3_only();  emit_int32( op(arith_op) | rd(d) | op3(mftoi_op3) | opf(mstosw_opf) | fs2(s, FloatRegisterImpl::S)); }
+  void movstouw( FloatRegister s, Register d ) { vis3_only();  emit_int32( op(arith_op) | rd(d) | op3(mftoi_op3) | opf(mstouw_opf) | fs2(s, FloatRegisterImpl::S)); }
+  void movdtox(  FloatRegister s, Register d ) { vis3_only();  emit_int32( op(arith_op) | rd(d) | op3(mftoi_op3) | opf(mdtox_opf) | fs2(s, FloatRegisterImpl::D)); }
 
-  void movwtos( Register s, FloatRegister d ) { vis3_only();  emit_long( op(arith_op) | fd(d, FloatRegisterImpl::S) | op3(mftoi_op3) | opf(mwtos_opf) | rs2(s)); }
-  void movxtod( Register s, FloatRegister d ) { vis3_only();  emit_long( op(arith_op) | fd(d, FloatRegisterImpl::D) | op3(mftoi_op3) | opf(mxtod_opf) | rs2(s)); }
+  void movwtos( Register s, FloatRegister d ) { vis3_only();  emit_int32( op(arith_op) | fd(d, FloatRegisterImpl::S) | op3(mftoi_op3) | opf(mwtos_opf) | rs2(s)); }
+  void movxtod( Register s, FloatRegister d ) { vis3_only();  emit_int32( op(arith_op) | fd(d, FloatRegisterImpl::D) | op3(mftoi_op3) | opf(mxtod_opf) | rs2(s)); }
 
   // Creation
   Assembler(CodeBuffer* code) : AbstractAssembler(code) {
--- a/hotspot/src/cpu/sparc/vm/assembler_sparc.inline.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/cpu/sparc/vm/assembler_sparc.inline.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -35,24 +35,24 @@
 # endif
 }
 
-inline void Assembler::emit_long(int x) {
+inline void Assembler::emit_int32(int x) {
   check_delay();
-  AbstractAssembler::emit_long(x);
+  AbstractAssembler::emit_int32(x);
 }
 
 inline void Assembler::emit_data(int x, relocInfo::relocType rtype) {
   relocate(rtype);
-  emit_long(x);
+  emit_int32(x);
 }
 
 inline void Assembler::emit_data(int x, RelocationHolder const& rspec) {
   relocate(rspec);
-  emit_long(x);
+  emit_int32(x);
 }
 
 
-inline void Assembler::add(Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(add_op3) | rs1(s1) | rs2(s2) ); }
-inline void Assembler::add(Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(add_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+inline void Assembler::add(Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(add_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::add(Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(add_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
 inline void Assembler::bpr( RCondition c, bool a, Predict p, Register s1, address d, relocInfo::relocType rt ) { v9_only();  cti();  emit_data( op(branch_op) | annul(a) | cond(c) | op2(bpr_op2) | wdisp16(intptr_t(d), intptr_t(pc())) | predict(p) | rs1(s1), rt);  has_delay_slot(); }
 inline void Assembler::bpr( RCondition c, bool a, Predict p, Register s1, Label& L) { bpr( c, a, p, s1, target(L)); }
@@ -79,93 +79,93 @@
 inline void Assembler::call( address d,  relocInfo::relocType rt ) { cti();  emit_data( op(call_op) | wdisp(intptr_t(d), intptr_t(pc()), 30), rt);  has_delay_slot(); assert(rt != relocInfo::virtual_call_type, "must use virtual_call_Relocation::spec"); }
 inline void Assembler::call( Label& L,   relocInfo::relocType rt ) { call( target(L), rt); }
 
-inline void Assembler::flush( Register s1, Register s2) { emit_long( op(arith_op) | op3(flush_op3) | rs1(s1) | rs2(s2)); }
+inline void Assembler::flush( Register s1, Register s2) { emit_int32( op(arith_op) | op3(flush_op3) | rs1(s1) | rs2(s2)); }
 inline void Assembler::flush( Register s1, int simm13a) { emit_data( op(arith_op) | op3(flush_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
-inline void Assembler::jmpl( Register s1, Register s2, Register d ) { cti();  emit_long( op(arith_op) | rd(d) | op3(jmpl_op3) | rs1(s1) | rs2(s2));  has_delay_slot(); }
+inline void Assembler::jmpl( Register s1, Register s2, Register d ) { cti();  emit_int32( op(arith_op) | rd(d) | op3(jmpl_op3) | rs1(s1) | rs2(s2));  has_delay_slot(); }
 inline void Assembler::jmpl( Register s1, int simm13a, Register d, RelocationHolder const& rspec ) { cti();  emit_data( op(arith_op) | rd(d) | op3(jmpl_op3) | rs1(s1) | immed(true) | simm(simm13a, 13), rspec);  has_delay_slot(); }
 
-inline void Assembler::ldf(FloatRegisterImpl::Width w, Register s1, Register s2, FloatRegister d) { emit_long( op(ldst_op) | fd(d, w) | alt_op3(ldf_op3, w) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::ldf(FloatRegisterImpl::Width w, Register s1, Register s2, FloatRegister d) { emit_int32( op(ldst_op) | fd(d, w) | alt_op3(ldf_op3, w) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::ldf(FloatRegisterImpl::Width w, Register s1, int simm13a, FloatRegister d, RelocationHolder const& rspec) { emit_data( op(ldst_op) | fd(d, w) | alt_op3(ldf_op3, w) | rs1(s1) | immed(true) | simm(simm13a, 13), rspec); }
 
-inline void Assembler::ldfsr(  Register s1, Register s2) { v9_dep();   emit_long( op(ldst_op) |             op3(ldfsr_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::ldfsr(  Register s1, Register s2) { v9_dep();   emit_int32( op(ldst_op) |             op3(ldfsr_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::ldfsr(  Register s1, int simm13a) { v9_dep();   emit_data( op(ldst_op) |             op3(ldfsr_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::ldxfsr( Register s1, Register s2) { v9_only();  emit_long( op(ldst_op) | rd(G1)    | op3(ldfsr_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::ldxfsr( Register s1, Register s2) { v9_only();  emit_int32( op(ldst_op) | rd(G1)    | op3(ldfsr_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::ldxfsr( Register s1, int simm13a) { v9_only();  emit_data( op(ldst_op) | rd(G1)    | op3(ldfsr_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
-inline void Assembler::ldc(   Register s1, Register s2, int crd) { v8_only();  emit_long( op(ldst_op) | fcn(crd) | op3(ldc_op3  ) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::ldc(   Register s1, Register s2, int crd) { v8_only();  emit_int32( op(ldst_op) | fcn(crd) | op3(ldc_op3  ) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::ldc(   Register s1, int simm13a, int crd) { v8_only();  emit_data( op(ldst_op) | fcn(crd) | op3(ldc_op3  ) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::lddc(  Register s1, Register s2, int crd) { v8_only();  emit_long( op(ldst_op) | fcn(crd) | op3(lddc_op3 ) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::lddc(  Register s1, Register s2, int crd) { v8_only();  emit_int32( op(ldst_op) | fcn(crd) | op3(lddc_op3 ) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::lddc(  Register s1, int simm13a, int crd) { v8_only();  emit_data( op(ldst_op) | fcn(crd) | op3(lddc_op3 ) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::ldcsr( Register s1, Register s2, int crd) { v8_only();  emit_long( op(ldst_op) | fcn(crd) | op3(ldcsr_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::ldcsr( Register s1, Register s2, int crd) { v8_only();  emit_int32( op(ldst_op) | fcn(crd) | op3(ldcsr_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::ldcsr( Register s1, int simm13a, int crd) { v8_only();  emit_data( op(ldst_op) | fcn(crd) | op3(ldcsr_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
-inline void Assembler::ldsb(  Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(ldsb_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::ldsb(  Register s1, Register s2, Register d) { emit_int32( op(ldst_op) | rd(d) | op3(ldsb_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::ldsb(  Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(ldsb_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
-inline void Assembler::ldsh(  Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(ldsh_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::ldsh(  Register s1, Register s2, Register d) { emit_int32( op(ldst_op) | rd(d) | op3(ldsh_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::ldsh(  Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(ldsh_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::ldsw(  Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(ldsw_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::ldsw(  Register s1, Register s2, Register d) { emit_int32( op(ldst_op) | rd(d) | op3(ldsw_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::ldsw(  Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(ldsw_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::ldub(  Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(ldub_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::ldub(  Register s1, Register s2, Register d) { emit_int32( op(ldst_op) | rd(d) | op3(ldub_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::ldub(  Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(ldub_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::lduh(  Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(lduh_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::lduh(  Register s1, Register s2, Register d) { emit_int32( op(ldst_op) | rd(d) | op3(lduh_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::lduh(  Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(lduh_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::lduw(  Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(lduw_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::lduw(  Register s1, Register s2, Register d) { emit_int32( op(ldst_op) | rd(d) | op3(lduw_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::lduw(  Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(lduw_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
-inline void Assembler::ldx(   Register s1, Register s2, Register d) { v9_only();  emit_long( op(ldst_op) | rd(d) | op3(ldx_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::ldx(   Register s1, Register s2, Register d) { v9_only();  emit_int32( op(ldst_op) | rd(d) | op3(ldx_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::ldx(   Register s1, int simm13a, Register d) { v9_only();  emit_data( op(ldst_op) | rd(d) | op3(ldx_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::ldd(   Register s1, Register s2, Register d) { v9_dep(); assert(d->is_even(), "not even"); emit_long( op(ldst_op) | rd(d) | op3(ldd_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::ldd(   Register s1, Register s2, Register d) { v9_dep(); assert(d->is_even(), "not even"); emit_int32( op(ldst_op) | rd(d) | op3(ldd_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::ldd(   Register s1, int simm13a, Register d) { v9_dep(); assert(d->is_even(), "not even"); emit_data( op(ldst_op) | rd(d) | op3(ldd_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
-inline void Assembler::ldstub(  Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(ldstub_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::ldstub(  Register s1, Register s2, Register d) { emit_int32( op(ldst_op) | rd(d) | op3(ldstub_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::ldstub(  Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(ldstub_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
-inline void Assembler::rett( Register s1, Register s2                         ) { cti();  emit_long( op(arith_op) | op3(rett_op3) | rs1(s1) | rs2(s2));  has_delay_slot(); }
+inline void Assembler::rett( Register s1, Register s2                         ) { cti();  emit_int32( op(arith_op) | op3(rett_op3) | rs1(s1) | rs2(s2));  has_delay_slot(); }
 inline void Assembler::rett( Register s1, int simm13a, relocInfo::relocType rt) { cti();  emit_data( op(arith_op) | op3(rett_op3) | rs1(s1) | immed(true) | simm(simm13a, 13), rt);  has_delay_slot(); }
 
 inline void Assembler::sethi( int imm22a, Register d, RelocationHolder const& rspec ) { emit_data( op(branch_op) | rd(d) | op2(sethi_op2) | hi22(imm22a), rspec); }
 
   // pp 222
 
-inline void Assembler::stf(    FloatRegisterImpl::Width w, FloatRegister d, Register s1, Register s2) { emit_long( op(ldst_op) | fd(d, w) | alt_op3(stf_op3, w) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::stf(    FloatRegisterImpl::Width w, FloatRegister d, Register s1, Register s2) { emit_int32( op(ldst_op) | fd(d, w) | alt_op3(stf_op3, w) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::stf(    FloatRegisterImpl::Width w, FloatRegister d, Register s1, int simm13a) { emit_data( op(ldst_op) | fd(d, w) | alt_op3(stf_op3, w) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
-inline void Assembler::stfsr(  Register s1, Register s2) { v9_dep();   emit_long( op(ldst_op) |             op3(stfsr_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::stfsr(  Register s1, Register s2) { v9_dep();   emit_int32( op(ldst_op) |             op3(stfsr_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::stfsr(  Register s1, int simm13a) { v9_dep();   emit_data( op(ldst_op) |             op3(stfsr_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::stxfsr( Register s1, Register s2) { v9_only();  emit_long( op(ldst_op) | rd(G1)    | op3(stfsr_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::stxfsr( Register s1, Register s2) { v9_only();  emit_int32( op(ldst_op) | rd(G1)    | op3(stfsr_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::stxfsr( Register s1, int simm13a) { v9_only();  emit_data( op(ldst_op) | rd(G1)    | op3(stfsr_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
   // p 226
 
-inline void Assembler::stb(  Register d, Register s1, Register s2) { emit_long( op(ldst_op) | rd(d) | op3(stb_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::stb(  Register d, Register s1, Register s2) { emit_int32( op(ldst_op) | rd(d) | op3(stb_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::stb(  Register d, Register s1, int simm13a) { emit_data( op(ldst_op) | rd(d) | op3(stb_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::sth(  Register d, Register s1, Register s2) { emit_long( op(ldst_op) | rd(d) | op3(sth_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::sth(  Register d, Register s1, Register s2) { emit_int32( op(ldst_op) | rd(d) | op3(sth_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::sth(  Register d, Register s1, int simm13a) { emit_data( op(ldst_op) | rd(d) | op3(sth_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::stw(  Register d, Register s1, Register s2) { emit_long( op(ldst_op) | rd(d) | op3(stw_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::stw(  Register d, Register s1, Register s2) { emit_int32( op(ldst_op) | rd(d) | op3(stw_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::stw(  Register d, Register s1, int simm13a) { emit_data( op(ldst_op) | rd(d) | op3(stw_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
 
-inline void Assembler::stx(  Register d, Register s1, Register s2) { v9_only();  emit_long( op(ldst_op) | rd(d) | op3(stx_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::stx(  Register d, Register s1, Register s2) { v9_only();  emit_int32( op(ldst_op) | rd(d) | op3(stx_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::stx(  Register d, Register s1, int simm13a) { v9_only();  emit_data( op(ldst_op) | rd(d) | op3(stx_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::std(  Register d, Register s1, Register s2) { v9_dep(); assert(d->is_even(), "not even"); emit_long( op(ldst_op) | rd(d) | op3(std_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::std(  Register d, Register s1, Register s2) { v9_dep(); assert(d->is_even(), "not even"); emit_int32( op(ldst_op) | rd(d) | op3(std_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::std(  Register d, Register s1, int simm13a) { v9_dep(); assert(d->is_even(), "not even"); emit_data( op(ldst_op) | rd(d) | op3(std_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
 // v8 p 99
 
-inline void Assembler::stc(    int crd, Register s1, Register s2) { v8_only();  emit_long( op(ldst_op) | fcn(crd) | op3(stc_op3 ) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::stc(    int crd, Register s1, Register s2) { v8_only();  emit_int32( op(ldst_op) | fcn(crd) | op3(stc_op3 ) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::stc(    int crd, Register s1, int simm13a) { v8_only();  emit_data( op(ldst_op) | fcn(crd) | op3(stc_op3 ) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::stdc(   int crd, Register s1, Register s2) { v8_only();  emit_long( op(ldst_op) | fcn(crd) | op3(stdc_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::stdc(   int crd, Register s1, Register s2) { v8_only();  emit_int32( op(ldst_op) | fcn(crd) | op3(stdc_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::stdc(   int crd, Register s1, int simm13a) { v8_only();  emit_data( op(ldst_op) | fcn(crd) | op3(stdc_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::stcsr(  int crd, Register s1, Register s2) { v8_only();  emit_long( op(ldst_op) | fcn(crd) | op3(stcsr_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::stcsr(  int crd, Register s1, Register s2) { v8_only();  emit_int32( op(ldst_op) | fcn(crd) | op3(stcsr_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::stcsr(  int crd, Register s1, int simm13a) { v8_only();  emit_data( op(ldst_op) | fcn(crd) | op3(stcsr_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::stdcq(  int crd, Register s1, Register s2) { v8_only();  emit_long( op(ldst_op) | fcn(crd) | op3(stdcq_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::stdcq(  int crd, Register s1, Register s2) { v8_only();  emit_int32( op(ldst_op) | fcn(crd) | op3(stdcq_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::stdcq(  int crd, Register s1, int simm13a) { v8_only();  emit_data( op(ldst_op) | fcn(crd) | op3(stdcq_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
 // pp 231
 
-inline void Assembler::swap(    Register s1, Register s2, Register d) { v9_dep();  emit_long( op(ldst_op) | rd(d) | op3(swap_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::swap(    Register s1, Register s2, Register d) { v9_dep();  emit_int32( op(ldst_op) | rd(d) | op3(swap_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::swap(    Register s1, int simm13a, Register d) { v9_dep();  emit_data( op(ldst_op) | rd(d) | op3(swap_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
 #endif // CPU_SPARC_VM_ASSEMBLER_SPARC_INLINE_HPP
--- a/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -137,7 +137,7 @@
   }
   __ ret();                           // return from interpreter activation
   __ delayed()->restore(I5_savedSP, G0, SP);  // remove interpreter frame
-  NOT_PRODUCT(__ emit_long(0);)       // marker for disassembly
+  NOT_PRODUCT(__ emit_int32(0);)       // marker for disassembly
   return entry;
 }
 
@@ -232,7 +232,7 @@
   }
   __ retl();                          // return from interpreter activation
   __ delayed()->nop();                // schedule this better
-  NOT_PRODUCT(__ emit_long(0);)       // marker for disassembly
+  NOT_PRODUCT(__ emit_int32(0);)       // marker for disassembly
   return entry;
 }
 
@@ -1473,7 +1473,7 @@
     __ brx(Assembler::equal, false, Assembler::pt, skip);         \
     __ delayed()->nop();                                          \
     __ breakpoint_trap();                                         \
-    __ emit_long(marker);                                         \
+    __ emit_int32(marker);                                         \
     __ bind(skip);                                                \
   }
 #else
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -1224,7 +1224,7 @@
   // Relocation with special format (see relocInfo_sparc.hpp).
   relocate(rspec, 1);
   // Assembler::sethi(0x3fffff, d);
-  emit_long( op(branch_op) | rd(d) | op2(sethi_op2) | hi22(0x3fffff) );
+  emit_int32( op(branch_op) | rd(d) | op2(sethi_op2) | hi22(0x3fffff) );
   // Don't add relocation for 'add'. Do patching during 'sethi' processing.
   add(d, 0x3ff, d);
 
@@ -1240,7 +1240,7 @@
   // Relocation with special format (see relocInfo_sparc.hpp).
   relocate(rspec, 1);
   // Assembler::sethi(encoded_k, d);
-  emit_long( op(branch_op) | rd(d) | op2(sethi_op2) | hi22(encoded_k) );
+  emit_int32( op(branch_op) | rd(d) | op2(sethi_op2) | hi22(encoded_k) );
   // Don't add relocation for 'add'. Do patching during 'sethi' processing.
   add(d, low10(encoded_k), d);
 
--- a/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -259,7 +259,7 @@
   }
   __ ret();                           // return from interpreter activation
   __ delayed()->restore(I5_savedSP, G0, SP);  // remove interpreter frame
-  NOT_PRODUCT(__ emit_long(0);)       // marker for disassembly
+  NOT_PRODUCT(__ emit_int32(0);)       // marker for disassembly
   return entry;
 }
 
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -182,7 +182,7 @@
 // make this go away someday
 void Assembler::emit_data(jint data, relocInfo::relocType rtype, int format) {
   if (rtype == relocInfo::none)
-        emit_long(data);
+        emit_int32(data);
   else  emit_data(data, Relocation::spec_simple(rtype), format);
 }
 
@@ -202,7 +202,7 @@
     else
       code_section()->relocate(inst_mark(), rspec, format);
   }
-  emit_long(data);
+  emit_int32(data);
 }
 
 static int encode(Register r) {
@@ -243,7 +243,7 @@
   } else {
     emit_int8(op1);
     emit_int8(op2 | encode(dst));
-    emit_long(imm32);
+    emit_int32(imm32);
   }
 }
 
@@ -254,7 +254,7 @@
   assert((op1 & 0x02) == 0, "sign-extension bit should not be set");
   emit_int8(op1);
   emit_int8(op2 | encode(dst));
-  emit_long(imm32);
+  emit_int32(imm32);
 }
 
 // immediate-to-memory forms
@@ -268,7 +268,7 @@
   } else {
     emit_int8(op1);
     emit_operand(rm, adr, 4);
-    emit_long(imm32);
+    emit_int32(imm32);
   }
 }
 
@@ -976,7 +976,7 @@
   emit_int8(0x1F);
   emit_int8((unsigned char)0x80);
                    // emit_rm(cbuf, 0x2, EAX_enc, EAX_enc);
-  emit_long(0);    // 32-bits offset (4 bytes)
+  emit_int32(0);   // 32-bits offset (4 bytes)
 }
 
 void Assembler::addr_nop_8() {
@@ -987,7 +987,7 @@
   emit_int8((unsigned char)0x84);
                    // emit_rm(cbuf, 0x2, EAX_enc, 0x4);
   emit_int8(0x00); // emit_rm(cbuf, 0x0, EAX_enc, EAX_enc);
-  emit_long(0);    // 32-bits offset (4 bytes)
+  emit_int32(0);   // 32-bits offset (4 bytes)
 }
 
 void Assembler::addsd(XMMRegister dst, XMMRegister src) {
@@ -1076,7 +1076,7 @@
   prefix(dst);
   emit_int8((unsigned char)0x81);
   emit_operand(rsp, dst, 4);
-  emit_long(imm32);
+  emit_int32(imm32);
 }
 
 void Assembler::andl(Register dst, int32_t imm32) {
@@ -1204,7 +1204,7 @@
   prefix(dst);
   emit_int8((unsigned char)0x81);
   emit_operand(rdi, dst, 4);
-  emit_long(imm32);
+  emit_int32(imm32);
 }
 
 void Assembler::cmpl(Register dst, int32_t imm32) {
@@ -1408,7 +1408,7 @@
   } else {
     emit_int8(0x69);
     emit_int8((unsigned char)(0xC0 | encode));
-    emit_long(value);
+    emit_int32(value);
   }
 }
 
@@ -1440,7 +1440,7 @@
              "must be 32bit offset (call4)");
       emit_int8(0x0F);
       emit_int8((unsigned char)(0x80 | cc));
-      emit_long(offs - long_size);
+      emit_int32(offs - long_size);
     }
   } else {
     // Note: could eliminate cond. jumps to this jump if condition
@@ -1450,7 +1450,7 @@
     L.add_patch_at(code(), locator());
     emit_int8(0x0F);
     emit_int8((unsigned char)(0x80 | cc));
-    emit_long(0);
+    emit_int32(0);
   }
 }
 
@@ -1498,7 +1498,7 @@
       emit_int8((offs - short_size) & 0xFF);
     } else {
       emit_int8((unsigned char)0xE9);
-      emit_long(offs - long_size);
+      emit_int32(offs - long_size);
     }
   } else {
     // By default, forward jumps are always 32-bit displacements, since
@@ -1508,7 +1508,7 @@
     InstructionMark im(this);
     L.add_patch_at(code(), locator());
     emit_int8((unsigned char)0xE9);
-    emit_long(0);
+    emit_int32(0);
   }
 }
 
@@ -1732,7 +1732,7 @@
 void Assembler::movl(Register dst, int32_t imm32) {
   int encode = prefix_and_encode(dst->encoding());
   emit_int8((unsigned char)(0xB8 | encode));
-  emit_long(imm32);
+  emit_int32(imm32);
 }
 
 void Assembler::movl(Register dst, Register src) {
@@ -1753,7 +1753,7 @@
   prefix(dst);
   emit_int8((unsigned char)0xC7);
   emit_operand(rax, dst, 4);
-  emit_long(imm32);
+  emit_int32(imm32);
 }
 
 void Assembler::movl(Address dst, Register src) {
@@ -2468,6 +2468,26 @@
   emit_int8((unsigned char)(0xC0 | encode));
 }
 
+void Assembler::vptest(XMMRegister dst, Address src) {
+  assert(VM_Version::supports_avx(), "");
+  InstructionMark im(this);
+  bool vector256 = true;
+  assert(dst != xnoreg, "sanity");
+  int dst_enc = dst->encoding();
+  // swap src<->dst for encoding
+  vex_prefix(src, dst_enc, dst_enc, VEX_SIMD_66, VEX_OPCODE_0F_38, false, vector256);
+  emit_int8(0x17);
+  emit_operand(dst, src);
+}
+
+void Assembler::vptest(XMMRegister dst, XMMRegister src) {
+  assert(VM_Version::supports_avx(), "");
+  bool vector256 = true;
+  int encode = vex_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, vector256, VEX_OPCODE_0F_38);
+  emit_int8(0x17);
+  emit_int8((unsigned char)(0xC0 | encode));
+}
+
 void Assembler::punpcklbw(XMMRegister dst, Address src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes");
@@ -2499,7 +2519,7 @@
   // in 64bits we push 64bits onto the stack but only
   // take a 32bit immediate
   emit_int8(0x68);
-  emit_long(imm32);
+  emit_int32(imm32);
 }
 
 void Assembler::push(Register src) {
@@ -2544,12 +2564,18 @@
   emit_int8((unsigned char)0xA5);
 }
 
+// sets rcx bytes with rax, value at [edi]
+void Assembler::rep_stosb() {
+  emit_int8((unsigned char)0xF3); // REP
+  LP64_ONLY(prefix(REX_W));
+  emit_int8((unsigned char)0xAA); // STOSB
+}
+
 // sets rcx pointer sized words with rax, value at [edi]
 // generic
-void Assembler::rep_set() { // rep_set
-  emit_int8((unsigned char)0xF3);
-  // STOSQ
-  LP64_ONLY(prefix(REX_W));
+void Assembler::rep_stos() {
+  emit_int8((unsigned char)0xF3); // REP
+  LP64_ONLY(prefix(REX_W));       // LP64:STOSQ, LP32:STOSD
   emit_int8((unsigned char)0xAB);
 }
 
@@ -2785,7 +2811,7 @@
     emit_int8((unsigned char)0xF7);
     emit_int8((unsigned char)(0xC0 | encode));
   }
-  emit_long(imm32);
+  emit_int32(imm32);
 }
 
 void Assembler::testl(Register dst, Register src) {
@@ -3650,6 +3676,15 @@
   emit_int8(0x01);
 }
 
+// duplicate 4-bytes integer data from src into 8 locations in dest
+void Assembler::vpbroadcastd(XMMRegister dst, XMMRegister src) {
+  assert(VM_Version::supports_avx2(), "");
+  bool vector256 = true;
+  int encode = vex_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, vector256, VEX_OPCODE_0F_38);
+  emit_int8(0x58);
+  emit_int8((unsigned char)(0xC0 | encode));
+}
+
 void Assembler::vzeroupper() {
   assert(VM_Version::supports_avx(), "");
   (void)vex_prefix_and_encode(xmm0, xmm0, xmm0, VEX_SIMD_NONE);
@@ -4720,7 +4755,7 @@
   prefixq(dst);
   emit_int8((unsigned char)0x81);
   emit_operand(rsp, dst, 4);
-  emit_long(imm32);
+  emit_int32(imm32);
 }
 
 void Assembler::andq(Register dst, int32_t imm32) {
@@ -4793,7 +4828,7 @@
   prefixq(dst);
   emit_int8((unsigned char)0x81);
   emit_operand(rdi, dst, 4);
-  emit_long(imm32);
+  emit_int32(imm32);
 }
 
 void Assembler::cmpq(Register dst, int32_t imm32) {
@@ -4932,7 +4967,7 @@
   } else {
     emit_int8(0x69);
     emit_int8((unsigned char)(0xC0 | encode));
-    emit_long(value);
+    emit_int32(value);
   }
 }
 
@@ -5085,7 +5120,7 @@
   InstructionMark im(this);
   int encode = prefixq_and_encode(dst->encoding());
   emit_int8((unsigned char)(0xC7 | encode));
-  emit_long(imm32);
+  emit_int32(imm32);
 }
 
 void Assembler::movslq(Address dst, int32_t imm32) {
@@ -5094,7 +5129,7 @@
   prefixq(dst);
   emit_int8((unsigned char)0xC7);
   emit_operand(rax, dst, 4);
-  emit_long(imm32);
+  emit_int32(imm32);
 }
 
 void Assembler::movslq(Register dst, Address src) {
@@ -5172,7 +5207,7 @@
   prefixq(dst);
   emit_int8((unsigned char)0x81);
   emit_operand(rcx, dst, 4);
-  emit_long(imm32);
+  emit_int32(imm32);
 }
 
 void Assembler::orq(Register dst, int32_t imm32) {
@@ -5407,7 +5442,7 @@
     emit_int8((unsigned char)0xF7);
     emit_int8((unsigned char)(0xC0 | encode));
   }
-  emit_long(imm32);
+  emit_int32(imm32);
 }
 
 void Assembler::testq(Register dst, Register src) {
--- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -832,7 +832,8 @@
 
   // These do register sized moves/scans
   void rep_mov();
-  void rep_set();
+  void rep_stos();
+  void rep_stosb();
   void repne_scan();
 #ifdef _LP64
   void repne_scanl();
@@ -1443,9 +1444,12 @@
   // Shift Right by bytes Logical DoubleQuadword Immediate
   void psrldq(XMMRegister dst, int shift);
 
-  // Logical Compare Double Quadword
+  // Logical Compare 128bit
   void ptest(XMMRegister dst, XMMRegister src);
   void ptest(XMMRegister dst, Address src);
+  // Logical Compare 256bit
+  void vptest(XMMRegister dst, XMMRegister src);
+  void vptest(XMMRegister dst, Address src);
 
   // Interleave Low Bytes
   void punpcklbw(XMMRegister dst, XMMRegister src);
@@ -1753,6 +1757,9 @@
   void vextractf128h(Address dst, XMMRegister src);
   void vextracti128h(Address dst, XMMRegister src);
 
+  // duplicate 4-bytes integer data from src into 8 locations in dest
+  void vpbroadcastd(XMMRegister dst, XMMRegister src);
+
   // AVX instruction which is used to clear upper 128 bits of YMM registers and
   // to avoid transaction penalty between AVX and SSE states. There is no
   // penalty if legacy SSE instructions are encoded using VEX prefix because
--- a/hotspot/src/cpu/x86/vm/globals_x86.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/cpu/x86/vm/globals_x86.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -120,6 +120,9 @@
   product(bool, UseUnalignedLoadStores, false,                              \
           "Use SSE2 MOVDQU instruction for Arraycopy")                      \
                                                                             \
+  product(bool, UseFastStosb, false,                                        \
+          "Use fast-string operation for zeroing: rep stosb")               \
+                                                                            \
   /* assembler */                                                           \
   product(bool, Use486InstrsOnly, false,                                    \
           "Use 80486 Compliant instruction subset")                         \
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -2540,7 +2540,7 @@
       // 0000 1111 1000 tttn #32-bit disp
       emit_int8(0x0F);
       emit_int8((unsigned char)(0x80 | cc));
-      emit_long(offs - long_size);
+      emit_int32(offs - long_size);
     }
   } else {
 #ifdef ASSERT
@@ -5224,6 +5224,22 @@
 
 }
 
+void MacroAssembler::clear_mem(Register base, Register cnt, Register tmp) {
+  // cnt - number of qwords (8-byte words).
+  // base - start address, qword aligned.
+  assert(base==rdi, "base register must be edi for rep stos");
+  assert(tmp==rax,   "tmp register must be eax for rep stos");
+  assert(cnt==rcx,   "cnt register must be ecx for rep stos");
+
+  xorptr(tmp, tmp);
+  if (UseFastStosb) {
+    shlptr(cnt,3); // convert to number of bytes
+    rep_stosb();
+  } else {
+    NOT_LP64(shlptr(cnt,1);) // convert to number of dwords for 32-bit VM
+    rep_stos();
+  }
+}
 
 // IndexOf for constant substrings with size >= 8 chars
 // which don't need to be loaded through stack.
@@ -5659,42 +5675,114 @@
   testl(cnt2, cnt2);
   jcc(Assembler::zero, LENGTH_DIFF_LABEL);
 
-  // Load first characters
+  // Compare first characters
   load_unsigned_short(result, Address(str1, 0));
   load_unsigned_short(cnt1, Address(str2, 0));
-
-  // Compare first characters
   subl(result, cnt1);
   jcc(Assembler::notZero,  POP_LABEL);
-  decrementl(cnt2);
-  jcc(Assembler::zero, LENGTH_DIFF_LABEL);
-
-  {
-    // Check after comparing first character to see if strings are equivalent
-    Label LSkip2;
-    // Check if the strings start at same location
-    cmpptr(str1, str2);
-    jccb(Assembler::notEqual, LSkip2);
-
-    // Check if the length difference is zero (from stack)
-    cmpl(Address(rsp, 0), 0x0);
-    jcc(Assembler::equal,  LENGTH_DIFF_LABEL);
-
-    // Strings might not be equivalent
-    bind(LSkip2);
-  }
+  cmpl(cnt2, 1);
+  jcc(Assembler::equal, LENGTH_DIFF_LABEL);
+
+  // Check if the strings start at the same location.
+  cmpptr(str1, str2);
+  jcc(Assembler::equal, LENGTH_DIFF_LABEL);
 
   Address::ScaleFactor scale = Address::times_2;
   int stride = 8;
 
-  // Advance to next element
-  addptr(str1, 16/stride);
-  addptr(str2, 16/stride);
-
-  if (UseSSE42Intrinsics) {
+  if (UseAVX >= 2) {
+    Label COMPARE_WIDE_VECTORS, VECTOR_NOT_EQUAL, COMPARE_WIDE_TAIL, COMPARE_SMALL_STR;
+    Label COMPARE_WIDE_VECTORS_LOOP, COMPARE_16_CHARS, COMPARE_INDEX_CHAR;
+    Label COMPARE_TAIL_LONG;
+    int pcmpmask = 0x19;
+
+    // Setup to compare 16-chars (32-bytes) vectors,
+    // start from first character again because it has aligned address.
+    int stride2 = 16;
+    int adr_stride  = stride  << scale;
+    int adr_stride2 = stride2 << scale;
+
+    assert(result == rax && cnt2 == rdx && cnt1 == rcx, "pcmpestri");
+    // rax and rdx are used by pcmpestri as elements counters
+    movl(result, cnt2);
+    andl(cnt2, ~(stride2-1));   // cnt2 holds the vector count
+    jcc(Assembler::zero, COMPARE_TAIL_LONG);
+
+    // fast path : compare first 2 8-char vectors.
+    bind(COMPARE_16_CHARS);
+    movdqu(vec1, Address(str1, 0));
+    pcmpestri(vec1, Address(str2, 0), pcmpmask);
+    jccb(Assembler::below, COMPARE_INDEX_CHAR);
+
+    movdqu(vec1, Address(str1, adr_stride));
+    pcmpestri(vec1, Address(str2, adr_stride), pcmpmask);
+    jccb(Assembler::aboveEqual, COMPARE_WIDE_VECTORS);
+    addl(cnt1, stride);
+
+    // Compare the characters at index in cnt1
+    bind(COMPARE_INDEX_CHAR); //cnt1 has the offset of the mismatching character
+    load_unsigned_short(result, Address(str1, cnt1, scale));
+    load_unsigned_short(cnt2, Address(str2, cnt1, scale));
+    subl(result, cnt2);
+    jmp(POP_LABEL);
+
+    // Setup the registers to start vector comparison loop
+    bind(COMPARE_WIDE_VECTORS);
+    lea(str1, Address(str1, result, scale));
+    lea(str2, Address(str2, result, scale));
+    subl(result, stride2);
+    subl(cnt2, stride2);
+    jccb(Assembler::zero, COMPARE_WIDE_TAIL);
+    negptr(result);
+
+    //  In a loop, compare 16-chars (32-bytes) at once using (vpxor+vptest)
+    bind(COMPARE_WIDE_VECTORS_LOOP);
+    vmovdqu(vec1, Address(str1, result, scale));
+    vpxor(vec1, Address(str2, result, scale));
+    vptest(vec1, vec1);
+    jccb(Assembler::notZero, VECTOR_NOT_EQUAL);
+    addptr(result, stride2);
+    subl(cnt2, stride2);
+    jccb(Assembler::notZero, COMPARE_WIDE_VECTORS_LOOP);
+
+    // compare wide vectors tail
+    bind(COMPARE_WIDE_TAIL);
+    testptr(result, result);
+    jccb(Assembler::zero, LENGTH_DIFF_LABEL);
+
+    movl(result, stride2);
+    movl(cnt2, result);
+    negptr(result);
+    jmpb(COMPARE_WIDE_VECTORS_LOOP);
+
+    // Identifies the mismatching (higher or lower)16-bytes in the 32-byte vectors.
+    bind(VECTOR_NOT_EQUAL);
+    lea(str1, Address(str1, result, scale));
+    lea(str2, Address(str2, result, scale));
+    jmp(COMPARE_16_CHARS);
+
+    // Compare tail chars, length between 1 to 15 chars
+    bind(COMPARE_TAIL_LONG);
+    movl(cnt2, result);
+    cmpl(cnt2, stride);
+    jccb(Assembler::less, COMPARE_SMALL_STR);
+
+    movdqu(vec1, Address(str1, 0));
+    pcmpestri(vec1, Address(str2, 0), pcmpmask);
+    jcc(Assembler::below, COMPARE_INDEX_CHAR);
+    subptr(cnt2, stride);
+    jccb(Assembler::zero, LENGTH_DIFF_LABEL);
+    lea(str1, Address(str1, result, scale));
+    lea(str2, Address(str2, result, scale));
+    negptr(cnt2);
+    jmpb(WHILE_HEAD_LABEL);
+
+    bind(COMPARE_SMALL_STR);
+  } else if (UseSSE42Intrinsics) {
     Label COMPARE_WIDE_VECTORS, VECTOR_NOT_EQUAL, COMPARE_TAIL;
     int pcmpmask = 0x19;
-    // Setup to compare 16-byte vectors
+    // Setup to compare 8-char (16-byte) vectors,
+    // start from first character again because it has aligned address.
     movl(result, cnt2);
     andl(cnt2, ~(stride - 1));   // cnt2 holds the vector count
     jccb(Assembler::zero, COMPARE_TAIL);
@@ -5726,7 +5814,7 @@
     jccb(Assembler::notZero, COMPARE_WIDE_VECTORS);
 
     // compare wide vectors tail
-    testl(result, result);
+    testptr(result, result);
     jccb(Assembler::zero, LENGTH_DIFF_LABEL);
 
     movl(cnt2, stride);
@@ -5738,21 +5826,20 @@
 
     // Mismatched characters in the vectors
     bind(VECTOR_NOT_EQUAL);
-    addptr(result, cnt1);
-    movptr(cnt2, result);
-    load_unsigned_short(result, Address(str1, cnt2, scale));
-    load_unsigned_short(cnt1, Address(str2, cnt2, scale));
-    subl(result, cnt1);
+    addptr(cnt1, result);
+    load_unsigned_short(result, Address(str1, cnt1, scale));
+    load_unsigned_short(cnt2, Address(str2, cnt1, scale));
+    subl(result, cnt2);
     jmpb(POP_LABEL);
 
     bind(COMPARE_TAIL); // limit is zero
     movl(cnt2, result);
     // Fallthru to tail compare
   }
-
   // Shift str2 and str1 to the end of the arrays, negate min
-  lea(str1, Address(str1, cnt2, scale, 0));
-  lea(str2, Address(str2, cnt2, scale, 0));
+  lea(str1, Address(str1, cnt2, scale));
+  lea(str2, Address(str2, cnt2, scale));
+  decrementl(cnt2);  // first character was compared already
   negptr(cnt2);
 
   // Compare the rest of the elements
@@ -5817,7 +5904,44 @@
   shll(limit, 1);      // byte count != 0
   movl(result, limit); // copy
 
-  if (UseSSE42Intrinsics) {
+  if (UseAVX >= 2) {
+    // With AVX2, use 32-byte vector compare
+    Label COMPARE_WIDE_VECTORS, COMPARE_TAIL;
+
+    // Compare 32-byte vectors
+    andl(result, 0x0000001e);  //   tail count (in bytes)
+    andl(limit, 0xffffffe0);   // vector count (in bytes)
+    jccb(Assembler::zero, COMPARE_TAIL);
+
+    lea(ary1, Address(ary1, limit, Address::times_1));
+    lea(ary2, Address(ary2, limit, Address::times_1));
+    negptr(limit);
+
+    bind(COMPARE_WIDE_VECTORS);
+    vmovdqu(vec1, Address(ary1, limit, Address::times_1));
+    vmovdqu(vec2, Address(ary2, limit, Address::times_1));
+    vpxor(vec1, vec2);
+
+    vptest(vec1, vec1);
+    jccb(Assembler::notZero, FALSE_LABEL);
+    addptr(limit, 32);
+    jcc(Assembler::notZero, COMPARE_WIDE_VECTORS);
+
+    testl(result, result);
+    jccb(Assembler::zero, TRUE_LABEL);
+
+    vmovdqu(vec1, Address(ary1, result, Address::times_1, -32));
+    vmovdqu(vec2, Address(ary2, result, Address::times_1, -32));
+    vpxor(vec1, vec2);
+
+    vptest(vec1, vec1);
+    jccb(Assembler::notZero, FALSE_LABEL);
+    jmpb(TRUE_LABEL);
+
+    bind(COMPARE_TAIL); // limit is zero
+    movl(limit, result);
+    // Fallthru to tail compare
+  } else if (UseSSE42Intrinsics) {
     // With SSE4.2, use double quad vector compare
     Label COMPARE_WIDE_VECTORS, COMPARE_TAIL;
 
@@ -5995,29 +6119,53 @@
     {
       assert( UseSSE >= 2, "supported cpu only" );
       Label L_fill_32_bytes_loop, L_check_fill_8_bytes, L_fill_8_bytes_loop, L_fill_8_bytes;
-      // Fill 32-byte chunks
       movdl(xtmp, value);
-      pshufd(xtmp, xtmp, 0);
-
-      subl(count, 8 << shift);
-      jcc(Assembler::less, L_check_fill_8_bytes);
-      align(16);
-
-      BIND(L_fill_32_bytes_loop);
-
-      if (UseUnalignedLoadStores) {
-        movdqu(Address(to, 0), xtmp);
-        movdqu(Address(to, 16), xtmp);
+      if (UseAVX >= 2 && UseUnalignedLoadStores) {
+        // Fill 64-byte chunks
+        Label L_fill_64_bytes_loop, L_check_fill_32_bytes;
+        vpbroadcastd(xtmp, xtmp);
+
+        subl(count, 16 << shift);
+        jcc(Assembler::less, L_check_fill_32_bytes);
+        align(16);
+
+        BIND(L_fill_64_bytes_loop);
+        vmovdqu(Address(to, 0), xtmp);
+        vmovdqu(Address(to, 32), xtmp);
+        addptr(to, 64);
+        subl(count, 16 << shift);
+        jcc(Assembler::greaterEqual, L_fill_64_bytes_loop);
+
+        BIND(L_check_fill_32_bytes);
+        addl(count, 8 << shift);
+        jccb(Assembler::less, L_check_fill_8_bytes);
+        vmovdqu(Address(to, 0), xtmp);
+        addptr(to, 32);
+        subl(count, 8 << shift);
       } else {
-        movq(Address(to, 0), xtmp);
-        movq(Address(to, 8), xtmp);
-        movq(Address(to, 16), xtmp);
-        movq(Address(to, 24), xtmp);
+        // Fill 32-byte chunks
+        pshufd(xtmp, xtmp, 0);
+
+        subl(count, 8 << shift);
+        jcc(Assembler::less, L_check_fill_8_bytes);
+        align(16);
+
+        BIND(L_fill_32_bytes_loop);
+
+        if (UseUnalignedLoadStores) {
+          movdqu(Address(to, 0), xtmp);
+          movdqu(Address(to, 16), xtmp);
+        } else {
+          movq(Address(to, 0), xtmp);
+          movq(Address(to, 8), xtmp);
+          movq(Address(to, 16), xtmp);
+          movq(Address(to, 24), xtmp);
+        }
+
+        addptr(to, 32);
+        subl(count, 8 << shift);
+        jcc(Assembler::greaterEqual, L_fill_32_bytes_loop);
       }
-
-      addptr(to, 32);
-      subl(count, 8 << shift);
-      jcc(Assembler::greaterEqual, L_fill_32_bytes_loop);
       BIND(L_check_fill_8_bytes);
       addl(count, 8 << shift);
       jccb(Assembler::zero, L_exit);
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -1011,6 +1011,10 @@
       Assembler::vxorpd(dst, nds, src, vector256);
   }
 
+  // Simple version for AVX2 256bit vectors
+  void vpxor(XMMRegister dst, XMMRegister src) { Assembler::vpxor(dst, dst, src, true); }
+  void vpxor(XMMRegister dst, Address src) { Assembler::vpxor(dst, dst, src, true); }
+
   // Move packed integer values from low 128 bit to hign 128 bit in 256 bit vector.
   void vinserti128h(XMMRegister dst, XMMRegister nds, XMMRegister src) {
     if (UseAVX > 1) // vinserti128h is available only in AVX2
@@ -1096,6 +1100,9 @@
   // C2 compiled method's prolog code.
   void verified_entry(int framesize, bool stack_bang, bool fp_mode_24b);
 
+  // clear memory of size 'cnt' qwords, starting at 'base'.
+  void clear_mem(Register base, Register cnt, Register rtmp);
+
   // IndexOf strings.
   // Small strings are loaded through stack if they cross page boundary.
   void string_indexof(Register str1, Register str2,
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -796,16 +796,22 @@
     __ align(OptoLoopAlignment);
   __ BIND(L_copy_64_bytes_loop);
 
-    if(UseUnalignedLoadStores) {
-      __ movdqu(xmm0, Address(from, 0));
-      __ movdqu(Address(from, to_from, Address::times_1, 0), xmm0);
-      __ movdqu(xmm1, Address(from, 16));
-      __ movdqu(Address(from, to_from, Address::times_1, 16), xmm1);
-      __ movdqu(xmm2, Address(from, 32));
-      __ movdqu(Address(from, to_from, Address::times_1, 32), xmm2);
-      __ movdqu(xmm3, Address(from, 48));
-      __ movdqu(Address(from, to_from, Address::times_1, 48), xmm3);
-
+    if (UseUnalignedLoadStores) {
+      if (UseAVX >= 2) {
+        __ vmovdqu(xmm0, Address(from,  0));
+        __ vmovdqu(Address(from, to_from, Address::times_1,  0), xmm0);
+        __ vmovdqu(xmm1, Address(from, 32));
+        __ vmovdqu(Address(from, to_from, Address::times_1, 32), xmm1);
+      } else {
+        __ movdqu(xmm0, Address(from, 0));
+        __ movdqu(Address(from, to_from, Address::times_1, 0), xmm0);
+        __ movdqu(xmm1, Address(from, 16));
+        __ movdqu(Address(from, to_from, Address::times_1, 16), xmm1);
+        __ movdqu(xmm2, Address(from, 32));
+        __ movdqu(Address(from, to_from, Address::times_1, 32), xmm2);
+        __ movdqu(xmm3, Address(from, 48));
+        __ movdqu(Address(from, to_from, Address::times_1, 48), xmm3);
+      }
     } else {
       __ movq(xmm0, Address(from, 0));
       __ movq(Address(from, to_from, Address::times_1, 0), xmm0);
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -1286,23 +1286,54 @@
   //   end_to       - destination array end address
   //   qword_count  - 64-bits element count, negative
   //   to           - scratch
-  //   L_copy_32_bytes - entry label
+  //   L_copy_bytes - entry label
   //   L_copy_8_bytes  - exit  label
   //
-  void copy_32_bytes_forward(Register end_from, Register end_to,
+  void copy_bytes_forward(Register end_from, Register end_to,
                              Register qword_count, Register to,
-                             Label& L_copy_32_bytes, Label& L_copy_8_bytes) {
+                             Label& L_copy_bytes, Label& L_copy_8_bytes) {
     DEBUG_ONLY(__ stop("enter at entry label, not here"));
     Label L_loop;
     __ align(OptoLoopAlignment);
-  __ BIND(L_loop);
-    if(UseUnalignedLoadStores) {
-      __ movdqu(xmm0, Address(end_from, qword_count, Address::times_8, -24));
-      __ movdqu(Address(end_to, qword_count, Address::times_8, -24), xmm0);
-      __ movdqu(xmm1, Address(end_from, qword_count, Address::times_8, - 8));
-      __ movdqu(Address(end_to, qword_count, Address::times_8, - 8), xmm1);
-
+    if (UseUnalignedLoadStores) {
+      Label L_end;
+      // Copy 64-bytes per iteration
+      __ BIND(L_loop);
+      if (UseAVX >= 2) {
+        __ vmovdqu(xmm0, Address(end_from, qword_count, Address::times_8, -56));
+        __ vmovdqu(Address(end_to, qword_count, Address::times_8, -56), xmm0);
+        __ vmovdqu(xmm1, Address(end_from, qword_count, Address::times_8, -24));
+        __ vmovdqu(Address(end_to, qword_count, Address::times_8, -24), xmm1);
+      } else {
+        __ movdqu(xmm0, Address(end_from, qword_count, Address::times_8, -56));
+        __ movdqu(Address(end_to, qword_count, Address::times_8, -56), xmm0);
+        __ movdqu(xmm1, Address(end_from, qword_count, Address::times_8, -40));
+        __ movdqu(Address(end_to, qword_count, Address::times_8, -40), xmm1);
+        __ movdqu(xmm2, Address(end_from, qword_count, Address::times_8, -24));
+        __ movdqu(Address(end_to, qword_count, Address::times_8, -24), xmm2);
+        __ movdqu(xmm3, Address(end_from, qword_count, Address::times_8, - 8));
+        __ movdqu(Address(end_to, qword_count, Address::times_8, - 8), xmm3);
+      }
+      __ BIND(L_copy_bytes);
+      __ addptr(qword_count, 8);
+      __ jcc(Assembler::lessEqual, L_loop);
+      __ subptr(qword_count, 4);  // sub(8) and add(4)
+      __ jccb(Assembler::greater, L_end);
+      // Copy trailing 32 bytes
+      if (UseAVX >= 2) {
+        __ vmovdqu(xmm0, Address(end_from, qword_count, Address::times_8, -24));
+        __ vmovdqu(Address(end_to, qword_count, Address::times_8, -24), xmm0);
+      } else {
+        __ movdqu(xmm0, Address(end_from, qword_count, Address::times_8, -24));
+        __ movdqu(Address(end_to, qword_count, Address::times_8, -24), xmm0);
+        __ movdqu(xmm1, Address(end_from, qword_count, Address::times_8, - 8));
+        __ movdqu(Address(end_to, qword_count, Address::times_8, - 8), xmm1);
+      }
+      __ addptr(qword_count, 4);
+      __ BIND(L_end);
     } else {
+      // Copy 32-bytes per iteration
+      __ BIND(L_loop);
       __ movq(to, Address(end_from, qword_count, Address::times_8, -24));
       __ movq(Address(end_to, qword_count, Address::times_8, -24), to);
       __ movq(to, Address(end_from, qword_count, Address::times_8, -16));
@@ -1311,15 +1342,15 @@
       __ movq(Address(end_to, qword_count, Address::times_8, - 8), to);
       __ movq(to, Address(end_from, qword_count, Address::times_8, - 0));
       __ movq(Address(end_to, qword_count, Address::times_8, - 0), to);
+
+      __ BIND(L_copy_bytes);
+      __ addptr(qword_count, 4);
+      __ jcc(Assembler::lessEqual, L_loop);
     }
-  __ BIND(L_copy_32_bytes);
-    __ addptr(qword_count, 4);
-    __ jcc(Assembler::lessEqual, L_loop);
     __ subptr(qword_count, 4);
     __ jcc(Assembler::less, L_copy_8_bytes); // Copy trailing qwords
   }
 
-
   // Copy big chunks backward
   //
   // Inputs:
@@ -1327,23 +1358,55 @@
   //   dest         - destination array address
   //   qword_count  - 64-bits element count
   //   to           - scratch
-  //   L_copy_32_bytes - entry label
+  //   L_copy_bytes - entry label
   //   L_copy_8_bytes  - exit  label
   //
-  void copy_32_bytes_backward(Register from, Register dest,
+  void copy_bytes_backward(Register from, Register dest,
                               Register qword_count, Register to,
-                              Label& L_copy_32_bytes, Label& L_copy_8_bytes) {
+                              Label& L_copy_bytes, Label& L_copy_8_bytes) {
     DEBUG_ONLY(__ stop("enter at entry label, not here"));
     Label L_loop;
     __ align(OptoLoopAlignment);
-  __ BIND(L_loop);
-    if(UseUnalignedLoadStores) {
-      __ movdqu(xmm0, Address(from, qword_count, Address::times_8, 16));
-      __ movdqu(Address(dest, qword_count, Address::times_8, 16), xmm0);
-      __ movdqu(xmm1, Address(from, qword_count, Address::times_8,  0));
-      __ movdqu(Address(dest, qword_count, Address::times_8,  0), xmm1);
-
+    if (UseUnalignedLoadStores) {
+      Label L_end;
+      // Copy 64-bytes per iteration
+      __ BIND(L_loop);
+      if (UseAVX >= 2) {
+        __ vmovdqu(xmm0, Address(from, qword_count, Address::times_8, 32));
+        __ vmovdqu(Address(dest, qword_count, Address::times_8, 32), xmm0);
+        __ vmovdqu(xmm1, Address(from, qword_count, Address::times_8,  0));
+        __ vmovdqu(Address(dest, qword_count, Address::times_8,  0), xmm1);
+      } else {
+        __ movdqu(xmm0, Address(from, qword_count, Address::times_8, 48));
+        __ movdqu(Address(dest, qword_count, Address::times_8, 48), xmm0);
+        __ movdqu(xmm1, Address(from, qword_count, Address::times_8, 32));
+        __ movdqu(Address(dest, qword_count, Address::times_8, 32), xmm1);
+        __ movdqu(xmm2, Address(from, qword_count, Address::times_8, 16));
+        __ movdqu(Address(dest, qword_count, Address::times_8, 16), xmm2);
+        __ movdqu(xmm3, Address(from, qword_count, Address::times_8,  0));
+        __ movdqu(Address(dest, qword_count, Address::times_8,  0), xmm3);
+      }
+      __ BIND(L_copy_bytes);
+      __ subptr(qword_count, 8);
+      __ jcc(Assembler::greaterEqual, L_loop);
+
+      __ addptr(qword_count, 4);  // add(8) and sub(4)
+      __ jccb(Assembler::less, L_end);
+      // Copy trailing 32 bytes
+      if (UseAVX >= 2) {
+        __ vmovdqu(xmm0, Address(from, qword_count, Address::times_8, 0));
+        __ vmovdqu(Address(dest, qword_count, Address::times_8, 0), xmm0);
+      } else {
+        __ movdqu(xmm0, Address(from, qword_count, Address::times_8, 16));
+        __ movdqu(Address(dest, qword_count, Address::times_8, 16), xmm0);
+        __ movdqu(xmm1, Address(from, qword_count, Address::times_8,  0));
+        __ movdqu(Address(dest, qword_count, Address::times_8,  0), xmm1);
+      }
+      __ subptr(qword_count, 4);
+      __ BIND(L_end);
     } else {
+      // Copy 32-bytes per iteration
+      __ BIND(L_loop);
       __ movq(to, Address(from, qword_count, Address::times_8, 24));
       __ movq(Address(dest, qword_count, Address::times_8, 24), to);
       __ movq(to, Address(from, qword_count, Address::times_8, 16));
@@ -1352,10 +1415,11 @@
       __ movq(Address(dest, qword_count, Address::times_8,  8), to);
       __ movq(to, Address(from, qword_count, Address::times_8,  0));
       __ movq(Address(dest, qword_count, Address::times_8,  0), to);
+
+      __ BIND(L_copy_bytes);
+      __ subptr(qword_count, 4);
+      __ jcc(Assembler::greaterEqual, L_loop);
     }
-  __ BIND(L_copy_32_bytes);
-    __ subptr(qword_count, 4);
-    __ jcc(Assembler::greaterEqual, L_loop);
     __ addptr(qword_count, 4);
     __ jcc(Assembler::greater, L_copy_8_bytes); // Copy trailing qwords
   }
@@ -1385,7 +1449,7 @@
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
 
-    Label L_copy_32_bytes, L_copy_8_bytes, L_copy_4_bytes, L_copy_2_bytes;
+    Label L_copy_bytes, L_copy_8_bytes, L_copy_4_bytes, L_copy_2_bytes;
     Label L_copy_byte, L_exit;
     const Register from        = rdi;  // source array address
     const Register to          = rsi;  // destination array address
@@ -1417,7 +1481,7 @@
     __ lea(end_from, Address(from, qword_count, Address::times_8, -8));
     __ lea(end_to,   Address(to,   qword_count, Address::times_8, -8));
     __ negptr(qword_count); // make the count negative
-    __ jmp(L_copy_32_bytes);
+    __ jmp(L_copy_bytes);
 
     // Copy trailing qwords
   __ BIND(L_copy_8_bytes);
@@ -1460,8 +1524,8 @@
     __ leave(); // required for proper stackwalking of RuntimeStub frame
     __ ret(0);
 
-    // Copy in 32-bytes chunks
-    copy_32_bytes_forward(end_from, end_to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes);
+    // Copy in multi-bytes chunks
+    copy_bytes_forward(end_from, end_to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
     __ jmp(L_copy_4_bytes);
 
     return start;
@@ -1488,7 +1552,7 @@
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
 
-    Label L_copy_32_bytes, L_copy_8_bytes, L_copy_4_bytes, L_copy_2_bytes;
+    Label L_copy_bytes, L_copy_8_bytes, L_copy_4_bytes, L_copy_2_bytes;
     const Register from        = rdi;  // source array address
     const Register to          = rsi;  // destination array address
     const Register count       = rdx;  // elements count
@@ -1531,10 +1595,10 @@
     // Check for and copy trailing dword
   __ BIND(L_copy_4_bytes);
     __ testl(byte_count, 4);
-    __ jcc(Assembler::zero, L_copy_32_bytes);
+    __ jcc(Assembler::zero, L_copy_bytes);
     __ movl(rax, Address(from, qword_count, Address::times_8));
     __ movl(Address(to, qword_count, Address::times_8), rax);
-    __ jmp(L_copy_32_bytes);
+    __ jmp(L_copy_bytes);
 
     // Copy trailing qwords
   __ BIND(L_copy_8_bytes);
@@ -1549,8 +1613,8 @@
     __ leave(); // required for proper stackwalking of RuntimeStub frame
     __ ret(0);
 
-    // Copy in 32-bytes chunks
-    copy_32_bytes_backward(from, to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes);
+    // Copy in multi-bytes chunks
+    copy_bytes_backward(from, to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
 
     restore_arg_regs();
     inc_counter_np(SharedRuntime::_jbyte_array_copy_ctr); // Update counter after rscratch1 is free
@@ -1585,7 +1649,7 @@
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
 
-    Label L_copy_32_bytes, L_copy_8_bytes, L_copy_4_bytes,L_copy_2_bytes,L_exit;
+    Label L_copy_bytes, L_copy_8_bytes, L_copy_4_bytes,L_copy_2_bytes,L_exit;
     const Register from        = rdi;  // source array address
     const Register to          = rsi;  // destination array address
     const Register count       = rdx;  // elements count
@@ -1616,7 +1680,7 @@
     __ lea(end_from, Address(from, qword_count, Address::times_8, -8));
     __ lea(end_to,   Address(to,   qword_count, Address::times_8, -8));
     __ negptr(qword_count);
-    __ jmp(L_copy_32_bytes);
+    __ jmp(L_copy_bytes);
 
     // Copy trailing qwords
   __ BIND(L_copy_8_bytes);
@@ -1652,8 +1716,8 @@
     __ leave(); // required for proper stackwalking of RuntimeStub frame
     __ ret(0);
 
-    // Copy in 32-bytes chunks
-    copy_32_bytes_forward(end_from, end_to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes);
+    // Copy in multi-bytes chunks
+    copy_bytes_forward(end_from, end_to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
     __ jmp(L_copy_4_bytes);
 
     return start;
@@ -1700,7 +1764,7 @@
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
 
-    Label L_copy_32_bytes, L_copy_8_bytes, L_copy_4_bytes;
+    Label L_copy_bytes, L_copy_8_bytes, L_copy_4_bytes;
     const Register from        = rdi;  // source array address
     const Register to          = rsi;  // destination array address
     const Register count       = rdx;  // elements count
@@ -1735,10 +1799,10 @@
     // Check for and copy trailing dword
   __ BIND(L_copy_4_bytes);
     __ testl(word_count, 2);
-    __ jcc(Assembler::zero, L_copy_32_bytes);
+    __ jcc(Assembler::zero, L_copy_bytes);
     __ movl(rax, Address(from, qword_count, Address::times_8));
     __ movl(Address(to, qword_count, Address::times_8), rax);
-    __ jmp(L_copy_32_bytes);
+    __ jmp(L_copy_bytes);
 
     // Copy trailing qwords
   __ BIND(L_copy_8_bytes);
@@ -1753,8 +1817,8 @@
     __ leave(); // required for proper stackwalking of RuntimeStub frame
     __ ret(0);
 
-    // Copy in 32-bytes chunks
-    copy_32_bytes_backward(from, to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes);
+    // Copy in multi-bytes chunks
+    copy_bytes_backward(from, to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
 
     restore_arg_regs();
     inc_counter_np(SharedRuntime::_jshort_array_copy_ctr); // Update counter after rscratch1 is free
@@ -1790,7 +1854,7 @@
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
 
-    Label L_copy_32_bytes, L_copy_8_bytes, L_copy_4_bytes, L_exit;
+    Label L_copy_bytes, L_copy_8_bytes, L_copy_4_bytes, L_exit;
     const Register from        = rdi;  // source array address
     const Register to          = rsi;  // destination array address
     const Register count       = rdx;  // elements count
@@ -1826,7 +1890,7 @@
     __ lea(end_from, Address(from, qword_count, Address::times_8, -8));
     __ lea(end_to,   Address(to,   qword_count, Address::times_8, -8));
     __ negptr(qword_count);
-    __ jmp(L_copy_32_bytes);
+    __ jmp(L_copy_bytes);
 
     // Copy trailing qwords
   __ BIND(L_copy_8_bytes);
@@ -1853,8 +1917,8 @@
     __ leave(); // required for proper stackwalking of RuntimeStub frame
     __ ret(0);
 
-    // Copy 32-bytes chunks
-    copy_32_bytes_forward(end_from, end_to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes);
+    // Copy in multi-bytes chunks
+    copy_bytes_forward(end_from, end_to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
     __ jmp(L_copy_4_bytes);
 
     return start;
@@ -1882,7 +1946,7 @@
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
 
-    Label L_copy_32_bytes, L_copy_8_bytes, L_copy_2_bytes, L_exit;
+    Label L_copy_bytes, L_copy_8_bytes, L_copy_2_bytes, L_exit;
     const Register from        = rdi;  // source array address
     const Register to          = rsi;  // destination array address
     const Register count       = rdx;  // elements count
@@ -1916,10 +1980,10 @@
 
     // Check for and copy trailing dword
     __ testl(dword_count, 1);
-    __ jcc(Assembler::zero, L_copy_32_bytes);
+    __ jcc(Assembler::zero, L_copy_bytes);
     __ movl(rax, Address(from, dword_count, Address::times_4, -4));
     __ movl(Address(to, dword_count, Address::times_4, -4), rax);
-    __ jmp(L_copy_32_bytes);
+    __ jmp(L_copy_bytes);
 
     // Copy trailing qwords
   __ BIND(L_copy_8_bytes);
@@ -1937,8 +2001,8 @@
     __ leave(); // required for proper stackwalking of RuntimeStub frame
     __ ret(0);
 
-    // Copy in 32-bytes chunks
-    copy_32_bytes_backward(from, to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes);
+    // Copy in multi-bytes chunks
+    copy_bytes_backward(from, to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
 
    __ bind(L_exit);
      if (is_oop) {
@@ -1976,7 +2040,7 @@
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
 
-    Label L_copy_32_bytes, L_copy_8_bytes, L_exit;
+    Label L_copy_bytes, L_copy_8_bytes, L_exit;
     const Register from        = rdi;  // source array address
     const Register to          = rsi;  // destination array address
     const Register qword_count = rdx;  // elements count
@@ -2008,7 +2072,7 @@
     __ lea(end_from, Address(from, qword_count, Address::times_8, -8));
     __ lea(end_to,   Address(to,   qword_count, Address::times_8, -8));
     __ negptr(qword_count);
-    __ jmp(L_copy_32_bytes);
+    __ jmp(L_copy_bytes);
 
     // Copy trailing qwords
   __ BIND(L_copy_8_bytes);
@@ -2027,8 +2091,8 @@
       __ ret(0);
     }
 
-    // Copy 64-byte chunks
-    copy_32_bytes_forward(end_from, end_to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes);
+    // Copy in multi-bytes chunks
+    copy_bytes_forward(end_from, end_to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
 
     if (is_oop) {
     __ BIND(L_exit);
@@ -2065,7 +2129,7 @@
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
 
-    Label L_copy_32_bytes, L_copy_8_bytes, L_exit;
+    Label L_copy_bytes, L_copy_8_bytes, L_exit;
     const Register from        = rdi;  // source array address
     const Register to          = rsi;  // destination array address
     const Register qword_count = rdx;  // elements count
@@ -2091,7 +2155,7 @@
       gen_write_ref_array_pre_barrier(to, saved_count, dest_uninitialized);
     }
 
-    __ jmp(L_copy_32_bytes);
+    __ jmp(L_copy_bytes);
 
     // Copy trailing qwords
   __ BIND(L_copy_8_bytes);
@@ -2110,8 +2174,8 @@
       __ ret(0);
     }
 
-    // Copy in 32-bytes chunks
-    copy_32_bytes_backward(from, to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes);
+    // Copy in multi-bytes chunks
+    copy_bytes_backward(from, to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
 
     if (is_oop) {
     __ BIND(L_exit);
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -429,7 +429,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",
+  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",
                cores_per_cpu(), threads_per_core(),
                cpu_family(), _model, _stepping,
                (supports_cmov() ? ", cmov" : ""),
@@ -446,6 +446,7 @@
                (supports_avx()    ? ", avx" : ""),
                (supports_avx2()   ? ", avx2" : ""),
                (supports_aes()    ? ", aes" : ""),
+               (supports_erms()   ? ", erms" : ""),
                (supports_mmx_ext() ? ", mmxext" : ""),
                (supports_3dnow_prefetch() ? ", 3dnowpref" : ""),
                (supports_lzcnt()   ? ", lzcnt": ""),
@@ -671,6 +672,16 @@
     FLAG_SET_DEFAULT(UsePopCountInstruction, false);
   }
 
+  // Use fast-string operations if available.
+  if (supports_erms()) {
+    if (FLAG_IS_DEFAULT(UseFastStosb)) {
+      UseFastStosb = true;
+    }
+  } else if (UseFastStosb) {
+    warning("fast-string operations are not available on this CPU");
+    FLAG_SET_DEFAULT(UseFastStosb, false);
+  }
+
 #ifdef COMPILER2
   if (FLAG_IS_DEFAULT(AlignVector)) {
     // Modern processors allow misaligned memory operations for vectors.
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -204,7 +204,8 @@
                    avx2 : 1,
                         : 2,
                    bmi2 : 1,
-                        : 23;
+                   erms : 1,
+                        : 22;
     } bits;
   };
 
@@ -247,7 +248,8 @@
     CPU_TSCINV = (1 << 16),
     CPU_AVX    = (1 << 17),
     CPU_AVX2   = (1 << 18),
-    CPU_AES    = (1 << 19)
+    CPU_AES    = (1 << 19),
+    CPU_ERMS   = (1 << 20) // enhanced 'rep movsb/stosb' instructions
   } cpuFeatureFlags;
 
   enum {
@@ -425,6 +427,8 @@
       result |= CPU_TSCINV;
     if (_cpuid_info.std_cpuid1_ecx.bits.aes != 0)
       result |= CPU_AES;
+    if (_cpuid_info.sef_cpuid7_ebx.bits.erms != 0)
+      result |= CPU_ERMS;
 
     // AMD features.
     if (is_amd()) {
@@ -489,7 +493,7 @@
     return (_cpuid_info.std_max_function >= 0xB) &&
            // eax[4:0] | ebx[0:15] == 0 indicates invalid topology level.
            // Some cpus have max cpuid >= 0xB but do not support processor topology.
-           ((_cpuid_info.tpl_cpuidB0_eax & 0x1f | _cpuid_info.tpl_cpuidB0_ebx.bits.logical_cpus) != 0);
+           (((_cpuid_info.tpl_cpuidB0_eax & 0x1f) | _cpuid_info.tpl_cpuidB0_ebx.bits.logical_cpus) != 0);
   }
 
   static uint cores_per_cpu()  {
@@ -550,6 +554,7 @@
   static bool supports_avx2()     { return (_cpuFeatures & CPU_AVX2) != 0; }
   static bool supports_tsc()      { return (_cpuFeatures & CPU_TSC)    != 0; }
   static bool supports_aes()      { return (_cpuFeatures & CPU_AES) != 0; }
+  static bool supports_erms()     { return (_cpuFeatures & CPU_ERMS) != 0; }
 
   // Intel features
   static bool is_intel_family_core() { return is_intel() &&
--- a/hotspot/src/cpu/x86/vm/x86_32.ad	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/cpu/x86/vm/x86_32.ad	Wed Jul 05 18:36:58 2017 +0200
@@ -11572,15 +11572,28 @@
 // =======================================================================
 // fast clearing of an array
 instruct rep_stos(eCXRegI cnt, eDIRegP base, eAXRegI zero, Universe dummy, eFlagsReg cr) %{
+  predicate(!UseFastStosb);
   match(Set dummy (ClearArray cnt base));
   effect(USE_KILL cnt, USE_KILL base, KILL zero, KILL cr);
-  format %{ "SHL    ECX,1\t# Convert doublewords to words\n\t"
-            "XOR    EAX,EAX\n\t"
+  format %{ "XOR    EAX,EAX\t# ClearArray:\n\t"
+            "SHL    ECX,1\t# Convert doublewords to words\n\t"
             "REP STOS\t# store EAX into [EDI++] while ECX--" %}
-  opcode(0,0x4);
-  ins_encode( Opcode(0xD1), RegOpc(ECX),
-              OpcRegReg(0x33,EAX,EAX),
-              Opcode(0xF3), Opcode(0xAB) );
+  ins_encode %{ 
+    __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register);
+  %}
+  ins_pipe( pipe_slow );
+%}
+
+instruct rep_fast_stosb(eCXRegI cnt, eDIRegP base, eAXRegI zero, Universe dummy, eFlagsReg cr) %{
+  predicate(UseFastStosb);
+  match(Set dummy (ClearArray cnt base));
+  effect(USE_KILL cnt, USE_KILL base, KILL zero, KILL cr);
+  format %{ "XOR    EAX,EAX\t# ClearArray:\n\t"
+            "SHL    ECX,3\t# Convert doublewords to bytes\n\t"
+            "REP STOSB\t# store EAX into [EDI++] while ECX--" %}
+  ins_encode %{ 
+    __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register);
+  %}
   ins_pipe( pipe_slow );
 %}
 
--- a/hotspot/src/cpu/x86/vm/x86_64.ad	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/cpu/x86/vm/x86_64.ad	Wed Jul 05 18:36:58 2017 +0200
@@ -10374,16 +10374,33 @@
 instruct rep_stos(rcx_RegL cnt, rdi_RegP base, rax_RegI zero, Universe dummy,
                   rFlagsReg cr)
 %{
+  predicate(!UseFastStosb);
   match(Set dummy (ClearArray cnt base));
   effect(USE_KILL cnt, USE_KILL base, KILL zero, KILL cr);
 
-  format %{ "xorl    rax, rax\t# ClearArray:\n\t"
-            "rep stosq\t# Store rax to *rdi++ while rcx--" %}
-  ins_encode(opc_reg_reg(0x33, RAX, RAX), // xorl %eax, %eax
-             Opcode(0xF3), Opcode(0x48), Opcode(0xAB)); // rep REX_W stos
+  format %{ "xorq    rax, rax\t# ClearArray:\n\t"
+            "rep     stosq\t# Store rax to *rdi++ while rcx--" %}
+  ins_encode %{ 
+    __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register);
+  %}
   ins_pipe(pipe_slow);
 %}
 
+instruct rep_fast_stosb(rcx_RegL cnt, rdi_RegP base, rax_RegI zero, Universe dummy,
+                        rFlagsReg cr)
+%{
+  predicate(UseFastStosb);
+  match(Set dummy (ClearArray cnt base));
+  effect(USE_KILL cnt, USE_KILL base, KILL zero, KILL cr);
+  format %{ "xorq    rax, rax\t# ClearArray:\n\t"
+            "shlq    rcx,3\t# Convert doublewords to bytes\n\t"
+            "rep     stosb\t# Store rax to *rdi++ while rcx--" %}
+  ins_encode %{ 
+    __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register);
+  %}
+  ins_pipe( pipe_slow );
+%}
+
 instruct string_compare(rdi_RegP str1, rcx_RegI cnt1, rsi_RegP str2, rdx_RegI cnt2,
                         rax_RegI result, regD tmp1, rFlagsReg cr)
 %{
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -298,12 +298,12 @@
 
   // The next steps are taken in the product version:
   //
-  // Obtain the JAVA_HOME value from the location of libjvm[_g].so.
+  // Obtain the JAVA_HOME value from the location of libjvm.so.
   // This library should be located at:
-  // <JAVA_HOME>/jre/lib/<arch>/{client|server}/libjvm[_g].so.
+  // <JAVA_HOME>/jre/lib/<arch>/{client|server}/libjvm.so.
   //
   // If "/jre/lib/" appears at the right place in the path, then we
-  // assume libjvm[_g].so is installed in a JDK and we use this path.
+  // assume libjvm.so is installed in a JDK and we use this path.
   //
   // Otherwise exit with message: "Could not create the Java virtual machine."
   //
@@ -313,9 +313,9 @@
   // instead of exit check for $JAVA_HOME environment variable.
   //
   // If it is defined and we are able to locate $JAVA_HOME/jre/lib/<arch>,
-  // then we append a fake suffix "hotspot/libjvm[_g].so" to this path so
-  // it looks like libjvm[_g].so is installed there
-  // <JAVA_HOME>/jre/lib/<arch>/hotspot/libjvm[_g].so.
+  // then we append a fake suffix "hotspot/libjvm.so" to this path so
+  // it looks like libjvm.so is installed there
+  // <JAVA_HOME>/jre/lib/<arch>/hotspot/libjvm.so.
   //
   // Otherwise exit.
   //
@@ -1228,7 +1228,7 @@
   return getcwd(buf, buflen);
 }
 
-// check if addr is inside libjvm[_g].so
+// check if addr is inside libjvm.so
 bool os::address_is_in_vm(address addr) {
   static address libjvm_base_addr;
   Dl_info dlinfo;
@@ -1689,7 +1689,7 @@
 
 static char saved_jvm_path[MAXPATHLEN] = {0};
 
-// Find the full path to the current module, libjvm or libjvm_g
+// Find the full path to the current module, libjvm
 void os::jvm_path(char *buf, jint buflen) {
   // Error checking.
   if (buflen < MAXPATHLEN) {
@@ -1732,10 +1732,9 @@
         char* jrelib_p;
         int len;
 
-        // Check the current module name "libjvm" or "libjvm_g".
+        // Check the current module name "libjvm"
         p = strrchr(buf, '/');
         assert(strstr(p, "/libjvm") == p, "invalid library name");
-        p = strstr(p, "_g") ? "_g" : "";
 
         rp = realpath(java_home_var, buf);
         if (rp == NULL)
@@ -1764,11 +1763,9 @@
         // to complete the path to JVM being overridden.  Otherwise fallback
         // to the path to the current library.
         if (0 == access(buf, F_OK)) {
-          // Use current module name "libjvm[_g]" instead of
-          // "libjvm"debug_only("_g")"" since for fastdebug version
-          // we should have "libjvm" but debug_only("_g") adds "_g"!
+          // Use current module name "libjvm"
           len = strlen(buf);
-          snprintf(buf + len, buflen-len, "/libjvm%s%s", p, JNI_LIB_SUFFIX);
+          snprintf(buf + len, buflen-len, "/libjvm%s", JNI_LIB_SUFFIX);
         } else {
           // Fall back to path of current library
           rp = realpath(dli_fname, buf);
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -321,12 +321,12 @@
 
   // The next steps are taken in the product version:
   //
-  // Obtain the JAVA_HOME value from the location of libjvm[_g].so.
+  // Obtain the JAVA_HOME value from the location of libjvm.so.
   // This library should be located at:
-  // <JAVA_HOME>/jre/lib/<arch>/{client|server}/libjvm[_g].so.
+  // <JAVA_HOME>/jre/lib/<arch>/{client|server}/libjvm.so.
   //
   // If "/jre/lib/" appears at the right place in the path, then we
-  // assume libjvm[_g].so is installed in a JDK and we use this path.
+  // assume libjvm.so is installed in a JDK and we use this path.
   //
   // Otherwise exit with message: "Could not create the Java virtual machine."
   //
@@ -336,9 +336,9 @@
   // instead of exit check for $JAVA_HOME environment variable.
   //
   // If it is defined and we are able to locate $JAVA_HOME/jre/lib/<arch>,
-  // then we append a fake suffix "hotspot/libjvm[_g].so" to this path so
-  // it looks like libjvm[_g].so is installed there
-  // <JAVA_HOME>/jre/lib/<arch>/hotspot/libjvm[_g].so.
+  // then we append a fake suffix "hotspot/libjvm.so" to this path so
+  // it looks like libjvm.so is installed there
+  // <JAVA_HOME>/jre/lib/<arch>/hotspot/libjvm.so.
   //
   // Otherwise exit.
   //
@@ -1679,7 +1679,7 @@
   return getcwd(buf, buflen);
 }
 
-// check if addr is inside libjvm[_g].so
+// check if addr is inside libjvm.so
 bool os::address_is_in_vm(address addr) {
   static address libjvm_base_addr;
   Dl_info dlinfo;
@@ -2180,7 +2180,7 @@
 
 static char saved_jvm_path[MAXPATHLEN] = {0};
 
-// Find the full path to the current module, libjvm.so or libjvm_g.so
+// Find the full path to the current module, libjvm.so
 void os::jvm_path(char *buf, jint buflen) {
   // Error checking.
   if (buflen < MAXPATHLEN) {
@@ -2223,10 +2223,9 @@
         char* jrelib_p;
         int len;
 
-        // Check the current module name "libjvm.so" or "libjvm_g.so".
+        // Check the current module name "libjvm.so".
         p = strrchr(buf, '/');
         assert(strstr(p, "/libjvm") == p, "invalid library name");
-        p = strstr(p, "_g") ? "_g" : "";
 
         rp = realpath(java_home_var, buf);
         if (rp == NULL)
@@ -2242,11 +2241,9 @@
         }
 
         if (0 == access(buf, F_OK)) {
-          // Use current module name "libjvm[_g].so" instead of
-          // "libjvm"debug_only("_g")".so" since for fastdebug version
-          // we should have "libjvm.so" but debug_only("_g") adds "_g"!
+          // Use current module name "libjvm.so"
           len = strlen(buf);
-          snprintf(buf + len, buflen-len, "/hotspot/libjvm%s.so", p);
+          snprintf(buf + len, buflen-len, "/hotspot/libjvm.so");
         } else {
           // Go back to path of .so
           rp = realpath(dli_fname, buf);
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -734,12 +734,12 @@
 
   // The next steps are taken in the product version:
   //
-  // Obtain the JAVA_HOME value from the location of libjvm[_g].so.
+  // Obtain the JAVA_HOME value from the location of libjvm.so.
   // This library should be located at:
-  // <JAVA_HOME>/jre/lib/<arch>/{client|server}/libjvm[_g].so.
+  // <JAVA_HOME>/jre/lib/<arch>/{client|server}/libjvm.so.
   //
   // If "/jre/lib/" appears at the right place in the path, then we
-  // assume libjvm[_g].so is installed in a JDK and we use this path.
+  // assume libjvm.so is installed in a JDK and we use this path.
   //
   // Otherwise exit with message: "Could not create the Java virtual machine."
   //
@@ -749,9 +749,9 @@
   // instead of exit check for $JAVA_HOME environment variable.
   //
   // If it is defined and we are able to locate $JAVA_HOME/jre/lib/<arch>,
-  // then we append a fake suffix "hotspot/libjvm[_g].so" to this path so
-  // it looks like libjvm[_g].so is installed there
-  // <JAVA_HOME>/jre/lib/<arch>/hotspot/libjvm[_g].so.
+  // then we append a fake suffix "hotspot/libjvm.so" to this path so
+  // it looks like libjvm.so is installed there
+  // <JAVA_HOME>/jre/lib/<arch>/hotspot/libjvm.so.
   //
   // Otherwise exit.
   //
@@ -1934,7 +1934,7 @@
   return getcwd(buf, buflen);
 }
 
-// check if addr is inside libjvm[_g].so
+// check if addr is inside libjvm.so
 bool os::address_is_in_vm(address addr) {
   static address libjvm_base_addr;
   Dl_info dlinfo;
@@ -2474,7 +2474,7 @@
 
 static char saved_jvm_path[MAXPATHLEN] = { 0 };
 
-// Find the full path to the current module, libjvm.so or libjvm_g.so
+// Find the full path to the current module, libjvm.so
 void os::jvm_path(char *buf, jint buflen) {
   // Error checking.
   if (buflen < MAXPATHLEN) {
@@ -2522,10 +2522,9 @@
           strcpy(cpu_arch, "amd64");
         }
 #endif
-        // Check the current module name "libjvm.so" or "libjvm_g.so".
+        // Check the current module name "libjvm.so".
         p = strrchr(buf, '/');
         assert(strstr(p, "/libjvm") == p, "invalid library name");
-        p = strstr(p, "_g") ? "_g" : "";
 
         realpath(java_home_var, buf);
         // determine if this is a legacy image or modules image
@@ -2538,11 +2537,9 @@
         }
 
         if (0 == access(buf, F_OK)) {
-          // Use current module name "libjvm[_g].so" instead of
-          // "libjvm"debug_only("_g")".so" since for fastdebug version
-          // we should have "libjvm.so" but debug_only("_g") adds "_g"!
+          // Use current module name "libjvm.so"
           len = strlen(buf);
-          snprintf(buf + len, buflen-len, "/hotspot/libjvm%s.so", p);
+          snprintf(buf + len, buflen-len, "/hotspot/libjvm.so");
         } else {
           // Go back to path of .so
           realpath((char *)dlinfo.dli_fname, buf);
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -182,7 +182,7 @@
 
       if (!getenv("_ALT_JAVA_HOME_DIR", home_dir, MAX_PATH)) {
           os::jvm_path(home_dir, sizeof(home_dir));
-          // Found the full path to jvm[_g].dll.
+          // Found the full path to jvm.dll.
           // Now cut the path to <java_home>/jre if we can.
           *(strrchr(home_dir, '\\')) = '\0';  /* get rid of \jvm.dll */
           pslash = strrchr(home_dir, '\\');
@@ -1715,7 +1715,7 @@
 
 static char saved_jvm_path[MAX_PATH] = {0};
 
-// Find the full path to the current module, jvm.dll or jvm_g.dll
+// Find the full path to the current module, jvm.dll
 void os::jvm_path(char *buf, jint buflen) {
   // Error checking.
   if (buflen < MAX_PATH) {
--- a/hotspot/src/share/tools/ProjectCreator/ProjectCreator.java	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/tools/ProjectCreator/ProjectCreator.java	Wed Jul 05 18:36:58 2017 +0200
@@ -36,7 +36,7 @@
             + "into .dsp file, substituting for path given in "
             + "-sourceBase. Example: HotSpotWorkSpace>");
       System.err.println("  -dllLoc <path to directory in which to put "
-            + "jvm.dll and jvm_g.dll; no trailing slash>");
+            + "jvm.dll; no trailing slash>");
       System.err.println("  If any of the above are specified, "
             + "they must all be.");
       System.err.println("  Additional, optional arguments, which can be "
--- a/hotspot/src/share/vm/asm/assembler.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/asm/assembler.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -216,8 +216,6 @@
   bool isByte(int x) const             { return 0 <= x && x < 0x100; }
   bool isShiftCount(int x) const       { return 0 <= x && x < 32; }
 
-  void emit_long(jint x) { emit_int32(x); }  // deprecated
-
   // Instruction boundaries (required when emitting relocatable values).
   class InstructionMark: public StackObj {
    private:
--- a/hotspot/src/share/vm/c1/c1_LIR.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/c1/c1_LIR.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -2259,7 +2259,7 @@
   typedef enum { inputMode, firstMode = inputMode, tempMode, outputMode, numModes, invalidMode = -1 } OprMode;
 
   enum {
-    maxNumberOfOperands = 16,
+    maxNumberOfOperands = 20,
     maxNumberOfInfos = 4
   };
 
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -906,6 +906,7 @@
                                              bool* is_synthetic_addr,
                                              u2* generic_signature_index_addr,
                                              AnnotationArray** field_annotations,
+                                             AnnotationArray** field_type_annotations,
                                              ClassFileParser::FieldAnnotationCollector* parsed_annotations,
                                              TRAPS) {
   ClassFileStream* cfs = stream();
@@ -917,6 +918,10 @@
   int runtime_visible_annotations_length = 0;
   u1* runtime_invisible_annotations = NULL;
   int runtime_invisible_annotations_length = 0;
+  u1* runtime_visible_type_annotations = NULL;
+  int runtime_visible_type_annotations_length = 0;
+  u1* runtime_invisible_type_annotations = NULL;
+  int runtime_invisible_type_annotations_length = 0;
   while (attributes_count--) {
     cfs->guarantee_more(6, CHECK);  // attribute_name_index, attribute_length
     u2 attribute_name_index = cfs->get_u2_fast();
@@ -971,6 +976,16 @@
         runtime_invisible_annotations = cfs->get_u1_buffer();
         assert(runtime_invisible_annotations != NULL, "null invisible annotations");
         cfs->skip_u1(runtime_invisible_annotations_length, CHECK);
+      } else if (attribute_name == vmSymbols::tag_runtime_visible_type_annotations()) {
+        runtime_visible_type_annotations_length = attribute_length;
+        runtime_visible_type_annotations = cfs->get_u1_buffer();
+        assert(runtime_visible_type_annotations != NULL, "null visible type annotations");
+        cfs->skip_u1(runtime_visible_type_annotations_length, CHECK);
+      } else if (PreserveAllAnnotations && attribute_name == vmSymbols::tag_runtime_invisible_type_annotations()) {
+        runtime_invisible_type_annotations_length = attribute_length;
+        runtime_invisible_type_annotations = cfs->get_u1_buffer();
+        assert(runtime_invisible_type_annotations != NULL, "null invisible type annotations");
+        cfs->skip_u1(runtime_invisible_type_annotations_length, CHECK);
       } else {
         cfs->skip_u1(attribute_length, CHECK);  // Skip unknown attributes
       }
@@ -988,6 +1003,12 @@
                                             runtime_invisible_annotations,
                                             runtime_invisible_annotations_length,
                                             CHECK);
+  *field_type_annotations = assemble_annotations(loader_data,
+                                            runtime_visible_type_annotations,
+                                            runtime_visible_type_annotations_length,
+                                            runtime_invisible_type_annotations,
+                                            runtime_invisible_type_annotations_length,
+                                            CHECK);
   return;
 }
 
@@ -1084,6 +1105,7 @@
                                          bool is_interface,
                                          FieldAllocationCount *fac,
                                          Array<AnnotationArray*>** fields_annotations,
+                                         Array<AnnotationArray*>** fields_type_annotations,
                                          u2* java_fields_count_ptr, TRAPS) {
   ClassFileStream* cfs = stream();
   cfs->guarantee_more(2, CHECK_NULL);  // length
@@ -1119,6 +1141,7 @@
              THREAD, u2, total_fields * (FieldInfo::field_slots + 1));
 
   AnnotationArray* field_annotations = NULL;
+  AnnotationArray* field_type_annotations = NULL;
   // The generic signature slots start after all other fields' data.
   int generic_signature_slot = total_fields * FieldInfo::field_slots;
   int num_generic_signature = 0;
@@ -1160,7 +1183,7 @@
                              cp, attributes_count, is_static, signature_index,
                              &constantvalue_index, &is_synthetic,
                              &generic_signature_index, &field_annotations,
-                             &parsed_annotations,
+                             &field_type_annotations, &parsed_annotations,
                              CHECK_NULL);
       if (field_annotations != NULL) {
         if (*fields_annotations == NULL) {
@@ -1170,6 +1193,14 @@
         }
         (*fields_annotations)->at_put(n, field_annotations);
       }
+      if (field_type_annotations != NULL) {
+        if (*fields_type_annotations == NULL) {
+          *fields_type_annotations = MetadataFactory::new_array<AnnotationArray*>(
+                                                  loader_data, length, NULL,
+                                                  CHECK_NULL);
+        }
+        (*fields_type_annotations)->at_put(n, field_type_annotations);
+      }
       if (is_synthetic) {
         access_flags.set_is_synthetic();
       }
@@ -1831,6 +1862,7 @@
                                            AnnotationArray** method_annotations,
                                            AnnotationArray** method_parameter_annotations,
                                            AnnotationArray** method_default_annotations,
+                                           AnnotationArray** method_type_annotations,
                                            TRAPS) {
   ClassFileStream* cfs = stream();
   methodHandle nullHandle;
@@ -1903,6 +1935,8 @@
   u2** localvariable_table_start;
   u2* localvariable_type_table_length;
   u2** localvariable_type_table_start;
+  u2 method_parameters_length = 0;
+  u1* method_parameters_data = NULL;
   bool parsed_code_attribute = false;
   bool parsed_checked_exceptions_attribute = false;
   bool parsed_stackmap_attribute = false;
@@ -1918,6 +1952,10 @@
   int runtime_visible_parameter_annotations_length = 0;
   u1* runtime_invisible_parameter_annotations = NULL;
   int runtime_invisible_parameter_annotations_length = 0;
+  u1* runtime_visible_type_annotations = NULL;
+  int runtime_visible_type_annotations_length = 0;
+  u1* runtime_invisible_type_annotations = NULL;
+  int runtime_invisible_type_annotations_length = 0;
   u1* annotation_default = NULL;
   int annotation_default_length = 0;
 
@@ -2108,6 +2146,14 @@
             parse_checked_exceptions(&checked_exceptions_length,
                                      method_attribute_length,
                                      cp, CHECK_(nullHandle));
+    } else if (method_attribute_name == vmSymbols::tag_method_parameters()) {
+      method_parameters_length = cfs->get_u1_fast();
+      method_parameters_data = cfs->get_u1_buffer();
+      cfs->skip_u2_fast(method_parameters_length);
+      cfs->skip_u4_fast(method_parameters_length);
+      // ignore this attribute if it cannot be reflected
+      if (!SystemDictionary::Parameter_klass_loaded())
+        method_parameters_length = 0;
     } else if (method_attribute_name == vmSymbols::tag_synthetic()) {
       if (method_attribute_length != 0) {
         classfile_parse_error(
@@ -2159,6 +2205,17 @@
         annotation_default = cfs->get_u1_buffer();
         assert(annotation_default != NULL, "null annotation default");
         cfs->skip_u1(annotation_default_length, CHECK_(nullHandle));
+      } else if (method_attribute_name == vmSymbols::tag_runtime_visible_type_annotations()) {
+        runtime_visible_type_annotations_length = method_attribute_length;
+        runtime_visible_type_annotations = cfs->get_u1_buffer();
+        assert(runtime_visible_type_annotations != NULL, "null visible type annotations");
+        // No need for the VM to parse Type annotations
+        cfs->skip_u1(runtime_visible_type_annotations_length, CHECK_(nullHandle));
+      } else if (PreserveAllAnnotations && method_attribute_name == vmSymbols::tag_runtime_invisible_type_annotations()) {
+        runtime_invisible_type_annotations_length = method_attribute_length;
+        runtime_invisible_type_annotations = cfs->get_u1_buffer();
+        assert(runtime_invisible_type_annotations != NULL, "null invisible type annotations");
+        cfs->skip_u1(runtime_invisible_type_annotations_length, CHECK_(nullHandle));
       } else {
         // Skip unknown attributes
         cfs->skip_u1(method_attribute_length, CHECK_(nullHandle));
@@ -2184,7 +2241,8 @@
   Method* m = Method::allocate(
       loader_data, code_length, access_flags, linenumber_table_length,
       total_lvt_length, exception_table_length, checked_exceptions_length,
-      generic_signature_index, ConstMethod::NORMAL, CHECK_(nullHandle));
+      method_parameters_length, generic_signature_index,
+      ConstMethod::NORMAL, CHECK_(nullHandle));
 
   ClassLoadingService::add_class_method_size(m->size()*HeapWordSize);
 
@@ -2232,6 +2290,18 @@
                              exception_table_start, size);
   }
 
+  // Copy method parameters
+  if (method_parameters_length > 0) {
+    MethodParametersElement* elem = m->constMethod()->method_parameters_start();
+    for(int i = 0; i < method_parameters_length; i++) {
+      elem[i].name_cp_index =
+        Bytes::get_Java_u2(method_parameters_data);
+      method_parameters_data += 2;
+      elem[i].flags = Bytes::get_Java_u4(method_parameters_data);
+      method_parameters_data += 4;
+    }
+  }
+
   // Copy checked exceptions
   if (checked_exceptions_length > 0) {
     int size = checked_exceptions_length * sizeof(CheckedExceptionElement) / sizeof(u2);
@@ -2333,6 +2403,12 @@
                                                      NULL,
                                                      0,
                                                      CHECK_(nullHandle));
+  *method_type_annotations = assemble_annotations(loader_data,
+                                                  runtime_visible_type_annotations,
+                                                  runtime_visible_type_annotations_length,
+                                                  runtime_invisible_type_annotations,
+                                                  runtime_invisible_type_annotations_length,
+                                                  CHECK_(nullHandle));
 
   if (name == vmSymbols::finalize_method_name() &&
       signature == vmSymbols::void_method_signature()) {
@@ -2364,12 +2440,14 @@
                                                Array<AnnotationArray*>** methods_annotations,
                                                Array<AnnotationArray*>** methods_parameter_annotations,
                                                Array<AnnotationArray*>** methods_default_annotations,
+                                               Array<AnnotationArray*>** methods_type_annotations,
                                                bool* has_default_methods,
                                                TRAPS) {
   ClassFileStream* cfs = stream();
   AnnotationArray* method_annotations = NULL;
   AnnotationArray* method_parameter_annotations = NULL;
   AnnotationArray* method_default_annotations = NULL;
+  AnnotationArray* method_type_annotations = NULL;
   cfs->guarantee_more(2, CHECK_NULL);  // length
   u2 length = cfs->get_u2_fast();
   if (length == 0) {
@@ -2386,6 +2464,7 @@
                                          &method_annotations,
                                          &method_parameter_annotations,
                                          &method_default_annotations,
+                                         &method_type_annotations,
                                          CHECK_NULL);
 
       if (method->is_final()) {
@@ -2411,7 +2490,13 @@
             MetadataFactory::new_array<AnnotationArray*>(loader_data, length, NULL, CHECK_NULL);
       }
       (*methods_default_annotations)->at_put(index, method_default_annotations);
+      if (*methods_type_annotations == NULL) {
+        *methods_type_annotations =
+             MetadataFactory::new_array<AnnotationArray*>(loader_data, length, NULL, CHECK_NULL);
+      }
+      (*methods_type_annotations)->at_put(index, method_type_annotations);
     }
+
     if (_need_verify && length > 1) {
       // Check duplicated methods
       ResourceMark rm(THREAD);
@@ -2445,6 +2530,7 @@
                                           Array<AnnotationArray*>* methods_annotations,
                                           Array<AnnotationArray*>* methods_parameter_annotations,
                                           Array<AnnotationArray*>* methods_default_annotations,
+                                          Array<AnnotationArray*>* methods_type_annotations,
                                               TRAPS) {
   int length = methods->length();
   // If JVMTI original method ordering or sharing is enabled we have to
@@ -2463,7 +2549,8 @@
   // Note that the ordering is not alphabetical, see Symbol::fast_compare
   Method::sort_methods(methods, methods_annotations,
                        methods_parameter_annotations,
-                       methods_default_annotations);
+                       methods_default_annotations,
+                       methods_type_annotations);
 
   // If JVMTI original method ordering or sharing is enabled construct int
   // array remembering the original ordering
@@ -2728,6 +2815,10 @@
   int runtime_visible_annotations_length = 0;
   u1* runtime_invisible_annotations = NULL;
   int runtime_invisible_annotations_length = 0;
+  u1* runtime_visible_type_annotations = NULL;
+  int runtime_visible_type_annotations_length = 0;
+  u1* runtime_invisible_type_annotations = NULL;
+  int runtime_invisible_type_annotations_length = 0;
   u1* inner_classes_attribute_start = NULL;
   u4  inner_classes_attribute_length = 0;
   u2  enclosing_method_class_index = 0;
@@ -2834,6 +2925,17 @@
           classfile_parse_error("Multiple BootstrapMethods attributes in class file %s", CHECK);
         parsed_bootstrap_methods_attribute = true;
         parse_classfile_bootstrap_methods_attribute(loader_data, cp, attribute_length, CHECK);
+      } else if (tag == vmSymbols::tag_runtime_visible_type_annotations()) {
+        runtime_visible_type_annotations_length = attribute_length;
+        runtime_visible_type_annotations = cfs->get_u1_buffer();
+        assert(runtime_visible_type_annotations != NULL, "null visible type annotations");
+        // No need for the VM to parse Type annotations
+        cfs->skip_u1(runtime_visible_type_annotations_length, CHECK);
+      } else if (PreserveAllAnnotations && tag == vmSymbols::tag_runtime_invisible_type_annotations()) {
+        runtime_invisible_type_annotations_length = attribute_length;
+        runtime_invisible_type_annotations = cfs->get_u1_buffer();
+        assert(runtime_invisible_type_annotations != NULL, "null invisible type annotations");
+        cfs->skip_u1(runtime_invisible_type_annotations_length, CHECK);
       } else {
         // Unknown attribute
         cfs->skip_u1(attribute_length, CHECK);
@@ -2850,6 +2952,13 @@
                                                       runtime_invisible_annotations_length,
                                                       CHECK);
   set_class_annotations(annotations);
+  AnnotationArray* type_annotations = assemble_annotations(loader_data,
+                                                           runtime_visible_type_annotations,
+                                                           runtime_visible_type_annotations_length,
+                                                           runtime_invisible_type_annotations,
+                                                           runtime_invisible_type_annotations_length,
+                                                           CHECK);
+  set_class_type_annotations(type_annotations);
 
   if (parsed_innerclasses_attribute || parsed_enclosingmethod_attribute) {
     u2 num_of_classes = parse_classfile_inner_classes_attribute(
@@ -2956,6 +3065,7 @@
                                                     TempNewSymbol& parsed_name,
                                                     bool verify,
                                                     TRAPS) {
+
   // When a retransformable agent is attached, JVMTI caches the
   // class bytes that existed before the first retransformation.
   // If RedefineClasses() was used before the retransformable
@@ -3190,7 +3300,9 @@
     // Fields (offsets are filled in later)
     FieldAllocationCount fac;
     Array<AnnotationArray*>* fields_annotations = NULL;
+    Array<AnnotationArray*>* fields_type_annotations = NULL;
     Array<u2>* fields = parse_fields(loader_data, class_name, cp, access_flags.is_interface(), &fac, &fields_annotations,
+                                          &fields_type_annotations,
                                           &java_fields_count,
                                           CHECK_(nullHandle));
     // Methods
@@ -3202,6 +3314,7 @@
     Array<AnnotationArray*>* methods_annotations = NULL;
     Array<AnnotationArray*>* methods_parameter_annotations = NULL;
     Array<AnnotationArray*>* methods_default_annotations = NULL;
+    Array<AnnotationArray*>* methods_type_annotations = NULL;
     Array<Method*>* methods = parse_methods(loader_data,
                                             cp, access_flags.is_interface(),
                                             &promoted_flags,
@@ -3209,6 +3322,7 @@
                                             &methods_annotations,
                                             &methods_parameter_annotations,
                                             &methods_default_annotations,
+                                            &methods_type_annotations,
                                             &has_default_methods,
                                             CHECK_(nullHandle));
 
@@ -3270,6 +3384,7 @@
                                                methods_annotations,
                                                methods_parameter_annotations,
                                                methods_default_annotations,
+                                               methods_type_annotations,
                                                CHECK_(nullHandle));
 
     // promote flags from parse_methods() to the klass' flags
@@ -3687,11 +3802,13 @@
     if (is_anonymous())  // I am well known to myself
       cp->klass_at_put(this_class_index, this_klass()); // eagerly resolve
 
+    // Allocate an annotation type if needed.
     if (fields_annotations != NULL ||
         methods_annotations != NULL ||
         methods_parameter_annotations != NULL ||
-        methods_default_annotations != NULL) {
-      // Allocate an annotation type if needed.
+        methods_default_annotations != NULL ||
+        fields_type_annotations != NULL ||
+        methods_type_annotations != NULL) {
       Annotations* anno = Annotations::allocate(loader_data,
                             fields_annotations, methods_annotations,
                             methods_parameter_annotations,
@@ -3701,6 +3818,16 @@
       this_klass->set_annotations(NULL);
     }
 
+    if (fields_type_annotations != NULL ||
+        methods_type_annotations != NULL) {
+      assert(this_klass->annotations() != NULL, "annotations should have been allocated");
+      Annotations* anno = Annotations::allocate(loader_data,
+                                                fields_type_annotations,
+                                                methods_type_annotations,
+                                                NULL,
+                                                NULL, CHECK_(nullHandle));
+      this_klass->annotations()->set_type_annotations(anno);
+    }
 
     this_klass->set_minor_version(minor_version);
     this_klass->set_major_version(major_version);
@@ -3725,6 +3852,7 @@
     // Fill in field values obtained by parse_classfile_attributes
     if (parsed_annotations.has_any_annotations())
       parsed_annotations.apply_to(this_klass);
+
     // Create annotations
     if (_annotations != NULL && this_klass->annotations() == NULL) {
       Annotations* anno = Annotations::allocate(loader_data, CHECK_NULL);
@@ -3732,6 +3860,19 @@
     }
     apply_parsed_class_attributes(this_klass);
 
+    // Create type annotations
+    if (_type_annotations != NULL) {
+      if (this_klass->annotations() == NULL) {
+        Annotations* anno = Annotations::allocate(loader_data, CHECK_NULL);
+        this_klass->set_annotations(anno);
+      }
+      if (this_klass->annotations()->type_annotations() == NULL) {
+        Annotations* anno = Annotations::allocate(loader_data, CHECK_NULL);
+        this_klass->annotations()->set_type_annotations(anno);
+      }
+      this_klass->annotations()->type_annotations()->set_class_annotations(_type_annotations);
+    }
+
     // Miranda methods
     if ((num_miranda_methods > 0) ||
         // if this class introduced new miranda methods or
--- a/hotspot/src/share/vm/classfile/classFileParser.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/classfile/classFileParser.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -64,6 +64,7 @@
   int        _sde_length;
   Array<u2>* _inner_classes;
   AnnotationArray* _annotations;
+  AnnotationArray* _type_annotations;
 
   void set_class_synthetic_flag(bool x)           { _synthetic_flag = x; }
   void set_class_sourcefile(Symbol* x)            { _sourcefile = x; }
@@ -71,12 +72,14 @@
   void set_class_sde_buffer(char* x, int len)     { _sde_buffer = x; _sde_length = len; }
   void set_class_inner_classes(Array<u2>* x)      { _inner_classes = x; }
   void set_class_annotations(AnnotationArray* x)  { _annotations = x; }
+  void set_class_type_annotations(AnnotationArray* x)  { _type_annotations = x; }
   void init_parsed_class_attributes() {
     _synthetic_flag = false;
     _sourcefile = NULL;
     _generic_signature = NULL;
     _sde_buffer = NULL;
     _sde_length = 0;
+    _annotations = _type_annotations = NULL;
     // initialize the other flags too:
     _has_finalizer = _has_empty_finalizer = _has_vanilla_constructor = false;
     _max_bootstrap_specifier_index = -1;
@@ -163,6 +166,7 @@
                               bool* is_synthetic_addr,
                               u2* generic_signature_index_addr,
                               AnnotationArray** field_annotations,
+                              AnnotationArray** field_type_annotations,
                               FieldAnnotationCollector* parsed_annotations,
                               TRAPS);
   Array<u2>* parse_fields(ClassLoaderData* loader_data,
@@ -170,6 +174,7 @@
                           constantPoolHandle cp, bool is_interface,
                           FieldAllocationCount *fac,
                           Array<AnnotationArray*>** fields_annotations,
+                          Array<AnnotationArray*>** fields_type_annotations,
                           u2* java_fields_count_ptr, TRAPS);
 
   // Method parsing
@@ -180,6 +185,7 @@
                             AnnotationArray** method_annotations,
                             AnnotationArray** method_parameter_annotations,
                             AnnotationArray** method_default_annotations,
+                            AnnotationArray** method_type_annotations,
                             TRAPS);
   Array<Method*>* parse_methods(ClassLoaderData* loader_data,
                                 constantPoolHandle cp,
@@ -189,6 +195,7 @@
                                 Array<AnnotationArray*>** methods_annotations,
                                 Array<AnnotationArray*>** methods_parameter_annotations,
                                 Array<AnnotationArray*>** methods_default_annotations,
+                                Array<AnnotationArray*>** methods_type_annotations,
                                 bool* has_default_method,
                                 TRAPS);
   Array<int>* sort_methods(ClassLoaderData* loader_data,
@@ -196,6 +203,7 @@
                            Array<AnnotationArray*>* methods_annotations,
                            Array<AnnotationArray*>* methods_parameter_annotations,
                            Array<AnnotationArray*>* methods_default_annotations,
+                           Array<AnnotationArray*>* methods_type_annotations,
                                 TRAPS);
   u2* parse_exception_table(ClassLoaderData* loader_data,
                             u4 code_length, u4 exception_table_length,
--- a/hotspot/src/share/vm/classfile/classFileStream.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/classfile/classFileStream.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -93,3 +93,10 @@
   }
   _current += length * 2;
 }
+
+void ClassFileStream::skip_u4(int length, TRAPS) {
+  if (_need_verify) {
+    guarantee_more(length * 4, CHECK);
+  }
+  _current += length * 4;
+}
--- a/hotspot/src/share/vm/classfile/classFileStream.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/classfile/classFileStream.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -133,6 +133,11 @@
     _current += 2 * length;
   }
 
+  void skip_u4(int length, TRAPS);
+  void skip_u4_fast(int length) {
+    _current += 4 * length;
+  }
+
   // Tells whether eos is reached
   bool at_eos() const          { return _current == _buffer_end; }
 };
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -330,10 +330,19 @@
     }
     if (this == the_null_class_loader_data()) {
       assert (class_loader() == NULL, "Must be");
-      size_t word_size = Metaspace::first_chunk_word_size();
-      set_metaspace(new Metaspace(_metaspace_lock, word_size));
+      set_metaspace(new Metaspace(_metaspace_lock, Metaspace::BootMetaspaceType));
+    } else if (is_anonymous()) {
+      if (TraceClassLoaderData && Verbose && class_loader() != NULL) {
+        tty->print_cr("is_anonymous: %s", class_loader()->klass()->internal_name());
+      }
+      set_metaspace(new Metaspace(_metaspace_lock, Metaspace::AnonymousMetaspaceType));
+    } else if (class_loader()->is_a(SystemDictionary::reflect_DelegatingClassLoader_klass())) {
+      if (TraceClassLoaderData && Verbose && class_loader() != NULL) {
+        tty->print_cr("is_reflection: %s", class_loader()->klass()->internal_name());
+      }
+      set_metaspace(new Metaspace(_metaspace_lock, Metaspace::ReflectionMetaspaceType));
     } else {
-      set_metaspace(new Metaspace(_metaspace_lock));  // default size for now.
+      set_metaspace(new Metaspace(_metaspace_lock, Metaspace::StandardMetaspaceType));
     }
   }
   return _metaspace;
@@ -672,8 +681,8 @@
          "only supported for null loader data for now");
   assert (!_shared_metaspaces_initialized, "only initialize once");
   MutexLockerEx ml(metaspace_lock(),  Mutex::_no_safepoint_check_flag);
-  _ro_metaspace = new Metaspace(_metaspace_lock, SharedReadOnlySize/wordSize);
-  _rw_metaspace = new Metaspace(_metaspace_lock, SharedReadWriteSize/wordSize);
+  _ro_metaspace = new Metaspace(_metaspace_lock, Metaspace::ROMetaspaceType);
+  _rw_metaspace = new Metaspace(_metaspace_lock, Metaspace::ReadWriteMetaspaceType);
   _shared_metaspaces_initialized = true;
 }
 
--- a/hotspot/src/share/vm/classfile/defaultMethods.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/classfile/defaultMethods.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -1148,7 +1148,8 @@
   int code_length = bytecodes->length();
 
   Method* m = Method::allocate(cp->pool_holder()->class_loader_data(),
-      code_length, flags, 0, 0, 0, 0, 0, mt, CHECK_NULL);
+                               code_length, flags, 0, 0, 0, 0, 0, 0,
+                               mt, CHECK_NULL);
 
   m->set_constants(NULL); // This will get filled in later
   m->set_name_index(cp->utf8(name));
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -1813,10 +1813,12 @@
   annotations_offset = -1;
   parameter_annotations_offset = -1;
   annotation_default_offset = -1;
+  type_annotations_offset = -1;
   compute_optional_offset(signature_offset,             k, vmSymbols::signature_name(),             vmSymbols::string_signature());
   compute_optional_offset(annotations_offset,           k, vmSymbols::annotations_name(),           vmSymbols::byte_array_signature());
   compute_optional_offset(parameter_annotations_offset, k, vmSymbols::parameter_annotations_name(), vmSymbols::byte_array_signature());
   compute_optional_offset(annotation_default_offset,    k, vmSymbols::annotation_default_name(),    vmSymbols::byte_array_signature());
+  compute_optional_offset(type_annotations_offset,      k, vmSymbols::type_annotations_name(),      vmSymbols::byte_array_signature());
 }
 
 Handle java_lang_reflect_Method::create(TRAPS) {
@@ -1962,6 +1964,22 @@
   method->obj_field_put(annotation_default_offset, value);
 }
 
+bool java_lang_reflect_Method::has_type_annotations_field() {
+  return (type_annotations_offset >= 0);
+}
+
+oop java_lang_reflect_Method::type_annotations(oop method) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  assert(has_type_annotations_field(), "type_annotations field must be present");
+  return method->obj_field(type_annotations_offset);
+}
+
+void java_lang_reflect_Method::set_type_annotations(oop method, oop value) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  assert(has_type_annotations_field(), "type_annotations field must be present");
+  method->obj_field_put(type_annotations_offset, value);
+}
+
 void java_lang_reflect_Constructor::compute_offsets() {
   Klass* k = SystemDictionary::reflect_Constructor_klass();
   compute_offset(clazz_offset,          k, vmSymbols::clazz_name(),          vmSymbols::class_signature());
@@ -1973,9 +1991,11 @@
   signature_offset = -1;
   annotations_offset = -1;
   parameter_annotations_offset = -1;
+  type_annotations_offset = -1;
   compute_optional_offset(signature_offset,             k, vmSymbols::signature_name(),             vmSymbols::string_signature());
   compute_optional_offset(annotations_offset,           k, vmSymbols::annotations_name(),           vmSymbols::byte_array_signature());
   compute_optional_offset(parameter_annotations_offset, k, vmSymbols::parameter_annotations_name(), vmSymbols::byte_array_signature());
+  compute_optional_offset(type_annotations_offset,      k, vmSymbols::type_annotations_name(),      vmSymbols::byte_array_signature());
 }
 
 Handle java_lang_reflect_Constructor::create(TRAPS) {
@@ -2086,6 +2106,22 @@
   method->obj_field_put(parameter_annotations_offset, value);
 }
 
+bool java_lang_reflect_Constructor::has_type_annotations_field() {
+  return (type_annotations_offset >= 0);
+}
+
+oop java_lang_reflect_Constructor::type_annotations(oop constructor) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  assert(has_type_annotations_field(), "type_annotations field must be present");
+  return constructor->obj_field(type_annotations_offset);
+}
+
+void java_lang_reflect_Constructor::set_type_annotations(oop constructor, oop value) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  assert(has_type_annotations_field(), "type_annotations field must be present");
+  constructor->obj_field_put(type_annotations_offset, value);
+}
+
 void java_lang_reflect_Field::compute_offsets() {
   Klass* k = SystemDictionary::reflect_Field_klass();
   compute_offset(clazz_offset,     k, vmSymbols::clazz_name(),     vmSymbols::class_signature());
@@ -2096,8 +2132,10 @@
   // The generic signature and annotations fields are only present in 1.5
   signature_offset = -1;
   annotations_offset = -1;
+  type_annotations_offset = -1;
   compute_optional_offset(signature_offset, k, vmSymbols::signature_name(), vmSymbols::string_signature());
   compute_optional_offset(annotations_offset,  k, vmSymbols::annotations_name(),  vmSymbols::byte_array_signature());
+  compute_optional_offset(type_annotations_offset,  k, vmSymbols::type_annotations_name(),  vmSymbols::byte_array_signature());
 }
 
 Handle java_lang_reflect_Field::create(TRAPS) {
@@ -2192,6 +2230,21 @@
   field->obj_field_put(annotations_offset, value);
 }
 
+bool java_lang_reflect_Field::has_type_annotations_field() {
+  return (type_annotations_offset >= 0);
+}
+
+oop java_lang_reflect_Field::type_annotations(oop field) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  assert(has_type_annotations_field(), "type_annotations field must be present");
+  return field->obj_field(type_annotations_offset);
+}
+
+void java_lang_reflect_Field::set_type_annotations(oop field, oop value) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  assert(has_type_annotations_field(), "type_annotations field must be present");
+  field->obj_field_put(type_annotations_offset, value);
+}
 
 void sun_reflect_ConstantPool::compute_offsets() {
   Klass* k = SystemDictionary::reflect_ConstantPool_klass();
@@ -2202,6 +2255,66 @@
   }
 }
 
+void java_lang_reflect_Parameter::compute_offsets() {
+  Klass* k = SystemDictionary::reflect_Parameter_klass();
+  if(NULL != k) {
+    compute_offset(name_offset,        k, vmSymbols::name_name(),        vmSymbols::string_signature());
+    compute_offset(modifiers_offset,   k, vmSymbols::modifiers_name(),   vmSymbols::int_signature());
+    compute_offset(index_offset,       k, vmSymbols::index_name(),       vmSymbols::int_signature());
+    compute_offset(executable_offset,  k, vmSymbols::executable_name(),  vmSymbols::executable_signature());
+  }
+}
+
+Handle java_lang_reflect_Parameter::create(TRAPS) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  Symbol* name = vmSymbols::java_lang_reflect_Parameter();
+  Klass* k = SystemDictionary::resolve_or_fail(name, true, CHECK_NH);
+  instanceKlassHandle klass (THREAD, k);
+  // Ensure it is initialized
+  klass->initialize(CHECK_NH);
+  return klass->allocate_instance_handle(CHECK_NH);
+}
+
+oop java_lang_reflect_Parameter::name(oop param) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  return param->obj_field(name_offset);
+}
+
+void java_lang_reflect_Parameter::set_name(oop param, oop value) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  param->obj_field_put(name_offset, value);
+}
+
+int java_lang_reflect_Parameter::modifiers(oop param) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  return param->int_field(modifiers_offset);
+}
+
+void java_lang_reflect_Parameter::set_modifiers(oop param, int value) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  param->int_field_put(modifiers_offset, value);
+}
+
+int java_lang_reflect_Parameter::index(oop param) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  return param->int_field(index_offset);
+}
+
+void java_lang_reflect_Parameter::set_index(oop param, int value) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  param->int_field_put(index_offset, value);
+}
+
+oop java_lang_reflect_Parameter::executable(oop param) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  return param->obj_field(executable_offset);
+}
+
+void java_lang_reflect_Parameter::set_executable(oop param, oop value) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  param->obj_field_put(executable_offset, value);
+}
+
 
 Handle sun_reflect_ConstantPool::create(TRAPS) {
   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
@@ -2857,6 +2970,7 @@
 int java_lang_reflect_Method::annotations_offset;
 int java_lang_reflect_Method::parameter_annotations_offset;
 int java_lang_reflect_Method::annotation_default_offset;
+int java_lang_reflect_Method::type_annotations_offset;
 int java_lang_reflect_Constructor::clazz_offset;
 int java_lang_reflect_Constructor::parameterTypes_offset;
 int java_lang_reflect_Constructor::exceptionTypes_offset;
@@ -2865,6 +2979,7 @@
 int java_lang_reflect_Constructor::signature_offset;
 int java_lang_reflect_Constructor::annotations_offset;
 int java_lang_reflect_Constructor::parameter_annotations_offset;
+int java_lang_reflect_Constructor::type_annotations_offset;
 int java_lang_reflect_Field::clazz_offset;
 int java_lang_reflect_Field::name_offset;
 int java_lang_reflect_Field::type_offset;
@@ -2872,6 +2987,11 @@
 int java_lang_reflect_Field::modifiers_offset;
 int java_lang_reflect_Field::signature_offset;
 int java_lang_reflect_Field::annotations_offset;
+int java_lang_reflect_Field::type_annotations_offset;
+int java_lang_reflect_Parameter::name_offset;
+int java_lang_reflect_Parameter::modifiers_offset;
+int java_lang_reflect_Parameter::index_offset;
+int java_lang_reflect_Parameter::executable_offset;
 int java_lang_boxing_object::value_offset;
 int java_lang_boxing_object::long_value_offset;
 int java_lang_ref_Reference::referent_offset;
@@ -3056,6 +3176,8 @@
     sun_reflect_ConstantPool::compute_offsets();
     sun_reflect_UnsafeStaticFieldAccessorImpl::compute_offsets();
   }
+  if (JDK_Version::is_jdk18x_version())
+    java_lang_reflect_Parameter::compute_offsets();
 
   // generated interpreter code wants to know about the offsets we just computed:
   AbstractAssembler::update_delayed_values();
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/classfile/javaClasses.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -554,6 +554,7 @@
   static int annotations_offset;
   static int parameter_annotations_offset;
   static int annotation_default_offset;
+  static int type_annotations_offset;
 
   static void compute_offsets();
 
@@ -599,6 +600,10 @@
   static oop annotation_default(oop method);
   static void set_annotation_default(oop method, oop value);
 
+  static bool has_type_annotations_field();
+  static oop type_annotations(oop method);
+  static void set_type_annotations(oop method, oop value);
+
   // Debugging
   friend class JavaClasses;
 };
@@ -618,6 +623,7 @@
   static int signature_offset;
   static int annotations_offset;
   static int parameter_annotations_offset;
+  static int type_annotations_offset;
 
   static void compute_offsets();
 
@@ -653,6 +659,10 @@
   static oop parameter_annotations(oop method);
   static void set_parameter_annotations(oop method, oop value);
 
+  static bool has_type_annotations_field();
+  static oop type_annotations(oop constructor);
+  static void set_type_annotations(oop constructor, oop value);
+
   // Debugging
   friend class JavaClasses;
 };
@@ -671,6 +681,7 @@
   static int modifiers_offset;
   static int signature_offset;
   static int annotations_offset;
+  static int type_annotations_offset;
 
   static void compute_offsets();
 
@@ -710,10 +721,45 @@
   static oop annotation_default(oop method);
   static void set_annotation_default(oop method, oop value);
 
+  static bool has_type_annotations_field();
+  static oop type_annotations(oop field);
+  static void set_type_annotations(oop field, oop value);
+
   // Debugging
   friend class JavaClasses;
 };
 
+class java_lang_reflect_Parameter {
+ private:
+  // Note that to reduce dependencies on the JDK we compute these
+  // offsets at run-time.
+  static int name_offset;
+  static int modifiers_offset;
+  static int index_offset;
+  static int executable_offset;
+
+  static void compute_offsets();
+
+ public:
+  // Allocation
+  static Handle create(TRAPS);
+
+  // Accessors
+  static oop name(oop field);
+  static void set_name(oop field, oop value);
+
+  static int index(oop reflect);
+  static void set_index(oop reflect, int value);
+
+  static int modifiers(oop reflect);
+  static void set_modifiers(oop reflect, int value);
+
+  static oop executable(oop constructor);
+  static void set_executable(oop constructor, oop value);
+
+  friend class JavaClasses;
+};
+
 // Interface to sun.reflect.ConstantPool objects
 class sun_reflect_ConstantPool {
  private:
--- a/hotspot/src/share/vm/classfile/systemDictionary.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -131,6 +131,7 @@
   do_klass(Properties_klass,                            java_util_Properties,                      Pre                 ) \
   do_klass(reflect_AccessibleObject_klass,              java_lang_reflect_AccessibleObject,        Pre                 ) \
   do_klass(reflect_Field_klass,                         java_lang_reflect_Field,                   Pre                 ) \
+  do_klass(reflect_Parameter_klass,                     java_lang_reflect_Parameter,               Opt                 ) \
   do_klass(reflect_Method_klass,                        java_lang_reflect_Method,                  Pre                 ) \
   do_klass(reflect_Constructor_klass,                   java_lang_reflect_Constructor,             Pre                 ) \
                                                                                                                          \
@@ -459,6 +460,7 @@
   // Tells whether ClassLoader.checkPackageAccess is present
   static bool has_checkPackageAccess()      { return _has_checkPackageAccess; }
 
+  static bool Parameter_klass_loaded()      { return WK_KLASS(reflect_Parameter_klass) != NULL; }
   static bool Class_klass_loaded()          { return WK_KLASS(Class_klass) != NULL; }
   static bool Cloneable_klass_loaded()      { return WK_KLASS(Cloneable_klass) != NULL; }
   static bool Object_klass_loaded()         { return WK_KLASS(Object_klass) != NULL; }
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -86,6 +86,7 @@
   template(java_lang_reflect_Method,                  "java/lang/reflect/Method")                 \
   template(java_lang_reflect_Constructor,             "java/lang/reflect/Constructor")            \
   template(java_lang_reflect_Field,                   "java/lang/reflect/Field")                  \
+  template(java_lang_reflect_Parameter,               "java/lang/reflect/Parameter")              \
   template(java_lang_reflect_Array,                   "java/lang/reflect/Array")                  \
   template(java_lang_StringBuffer,                    "java/lang/StringBuffer")                   \
   template(java_lang_StringBuilder,                   "java/lang/StringBuilder")                  \
@@ -126,6 +127,7 @@
   template(tag_line_number_table,                     "LineNumberTable")                          \
   template(tag_local_variable_table,                  "LocalVariableTable")                       \
   template(tag_local_variable_type_table,             "LocalVariableTypeTable")                   \
+  template(tag_method_parameters,                     "MethodParameters")                         \
   template(tag_stack_map_table,                       "StackMapTable")                            \
   template(tag_synthetic,                             "Synthetic")                                \
   template(tag_deprecated,                            "Deprecated")                               \
@@ -136,6 +138,8 @@
   template(tag_runtime_visible_parameter_annotations, "RuntimeVisibleParameterAnnotations")       \
   template(tag_runtime_invisible_parameter_annotations,"RuntimeInvisibleParameterAnnotations")    \
   template(tag_annotation_default,                    "AnnotationDefault")                        \
+  template(tag_runtime_visible_type_annotations,      "RuntimeVisibleTypeAnnotations")            \
+  template(tag_runtime_invisible_type_annotations,    "RuntimeInvisibleTypeAnnotations")          \
   template(tag_enclosing_method,                      "EnclosingMethod")                          \
   template(tag_bootstrap_methods,                     "BootstrapMethods")                         \
                                                                                                   \
@@ -233,12 +237,17 @@
   /* Support for annotations (JDK 1.5 and above) */                                               \
                                                                                                   \
   template(annotations_name,                          "annotations")                              \
+  template(index_name,                                "index")                                    \
+  template(executable_name,                           "executable")                               \
   template(parameter_annotations_name,                "parameterAnnotations")                     \
   template(annotation_default_name,                   "annotationDefault")                        \
   template(sun_reflect_ConstantPool,                  "sun/reflect/ConstantPool")                 \
   template(ConstantPool_name,                         "constantPoolOop")                          \
   template(sun_reflect_UnsafeStaticFieldAccessorImpl, "sun/reflect/UnsafeStaticFieldAccessorImpl")\
   template(base_name,                                 "base")                                     \
+  /* Type Annotations (JDK 8 and above) */                                                        \
+  template(type_annotations_name,                     "typeAnnotations")                          \
+                                                                                                  \
                                                                                                   \
   /* Support for JSR 292 & invokedynamic (JDK 1.7 and above) */                                   \
   template(java_lang_invoke_CallSite,                 "java/lang/invoke/CallSite")                \
@@ -470,6 +479,7 @@
   template(class_signature,                           "Ljava/lang/Class;")                                        \
   template(string_signature,                          "Ljava/lang/String;")                                       \
   template(reference_signature,                       "Ljava/lang/ref/Reference;")                                \
+  template(executable_signature,                      "Ljava/lang/reflect/Executable;")                           \
   template(concurrenthashmap_signature,               "Ljava/util/concurrent/ConcurrentHashMap;")                 \
   template(String_StringBuilder_signature,            "(Ljava/lang/String;)Ljava/lang/StringBuilder;")            \
   template(int_StringBuilder_signature,               "(I)Ljava/lang/StringBuilder;")                             \
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -56,7 +56,7 @@
   if (_generations == NULL)
     vm_exit_during_initialization("Unable to allocate gen spec");
 
-  if (ParNewGeneration::in_use()) {
+  if (UseParNewGC) {
     if (UseAdaptiveSizePolicy) {
       _generations[0] = new GenerationSpec(Generation::ASParNew,
                                            _initial_gen0_size, _max_gen0_size);
@@ -96,7 +96,7 @@
 
 void ConcurrentMarkSweepPolicy::initialize_gc_policy_counters() {
   // initialize the policy counters - 2 collectors, 3 generations
-  if (ParNewGeneration::in_use()) {
+  if (UseParNewGC) {
     _gc_policy_counters = new GCPolicyCounters("ParNew:CMS", 2, 3);
   }
   else {
@@ -119,7 +119,7 @@
 
   assert(size_policy() != NULL, "A size policy is required");
   // initialize the policy counters - 2 collectors, 3 generations
-  if (ParNewGeneration::in_use()) {
+  if (UseParNewGC) {
     _gc_policy_counters = new CMSGCAdaptivePolicyCounters("ParNew:CMS", 2, 3,
       size_policy());
   }
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -214,7 +214,6 @@
     assert(q->forwardee() == NULL, "should be forwarded to NULL");
   }
 
-  VALIDATE_MARK_SWEEP_ONLY(MarkSweep::register_live_oop(q, adjusted_size));
   compact_top += adjusted_size;
 
   // we need to update the offset table so that the beginnings of objects can be
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -827,10 +827,10 @@
   GenCollectedHeap* gch = GenCollectedHeap::heap();
   if (PrintGCDetails) {
     if (Verbose) {
-      gclog_or_tty->print(" [%d %s-%s: "SIZE_FORMAT"("SIZE_FORMAT")]",
+      gclog_or_tty->print("[%d %s-%s: "SIZE_FORMAT"("SIZE_FORMAT")]",
         level(), short_name(), s, used(), capacity());
     } else {
-      gclog_or_tty->print(" [%d %s-%s: "SIZE_FORMAT"K("SIZE_FORMAT"K)]",
+      gclog_or_tty->print("[%d %s-%s: "SIZE_FORMAT"K("SIZE_FORMAT"K)]",
         level(), short_name(), s, used() / K, capacity() / K);
     }
   }
--- a/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -85,7 +85,7 @@
     _curr_index(0), _length(0), _first_par_unreserved_idx(0),
     _region_live_threshold_bytes(0), _remaining_reclaimable_bytes(0) {
   _region_live_threshold_bytes =
-    HeapRegion::GrainBytes * (size_t) G1OldCSetRegionLiveThresholdPercent / 100;
+    HeapRegion::GrainBytes * (size_t) G1MixedGCLiveThresholdPercent / 100;
 }
 
 #ifndef PRODUCT
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -192,6 +192,7 @@
   setEmpty();
   _capacity = (jint) capacity;
   _saved_index = -1;
+  _should_expand = false;
   NOT_PRODUCT(_max_depth = 0);
   return true;
 }
@@ -747,8 +748,8 @@
   assert(_heap_end != NULL, "heap bounds should look ok");
   assert(_heap_start < _heap_end, "heap bounds should look ok");
 
-  // reset all the marking data structures and any necessary flags
-  clear_marking_state();
+  // Reset all the marking data structures and any necessary flags
+  reset_marking_state();
 
   if (verbose_low()) {
     gclog_or_tty->print_cr("[global] resetting");
@@ -766,6 +767,23 @@
   set_concurrent_marking_in_progress();
 }
 
+
+void ConcurrentMark::reset_marking_state(bool clear_overflow) {
+  _markStack.set_should_expand();
+  _markStack.setEmpty();        // Also clears the _markStack overflow flag
+  if (clear_overflow) {
+    clear_has_overflown();
+  } else {
+    assert(has_overflown(), "pre-condition");
+  }
+  _finger = _heap_start;
+
+  for (uint i = 0; i < _max_worker_id; ++i) {
+    CMTaskQueue* queue = _task_queues->queue(i);
+    queue->set_empty();
+  }
+}
+
 void ConcurrentMark::set_phase(uint active_tasks, bool concurrent) {
   assert(active_tasks <= _max_worker_id, "we should not have more");
 
@@ -796,7 +814,7 @@
 void ConcurrentMark::set_non_marking_state() {
   // We set the global marking state to some default values when we're
   // not doing marking.
-  clear_marking_state();
+  reset_marking_state();
   _active_tasks = 0;
   clear_concurrent_marking_in_progress();
 }
@@ -963,7 +981,7 @@
     // not clear the overflow flag since we rely on it being true when
     // we exit this method to abort the pause and restart concurent
     // marking.
-    clear_marking_state(concurrent() /* clear_overflow */);
+    reset_marking_state(concurrent() /* clear_overflow */);
     force_overflow()->update();
 
     if (G1Log::fine()) {
@@ -1257,8 +1275,9 @@
   if (has_overflown()) {
     // Oops.  We overflowed.  Restart concurrent marking.
     _restart_for_overflow = true;
-    // Clear the flag. We do not need it any more.
-    clear_has_overflown();
+    // Clear the marking state because we will be restarting
+    // marking due to overflowing the global mark stack.
+    reset_marking_state();
     if (G1TraceMarkStackOverflow) {
       gclog_or_tty->print_cr("\nRemark led to restart for overflow.");
     }
@@ -1282,6 +1301,8 @@
                        /* option */ VerifyOption_G1UseNextMarking);
     }
     assert(!restart_for_overflow(), "sanity");
+    // Completely reset the marking state since marking completed
+    set_non_marking_state();
   }
 
   // Expand the marking stack, if we have to and if we can.
@@ -1289,11 +1310,6 @@
     _markStack.expand();
   }
 
-  // Reset the marking state if marking completed
-  if (!restart_for_overflow()) {
-    set_non_marking_state();
-  }
-
 #if VERIFY_OBJS_PROCESSED
   _scan_obj_cl.objs_processed = 0;
   ThreadLocalObjQueue::objs_enqueued = 0;
@@ -2963,22 +2979,6 @@
 }
 #endif // PRODUCT
 
-void ConcurrentMark::clear_marking_state(bool clear_overflow) {
-  _markStack.set_should_expand();
-  _markStack.setEmpty();        // Also clears the _markStack overflow flag
-  if (clear_overflow) {
-    clear_has_overflown();
-  } else {
-    assert(has_overflown(), "pre-condition");
-  }
-  _finger = _heap_start;
-
-  for (uint i = 0; i < _max_worker_id; ++i) {
-    CMTaskQueue* queue = _task_queues->queue(i);
-    queue->set_empty();
-  }
-}
-
 // Aggregate the counting data that was constructed concurrently
 // with marking.
 class AggregateCountDataHRClosure: public HeapRegionClosure {
@@ -3185,7 +3185,7 @@
   // Clear the liveness counting data
   clear_all_count_data();
   // Empty mark stack
-  clear_marking_state();
+  reset_marking_state();
   for (uint i = 0; i < _max_worker_id; ++i) {
     _tasks[i]->clear_region_fields();
   }
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -478,15 +478,18 @@
   // It resets the global marking data structures, as well as the
   // task local ones; should be called during initial mark.
   void reset();
-  // It resets all the marking data structures.
-  void clear_marking_state(bool clear_overflow = true);
+
+  // Resets all the marking data structures. Called when we have to restart
+  // marking or when marking completes (via set_non_marking_state below).
+  void reset_marking_state(bool clear_overflow = true);
+
+  // We do this after we're done with marking so that the marking data
+  // structures are initialised to a sensible and predictable state.
+  void set_non_marking_state();
 
   // It should be called to indicate which phase we're in (concurrent
   // mark or remark) and how many threads are currently active.
   void set_phase(uint active_tasks, bool concurrent);
-  // We do this after we're done with marking so that the marking data
-  // structures are initialised to a sensible and predictable state.
-  void set_non_marking_state();
 
   // prints all gathered CM-related statistics
   void print_stats();
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -159,13 +159,11 @@
           VM_CGC_Operation op(&final_cl, verbose_str, true /* needs_pll */);
           VMThread::execute(&op);
         }
-        if (cm()->restart_for_overflow() &&
-            G1TraceMarkStackOverflow) {
-          gclog_or_tty->print_cr("Restarting conc marking because of MS overflow "
-                                 "in remark (restart #%d).", iter);
-        }
-
         if (cm()->restart_for_overflow()) {
+          if (G1TraceMarkStackOverflow) {
+            gclog_or_tty->print_cr("Restarting conc marking because of MS overflow "
+                                   "in remark (restart #%d).", iter);
+          }
           if (G1Log::fine()) {
             gclog_or_tty->date_stamp(PrintGCDateStamps);
             gclog_or_tty->stamp(PrintGCTimeStamps);
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -3668,7 +3668,7 @@
   gclog_or_tty->stamp(PrintGCTimeStamps);
 
   GCCauseString gc_cause_str = GCCauseString("GC pause", gc_cause())
-    .append(g1_policy()->gcs_are_young() ? " (young)" : " (mixed)")
+    .append(g1_policy()->gcs_are_young() ? "(young)" : "(mixed)")
     .append(g1_policy()->during_initial_mark_pause() ? " (initial-mark)" : "");
 
   gclog_or_tty->print("[%s", (const char*)gc_cause_str);
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -309,9 +309,9 @@
 }
 
 G1YoungGenSizer::G1YoungGenSizer() : _sizer_kind(SizerDefaults), _adaptive_size(true) {
-  assert(G1DefaultMinNewGenPercent <= G1DefaultMaxNewGenPercent, "Min larger than max");
-  assert(G1DefaultMinNewGenPercent > 0 && G1DefaultMinNewGenPercent < 100, "Min out of bounds");
-  assert(G1DefaultMaxNewGenPercent > 0 && G1DefaultMaxNewGenPercent < 100, "Max out of bounds");
+  assert(G1NewSizePercent <= G1MaxNewSizePercent, "Min larger than max");
+  assert(G1NewSizePercent > 0 && G1NewSizePercent < 100, "Min out of bounds");
+  assert(G1MaxNewSizePercent > 0 && G1MaxNewSizePercent < 100, "Max out of bounds");
 
   if (FLAG_IS_CMDLINE(NewRatio)) {
     if (FLAG_IS_CMDLINE(NewSize) || FLAG_IS_CMDLINE(MaxNewSize)) {
@@ -344,12 +344,12 @@
 }
 
 uint G1YoungGenSizer::calculate_default_min_length(uint new_number_of_heap_regions) {
-  uint default_value = (new_number_of_heap_regions * G1DefaultMinNewGenPercent) / 100;
+  uint default_value = (new_number_of_heap_regions * G1NewSizePercent) / 100;
   return MAX2(1U, default_value);
 }
 
 uint G1YoungGenSizer::calculate_default_max_length(uint new_number_of_heap_regions) {
-  uint default_value = (new_number_of_heap_regions * G1DefaultMaxNewGenPercent) / 100;
+  uint default_value = (new_number_of_heap_regions * G1MaxNewSizePercent) / 100;
   return MAX2(1U, default_value);
 }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -94,18 +94,18 @@
 // will occur.
 //
 // If nothing related to the the young gen size is set on the command
-// line we should allow the young gen to be between
-// G1DefaultMinNewGenPercent and G1DefaultMaxNewGenPercent of the
-// heap size. This means that every time the heap size changes the
-// limits for the young gen size will be updated.
+// line we should allow the young gen to be between G1NewSizePercent
+// and G1MaxNewSizePercent of the heap size. This means that every time
+// the heap size changes, the limits for the young gen size will be
+// recalculated.
 //
 // If only -XX:NewSize is set we should use the specified value as the
-// minimum size for young gen. Still using G1DefaultMaxNewGenPercent
-// of the heap as maximum.
+// minimum size for young gen. Still using G1MaxNewSizePercent of the
+// heap as maximum.
 //
 // If only -XX:MaxNewSize is set we should use the specified value as the
-// maximum size for young gen. Still using G1DefaultMinNewGenPercent
-// of the heap as minimum.
+// maximum size for young gen. Still using G1NewSizePercent of the heap
+// as minimum.
 //
 // If -XX:NewSize and -XX:MaxNewSize are both specified we use these values.
 // No updates when the heap size changes. There is a special case when
--- a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -282,10 +282,8 @@
       if (r->startsHumongous()) {
         // We must adjust the pointers on the single H object.
         oop obj = oop(r->bottom());
-        debug_only(GenMarkSweep::track_interior_pointers(obj));
         // point all the oops to the new location
         obj->adjust_pointers();
-        debug_only(GenMarkSweep::check_interior_pointers());
       }
     } else {
       // This really ought to be "as_CompactibleSpace"...
--- a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -287,17 +287,18 @@
           "The number of times we'll force an overflow during "             \
           "concurrent marking")                                             \
                                                                             \
-  experimental(uintx, G1DefaultMinNewGenPercent, 20,                        \
-          "Percentage (0-100) of the heap size to use as minimum "          \
-          "young gen size.")                                                \
+  experimental(uintx, G1NewSizePercent, 20,                                 \
+          "Percentage (0-100) of the heap size to use as default "          \
+          "minimum young gen size.")                                        \
                                                                             \
-  experimental(uintx, G1DefaultMaxNewGenPercent, 80,                        \
-          "Percentage (0-100) of the heap size to use as maximum "          \
-          "young gen size.")                                                \
+  experimental(uintx, G1MaxNewSizePercent, 80,                              \
+          "Percentage (0-100) of the heap size to use as default "          \
+          " maximum young gen size.")                                       \
                                                                             \
-  experimental(uintx, G1OldCSetRegionLiveThresholdPercent, 90,              \
-          "Threshold for regions to be added to the collection set. "       \
-          "Regions with more live bytes than this will not be collected.")  \
+  experimental(uintx, G1MixedGCLiveThresholdPercent, 90,                    \
+          "Threshold for regions to be considered for inclusion in the "    \
+          "collection set of mixed GCs. "                                   \
+          "Regions with live bytes exceeding this will not be collected.")  \
                                                                             \
   product(uintx, G1HeapWastePercent, 5,                                     \
           "Amount of space, expressed as a percentage of the heap size, "   \
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -1623,7 +1623,3 @@
 const char* ParNewGeneration::name() const {
   return "par new generation";
 }
-
-bool ParNewGeneration::in_use() {
-  return UseParNewGC && ParallelGCThreads > 0;
-}
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -361,8 +361,6 @@
     delete _task_queues;
   }
 
-  static bool in_use();
-
   virtual void ref_processor_init();
   virtual Generation::Name kind()        { return Generation::ParNew; }
   virtual const char* name() const;
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -164,7 +164,6 @@
         start_array->allocate_block(compact_top);
       }
 
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::register_live_oop(oop(q), size));
       compact_top += size;
       assert(compact_top <= dest->space()->end(),
         "Exceeding space in destination");
@@ -225,7 +224,6 @@
             start_array->allocate_block(compact_top);
           }
 
-          VALIDATE_MARK_SWEEP_ONLY(MarkSweep::register_live_oop(oop(q), sz));
           compact_top += sz;
           assert(compact_top <= dest->space()->end(),
             "Exceeding space in destination");
@@ -304,11 +302,8 @@
     HeapWord* end = _first_dead;
 
     while (q < end) {
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::track_interior_pointers(oop(q)));
       // point all the oops to the new location
       size_t size = oop(q)->adjust_pointers();
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::check_interior_pointers());
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::validate_live_oop(oop(q), size));
       q += size;
     }
 
@@ -328,11 +323,8 @@
     Prefetch::write(q, interval);
     if (oop(q)->is_gc_marked()) {
       // q is alive
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::track_interior_pointers(oop(q)));
       // point all the oops to the new location
       size_t size = oop(q)->adjust_pointers();
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::check_interior_pointers());
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::validate_live_oop(oop(q), size));
       debug_only(prev_q = q);
       q += size;
     } else {
@@ -366,7 +358,6 @@
     while (q < end) {
       size_t size = oop(q)->size();
       assert(!oop(q)->is_gc_marked(), "should be unmarked (special dense prefix handling)");
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::live_oop_moved_to(q, size, q));
       debug_only(prev_q = q);
       q += size;
     }
@@ -401,7 +392,6 @@
       Prefetch::write(compaction_top, copy_interval);
 
       // copy object and reinit its mark
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::live_oop_moved_to(q, size, compaction_top));
       assert(q != compaction_top, "everything in this pass should be moving");
       Copy::aligned_conjoint_words(q, compaction_top, size);
       oop(compaction_top)->init_mark();
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -99,25 +99,6 @@
 bool   PSParallelCompact::_dwl_initialized = false;
 #endif  // #ifdef ASSERT
 
-#ifdef VALIDATE_MARK_SWEEP
-GrowableArray<void*>*   PSParallelCompact::_root_refs_stack = NULL;
-GrowableArray<oop> *    PSParallelCompact::_live_oops = NULL;
-GrowableArray<oop> *    PSParallelCompact::_live_oops_moved_to = NULL;
-GrowableArray<size_t>*  PSParallelCompact::_live_oops_size = NULL;
-size_t                  PSParallelCompact::_live_oops_index = 0;
-GrowableArray<void*>*   PSParallelCompact::_other_refs_stack = NULL;
-GrowableArray<void*>*   PSParallelCompact::_adjusted_pointers = NULL;
-bool                    PSParallelCompact::_pointer_tracking = false;
-bool                    PSParallelCompact::_root_tracking = true;
-
-GrowableArray<HeapWord*>* PSParallelCompact::_cur_gc_live_oops = NULL;
-GrowableArray<HeapWord*>* PSParallelCompact::_cur_gc_live_oops_moved_to = NULL;
-GrowableArray<size_t>   * PSParallelCompact::_cur_gc_live_oops_size = NULL;
-GrowableArray<HeapWord*>* PSParallelCompact::_last_gc_live_oops = NULL;
-GrowableArray<HeapWord*>* PSParallelCompact::_last_gc_live_oops_moved_to = NULL;
-GrowableArray<size_t>   * PSParallelCompact::_last_gc_live_oops_size = NULL;
-#endif
-
 void SplitInfo::record(size_t src_region_idx, size_t partial_obj_size,
                        HeapWord* destination)
 {
@@ -2715,151 +2696,6 @@
 }
 #endif  // #ifdef ASSERT
 
-
-#ifdef VALIDATE_MARK_SWEEP
-
-void PSParallelCompact::track_adjusted_pointer(void* p, bool isroot) {
-  if (!ValidateMarkSweep)
-    return;
-
-  if (!isroot) {
-    if (_pointer_tracking) {
-      guarantee(_adjusted_pointers->contains(p), "should have seen this pointer");
-      _adjusted_pointers->remove(p);
-    }
-  } else {
-    ptrdiff_t index = _root_refs_stack->find(p);
-    if (index != -1) {
-      int l = _root_refs_stack->length();
-      if (l > 0 && l - 1 != index) {
-        void* last = _root_refs_stack->pop();
-        assert(last != p, "should be different");
-        _root_refs_stack->at_put(index, last);
-      } else {
-        _root_refs_stack->remove(p);
-      }
-    }
-  }
-}
-
-
-void PSParallelCompact::check_adjust_pointer(void* p) {
-  _adjusted_pointers->push(p);
-}
-
-
-class AdjusterTracker: public OopClosure {
- public:
-  AdjusterTracker() {};
-  void do_oop(oop* o)         { PSParallelCompact::check_adjust_pointer(o); }
-  void do_oop(narrowOop* o)   { PSParallelCompact::check_adjust_pointer(o); }
-};
-
-
-void PSParallelCompact::track_interior_pointers(oop obj) {
-  if (ValidateMarkSweep) {
-    _adjusted_pointers->clear();
-    _pointer_tracking = true;
-
-    AdjusterTracker checker;
-    obj->oop_iterate_no_header(&checker);
-  }
-}
-
-
-void PSParallelCompact::check_interior_pointers() {
-  if (ValidateMarkSweep) {
-    _pointer_tracking = false;
-    guarantee(_adjusted_pointers->length() == 0, "should have processed the same pointers");
-  }
-}
-
-
-void PSParallelCompact::reset_live_oop_tracking() {
-  if (ValidateMarkSweep) {
-    guarantee((size_t)_live_oops->length() == _live_oops_index, "should be at end of live oops");
-    _live_oops_index = 0;
-  }
-}
-
-
-void PSParallelCompact::register_live_oop(oop p, size_t size) {
-  if (ValidateMarkSweep) {
-    _live_oops->push(p);
-    _live_oops_size->push(size);
-    _live_oops_index++;
-  }
-}
-
-void PSParallelCompact::validate_live_oop(oop p, size_t size) {
-  if (ValidateMarkSweep) {
-    oop obj = _live_oops->at((int)_live_oops_index);
-    guarantee(obj == p, "should be the same object");
-    guarantee(_live_oops_size->at((int)_live_oops_index) == size, "should be the same size");
-    _live_oops_index++;
-  }
-}
-
-void PSParallelCompact::live_oop_moved_to(HeapWord* q, size_t size,
-                                  HeapWord* compaction_top) {
-  assert(oop(q)->forwardee() == NULL || oop(q)->forwardee() == oop(compaction_top),
-         "should be moved to forwarded location");
-  if (ValidateMarkSweep) {
-    PSParallelCompact::validate_live_oop(oop(q), size);
-    _live_oops_moved_to->push(oop(compaction_top));
-  }
-  if (RecordMarkSweepCompaction) {
-    _cur_gc_live_oops->push(q);
-    _cur_gc_live_oops_moved_to->push(compaction_top);
-    _cur_gc_live_oops_size->push(size);
-  }
-}
-
-
-void PSParallelCompact::compaction_complete() {
-  if (RecordMarkSweepCompaction) {
-    GrowableArray<HeapWord*>* _tmp_live_oops          = _cur_gc_live_oops;
-    GrowableArray<HeapWord*>* _tmp_live_oops_moved_to = _cur_gc_live_oops_moved_to;
-    GrowableArray<size_t>   * _tmp_live_oops_size     = _cur_gc_live_oops_size;
-
-    _cur_gc_live_oops           = _last_gc_live_oops;
-    _cur_gc_live_oops_moved_to  = _last_gc_live_oops_moved_to;
-    _cur_gc_live_oops_size      = _last_gc_live_oops_size;
-    _last_gc_live_oops          = _tmp_live_oops;
-    _last_gc_live_oops_moved_to = _tmp_live_oops_moved_to;
-    _last_gc_live_oops_size     = _tmp_live_oops_size;
-  }
-}
-
-
-void PSParallelCompact::print_new_location_of_heap_address(HeapWord* q) {
-  if (!RecordMarkSweepCompaction) {
-    tty->print_cr("Requires RecordMarkSweepCompaction to be enabled");
-    return;
-  }
-
-  if (_last_gc_live_oops == NULL) {
-    tty->print_cr("No compaction information gathered yet");
-    return;
-  }
-
-  for (int i = 0; i < _last_gc_live_oops->length(); i++) {
-    HeapWord* old_oop = _last_gc_live_oops->at(i);
-    size_t    sz      = _last_gc_live_oops_size->at(i);
-    if (old_oop <= q && q < (old_oop + sz)) {
-      HeapWord* new_oop = _last_gc_live_oops_moved_to->at(i);
-      size_t offset = (q - old_oop);
-      tty->print_cr("Address " PTR_FORMAT, q);
-      tty->print_cr(" Was in oop " PTR_FORMAT ", size %d, at offset %d", old_oop, sz, offset);
-      tty->print_cr(" Now in oop " PTR_FORMAT ", actual address " PTR_FORMAT, new_oop, new_oop + offset);
-      return;
-    }
-  }
-
-  tty->print_cr("Address " PTR_FORMAT " not found in live oop information from last GC", q);
-}
-#endif //VALIDATE_MARK_SWEEP
-
 // Update interior oops in the ranges of regions [beg_region, end_region).
 void
 PSParallelCompact::update_and_deadwood_in_dense_prefix(ParCompactionManager* cm,
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -1006,34 +1006,6 @@
   // Reset time since last full gc
   static void reset_millis_since_last_gc();
 
- protected:
-#ifdef VALIDATE_MARK_SWEEP
-  static GrowableArray<void*>*           _root_refs_stack;
-  static GrowableArray<oop> *            _live_oops;
-  static GrowableArray<oop> *            _live_oops_moved_to;
-  static GrowableArray<size_t>*          _live_oops_size;
-  static size_t                          _live_oops_index;
-  static size_t                          _live_oops_index_at_perm;
-  static GrowableArray<void*>*           _other_refs_stack;
-  static GrowableArray<void*>*           _adjusted_pointers;
-  static bool                            _pointer_tracking;
-  static bool                            _root_tracking;
-
-  // The following arrays are saved since the time of the last GC and
-  // assist in tracking down problems where someone has done an errant
-  // store into the heap, usually to an oop that wasn't properly
-  // handleized across a GC. If we crash or otherwise fail before the
-  // next GC, we can query these arrays to find out the object we had
-  // intended to do the store to (assuming it is still alive) and the
-  // offset within that object. Covered under RecordMarkSweepCompaction.
-  static GrowableArray<HeapWord*> *      _cur_gc_live_oops;
-  static GrowableArray<HeapWord*> *      _cur_gc_live_oops_moved_to;
-  static GrowableArray<size_t>*          _cur_gc_live_oops_size;
-  static GrowableArray<HeapWord*> *      _last_gc_live_oops;
-  static GrowableArray<HeapWord*> *      _last_gc_live_oops_moved_to;
-  static GrowableArray<size_t>*          _last_gc_live_oops_size;
-#endif
-
  public:
   class MarkAndPushClosure: public OopClosure {
    private:
@@ -1191,25 +1163,6 @@
   // Time since last full gc (in milliseconds).
   static jlong millis_since_last_gc();
 
-#ifdef VALIDATE_MARK_SWEEP
-  static void track_adjusted_pointer(void* p, bool isroot);
-  static void check_adjust_pointer(void* p);
-  static void track_interior_pointers(oop obj);
-  static void check_interior_pointers();
-
-  static void reset_live_oop_tracking();
-  static void register_live_oop(oop p, size_t size);
-  static void validate_live_oop(oop p, size_t size);
-  static void live_oop_moved_to(HeapWord* q, size_t size, HeapWord* compaction_top);
-  static void compaction_complete();
-
-  // Querying operation of RecordMarkSweepCompaction results.
-  // Finds and prints the current base oop and offset for a word
-  // within an oop that was live during the last GC. Helpful for
-  // tracking down heap stomps.
-  static void print_new_location_of_heap_address(HeapWord* q);
-#endif  // #ifdef VALIDATE_MARK_SWEEP
-
 #ifndef PRODUCT
   // Debugging support.
   static const char* space_names[last_space_id];
@@ -1250,12 +1203,7 @@
 inline void PSParallelCompact::follow_root(ParCompactionManager* cm, T* p) {
   assert(!Universe::heap()->is_in_reserved(p),
          "roots shouldn't be things within the heap");
-#ifdef VALIDATE_MARK_SWEEP
-  if (ValidateMarkSweep) {
-    guarantee(!_root_refs_stack->contains(p), "should only be in here once");
-    _root_refs_stack->push(p);
-  }
-#endif
+
   T heap_oop = oopDesc::load_heap_oop(p);
   if (!oopDesc::is_null(heap_oop)) {
     oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
@@ -1294,20 +1242,10 @@
       oopDesc::encode_store_heap_oop_not_null(p, new_obj);
     }
   }
-  VALIDATE_MARK_SWEEP_ONLY(track_adjusted_pointer(p, isroot));
 }
 
 template <class T>
 inline void PSParallelCompact::KeepAliveClosure::do_oop_work(T* p) {
-#ifdef VALIDATE_MARK_SWEEP
-  if (ValidateMarkSweep) {
-    if (!Universe::heap()->is_in_reserved(p)) {
-      _root_refs_stack->push(p);
-    } else {
-      _other_refs_stack->push(p);
-    }
-  }
-#endif
   mark_and_push(_compaction_manager, p);
 }
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -808,8 +808,9 @@
   st->print("  to  "); to_space()->print_on(st);
 }
 
+// Note that a space is not printed before the [NAME:
 void PSYoungGen::print_used_change(size_t prev_used) const {
-  gclog_or_tty->print(" [%s:", name());
+  gclog_or_tty->print("[%s:", name());
   gclog_or_tty->print(" "  SIZE_FORMAT "K"
                       "->" SIZE_FORMAT "K"
                       "("  SIZE_FORMAT "K)",
--- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -42,26 +42,6 @@
 PreservedMark*          MarkSweep::_preserved_marks = NULL;
 ReferenceProcessor*     MarkSweep::_ref_processor   = NULL;
 
-#ifdef VALIDATE_MARK_SWEEP
-GrowableArray<void*>*   MarkSweep::_root_refs_stack = NULL;
-GrowableArray<oop> *    MarkSweep::_live_oops = NULL;
-GrowableArray<oop> *    MarkSweep::_live_oops_moved_to = NULL;
-GrowableArray<size_t>*  MarkSweep::_live_oops_size = NULL;
-size_t                  MarkSweep::_live_oops_index = 0;
-size_t                  MarkSweep::_live_oops_index_at_perm = 0;
-GrowableArray<void*>*   MarkSweep::_other_refs_stack = NULL;
-GrowableArray<void*>*   MarkSweep::_adjusted_pointers = NULL;
-bool                         MarkSweep::_pointer_tracking = false;
-bool                         MarkSweep::_root_tracking = true;
-
-GrowableArray<HeapWord*>* MarkSweep::_cur_gc_live_oops = NULL;
-GrowableArray<HeapWord*>* MarkSweep::_cur_gc_live_oops_moved_to = NULL;
-GrowableArray<size_t>   * MarkSweep::_cur_gc_live_oops_size = NULL;
-GrowableArray<HeapWord*>* MarkSweep::_last_gc_live_oops = NULL;
-GrowableArray<HeapWord*>* MarkSweep::_last_gc_live_oops_moved_to = NULL;
-GrowableArray<size_t>   * MarkSweep::_last_gc_live_oops_size = NULL;
-#endif
-
 MarkSweep::FollowRootClosure  MarkSweep::follow_root_closure;
 CodeBlobToOopClosure MarkSweep::follow_code_root_closure(&MarkSweep::follow_root_closure, /*do_marking=*/ true);
 
@@ -185,142 +165,6 @@
   }
 }
 
-#ifdef VALIDATE_MARK_SWEEP
-
-void MarkSweep::track_adjusted_pointer(void* p, bool isroot) {
-  if (!ValidateMarkSweep)
-    return;
-
-  if (!isroot) {
-    if (_pointer_tracking) {
-      guarantee(_adjusted_pointers->contains(p), "should have seen this pointer");
-      _adjusted_pointers->remove(p);
-    }
-  } else {
-    ptrdiff_t index = _root_refs_stack->find(p);
-    if (index != -1) {
-      int l = _root_refs_stack->length();
-      if (l > 0 && l - 1 != index) {
-        void* last = _root_refs_stack->pop();
-        assert(last != p, "should be different");
-        _root_refs_stack->at_put(index, last);
-      } else {
-        _root_refs_stack->remove(p);
-      }
-    }
-  }
-}
-
-void MarkSweep::check_adjust_pointer(void* p) {
-  _adjusted_pointers->push(p);
-}
-
-class AdjusterTracker: public OopClosure {
- public:
-  AdjusterTracker() {}
-  void do_oop(oop* o)       { MarkSweep::check_adjust_pointer(o); }
-  void do_oop(narrowOop* o) { MarkSweep::check_adjust_pointer(o); }
-};
-
-void MarkSweep::track_interior_pointers(oop obj) {
-  if (ValidateMarkSweep) {
-    _adjusted_pointers->clear();
-    _pointer_tracking = true;
-
-    AdjusterTracker checker;
-    obj->oop_iterate_no_header(&checker);
-  }
-}
-
-void MarkSweep::check_interior_pointers() {
-  if (ValidateMarkSweep) {
-    _pointer_tracking = false;
-    guarantee(_adjusted_pointers->length() == 0, "should have processed the same pointers");
-  }
-}
-
-void MarkSweep::reset_live_oop_tracking() {
-  if (ValidateMarkSweep) {
-    guarantee((size_t)_live_oops->length() == _live_oops_index, "should be at end of live oops");
-    _live_oops_index = 0;
-  }
-}
-
-void MarkSweep::register_live_oop(oop p, size_t size) {
-  if (ValidateMarkSweep) {
-    _live_oops->push(p);
-    _live_oops_size->push(size);
-    _live_oops_index++;
-  }
-}
-
-void MarkSweep::validate_live_oop(oop p, size_t size) {
-  if (ValidateMarkSweep) {
-    oop obj = _live_oops->at((int)_live_oops_index);
-    guarantee(obj == p, "should be the same object");
-    guarantee(_live_oops_size->at((int)_live_oops_index) == size, "should be the same size");
-    _live_oops_index++;
-  }
-}
-
-void MarkSweep::live_oop_moved_to(HeapWord* q, size_t size,
-                                  HeapWord* compaction_top) {
-  assert(oop(q)->forwardee() == NULL || oop(q)->forwardee() == oop(compaction_top),
-         "should be moved to forwarded location");
-  if (ValidateMarkSweep) {
-    MarkSweep::validate_live_oop(oop(q), size);
-    _live_oops_moved_to->push(oop(compaction_top));
-  }
-  if (RecordMarkSweepCompaction) {
-    _cur_gc_live_oops->push(q);
-    _cur_gc_live_oops_moved_to->push(compaction_top);
-    _cur_gc_live_oops_size->push(size);
-  }
-}
-
-void MarkSweep::compaction_complete() {
-  if (RecordMarkSweepCompaction) {
-    GrowableArray<HeapWord*>* _tmp_live_oops          = _cur_gc_live_oops;
-    GrowableArray<HeapWord*>* _tmp_live_oops_moved_to = _cur_gc_live_oops_moved_to;
-    GrowableArray<size_t>   * _tmp_live_oops_size     = _cur_gc_live_oops_size;
-
-    _cur_gc_live_oops           = _last_gc_live_oops;
-    _cur_gc_live_oops_moved_to  = _last_gc_live_oops_moved_to;
-    _cur_gc_live_oops_size      = _last_gc_live_oops_size;
-    _last_gc_live_oops          = _tmp_live_oops;
-    _last_gc_live_oops_moved_to = _tmp_live_oops_moved_to;
-    _last_gc_live_oops_size     = _tmp_live_oops_size;
-  }
-}
-
-void MarkSweep::print_new_location_of_heap_address(HeapWord* q) {
-  if (!RecordMarkSweepCompaction) {
-    tty->print_cr("Requires RecordMarkSweepCompaction to be enabled");
-    return;
-  }
-
-  if (_last_gc_live_oops == NULL) {
-    tty->print_cr("No compaction information gathered yet");
-    return;
-  }
-
-  for (int i = 0; i < _last_gc_live_oops->length(); i++) {
-    HeapWord* old_oop = _last_gc_live_oops->at(i);
-    size_t    sz      = _last_gc_live_oops_size->at(i);
-    if (old_oop <= q && q < (old_oop + sz)) {
-      HeapWord* new_oop = _last_gc_live_oops_moved_to->at(i);
-      size_t offset = (q - old_oop);
-      tty->print_cr("Address " PTR_FORMAT, q);
-      tty->print_cr(" Was in oop " PTR_FORMAT ", size " SIZE_FORMAT ", at offset " SIZE_FORMAT, old_oop, sz, offset);
-      tty->print_cr(" Now in oop " PTR_FORMAT ", actual address " PTR_FORMAT, new_oop, new_oop + offset);
-      return;
-    }
-  }
-
-  tty->print_cr("Address " PTR_FORMAT " not found in live oop information from last GC", q);
-}
-#endif //VALIDATE_MARK_SWEEP
-
 MarkSweep::IsAliveClosure   MarkSweep::is_alive;
 
 void MarkSweep::IsAliveClosure::do_object(oop p)   { ShouldNotReachHere(); }
--- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -44,21 +44,6 @@
 //
 // Class unloading will only occur when a full gc is invoked.
 
-// If VALIDATE_MARK_SWEEP is defined, the -XX:+ValidateMarkSweep flag will
-// be operational, and will provide slow but comprehensive self-checks within
-// the GC.  This is not enabled by default in product or release builds,
-// since the extra call to track_adjusted_pointer() in _adjust_pointer()
-// would be too much overhead, and would disturb performance measurement.
-// However, debug builds are sometimes way too slow to run GC tests!
-#ifdef ASSERT
-#define VALIDATE_MARK_SWEEP 1
-#endif
-#ifdef VALIDATE_MARK_SWEEP
-#define VALIDATE_MARK_SWEEP_ONLY(code) code
-#else
-#define VALIDATE_MARK_SWEEP_ONLY(code)
-#endif
-
 // declared at end
 class PreservedMark;
 
@@ -147,33 +132,6 @@
   // Reference processing (used in ...follow_contents)
   static ReferenceProcessor*             _ref_processor;
 
-#ifdef VALIDATE_MARK_SWEEP
-  static GrowableArray<void*>*           _root_refs_stack;
-  static GrowableArray<oop> *            _live_oops;
-  static GrowableArray<oop> *            _live_oops_moved_to;
-  static GrowableArray<size_t>*          _live_oops_size;
-  static size_t                          _live_oops_index;
-  static size_t                          _live_oops_index_at_perm;
-  static GrowableArray<void*>*           _other_refs_stack;
-  static GrowableArray<void*>*           _adjusted_pointers;
-  static bool                            _pointer_tracking;
-  static bool                            _root_tracking;
-
-  // The following arrays are saved since the time of the last GC and
-  // assist in tracking down problems where someone has done an errant
-  // store into the heap, usually to an oop that wasn't properly
-  // handleized across a GC. If we crash or otherwise fail before the
-  // next GC, we can query these arrays to find out the object we had
-  // intended to do the store to (assuming it is still alive) and the
-  // offset within that object. Covered under RecordMarkSweepCompaction.
-  static GrowableArray<HeapWord*> *      _cur_gc_live_oops;
-  static GrowableArray<HeapWord*> *      _cur_gc_live_oops_moved_to;
-  static GrowableArray<size_t>*          _cur_gc_live_oops_size;
-  static GrowableArray<HeapWord*> *      _last_gc_live_oops;
-  static GrowableArray<HeapWord*> *      _last_gc_live_oops_moved_to;
-  static GrowableArray<size_t>*          _last_gc_live_oops_size;
-#endif
-
   // Non public closures
   static KeepAliveClosure keep_alive;
 
@@ -227,24 +185,6 @@
   static void adjust_pointer(oop* p)       { adjust_pointer(p, false); }
   static void adjust_pointer(narrowOop* p) { adjust_pointer(p, false); }
 
-#ifdef VALIDATE_MARK_SWEEP
-  static void track_adjusted_pointer(void* p, bool isroot);
-  static void check_adjust_pointer(void* p);
-  static void track_interior_pointers(oop obj);
-  static void check_interior_pointers();
-
-  static void reset_live_oop_tracking();
-  static void register_live_oop(oop p, size_t size);
-  static void validate_live_oop(oop p, size_t size);
-  static void live_oop_moved_to(HeapWord* q, size_t size, HeapWord* compaction_top);
-  static void compaction_complete();
-
-  // Querying operation of RecordMarkSweepCompaction results.
-  // Finds and prints the current base oop and offset for a word
-  // within an oop that was live during the last GC. Helpful for
-  // tracking down heap stomps.
-  static void print_new_location_of_heap_address(HeapWord* q);
-#endif
 };
 
 class PreservedMark VALUE_OBJ_CLASS_SPEC {
--- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -46,12 +46,6 @@
 template <class T> inline void MarkSweep::follow_root(T* p) {
   assert(!Universe::heap()->is_in_reserved(p),
          "roots shouldn't be things within the heap");
-#ifdef VALIDATE_MARK_SWEEP
-  if (ValidateMarkSweep) {
-    guarantee(!_root_refs_stack->contains(p), "should only be in here once");
-    _root_refs_stack->push(p);
-  }
-#endif
   T heap_oop = oopDesc::load_heap_oop(p);
   if (!oopDesc::is_null(heap_oop)) {
     oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
@@ -97,19 +91,9 @@
       oopDesc::encode_store_heap_oop_not_null(p, new_obj);
     }
   }
-  VALIDATE_MARK_SWEEP_ONLY(track_adjusted_pointer(p, isroot));
 }
 
 template <class T> inline void MarkSweep::KeepAliveClosure::do_oop_work(T* p) {
-#ifdef VALIDATE_MARK_SWEEP
-  if (ValidateMarkSweep) {
-    if (!Universe::heap()->is_in_reserved(p)) {
-      _root_refs_stack->push(p);
-    } else {
-      _other_refs_stack->push(p);
-    }
-  }
-#endif
   mark_and_push(p);
 }
 
--- a/hotspot/src/share/vm/gc_interface/gcCause.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/gc_interface/gcCause.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -99,9 +99,9 @@
  public:
    GCCauseString(const char* prefix, GCCause::Cause cause) {
      if (PrintGCCause) {
-      _position = jio_snprintf(_buffer, _length, "%s (%s)", prefix, GCCause::to_string(cause));
+      _position = jio_snprintf(_buffer, _length, "%s (%s) ", prefix, GCCause::to_string(cause));
      } else {
-      _position = jio_snprintf(_buffer, _length, "%s", prefix);
+      _position = jio_snprintf(_buffer, _length, "%s ", prefix);
      }
      assert(_position >= 0 && _position <= _length,
        err_msg("Need to increase the buffer size in GCCauseString? %d", _position));
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -417,7 +417,7 @@
 
     // exception handler lookup
     KlassHandle h_klass(THREAD, h_exception->klass());
-    handler_bci = h_method->fast_exception_handler_bci_for(h_klass, current_bci, THREAD);
+    handler_bci = Method::fast_exception_handler_bci_for(h_method, h_klass, current_bci, THREAD);
     if (HAS_PENDING_EXCEPTION) {
       // We threw an exception while trying to find the exception handler.
       // Transfer the new exception to the exception handle which will
--- a/hotspot/src/share/vm/interpreter/rewriter.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/interpreter/rewriter.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -27,13 +27,8 @@
 #include "interpreter/interpreter.hpp"
 #include "interpreter/rewriter.hpp"
 #include "memory/gcLocker.hpp"
-#include "memory/metadataFactory.hpp"
-#include "memory/oopFactory.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/generateOopMap.hpp"
-#include "oops/objArrayOop.hpp"
-#include "oops/oop.inline.hpp"
-#include "prims/methodComparator.hpp"
 #include "prims/methodHandles.hpp"
 
 // Computes a CPC map (new_index -> original_index) for constant pool entries
@@ -402,13 +397,6 @@
 }
 
 
-void Rewriter::rewrite(instanceKlassHandle klass, constantPoolHandle cpool, Array<Method*>* methods, TRAPS) {
-  ResourceMark rm(THREAD);
-  Rewriter     rw(klass, cpool, methods, CHECK);
-  // (That's all, folks.)
-}
-
-
 Rewriter::Rewriter(instanceKlassHandle klass, constantPoolHandle cpool, Array<Method*>* methods, TRAPS)
   : _klass(klass),
     _pool(cpool),
@@ -453,46 +441,25 @@
     restore_bytecodes();
     return;
   }
-}
 
-// Relocate jsr/rets in a method.  This can't be done with the rewriter
-// stage because it can throw other exceptions, leaving the bytecodes
-// pointing at constant pool cache entries.
-// Link and check jvmti dependencies while we're iterating over the methods.
-// JSR292 code calls with a different set of methods, so two entry points.
-void Rewriter::relocate_and_link(instanceKlassHandle this_oop, TRAPS) {
-  relocate_and_link(this_oop, this_oop->methods(), THREAD);
-}
-
-void Rewriter::relocate_and_link(instanceKlassHandle this_oop,
-                                 Array<Method*>* methods, TRAPS) {
-  int len = methods->length();
+  // Relocate after everything, but still do this under the is_rewritten flag,
+  // so methods with jsrs in custom class lists in aren't attempted to be
+  // rewritten in the RO section of the shared archive.
+  // Relocated bytecodes don't have to be restored, only the cp cache entries
   for (int i = len-1; i >= 0; i--) {
-    methodHandle m(THREAD, methods->at(i));
+    methodHandle m(THREAD, _methods->at(i));
 
     if (m->has_jsrs()) {
-      m = rewrite_jsrs(m, CHECK);
+      m = rewrite_jsrs(m, THREAD);
+      // Restore bytecodes to their unrewritten state if there are exceptions
+      // relocating bytecodes.  If some are relocated, that is ok because that
+      // doesn't affect constant pool to cpCache rewriting.
+      if (HAS_PENDING_EXCEPTION) {
+        restore_bytecodes();
+        return;
+      }
       // Method might have gotten rewritten.
       methods->at_put(i, m());
     }
-
-    // Set up method entry points for compiler and interpreter    .
-    m->link_method(m, CHECK);
-
-    // This is for JVMTI and unrelated to relocator but the last thing we do
-#ifdef ASSERT
-    if (StressMethodComparator) {
-      static int nmc = 0;
-      for (int j = i; j >= 0 && j >= i-4; j--) {
-        if ((++nmc % 1000) == 0)  tty->print_cr("Have run MethodComparator %d times...", nmc);
-        bool z = MethodComparator::methods_EMCP(m(),
-                   methods->at(j));
-        if (j == i && !z) {
-          tty->print("MethodComparator FAIL: "); m->print(); m->print_codes();
-          assert(z, "method must compare equal to itself");
-        }
-      }
-    }
-#endif //ASSERT
   }
 }
--- a/hotspot/src/share/vm/interpreter/rewriter.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/interpreter/rewriter.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -158,14 +158,6 @@
  public:
   // Driver routine:
   static void rewrite(instanceKlassHandle klass, TRAPS);
-  static void rewrite(instanceKlassHandle klass, constantPoolHandle cpool, Array<Method*>* methods, TRAPS);
-
-  // Second pass, not gated by is_rewritten flag
-  static void relocate_and_link(instanceKlassHandle klass, TRAPS);
-  // JSR292 version to call with it's own methods.
-  static void relocate_and_link(instanceKlassHandle klass,
-                                Array<Method*>* methods, TRAPS);
-
 };
 
 #endif // SHARE_VM_INTERPRETER_REWRITER_HPP
--- a/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -67,7 +67,8 @@
 }
 
 template <class Chunk_t, template <class> class FreeList_t>
-TreeList<Chunk_t, FreeList_t>::TreeList() {}
+TreeList<Chunk_t, FreeList_t>::TreeList() : _parent(NULL),
+  _left(NULL), _right(NULL) {}
 
 template <class Chunk_t, template <class> class FreeList_t>
 TreeList<Chunk_t, FreeList_t>*
@@ -82,7 +83,7 @@
   tl->link_head(tc);
   tl->link_tail(tc);
   tl->set_count(1);
-
+  assert(tl->parent() == NULL, "Should be clear");
   return tl;
 }
 
--- a/hotspot/src/share/vm/memory/collectorPolicy.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -777,6 +777,15 @@
                                        full_gc_count,
                                        GCCause::_metadata_GC_threshold);
     VMThread::execute(&op);
+
+    // If GC was locked out, try again.  Check
+    // before checking success because the prologue
+    // could have succeeded and the GC still have
+    // been locked out.
+    if (op.gc_locked()) {
+      continue;
+    }
+
     if (op.prologue_succeeded()) {
       return op.result();
     }
@@ -818,7 +827,7 @@
   if (_generations == NULL)
     vm_exit_during_initialization("Unable to allocate gen spec");
 
-  if (UseParNewGC && ParallelGCThreads > 0) {
+  if (UseParNewGC) {
     _generations[0] = new GenerationSpec(Generation::ParNew, _initial_gen0_size, _max_gen0_size);
   } else {
     _generations[0] = new GenerationSpec(Generation::DefNew, _initial_gen0_size, _max_gen0_size);
@@ -831,10 +840,9 @@
 
 void MarkSweepPolicy::initialize_gc_policy_counters() {
   // initialize the policy counters - 2 collectors, 3 generations
-  if (UseParNewGC && ParallelGCThreads > 0) {
+  if (UseParNewGC) {
     _gc_policy_counters = new GCPolicyCounters("ParNew:MSC", 2, 3);
-  }
-  else {
+  } else {
     _gc_policy_counters = new GCPolicyCounters("Copy:MSC", 2, 3);
   }
 }
--- a/hotspot/src/share/vm/memory/filemap.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/memory/filemap.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -119,6 +119,7 @@
   _header._magic = 0xf00baba2;
   _header._version = _current_version;
   _header._alignment = alignment;
+  _header._obj_alignment = ObjectAlignmentInBytes;
 
   // The following fields are for sanity checks for whether this archive
   // will function correctly with this JVM and the bootclasspath it's
@@ -211,7 +212,11 @@
 
   // Remove the existing file in case another process has it open.
   remove(_full_path);
+#ifdef _WINDOWS  // if 0444 is used on Windows, then remove() will fail.
+  int fd = open(_full_path, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0744);
+#else
   int fd = open(_full_path, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0444);
+#endif
   if (fd < 0) {
     fail_stop("Unable to create shared archive file %s.", _full_path);
   }
@@ -370,9 +375,8 @@
     return rs;
   }
   // the reserved virtual memory is for mapping class data sharing archive
-  if (MemTracker::is_on()) {
-    MemTracker::record_virtual_memory_type((address)rs.base(), mtClassShared);
-  }
+  MemTracker::record_virtual_memory_type((address)rs.base(), mtClassShared);
+
   return rs;
 }
 
@@ -394,6 +398,11 @@
     fail_continue(err_msg("Unable to map %s shared space at required address.", shared_region_name[i]));
     return NULL;
   }
+#ifdef _WINDOWS
+  // This call is Windows-only because the memory_type gets recorded for the other platforms
+  // in method FileMapInfo::reserve_shared_memory(), which is not called on Windows.
+  MemTracker::record_virtual_memory_type((address)base, mtClassShared);
+#endif
   return base;
 }
 
@@ -465,6 +474,12 @@
                   " version or build of HotSpot.");
     return false;
   }
+  if (_header._obj_alignment != ObjectAlignmentInBytes) {
+    fail_continue("The shared archive file's ObjectAlignmentInBytes of %d"
+                  " does not equal the current ObjectAlignmentInBytes of %d.",
+                  _header._obj_alignment, ObjectAlignmentInBytes);
+    return false;
+  }
 
   // Cannot verify interpreter yet, as it can only be created after the GC
   // heap has been initialized.
--- a/hotspot/src/share/vm/memory/filemap.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/memory/filemap.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -63,6 +63,7 @@
     int    _magic;                    // identify file type.
     int    _version;                  // (from enum, above.)
     size_t _alignment;                // how shared archive should be aligned
+    int    _obj_alignment;            // value of ObjectAlignmentInBytes
 
     struct space_info {
       int    _file_offset;   // sizeof(this) rounded to vm page size
--- a/hotspot/src/share/vm/memory/genMarkSweep.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/memory/genMarkSweep.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -100,21 +100,8 @@
 
   mark_sweep_phase3(level);
 
-  VALIDATE_MARK_SWEEP_ONLY(
-    if (ValidateMarkSweep) {
-      guarantee(_root_refs_stack->length() == 0, "should be empty by now");
-    }
-  )
-
   mark_sweep_phase4();
 
-  VALIDATE_MARK_SWEEP_ONLY(
-    if (ValidateMarkSweep) {
-      guarantee(_live_oops->length() == _live_oops_moved_to->length(),
-                "should be the same size");
-    }
-  )
-
   restore_marks();
 
   // Set saved marks for allocation profiler (and other things? -- dld)
@@ -187,31 +174,6 @@
 
   _preserved_marks = (PreservedMark*)scratch;
   _preserved_count = 0;
-
-#ifdef VALIDATE_MARK_SWEEP
-  if (ValidateMarkSweep) {
-    _root_refs_stack    = new (ResourceObj::C_HEAP, mtGC) GrowableArray<void*>(100, true);
-    _other_refs_stack   = new (ResourceObj::C_HEAP, mtGC) GrowableArray<void*>(100, true);
-    _adjusted_pointers  = new (ResourceObj::C_HEAP, mtGC) GrowableArray<void*>(100, true);
-    _live_oops          = new (ResourceObj::C_HEAP, mtGC) GrowableArray<oop>(100, true);
-    _live_oops_moved_to = new (ResourceObj::C_HEAP, mtGC) GrowableArray<oop>(100, true);
-    _live_oops_size     = new (ResourceObj::C_HEAP, mtGC) GrowableArray<size_t>(100, true);
-  }
-  if (RecordMarkSweepCompaction) {
-    if (_cur_gc_live_oops == NULL) {
-      _cur_gc_live_oops           = new(ResourceObj::C_HEAP, mtGC) GrowableArray<HeapWord*>(100, true);
-      _cur_gc_live_oops_moved_to  = new(ResourceObj::C_HEAP, mtGC) GrowableArray<HeapWord*>(100, true);
-      _cur_gc_live_oops_size      = new(ResourceObj::C_HEAP, mtGC) GrowableArray<size_t>(100, true);
-      _last_gc_live_oops          = new(ResourceObj::C_HEAP, mtGC) GrowableArray<HeapWord*>(100, true);
-      _last_gc_live_oops_moved_to = new(ResourceObj::C_HEAP, mtGC) GrowableArray<HeapWord*>(100, true);
-      _last_gc_live_oops_size     = new(ResourceObj::C_HEAP, mtGC) GrowableArray<size_t>(100, true);
-    } else {
-      _cur_gc_live_oops->clear();
-      _cur_gc_live_oops_moved_to->clear();
-      _cur_gc_live_oops_size->clear();
-    }
-  }
-#endif
 }
 
 
@@ -225,19 +187,6 @@
   _preserved_oop_stack.clear(true);
   _marking_stack.clear();
   _objarray_stack.clear(true);
-
-#ifdef VALIDATE_MARK_SWEEP
-  if (ValidateMarkSweep) {
-    delete _root_refs_stack;
-    delete _other_refs_stack;
-    delete _adjusted_pointers;
-    delete _live_oops;
-    delete _live_oops_size;
-    delete _live_oops_moved_to;
-    _live_oops_index = 0;
-    _live_oops_index_at_perm = 0;
-  }
-#endif
 }
 
 void GenMarkSweep::mark_sweep_phase1(int level,
@@ -246,8 +195,6 @@
   TraceTime tm("phase 1", PrintGC && Verbose, true, gclog_or_tty);
   trace(" 1");
 
-  VALIDATE_MARK_SWEEP_ONLY(reset_live_oop_tracking());
-
   GenCollectedHeap* gch = GenCollectedHeap::heap();
 
   // Because follow_root_closure is created statically, cannot
@@ -315,8 +262,6 @@
   TraceTime tm("phase 2", PrintGC && Verbose, true, gclog_or_tty);
   trace("2");
 
-  VALIDATE_MARK_SWEEP_ONLY(reset_live_oop_tracking());
-
   gch->prepare_for_compaction();
 }
 
@@ -337,8 +282,6 @@
   // Need new claim bits for the pointer adjustment tracing.
   ClassLoaderDataGraph::clear_claimed_marks();
 
-  VALIDATE_MARK_SWEEP_ONLY(reset_live_oop_tracking());
-
   // Because the two closures below are created statically, cannot
   // use OopsInGenClosure constructor which takes a generation,
   // as the Universe has not been created when the static constructors
@@ -393,10 +336,6 @@
   TraceTime tm("phase 4", PrintGC && Verbose, true, gclog_or_tty);
   trace("4");
 
-  VALIDATE_MARK_SWEEP_ONLY(reset_live_oop_tracking());
-
   GenCompactClosure blk;
   gch->generation_iterate(&blk, true);
-
-  VALIDATE_MARK_SWEEP_ONLY(compaction_complete());
 }
--- a/hotspot/src/share/vm/memory/metachunk.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/memory/metachunk.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -56,6 +56,7 @@
   assert(chunk_end > chunk_bottom, "Chunk must be too small");
   chunk->set_end(chunk_end);
   chunk->set_next(NULL);
+  chunk->set_prev(NULL);
   chunk->set_word_size(word_size);
 #ifdef ASSERT
   size_t data_word_size = pointer_delta(chunk_end, chunk_bottom, sizeof(MetaWord));
@@ -76,15 +77,15 @@
 }
 
 // _bottom points to the start of the chunk including the overhead.
-size_t Metachunk::used_word_size() {
+size_t Metachunk::used_word_size() const {
   return pointer_delta(_top, _bottom, sizeof(MetaWord));
 }
 
-size_t Metachunk::free_word_size() {
+size_t Metachunk::free_word_size() const {
   return pointer_delta(_end, _top, sizeof(MetaWord));
 }
 
-size_t Metachunk::capacity_word_size() {
+size_t Metachunk::capacity_word_size() const {
   return pointer_delta(_end, _bottom, sizeof(MetaWord));
 }
 
@@ -93,6 +94,10 @@
                " bottom " PTR_FORMAT " top " PTR_FORMAT
                " end " PTR_FORMAT " size " SIZE_FORMAT,
                bottom(), top(), end(), word_size());
+  if (Verbose) {
+    st->print_cr("    used " SIZE_FORMAT " free " SIZE_FORMAT,
+                 used_word_size(), free_word_size());
+  }
 }
 
 #ifndef PRODUCT
--- a/hotspot/src/share/vm/memory/metachunk.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/memory/metachunk.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -67,9 +67,11 @@
   void set_word_size(size_t v) { _word_size = v; }
  public:
 #ifdef ASSERT
-  Metachunk() : _bottom(NULL), _end(NULL), _top(NULL), _is_free(false) {}
+  Metachunk() : _bottom(NULL), _end(NULL), _top(NULL), _is_free(false),
+    _next(NULL), _prev(NULL) {}
 #else
-  Metachunk() : _bottom(NULL), _end(NULL), _top(NULL) {}
+  Metachunk() : _bottom(NULL), _end(NULL), _top(NULL),
+    _next(NULL), _prev(NULL) {}
 #endif
 
   // Used to add a Metachunk to a list of Metachunks
@@ -102,15 +104,15 @@
   }
 
   // Reset top to bottom so chunk can be reused.
-  void reset_empty() { _top = (_bottom + _overhead); }
+  void reset_empty() { _top = (_bottom + _overhead); _next = NULL; _prev = NULL; }
   bool is_empty() { return _top == (_bottom + _overhead); }
 
   // used (has been allocated)
   // free (available for future allocations)
   // capacity (total size of chunk)
-  size_t used_word_size();
-  size_t free_word_size();
-  size_t capacity_word_size();
+  size_t used_word_size() const;
+  size_t free_word_size() const;
+  size_t capacity_word_size()const;
 
   // Debug support
 #ifdef ASSERT
--- a/hotspot/src/share/vm/memory/metaspace.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/memory/metaspace.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -58,11 +58,23 @@
 
 // Used in declarations in SpaceManager and ChunkManager
 enum ChunkIndex {
-  SmallIndex = 0,
-  MediumIndex = 1,
-  HumongousIndex = 2,
-  NumberOfFreeLists = 2,
-  NumberOfInUseLists = 3
+  ZeroIndex = 0,
+  SpecializedIndex = ZeroIndex,
+  SmallIndex = SpecializedIndex + 1,
+  MediumIndex = SmallIndex + 1,
+  HumongousIndex = MediumIndex + 1,
+  NumberOfFreeLists = 3,
+  NumberOfInUseLists = 4
+};
+
+enum ChunkSizes {    // in words.
+  ClassSpecializedChunk = 128,
+  SpecializedChunk = 128,
+  ClassSmallChunk = 256,
+  SmallChunk = 512,
+  ClassMediumChunk = 1 * K,
+  MediumChunk = 8 * K,
+  HumongousChunkGranularity = 8
 };
 
 static ChunkIndex next_chunk_index(ChunkIndex i) {
@@ -126,6 +138,7 @@
   //   HumongousChunk
   ChunkList _free_chunks[NumberOfFreeLists];
 
+
   //   HumongousChunk
   ChunkTreeDictionary _humongous_dictionary;
 
@@ -169,6 +182,10 @@
   Metachunk* chunk_freelist_allocate(size_t word_size);
   void chunk_freelist_deallocate(Metachunk* chunk);
 
+  // Map a size to a list index assuming that there are lists
+  // for special, small, medium, and humongous chunks.
+  static ChunkIndex list_index(size_t size);
+
   // Total of the space in the free chunks list
   size_t free_chunks_total();
   size_t free_chunks_total_in_bytes();
@@ -180,8 +197,6 @@
     Atomic::add_ptr(count, &_free_chunks_count);
     Atomic::add_ptr(v, &_free_chunks_total);
   }
-  ChunkList* free_medium_chunks() { return &_free_chunks[1]; }
-  ChunkList* free_small_chunks() { return &_free_chunks[0]; }
   ChunkTreeDictionary* humongous_dictionary() {
     return &_humongous_dictionary;
   }
@@ -400,7 +415,14 @@
   VirtualSpaceList(size_t word_size);
   VirtualSpaceList(ReservedSpace rs);
 
-  Metachunk* get_new_chunk(size_t word_size, size_t grow_chunks_by_words);
+  Metachunk* get_new_chunk(size_t word_size,
+                           size_t grow_chunks_by_words,
+                           size_t medium_chunk_bunch);
+
+  // Get the first chunk for a Metaspace.  Used for
+  // special cases such as the boot class loader, reflection
+  // class loader and anonymous class loader.
+  Metachunk* get_initialization_chunk(size_t word_size, size_t chunk_bunch);
 
   VirtualSpaceNode* current_virtual_space() {
     return _current_virtual_space;
@@ -501,9 +523,13 @@
   friend class Metadebug;
 
  private:
+
   // protects allocations and contains.
   Mutex* const _lock;
 
+  // Chunk related size
+  size_t _medium_chunk_bunch;
+
   // List of chunks in use by this SpaceManager.  Allocations
   // are done from the current chunk.  The list is used for deallocating
   // chunks when the SpaceManager is freed.
@@ -532,6 +558,7 @@
   static const int    _expand_lock_rank;
   static Mutex* const _expand_lock;
 
+ private:
   // Accessors
   Metachunk* chunks_in_use(ChunkIndex index) const { return _chunks_in_use[index]; }
   void set_chunks_in_use(ChunkIndex index, Metachunk* v) { _chunks_in_use[index] = v; }
@@ -554,23 +581,37 @@
 
   Mutex* lock() const { return _lock; }
 
+  const char* chunk_size_name(ChunkIndex index) const;
+
+ protected:
+  void initialize();
+
  public:
-  SpaceManager(Mutex* lock, VirtualSpaceList* vs_list);
+  SpaceManager(Mutex* lock,
+               VirtualSpaceList* vs_list);
   ~SpaceManager();
 
-  enum ChunkSizes {    // in words.
-    SmallChunk = 512,
-    MediumChunk = 8 * K,
-    MediumChunkBunch = 4 * MediumChunk
+  enum ChunkMultiples {
+    MediumChunkMultiple = 4
   };
 
   // Accessors
+  size_t specialized_chunk_size() { return SpecializedChunk; }
+  size_t small_chunk_size() { return (size_t) vs_list()->is_class() ? ClassSmallChunk : SmallChunk; }
+  size_t medium_chunk_size() { return (size_t) vs_list()->is_class() ? ClassMediumChunk : MediumChunk; }
+  size_t medium_chunk_bunch() { return medium_chunk_size() * MediumChunkMultiple; }
+
   size_t allocation_total() const { return _allocation_total; }
   void inc_allocation_total(size_t v) { Atomic::add_ptr(v, &_allocation_total); }
-  static bool is_humongous(size_t word_size) { return word_size > MediumChunk; }
+  bool is_humongous(size_t word_size) { return word_size > medium_chunk_size(); }
 
   static Mutex* expand_lock() { return _expand_lock; }
 
+  // Set the sizes for the initial chunks.
+  void get_initial_chunk_sizes(Metaspace::MetaspaceType type,
+                               size_t* chunk_word_size,
+                               size_t* class_chunk_word_size);
+
   size_t sum_capacity_in_chunks_in_use() const;
   size_t sum_used_in_chunks_in_use() const;
   size_t sum_free_in_chunks_in_use() const;
@@ -580,6 +621,8 @@
   size_t sum_count_in_chunks_in_use();
   size_t sum_count_in_chunks_in_use(ChunkIndex i);
 
+  Metachunk* get_new_chunk(size_t word_size, size_t grow_chunks_by_words);
+
   // Block allocation and deallocation.
   // Allocates a block from the current chunk
   MetaWord* allocate(size_t word_size);
@@ -772,8 +815,10 @@
     return false;
   }
 
-  // Commit only 1 page instead of the whole reserved space _rs.size()
-  size_t committed_byte_size = os::vm_page_size();
+  // An allocation out of this Virtualspace that is larger
+  // than an initial commit size can waste that initial committed
+  // space.
+  size_t committed_byte_size = 0;
   bool result = virtual_space()->initialize(_rs, committed_byte_size);
   if (result) {
     set_top((MetaWord*)virtual_space()->low());
@@ -799,7 +844,8 @@
   st->print_cr("   space @ " PTR_FORMAT " " SIZE_FORMAT "K, %3d%% used "
            "[" PTR_FORMAT ", " PTR_FORMAT ", "
            PTR_FORMAT ", " PTR_FORMAT ")",
-           vs, capacity / K, used * 100 / capacity,
+           vs, capacity / K,
+           capacity == 0 ? 0 : used * 100 / capacity,
            bottom(), top(), end(),
            vs->high_boundary());
 }
@@ -922,7 +968,8 @@
 }
 
 Metachunk* VirtualSpaceList::get_new_chunk(size_t word_size,
-                                           size_t grow_chunks_by_words) {
+                                           size_t grow_chunks_by_words,
+                                           size_t medium_chunk_bunch) {
 
   // Get a chunk from the chunk freelist
   Metachunk* next = chunk_manager()->chunk_freelist_allocate(grow_chunks_by_words);
@@ -935,8 +982,8 @@
   if (next == NULL) {
     // Not enough room in current virtual space.  Try to commit
     // more space.
-    size_t expand_vs_by_words = MAX2((size_t)SpaceManager::MediumChunkBunch,
-                                       grow_chunks_by_words);
+    size_t expand_vs_by_words = MAX2(medium_chunk_bunch,
+                                     grow_chunks_by_words);
     size_t page_size_words = os::vm_page_size() / BytesPerWord;
     size_t aligned_expand_vs_by_words = align_size_up(expand_vs_by_words,
                                                         page_size_words);
@@ -954,12 +1001,6 @@
           // Got it.  It's on the list now.  Get a chunk from it.
           next = current_virtual_space()->get_chunk_vs_with_expand(grow_chunks_by_words);
         }
-        if (TraceMetadataHumongousAllocation && SpaceManager::is_humongous(word_size)) {
-          gclog_or_tty->print_cr("  aligned_expand_vs_by_words " PTR_FORMAT,
-                                 aligned_expand_vs_by_words);
-          gclog_or_tty->print_cr("  grow_vs_words " PTR_FORMAT,
-                                 grow_vs_words);
-        }
       } else {
         // Allocation will fail and induce a GC
         if (TraceMetadataChunkAllocation && Verbose) {
@@ -974,9 +1015,20 @@
     }
   }
 
+  assert(next == NULL || (next->next() == NULL && next->prev() == NULL),
+         "New chunk is still on some list");
   return next;
 }
 
+Metachunk* VirtualSpaceList::get_initialization_chunk(size_t chunk_word_size,
+                                                      size_t chunk_bunch) {
+  // Get a chunk from the chunk freelist
+  Metachunk* new_chunk = get_new_chunk(chunk_word_size,
+                                       chunk_word_size,
+                                       chunk_bunch);
+  return new_chunk;
+}
+
 void VirtualSpaceList::print_on(outputStream* st) const {
   if (TraceMetadataChunkAllocation && Verbose) {
     VirtualSpaceListIterator iter(virtual_space_list());
@@ -1373,16 +1425,17 @@
 
 void ChunkList::add_at_head(Metachunk* head, Metachunk* tail) {
   assert_lock_strong(SpaceManager::expand_lock());
-  assert(tail->next() == NULL, "Not the tail");
+  assert(head == tail || tail->next() == NULL,
+         "Not the tail or the head has already been added to a list");
 
   if (TraceMetadataChunkAllocation && Verbose) {
-    tty->print("ChunkList::add_at_head: ");
+    gclog_or_tty->print("ChunkList::add_at_head(head, tail): ");
     Metachunk* cur = head;
     while (cur != NULL) {
-    tty->print(PTR_FORMAT " (" SIZE_FORMAT ") ", cur, cur->word_size());
+      gclog_or_tty->print(PTR_FORMAT " (" SIZE_FORMAT ") ", cur, cur->word_size());
       cur = cur->next();
     }
-    tty->print_cr("");
+    gclog_or_tty->print_cr("");
   }
 
   if (tail != NULL) {
@@ -1486,13 +1539,13 @@
 
 void ChunkManager::locked_print_free_chunks(outputStream* st) {
   assert_lock_strong(SpaceManager::expand_lock());
-  st->print_cr("Free chunk total 0x%x  count 0x%x",
+  st->print_cr("Free chunk total " SIZE_FORMAT "  count " SIZE_FORMAT,
                 _free_chunks_total, _free_chunks_count);
 }
 
 void ChunkManager::locked_print_sum_free_chunks(outputStream* st) {
   assert_lock_strong(SpaceManager::expand_lock());
-  st->print_cr("Sum free chunk total 0x%x  count 0x%x",
+  st->print_cr("Sum free chunk total " SIZE_FORMAT "  count " SIZE_FORMAT,
                 sum_free_chunks(), sum_free_chunks_count());
 }
 ChunkList* ChunkManager::free_chunks(ChunkIndex index) {
@@ -1504,7 +1557,7 @@
 size_t ChunkManager::sum_free_chunks() {
   assert_lock_strong(SpaceManager::expand_lock());
   size_t result = 0;
-  for (ChunkIndex i = SmallIndex; i < NumberOfFreeLists; i = next_chunk_index(i)) {
+  for (ChunkIndex i = ZeroIndex; i < NumberOfFreeLists; i = next_chunk_index(i)) {
     ChunkList* list = free_chunks(i);
 
     if (list == NULL) {
@@ -1520,7 +1573,7 @@
 size_t ChunkManager::sum_free_chunks_count() {
   assert_lock_strong(SpaceManager::expand_lock());
   size_t count = 0;
-  for (ChunkIndex i = SmallIndex; i < NumberOfFreeLists; i = next_chunk_index(i)) {
+  for (ChunkIndex i = ZeroIndex; i < NumberOfFreeLists; i = next_chunk_index(i)) {
     ChunkList* list = free_chunks(i);
     if (list == NULL) {
       continue;
@@ -1532,15 +1585,9 @@
 }
 
 ChunkList* ChunkManager::find_free_chunks_list(size_t word_size) {
-  switch (word_size) {
-  case SpaceManager::SmallChunk :
-      return &_free_chunks[0];
-  case SpaceManager::MediumChunk :
-      return &_free_chunks[1];
-  default:
-    assert(word_size > SpaceManager::MediumChunk, "List inconsistency");
-    return &_free_chunks[2];
-  }
+  ChunkIndex index = list_index(word_size);
+  assert(index < HumongousIndex, "No humongous list");
+  return free_chunks(index);
 }
 
 void ChunkManager::free_chunks_put(Metachunk* chunk) {
@@ -1574,7 +1621,7 @@
   slow_locked_verify();
 
   Metachunk* chunk = NULL;
-  if (!SpaceManager::is_humongous(word_size)) {
+  if (list_index(word_size) != HumongousIndex) {
     ChunkList* free_list = find_free_chunks_list(word_size);
     assert(free_list != NULL, "Sanity check");
 
@@ -1587,8 +1634,8 @@
 
     // Remove the chunk as the head of the list.
     free_list->set_head(chunk->next());
-    chunk->set_next(NULL);
-    // Chunk has been removed from the chunks free list.
+
+    // Chunk is being removed from the chunks free list.
     dec_free_chunks_total(chunk->capacity_word_size());
 
     if (TraceMetadataChunkAllocation && Verbose) {
@@ -1614,8 +1661,14 @@
 #ifdef ASSERT
       chunk->set_is_free(false);
 #endif
+    } else {
+      return NULL;
     }
   }
+
+  // Remove it from the links to this freelist
+  chunk->set_next(NULL);
+  chunk->set_prev(NULL);
   slow_locked_verify();
   return chunk;
 }
@@ -1630,13 +1683,20 @@
     return NULL;
   }
 
-  assert(word_size <= chunk->word_size() ||
-           SpaceManager::is_humongous(chunk->word_size()),
-           "Non-humongous variable sized chunk");
+  assert((word_size <= chunk->word_size()) ||
+         list_index(chunk->word_size() == HumongousIndex),
+         "Non-humongous variable sized chunk");
   if (TraceMetadataChunkAllocation) {
-    tty->print("ChunkManager::chunk_freelist_allocate: chunk "
-               PTR_FORMAT "  size " SIZE_FORMAT " ",
-               chunk, chunk->word_size());
+    size_t list_count;
+    if (list_index(word_size) < HumongousIndex) {
+      ChunkList* list = find_free_chunks_list(word_size);
+      list_count = list->sum_list_count();
+    } else {
+      list_count = humongous_dictionary()->total_count();
+    }
+    tty->print("ChunkManager::chunk_freelist_allocate: " PTR_FORMAT " chunk "
+               PTR_FORMAT "  size " SIZE_FORMAT " count " SIZE_FORMAT " ",
+               this, chunk, chunk->word_size(), list_count);
     locked_print_free_chunks(tty);
   }
 
@@ -1651,10 +1711,42 @@
 
 // SpaceManager methods
 
+void SpaceManager::get_initial_chunk_sizes(Metaspace::MetaspaceType type,
+                                           size_t* chunk_word_size,
+                                           size_t* class_chunk_word_size) {
+  switch (type) {
+  case Metaspace::BootMetaspaceType:
+    *chunk_word_size = Metaspace::first_chunk_word_size();
+    *class_chunk_word_size = Metaspace::first_class_chunk_word_size();
+    break;
+  case Metaspace::ROMetaspaceType:
+    *chunk_word_size = SharedReadOnlySize / wordSize;
+    *class_chunk_word_size = ClassSpecializedChunk;
+    break;
+  case Metaspace::ReadWriteMetaspaceType:
+    *chunk_word_size = SharedReadWriteSize / wordSize;
+    *class_chunk_word_size = ClassSpecializedChunk;
+    break;
+  case Metaspace::AnonymousMetaspaceType:
+  case Metaspace::ReflectionMetaspaceType:
+    *chunk_word_size = SpecializedChunk;
+    *class_chunk_word_size = ClassSpecializedChunk;
+    break;
+  default:
+    *chunk_word_size = SmallChunk;
+    *class_chunk_word_size = ClassSmallChunk;
+    break;
+  }
+  assert(chunk_word_size != 0 && class_chunk_word_size != 0,
+    err_msg("Initial chunks sizes bad: data  " SIZE_FORMAT
+            " class " SIZE_FORMAT,
+            chunk_word_size, class_chunk_word_size));
+}
+
 size_t SpaceManager::sum_free_in_chunks_in_use() const {
   MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag);
   size_t free = 0;
-  for (ChunkIndex i = SmallIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
+  for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
     Metachunk* chunk = chunks_in_use(i);
     while (chunk != NULL) {
       free += chunk->free_word_size();
@@ -1667,9 +1759,7 @@
 size_t SpaceManager::sum_waste_in_chunks_in_use() const {
   MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag);
   size_t result = 0;
-  for (ChunkIndex i = SmallIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
-
-
+  for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
    result += sum_waste_in_chunks_in_use(i);
   }
 
@@ -1678,7 +1768,6 @@
 
 size_t SpaceManager::sum_waste_in_chunks_in_use(ChunkIndex index) const {
   size_t result = 0;
-  size_t count = 0;
   Metachunk* chunk = chunks_in_use(index);
   // Count the free space in all the chunk but not the
   // current chunk from which allocations are still being done.
@@ -1688,7 +1777,6 @@
       result += chunk->free_word_size();
       prev = chunk;
       chunk = chunk->next();
-      count++;
     }
   }
   return result;
@@ -1697,7 +1785,7 @@
 size_t SpaceManager::sum_capacity_in_chunks_in_use() const {
   MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag);
   size_t sum = 0;
-  for (ChunkIndex i = SmallIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
+  for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
     Metachunk* chunk = chunks_in_use(i);
     while (chunk != NULL) {
       // Just changed this sum += chunk->capacity_word_size();
@@ -1711,7 +1799,7 @@
 
 size_t SpaceManager::sum_count_in_chunks_in_use() {
   size_t count = 0;
-  for (ChunkIndex i = SmallIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
+  for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
     count = count + sum_count_in_chunks_in_use(i);
   }
 
@@ -1732,7 +1820,7 @@
 size_t SpaceManager::sum_used_in_chunks_in_use() const {
   MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag);
   size_t used = 0;
-  for (ChunkIndex i = SmallIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
+  for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
     Metachunk* chunk = chunks_in_use(i);
     while (chunk != NULL) {
       used += chunk->used_word_size();
@@ -1744,19 +1832,17 @@
 
 void SpaceManager::locked_print_chunks_in_use_on(outputStream* st) const {
 
-  Metachunk* small_chunk = chunks_in_use(SmallIndex);
-  st->print_cr("SpaceManager: small chunk " PTR_FORMAT
-               " free " SIZE_FORMAT,
-               small_chunk,
-               small_chunk->free_word_size());
-
-  Metachunk* medium_chunk = chunks_in_use(MediumIndex);
-  st->print("medium chunk " PTR_FORMAT, medium_chunk);
-  Metachunk* tail = current_chunk();
-  st->print_cr(" current chunk " PTR_FORMAT, tail);
-
-  Metachunk* head = chunks_in_use(HumongousIndex);
-  st->print_cr("humongous chunk " PTR_FORMAT, head);
+  for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
+    Metachunk* chunk = chunks_in_use(i);
+    st->print("SpaceManager: %s " PTR_FORMAT,
+                 chunk_size_name(i), chunk);
+    if (chunk != NULL) {
+      st->print_cr(" free " SIZE_FORMAT,
+                   chunk->free_word_size());
+    } else {
+      st->print_cr("");
+    }
+  }
 
   vs_list()->chunk_manager()->locked_print_free_chunks(st);
   vs_list()->chunk_manager()->locked_print_sum_free_chunks(st);
@@ -1772,18 +1858,28 @@
   if (chunks_in_use(MediumIndex) == NULL &&
       (!has_small_chunk_limit() ||
        sum_count_in_chunks_in_use(SmallIndex) < _small_chunk_limit)) {
-    chunk_word_size = (size_t) SpaceManager::SmallChunk;
-    if (word_size + Metachunk::overhead() > SpaceManager::SmallChunk) {
-      chunk_word_size = MediumChunk;
+    chunk_word_size = (size_t) small_chunk_size();
+    if (word_size + Metachunk::overhead() > small_chunk_size()) {
+      chunk_word_size = medium_chunk_size();
     }
   } else {
-    chunk_word_size = MediumChunk;
+    chunk_word_size = medium_chunk_size();
   }
 
-  // Might still need a humongous chunk
+  // Might still need a humongous chunk.  Enforce an
+  // eight word granularity to facilitate reuse (some
+  // wastage but better chance of reuse).
+  size_t if_humongous_sized_chunk =
+    align_size_up(word_size + Metachunk::overhead(),
+                  HumongousChunkGranularity);
   chunk_word_size =
-    MAX2((size_t) chunk_word_size, word_size + Metachunk::overhead());
-
+    MAX2((size_t) chunk_word_size, if_humongous_sized_chunk);
+
+  assert(!SpaceManager::is_humongous(word_size) ||
+         chunk_word_size == if_humongous_sized_chunk,
+         err_msg("Size calculation is wrong, word_size " SIZE_FORMAT
+                 " chunk_word_size " SIZE_FORMAT,
+                 word_size, chunk_word_size));
   if (TraceMetadataHumongousAllocation &&
       SpaceManager::is_humongous(word_size)) {
     gclog_or_tty->print_cr("Metadata humongous allocation:");
@@ -1805,15 +1901,21 @@
   MutexLockerEx cl(SpaceManager::expand_lock(), Mutex::_no_safepoint_check_flag);
 
   if (TraceMetadataChunkAllocation && Verbose) {
+    size_t words_left = 0;
+    size_t words_used = 0;
+    if (current_chunk() != NULL) {
+      words_left = current_chunk()->free_word_size();
+      words_used = current_chunk()->used_word_size();
+    }
     gclog_or_tty->print_cr("SpaceManager::grow_and_allocate for " SIZE_FORMAT
-                           " words " SIZE_FORMAT " space left",
-                            word_size, current_chunk() != NULL ?
-                              current_chunk()->free_word_size() : 0);
+                           " words " SIZE_FORMAT " words used " SIZE_FORMAT
+                           " words left",
+                            word_size, words_used, words_left);
   }
 
   // Get another chunk out of the virtual space
   size_t grow_chunks_by_words = calc_chunk_size(word_size);
-  Metachunk* next = vs_list()->get_new_chunk(word_size, grow_chunks_by_words);
+  Metachunk* next = get_new_chunk(word_size, grow_chunks_by_words);
 
   // If a chunk was available, add it to the in-use chunk list
   // and do an allocation from it.
@@ -1828,7 +1930,7 @@
 
 void SpaceManager::print_on(outputStream* st) const {
 
-  for (ChunkIndex i = SmallIndex;
+  for (ChunkIndex i = ZeroIndex;
        i < NumberOfInUseLists ;
        i = next_chunk_index(i) ) {
     st->print_cr("  chunks_in_use " PTR_FORMAT " chunk size " PTR_FORMAT,
@@ -1847,12 +1949,18 @@
   }
 }
 
-SpaceManager::SpaceManager(Mutex* lock, VirtualSpaceList* vs_list) :
+SpaceManager::SpaceManager(Mutex* lock,
+                           VirtualSpaceList* vs_list) :
   _vs_list(vs_list),
   _allocation_total(0),
-  _lock(lock) {
+  _lock(lock)
+{
+  initialize();
+}
+
+void SpaceManager::initialize() {
   Metadebug::init_allocation_fail_alot_count();
-  for (ChunkIndex i = SmallIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
+  for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
     _chunks_in_use[i] = NULL;
   }
   _current_chunk = NULL;
@@ -1885,30 +1993,37 @@
   // Add all the chunks in use by this space manager
   // to the global list of free chunks.
 
-  // Small chunks.  There is one _current_chunk for each
-  // Metaspace.  It could point to a small or medium chunk.
-  // Rather than determine which it is, follow the list of
-  // small chunks to add them to the free list
-  Metachunk* small_chunk = chunks_in_use(SmallIndex);
-  chunk_manager->free_small_chunks()->add_at_head(small_chunk);
-  set_chunks_in_use(SmallIndex, NULL);
-
-  // After the small chunk are the medium chunks
-  Metachunk* medium_chunk = chunks_in_use(MediumIndex);
-  assert(medium_chunk == NULL ||
-         medium_chunk->word_size() == MediumChunk,
-         "Chunk is on the wrong list");
-
-  if (medium_chunk != NULL) {
-    Metachunk* head = medium_chunk;
-    // If there is a medium chunk then the _current_chunk can only
-    // point to the last medium chunk.
-    Metachunk* tail = current_chunk();
-    chunk_manager->free_medium_chunks()->add_at_head(head, tail);
-    set_chunks_in_use(MediumIndex, NULL);
+  // Follow each list of chunks-in-use and add them to the
+  // free lists.  Each list is NULL terminated.
+
+  for (ChunkIndex i = ZeroIndex; i < HumongousIndex; i = next_chunk_index(i)) {
+    if (TraceMetadataChunkAllocation && Verbose) {
+      gclog_or_tty->print_cr("returned %d %s chunks to freelist",
+                             sum_count_in_chunks_in_use(i),
+                             chunk_size_name(i));
+    }
+    Metachunk* chunks = chunks_in_use(i);
+    chunk_manager->free_chunks(i)->add_at_head(chunks);
+    set_chunks_in_use(i, NULL);
+    if (TraceMetadataChunkAllocation && Verbose) {
+      gclog_or_tty->print_cr("updated freelist count %d %s",
+                             chunk_manager->free_chunks(i)->sum_list_count(),
+                             chunk_size_name(i));
+    }
+    assert(i != HumongousIndex, "Humongous chunks are handled explicitly later");
   }
 
+  // The medium chunk case may be optimized by passing the head and
+  // tail of the medium chunk list to add_at_head().  The tail is often
+  // the current chunk but there are probably exceptions.
+
   // Humongous chunks
+  if (TraceMetadataChunkAllocation && Verbose) {
+    gclog_or_tty->print_cr("returned %d %s humongous chunks to dictionary",
+                            sum_count_in_chunks_in_use(HumongousIndex),
+                            chunk_size_name(HumongousIndex));
+    gclog_or_tty->print("Humongous chunk dictionary: ");
+  }
   // Humongous chunks are never the current chunk.
   Metachunk* humongous_chunks = chunks_in_use(HumongousIndex);
 
@@ -1916,14 +2031,65 @@
 #ifdef ASSERT
     humongous_chunks->set_is_free(true);
 #endif
+    if (TraceMetadataChunkAllocation && Verbose) {
+      gclog_or_tty->print(PTR_FORMAT " (" SIZE_FORMAT ") ",
+                          humongous_chunks,
+                          humongous_chunks->word_size());
+    }
+    assert(humongous_chunks->word_size() == (size_t)
+           align_size_up(humongous_chunks->word_size(),
+                             HumongousChunkGranularity),
+           err_msg("Humongous chunk size is wrong: word size " SIZE_FORMAT
+                   " granularity " SIZE_FORMAT,
+                   humongous_chunks->word_size(), HumongousChunkGranularity));
     Metachunk* next_humongous_chunks = humongous_chunks->next();
     chunk_manager->humongous_dictionary()->return_chunk(humongous_chunks);
     humongous_chunks = next_humongous_chunks;
   }
+  if (TraceMetadataChunkAllocation && Verbose) {
+    gclog_or_tty->print_cr("");
+    gclog_or_tty->print_cr("updated dictionary count %d %s",
+                     chunk_manager->humongous_dictionary()->total_count(),
+                     chunk_size_name(HumongousIndex));
+  }
   set_chunks_in_use(HumongousIndex, NULL);
   chunk_manager->slow_locked_verify();
 }
 
+const char* SpaceManager::chunk_size_name(ChunkIndex index) const {
+  switch (index) {
+    case SpecializedIndex:
+      return "Specialized";
+    case SmallIndex:
+      return "Small";
+    case MediumIndex:
+      return "Medium";
+    case HumongousIndex:
+      return "Humongous";
+    default:
+      return NULL;
+  }
+}
+
+ChunkIndex ChunkManager::list_index(size_t size) {
+  switch (size) {
+    case SpecializedChunk:
+      assert(SpecializedChunk == ClassSpecializedChunk,
+             "Need branch for ClassSpecializedChunk");
+      return SpecializedIndex;
+    case SmallChunk:
+    case ClassSmallChunk:
+      return SmallIndex;
+    case MediumChunk:
+    case ClassMediumChunk:
+      return MediumIndex;
+    default:
+      assert(size > MediumChunk || size > ClassMediumChunk,
+             "Not a humongous chunk");
+      return HumongousIndex;
+  }
+}
+
 void SpaceManager::deallocate(MetaWord* p, size_t word_size) {
   assert_lock_strong(_lock);
   size_t min_size = TreeChunk<Metablock, FreeList>::min_size();
@@ -1942,52 +2108,13 @@
 
   // Find the correct list and and set the current
   // chunk for that list.
-  switch (new_chunk->word_size()) {
-  case SpaceManager::SmallChunk :
-    if (chunks_in_use(SmallIndex) == NULL) {
-      // First chunk to add to the list
-      set_chunks_in_use(SmallIndex, new_chunk);
-    } else {
-      assert(current_chunk()->word_size() == SpaceManager::SmallChunk,
-        err_msg( "Incorrect mix of sizes in chunk list "
-        SIZE_FORMAT " new chunk " SIZE_FORMAT,
-        current_chunk()->word_size(), new_chunk->word_size()));
-      current_chunk()->set_next(new_chunk);
-    }
-    // Make current chunk
+  ChunkIndex index = ChunkManager::list_index(new_chunk->word_size());
+
+  if (index != HumongousIndex) {
     set_current_chunk(new_chunk);
-    break;
-  case SpaceManager::MediumChunk :
-    if (chunks_in_use(MediumIndex) == NULL) {
-      // About to add the first medium chunk so teminate the
-      // small chunk list.  In general once medium chunks are
-      // being added, we're past the need for small chunks.
-      if (current_chunk() != NULL) {
-        // Only a small chunk or the initial chunk could be
-        // the current chunk if this is the first medium chunk.
-        assert(current_chunk()->word_size() == SpaceManager::SmallChunk ||
-          chunks_in_use(SmallIndex) == NULL,
-          err_msg("Should be a small chunk or initial chunk, current chunk "
-          SIZE_FORMAT " new chunk " SIZE_FORMAT,
-          current_chunk()->word_size(), new_chunk->word_size()));
-        current_chunk()->set_next(NULL);
-      }
-      // First chunk to add to the list
-      set_chunks_in_use(MediumIndex, new_chunk);
-
-    } else {
-      // As a minimum the first medium chunk added would
-      // have become the _current_chunk
-      // so the _current_chunk has to be non-NULL here
-      // (although not necessarily still the first medium chunk).
-      assert(current_chunk()->word_size() == SpaceManager::MediumChunk,
-             "A medium chunk should the current chunk");
-      current_chunk()->set_next(new_chunk);
-    }
-    // Make current chunk
-    set_current_chunk(new_chunk);
-    break;
-  default: {
+    new_chunk->set_next(chunks_in_use(index));
+    set_chunks_in_use(index, new_chunk);
+  } else {
     // For null class loader data and DumpSharedSpaces, the first chunk isn't
     // small, so small will be null.  Link this first chunk as the current
     // chunk.
@@ -2002,8 +2129,7 @@
     new_chunk->set_next(chunks_in_use(HumongousIndex));
     set_chunks_in_use(HumongousIndex, new_chunk);
 
-    assert(new_chunk->word_size() > MediumChunk, "List inconsistency");
-  }
+    assert(new_chunk->word_size() > medium_chunk_size(), "List inconsistency");
   }
 
   assert(new_chunk->is_empty(), "Not ready for reuse");
@@ -2015,6 +2141,22 @@
   }
 }
 
+Metachunk* SpaceManager::get_new_chunk(size_t word_size,
+                                       size_t grow_chunks_by_words) {
+
+  Metachunk* next = vs_list()->get_new_chunk(word_size,
+                                             grow_chunks_by_words,
+                                             medium_chunk_bunch());
+
+  if (TraceMetadataHumongousAllocation &&
+      SpaceManager::is_humongous(next->word_size())) {
+    gclog_or_tty->print_cr("  new humongous chunk word size " PTR_FORMAT,
+                           next->word_size());
+  }
+
+  return next;
+}
+
 MetaWord* SpaceManager::allocate(size_t word_size) {
   MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag);
 
@@ -2090,12 +2232,7 @@
   // verfication of chunks does not work since
   // being in the dictionary alters a chunk.
   if (block_freelists()->total_size() == 0) {
-    // Skip the small chunks because their next link points to
-    // medium chunks.  This is because the small chunk is the
-    // current chunk (for allocations) until it is full and the
-    // the addition of the next chunk does not NULL the next
-    // like of the small chunk.
-    for (ChunkIndex i = MediumIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
+    for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
       Metachunk* curr = chunks_in_use(i);
       while (curr != NULL) {
         curr->verify();
@@ -2108,15 +2245,15 @@
 
 void SpaceManager::verify_chunk_size(Metachunk* chunk) {
   assert(is_humongous(chunk->word_size()) ||
-         chunk->word_size() == MediumChunk ||
-         chunk->word_size() == SmallChunk,
+         chunk->word_size() == medium_chunk_size() ||
+         chunk->word_size() == small_chunk_size() ||
+         chunk->word_size() == specialized_chunk_size(),
          "Chunk size is wrong");
   return;
 }
 
 #ifdef ASSERT
 void SpaceManager::verify_allocation_total() {
-#if 0
   // Verification is only guaranteed at a safepoint.
   if (SafepointSynchronize::is_at_safepoint()) {
     gclog_or_tty->print_cr("Chunk " PTR_FORMAT " allocation_total " SIZE_FORMAT
@@ -2129,7 +2266,6 @@
   assert(allocation_total() == sum_used_in_chunks_in_use(),
     err_msg("allocation total is not consistent %d vs %d",
             allocation_total(), sum_used_in_chunks_in_use()));
-#endif
 }
 
 #endif
@@ -2142,7 +2278,7 @@
   size_t capacity = 0;
 
   // Add up statistics for all chunks in this SpaceManager.
-  for (ChunkIndex index = SmallIndex;
+  for (ChunkIndex index = ZeroIndex;
        index < NumberOfInUseLists;
        index = next_chunk_index(index)) {
     for (Metachunk* curr = chunks_in_use(index);
@@ -2160,7 +2296,7 @@
     }
   }
 
-  size_t free = current_chunk()->free_word_size();
+  size_t free = current_chunk() == NULL ? 0 : current_chunk()->free_word_size();
   // Free space isn't wasted.
   waste -= free;
 
@@ -2171,25 +2307,18 @@
 
 #ifndef PRODUCT
 void SpaceManager::mangle_freed_chunks() {
-  for (ChunkIndex index = SmallIndex;
+  for (ChunkIndex index = ZeroIndex;
        index < NumberOfInUseLists;
        index = next_chunk_index(index)) {
     for (Metachunk* curr = chunks_in_use(index);
          curr != NULL;
          curr = curr->next()) {
-      // Try to detect incorrectly terminated small chunk
-      // list.
-      assert(index == MediumIndex || curr != chunks_in_use(MediumIndex),
-             err_msg("Mangling medium chunks in small chunks? "
-                     "curr " PTR_FORMAT " medium list " PTR_FORMAT,
-                     curr, chunks_in_use(MediumIndex)));
       curr->mangle();
     }
   }
 }
 #endif // PRODUCT
 
-
 // MetaspaceAux
 
 size_t MetaspaceAux::used_in_bytes(Metaspace::MetadataType mdtype) {
@@ -2236,7 +2365,7 @@
   return reserved * BytesPerWord;
 }
 
-size_t MetaspaceAux::min_chunk_size() { return SpaceManager::MediumChunk; }
+size_t MetaspaceAux::min_chunk_size() { return Metaspace::first_chunk_word_size(); }
 
 size_t MetaspaceAux::free_chunks_total(Metaspace::MetadataType mdtype) {
   ChunkManager* chunk = (mdtype == Metaspace::ClassType) ?
@@ -2316,26 +2445,44 @@
 // Print total fragmentation for class and data metaspaces separately
 void MetaspaceAux::print_waste(outputStream* out) {
 
-  size_t small_waste = 0, medium_waste = 0, large_waste = 0;
-  size_t cls_small_waste = 0, cls_medium_waste = 0, cls_large_waste = 0;
+  size_t specialized_waste = 0, small_waste = 0, medium_waste = 0, large_waste = 0;
+  size_t specialized_count = 0, small_count = 0, medium_count = 0, large_count = 0;
+  size_t cls_specialized_waste = 0, cls_small_waste = 0, cls_medium_waste = 0, cls_large_waste = 0;
+  size_t cls_specialized_count = 0, cls_small_count = 0, cls_medium_count = 0, cls_large_count = 0;
 
   ClassLoaderDataGraphMetaspaceIterator iter;
   while (iter.repeat()) {
     Metaspace* msp = iter.get_next();
     if (msp != NULL) {
+      specialized_waste += msp->vsm()->sum_waste_in_chunks_in_use(SpecializedIndex);
+      specialized_count += msp->vsm()->sum_count_in_chunks_in_use(SpecializedIndex);
       small_waste += msp->vsm()->sum_waste_in_chunks_in_use(SmallIndex);
+      small_count += msp->vsm()->sum_count_in_chunks_in_use(SmallIndex);
       medium_waste += msp->vsm()->sum_waste_in_chunks_in_use(MediumIndex);
+      medium_count += msp->vsm()->sum_count_in_chunks_in_use(MediumIndex);
       large_waste += msp->vsm()->sum_waste_in_chunks_in_use(HumongousIndex);
-
+      large_count += msp->vsm()->sum_count_in_chunks_in_use(HumongousIndex);
+
+      cls_specialized_waste += msp->class_vsm()->sum_waste_in_chunks_in_use(SpecializedIndex);
+      cls_specialized_count += msp->class_vsm()->sum_count_in_chunks_in_use(SpecializedIndex);
       cls_small_waste += msp->class_vsm()->sum_waste_in_chunks_in_use(SmallIndex);
+      cls_small_count += msp->class_vsm()->sum_count_in_chunks_in_use(SmallIndex);
       cls_medium_waste += msp->class_vsm()->sum_waste_in_chunks_in_use(MediumIndex);
+      cls_medium_count += msp->class_vsm()->sum_count_in_chunks_in_use(MediumIndex);
       cls_large_waste += msp->class_vsm()->sum_waste_in_chunks_in_use(HumongousIndex);
+      cls_large_count += msp->class_vsm()->sum_count_in_chunks_in_use(HumongousIndex);
     }
   }
   out->print_cr("Total fragmentation waste (words) doesn't count free space");
-  out->print("  data: small " SIZE_FORMAT " medium " SIZE_FORMAT,
-             small_waste, medium_waste);
-  out->print_cr(" class: small " SIZE_FORMAT, cls_small_waste);
+  out->print_cr("  data: " SIZE_FORMAT " specialized(s) " SIZE_FORMAT ", "
+                        SIZE_FORMAT " small(s) " SIZE_FORMAT ", "
+                        SIZE_FORMAT " medium(s) " SIZE_FORMAT,
+             specialized_count, specialized_waste, small_count,
+             small_waste, medium_count, medium_waste);
+  out->print_cr(" class: " SIZE_FORMAT " specialized(s) " SIZE_FORMAT ", "
+                           SIZE_FORMAT " small(s) " SIZE_FORMAT,
+             cls_specialized_count, cls_specialized_waste,
+             cls_small_count, cls_small_waste);
 }
 
 // Dump global metaspace things from the end of ClassLoaderDataGraph
@@ -2354,13 +2501,10 @@
 // Metaspace methods
 
 size_t Metaspace::_first_chunk_word_size = 0;
-
-Metaspace::Metaspace(Mutex* lock, size_t word_size) {
-  initialize(lock, word_size);
-}
-
-Metaspace::Metaspace(Mutex* lock) {
-  initialize(lock);
+size_t Metaspace::_first_class_chunk_word_size = 0;
+
+Metaspace::Metaspace(Mutex* lock, MetaspaceType type) {
+  initialize(lock, type);
 }
 
 Metaspace::~Metaspace() {
@@ -2412,11 +2556,18 @@
       }
     }
 
-    // Initialize this before initializing the VirtualSpaceList
+    // Initialize these before initializing the VirtualSpaceList
     _first_chunk_word_size = InitialBootClassLoaderMetaspaceSize / BytesPerWord;
+    _first_chunk_word_size = align_word_size_up(_first_chunk_word_size);
+    // Make the first class chunk bigger than a medium chunk so it's not put
+    // on the medium chunk list.   The next chunk will be small and progress
+    // from there.  This size calculated by -version.
+    _first_class_chunk_word_size = MIN2((size_t)MediumChunk*6,
+                                       (ClassMetaspaceSize/BytesPerWord)*2);
+    _first_class_chunk_word_size = align_word_size_up(_first_class_chunk_word_size);
     // Arbitrarily set the initial virtual space to a multiple
     // of the boot class loader size.
-    size_t word_size = VIRTUALSPACEMULTIPLIER * Metaspace::first_chunk_word_size();
+    size_t word_size = VIRTUALSPACEMULTIPLIER * first_chunk_word_size();
     // Initialize the list of virtual spaces.
     _space_list = new VirtualSpaceList(word_size);
   }
@@ -2431,23 +2582,8 @@
   _class_space_list = new VirtualSpaceList(rs);
 }
 
-
-void Metaspace::initialize(Mutex* lock, size_t initial_size) {
-  // Use SmallChunk size if not specified.   If specified, use this size for
-  // the data metaspace.
-  size_t word_size;
-  size_t class_word_size;
-  if (initial_size == 0) {
-    word_size = (size_t) SpaceManager::SmallChunk;
-    class_word_size = (size_t) SpaceManager::SmallChunk;
-  } else {
-    word_size = initial_size;
-    // Make the first class chunk bigger than a medium chunk so it's not put
-    // on the medium chunk list.   The next chunk will be small and progress
-    // from there.  This size calculated by -version.
-    class_word_size = MIN2((size_t)SpaceManager::MediumChunk*5,
-                           (ClassMetaspaceSize/BytesPerWord)*2);
-  }
+void Metaspace::initialize(Mutex* lock,
+                           MetaspaceType type) {
 
   assert(space_list() != NULL,
     "Metadata VirtualSpaceList has not been initialized");
@@ -2456,6 +2592,11 @@
   if (_vsm == NULL) {
     return;
   }
+  size_t word_size;
+  size_t class_word_size;
+  vsm()->get_initial_chunk_sizes(type,
+                                 &word_size,
+                                 &class_word_size);
 
   assert(class_space_list() != NULL,
     "Class VirtualSpaceList has not been initialized");
@@ -2470,7 +2611,8 @@
 
   // Allocate chunk for metadata objects
   Metachunk* new_chunk =
-     space_list()->current_virtual_space()->get_chunk_vs_with_expand(word_size);
+     space_list()->get_initialization_chunk(word_size,
+                                            vsm()->medium_chunk_bunch());
   assert(!DumpSharedSpaces || new_chunk != NULL, "should have enough space for both chunks");
   if (new_chunk != NULL) {
     // Add to this manager's list of chunks in use and current_chunk().
@@ -2479,12 +2621,18 @@
 
   // Allocate chunk for class metadata objects
   Metachunk* class_chunk =
-     class_space_list()->current_virtual_space()->get_chunk_vs_with_expand(class_word_size);
+     class_space_list()->get_initialization_chunk(class_word_size,
+                                                  class_vsm()->medium_chunk_bunch());
   if (class_chunk != NULL) {
     class_vsm()->add_chunk(class_chunk, true);
   }
 }
 
+size_t Metaspace::align_word_size_up(size_t word_size) {
+  size_t byte_size = word_size * wordSize;
+  return ReservedSpace::allocation_align_size_up(byte_size) / wordSize;
+}
+
 MetaWord* Metaspace::allocate(size_t word_size, MetadataType mdtype) {
   // DumpSharedSpaces doesn't use class metadata area (yet)
   if (mdtype == ClassType && !DumpSharedSpaces) {
@@ -2610,6 +2758,12 @@
 
     // If result is still null, we are out of memory.
     if (result == NULL) {
+      if (Verbose && TraceMetadataChunkAllocation) {
+        gclog_or_tty->print_cr("Metaspace allocation failed for size "
+          SIZE_FORMAT, word_size);
+        if (loader_data->metaspace_or_null() != NULL) loader_data->metaspace_or_null()->dump(gclog_or_tty);
+        MetaspaceAux::dump(gclog_or_tty);
+      }
       // -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support
       report_java_out_of_memory("Metadata space");
 
--- a/hotspot/src/share/vm/memory/metaspace.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/memory/metaspace.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -87,11 +87,23 @@
 
  public:
   enum MetadataType {ClassType, NonClassType};
+  enum MetaspaceType {
+    StandardMetaspaceType,
+    BootMetaspaceType,
+    ROMetaspaceType,
+    ReadWriteMetaspaceType,
+    AnonymousMetaspaceType,
+    ReflectionMetaspaceType
+  };
 
  private:
-  void initialize(Mutex* lock, size_t initial_size = 0);
+  void initialize(Mutex* lock, MetaspaceType type);
+
+  // Align up the word size to the allocation word size
+  static size_t align_word_size_up(size_t);
 
   static size_t _first_chunk_word_size;
+  static size_t _first_class_chunk_word_size;
 
   SpaceManager* _vsm;
   SpaceManager* vsm() const { return _vsm; }
@@ -110,8 +122,7 @@
 
  public:
 
-  Metaspace(Mutex* lock, size_t initial_size);
-  Metaspace(Mutex* lock);
+  Metaspace(Mutex* lock, MetaspaceType type);
   ~Metaspace();
 
   // Initialize globals for Metaspace
@@ -119,6 +130,7 @@
   static void initialize_class_space(ReservedSpace rs);
 
   static size_t first_chunk_word_size() { return _first_chunk_word_size; }
+  static size_t first_class_chunk_word_size() { return _first_class_chunk_word_size; }
 
   char*  bottom() const;
   size_t used_words(MetadataType mdtype) const;
--- a/hotspot/src/share/vm/memory/metaspaceShared.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -689,9 +689,15 @@
 bool MetaspaceShared::map_shared_spaces(FileMapInfo* mapinfo) {
   size_t image_alignment = mapinfo->alignment();
 
-  // Map in the shared memory and then map the regions on top of it
+#ifndef _WINDOWS
+  // Map in the shared memory and then map the regions on top of it.
+  // On Windows, don't map the memory here because it will cause the
+  // mappings of the regions to fail.
   ReservedSpace shared_rs = mapinfo->reserve_shared_memory();
   if (!shared_rs.is_reserved()) return false;
+#endif
+
+  assert(!DumpSharedSpaces, "Should not be called with DumpSharedSpaces");
 
   // Map each shared region
   if ((_ro_base = mapinfo->map_region(ro)) != NULL &&
@@ -708,8 +714,10 @@
     if (_rw_base != NULL) mapinfo->unmap_region(rw);
     if (_md_base != NULL) mapinfo->unmap_region(md);
     if (_mc_base != NULL) mapinfo->unmap_region(mc);
+#ifndef _WINDOWS
     // Release the entire mapped region
     shared_rs.release();
+#endif
     // If -Xshare:on is specified, print out the error message and exit VM,
     // otherwise, set UseSharedSpaces to false and continue.
     if (RequireSharedSpaces) {
--- a/hotspot/src/share/vm/memory/space.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/memory/space.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -411,7 +411,6 @@
     assert(q->forwardee() == NULL, "should be forwarded to NULL");
   }
 
-  VALIDATE_MARK_SWEEP_ONLY(MarkSweep::register_live_oop(q, size));
   compact_top += size;
 
   // we need to update the offset table so that the beginnings of objects can be
@@ -470,13 +469,10 @@
     if (oop(q)->is_gc_marked()) {
       // q is alive
 
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::track_interior_pointers(oop(q)));
       // point all the oops to the new location
       size_t size = oop(q)->adjust_pointers();
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::check_interior_pointers());
 
       debug_only(prev_q = q);
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::validate_live_oop(oop(q), size));
 
       q += size;
     } else {
--- a/hotspot/src/share/vm/memory/space.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/memory/space.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -655,16 +655,10 @@
       assert(block_is_obj(q),                                                   \
              "should be at block boundaries, and should be looking at objs");   \
                                                                                 \
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::track_interior_pointers(oop(q)));     \
-                                                                                \
       /* point all the oops to the new location */                              \
       size_t size = oop(q)->adjust_pointers();                                  \
       size = adjust_obj_size(size);                                             \
                                                                                 \
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::check_interior_pointers());           \
-                                                                                \
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::validate_live_oop(oop(q), size));     \
-                                                                                \
       q += size;                                                                \
     }                                                                           \
                                                                                 \
@@ -685,12 +679,9 @@
     Prefetch::write(q, interval);                                               \
     if (oop(q)->is_gc_marked()) {                                               \
       /* q is alive */                                                          \
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::track_interior_pointers(oop(q)));     \
       /* point all the oops to the new location */                              \
       size_t size = oop(q)->adjust_pointers();                                  \
       size = adjust_obj_size(size);                                             \
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::check_interior_pointers());           \
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::validate_live_oop(oop(q), size));     \
       debug_only(prev_q = q);                                                   \
       q += size;                                                                \
     } else {                                                                    \
@@ -725,7 +716,6 @@
       size_t size = obj_size(q);                                                \
       assert(!oop(q)->is_gc_marked(),                                           \
              "should be unmarked (special dense prefix handling)");             \
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::live_oop_moved_to(q, size, q));       \
       debug_only(prev_q = q);                                                   \
       q += size;                                                                \
     }                                                                           \
@@ -759,8 +749,6 @@
       Prefetch::write(compaction_top, copy_interval);                           \
                                                                                 \
       /* copy object and reinit its mark */                                     \
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::live_oop_moved_to(q, size,            \
-                                                            compaction_top));   \
       assert(q != compaction_top, "everything in this pass should be moving");  \
       Copy::aligned_conjoint_words(q, compaction_top, size);                    \
       oop(compaction_top)->init_mark();                                         \
--- a/hotspot/src/share/vm/memory/tenuredGeneration.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/memory/tenuredGeneration.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -62,7 +62,7 @@
                                        _virtual_space.reserved_size(),
                                        _the_space, _gen_counters);
 #ifndef SERIALGC
-  if (UseParNewGC && ParallelGCThreads > 0) {
+  if (UseParNewGC) {
     typedef ParGCAllocBufferWithBOT* ParGCAllocBufferWithBOTPtr;
     _alloc_buffers = NEW_C_HEAP_ARRAY(ParGCAllocBufferWithBOTPtr,
                                       ParallelGCThreads, mtGC);
--- a/hotspot/src/share/vm/oops/annotations.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/oops/annotations.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -61,6 +61,9 @@
   free_contents(loader_data, methods_annotations());
   free_contents(loader_data, methods_parameter_annotations());
   free_contents(loader_data, methods_default_annotations());
+
+  // Recursively deallocate optional Annotations linked through this one
+  MetadataFactory::free_metadata(loader_data, type_annotations());
 }
 
 // Set the annotation at 'idnum' to 'anno'.
--- a/hotspot/src/share/vm/oops/annotations.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/oops/annotations.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -38,7 +38,8 @@
 typedef Array<u1> AnnotationArray;
 
 // Class to hold the various types of annotations. The only metadata that points
-// to this is InstanceKlass.
+// to this is InstanceKlass, or another Annotations instance if this is a
+// a type_annotation instance.
 
 class Annotations: public MetaspaceObj {
 
@@ -58,6 +59,8 @@
   // such annotations.
   // Index is the idnum, which is initially the same as the methods array index.
   Array<AnnotationArray*>*     _methods_default_annotations;
+  // Type annotations for this class, or null if none.
+  Annotations*                 _type_annotations;
 
   // Constructor where some some values are known to not be null
   Annotations(Array<AnnotationArray*>* fa, Array<AnnotationArray*>* ma,
@@ -66,7 +69,8 @@
                  _fields_annotations(fa),
                  _methods_annotations(ma),
                  _methods_parameter_annotations(mpa),
-                 _methods_default_annotations(mda) {}
+                 _methods_default_annotations(mda),
+                 _type_annotations(NULL) {}
 
  public:
   // Allocate instance of this class
@@ -81,22 +85,26 @@
   static int size()    { return sizeof(Annotations) / wordSize; }
 
   // Constructor to initialize to null
-  Annotations() : _class_annotations(NULL), _fields_annotations(NULL),
+  Annotations() : _class_annotations(NULL),
+                  _fields_annotations(NULL),
                   _methods_annotations(NULL),
                   _methods_parameter_annotations(NULL),
-                  _methods_default_annotations(NULL) {}
+                  _methods_default_annotations(NULL),
+                  _type_annotations(NULL) {}
 
   AnnotationArray* class_annotations() const                       { return _class_annotations; }
   Array<AnnotationArray*>* fields_annotations() const              { return _fields_annotations; }
   Array<AnnotationArray*>* methods_annotations() const             { return _methods_annotations; }
   Array<AnnotationArray*>* methods_parameter_annotations() const   { return _methods_parameter_annotations; }
   Array<AnnotationArray*>* methods_default_annotations() const     { return _methods_default_annotations; }
+  Annotations* type_annotations() const                            { return _type_annotations; }
 
   void set_class_annotations(AnnotationArray* md)                     { _class_annotations = md; }
   void set_fields_annotations(Array<AnnotationArray*>* md)            { _fields_annotations = md; }
   void set_methods_annotations(Array<AnnotationArray*>* md)           { _methods_annotations = md; }
   void set_methods_parameter_annotations(Array<AnnotationArray*>* md) { _methods_parameter_annotations = md; }
   void set_methods_default_annotations(Array<AnnotationArray*>* md)   { _methods_default_annotations = md; }
+  void set_type_annotations(Annotations* annos)                       { _type_annotations = annos; }
 
   // Redefine classes support
   AnnotationArray* get_method_annotations_of(int idnum)
@@ -129,6 +137,7 @@
   inline AnnotationArray* get_method_annotations_from(int idnum, Array<AnnotationArray*>* annos);
   void set_annotations(Array<AnnotationArray*>* md, Array<AnnotationArray*>** md_p)  { *md_p = md; }
 
+  bool is_klass() const { return false; }
  private:
   void set_methods_annotations_of(instanceKlassHandle ik,
                                   int idnum, AnnotationArray* anno,
--- a/hotspot/src/share/vm/oops/constMethod.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/oops/constMethod.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -39,18 +39,21 @@
                                    int localvariable_table_length,
                                    int exception_table_length,
                                    int checked_exceptions_length,
+                                   int method_parameters_length,
                                    u2  generic_signature_index,
                                    MethodType method_type,
                                    TRAPS) {
   int size = ConstMethod::size(byte_code_size,
-                                      compressed_line_number_size,
-                                      localvariable_table_length,
-                                      exception_table_length,
-                                      checked_exceptions_length,
-                                      generic_signature_index);
+                               compressed_line_number_size,
+                               localvariable_table_length,
+                               exception_table_length,
+                               checked_exceptions_length,
+                               method_parameters_length,
+                               generic_signature_index);
   return new (loader_data, size, true, THREAD) ConstMethod(
       byte_code_size, compressed_line_number_size, localvariable_table_length,
-      exception_table_length, checked_exceptions_length, generic_signature_index,
+      exception_table_length, checked_exceptions_length,
+      method_parameters_length, generic_signature_index,
       method_type, size);
 }
 
@@ -59,6 +62,7 @@
                          int localvariable_table_length,
                          int exception_table_length,
                          int checked_exceptions_length,
+                         int method_parameters_length,
                          u2  generic_signature_index,
                          MethodType method_type,
                          int size) {
@@ -74,7 +78,8 @@
                             checked_exceptions_length,
                             compressed_line_number_size,
                             localvariable_table_length,
-                            exception_table_length);
+                            exception_table_length,
+                            method_parameters_length);
   set_method_type(method_type);
   assert(this->size() == size, "wrong size for object");
 }
@@ -92,11 +97,12 @@
 // How big must this constMethodObject be?
 
 int ConstMethod::size(int code_size,
-                                    int compressed_line_number_size,
-                                    int local_variable_table_length,
-                                    int exception_table_length,
-                                    int checked_exceptions_length,
-                                    u2  generic_signature_index) {
+                      int compressed_line_number_size,
+                      int local_variable_table_length,
+                      int exception_table_length,
+                      int checked_exceptions_length,
+                      int method_parameters_length,
+                      u2  generic_signature_index) {
   int extra_bytes = code_size;
   if (compressed_line_number_size > 0) {
     extra_bytes += compressed_line_number_size;
@@ -117,6 +123,10 @@
   if (generic_signature_index != 0) {
     extra_bytes += sizeof(u2);
   }
+  if (method_parameters_length > 0) {
+    extra_bytes += sizeof(u2);
+    extra_bytes += method_parameters_length * sizeof(MethodParametersElement);
+  }
   int extra_words = align_size_up(extra_bytes, BytesPerWord) / BytesPerWord;
   return align_object_size(header_size() + extra_words);
 }
@@ -143,6 +153,18 @@
 u2* ConstMethod::checked_exceptions_length_addr() const {
   // Located immediately before the generic signature index.
   assert(has_checked_exceptions(), "called only if table is present");
+  if(has_method_parameters()) {
+    // If method parameters present, locate immediately before them.
+    return (u2*)method_parameters_start() - 1;
+  } else {
+    // Else, the exception table is at the end of the constMethod.
+    return has_generic_signature() ? (last_u2_element() - 1) :
+                                     last_u2_element();
+  }
+}
+
+u2* ConstMethod::method_parameters_length_addr() const {
+  assert(has_method_parameters(), "called only if table is present");
   return has_generic_signature() ? (last_u2_element() - 1) :
                                     last_u2_element();
 }
@@ -153,11 +175,15 @@
     // If checked_exception present, locate immediately before them.
     return (u2*) checked_exceptions_start() - 1;
   } else {
-    // Else, the exception table is at the end of the constMethod or
-    // immediately before the generic signature index.
+    if(has_method_parameters()) {
+      // If method parameters present, locate immediately before them.
+      return (u2*)method_parameters_start() - 1;
+    } else {
+      // Else, the exception table is at the end of the constMethod.
     return has_generic_signature() ? (last_u2_element() - 1) :
                                       last_u2_element();
   }
+  }
 }
 
 u2* ConstMethod::localvariable_table_length_addr() const {
@@ -170,12 +196,16 @@
       // If checked_exception present, locate immediately before them.
       return (u2*) checked_exceptions_start() - 1;
     } else {
-      // Else, the linenumber table is at the end of the constMethod or
-      // immediately before the generic signature index.
+      if(has_method_parameters()) {
+        // If method parameters present, locate immediately before them.
+        return (u2*)method_parameters_start() - 1;
+      } else {
+        // Else, the exception table is at the end of the constMethod.
       return has_generic_signature() ? (last_u2_element() - 1) :
                                         last_u2_element();
     }
   }
+  }
 }
 
 // Update the flags to indicate the presence of these optional fields.
@@ -183,29 +213,57 @@
                                             int checked_exceptions_len,
                                             int compressed_line_number_size,
                                             int localvariable_table_len,
-                                            int exception_table_len) {
-  // Must be done in the order below, otherwise length_addr accessors
-  // will not work. Only set bit in header if length is positive.
+                                            int exception_table_len,
+                                            int method_parameters_len) {
   assert(_flags == 0, "Error");
-  if (compressed_line_number_size > 0) {
+  if (compressed_line_number_size > 0)
     _flags |= _has_linenumber_table;
-  }
-  if (generic_signature_index != 0) {
+  if (generic_signature_index != 0)
     _flags |= _has_generic_signature;
+  if (method_parameters_len > 0)
+    _flags |= _has_method_parameters;
+  if (checked_exceptions_len > 0)
+    _flags |= _has_checked_exceptions;
+  if (exception_table_len > 0)
+    _flags |= _has_exception_table;
+  if (localvariable_table_len > 0)
+    _flags |= _has_localvariable_table;
+
+  // This code is extremely brittle and should possibly be revised.
+  // The *_length_addr functions walk backwards through the
+  // constMethod data, using each of the length indexes ahead of them,
+  // as well as the flags variable.  Therefore, the indexes must be
+  // initialized in reverse order, or else they will compute the wrong
+  // offsets.  Moving the initialization of _flags into a separate
+  // block solves *half* of the problem, but the following part will
+  // still break if the order is not exactly right.
+  //
+  // Also, the servicability agent needs to be informed anytime
+  // anything is added here.  It might be advisable to have some sort
+  // of indication of this inline.
+  if (generic_signature_index != 0)
     *(generic_signature_index_addr()) = generic_signature_index;
-  }
-  if (checked_exceptions_len > 0) {
-    _flags |= _has_checked_exceptions;
+  // New data should probably go here.
+  if (method_parameters_len > 0)
+    *(method_parameters_length_addr()) = method_parameters_len;
+  if (checked_exceptions_len > 0)
     *(checked_exceptions_length_addr()) = checked_exceptions_len;
-  }
-  if (exception_table_len > 0) {
-    _flags |= _has_exception_table;
+  if (exception_table_len > 0)
     *(exception_table_length_addr()) = exception_table_len;
-  }
-  if (localvariable_table_len > 0) {
-    _flags |= _has_localvariable_table;
+  if (localvariable_table_len > 0)
     *(localvariable_table_length_addr()) = localvariable_table_len;
-  }
+}
+
+int ConstMethod::method_parameters_length() const {
+  return has_method_parameters() ? *(method_parameters_length_addr()) : 0;
+}
+
+MethodParametersElement* ConstMethod::method_parameters_start() const {
+  u2* addr = method_parameters_length_addr();
+  u2 length = *addr;
+  assert(length > 0, "should only be called if table is present");
+  addr -= length * sizeof(MethodParametersElement) / sizeof(u2);
+  return (MethodParametersElement*) addr;
 }
 
 
@@ -298,6 +356,10 @@
   }
   guarantee(compressed_table_end <= m_end, "invalid method layout");
   // Verify checked exceptions, exception table and local variable tables
+  if (has_method_parameters()) {
+    u2* addr = method_parameters_length_addr();
+    guarantee(*addr > 0 && (address) addr >= compressed_table_end && (address) addr < m_end, "invalid method layout");
+  }
   if (has_checked_exceptions()) {
     u2* addr = checked_exceptions_length_addr();
     guarantee(*addr > 0 && (address) addr >= compressed_table_end && (address) addr < m_end, "invalid method layout");
@@ -318,6 +380,8 @@
     uncompressed_table_start = (u2*) exception_table_start();
   } else if (has_checked_exceptions()) {
       uncompressed_table_start = (u2*) checked_exceptions_start();
+  } else if (has_method_parameters()) {
+      uncompressed_table_start = (u2*) method_parameters_start();
   } else {
       uncompressed_table_start = (u2*) m_end;
   }
--- a/hotspot/src/share/vm/oops/constMethod.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/oops/constMethod.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -77,9 +77,18 @@
 // |  (access flags bit tells whether table is present)   |
 // |  (indexed from end of ConstMethod*)                  |
 // |------------------------------------------------------|
+// | method parameters elements + length (length last)    |
+// |  (length is u2, elements are u2, u4 structures)      |
+// |  (see class MethodParametersElement)                 |
+// |  (access flags bit tells whether table is present)   |
+// |  (indexed from end of ConstMethod*)                  |
+// |------------------------------------------------------|
 // | generic signature index (u2)                         |
 // |  (indexed from start of constMethodOop)              |
 // |------------------------------------------------------|
+//
+// IMPORTANT: If anything gets added here, there need to be changes to
+// ensure that ServicabilityAgent doesn't get broken as a result!
 
 
 // Utitily class decribing elements in checked exceptions table inlined in Method*.
@@ -109,6 +118,13 @@
   u2 catch_type_index;
 };
 
+// Utility class describing elements in method parameters
+class MethodParametersElement VALUE_OBJ_CLASS_SPEC {
+ public:
+  u2 name_cp_index;
+  u4 flags;
+};
+
 
 class ConstMethod : public MetaspaceObj {
   friend class VMStructs;
@@ -123,7 +139,8 @@
     _has_localvariable_table = 4,
     _has_exception_table = 8,
     _has_generic_signature = 16,
-    _is_overpass = 32
+    _has_method_parameters = 32,
+    _is_overpass = 64
   };
 
   // Bit vector of signature
@@ -160,6 +177,7 @@
               int localvariable_table_length,
               int exception_table_length,
               int checked_exceptions_length,
+              int method_parameters_length,
               u2  generic_signature_index,
               MethodType is_overpass,
               int size);
@@ -171,6 +189,7 @@
                                int localvariable_table_length,
                                int exception_table_length,
                                int checked_exceptions_length,
+                               int method_parameters_length,
                                u2  generic_signature_index,
                                MethodType mt,
                                TRAPS);
@@ -182,7 +201,8 @@
                                  int checked_exceptions_len,
                                  int compressed_line_number_size,
                                  int localvariable_table_len,
-                                 int exception_table_len);
+                                 int exception_table_len,
+                                 int method_parameters_length);
 
   bool has_generic_signature() const
     { return (_flags & _has_generic_signature) != 0; }
@@ -199,6 +219,9 @@
   bool has_exception_handler() const
     { return (_flags & _has_exception_table) != 0; }
 
+  bool has_method_parameters() const
+    { return (_flags & _has_method_parameters) != 0; }
+
   MethodType method_type() const {
     return ((_flags & _is_overpass) == 0) ? NORMAL : OVERPASS;
   }
@@ -284,10 +307,11 @@
 
   // Size needed
   static int size(int code_size, int compressed_line_number_size,
-                         int local_variable_table_length,
-                         int exception_table_length,
-                         int checked_exceptions_length,
-                         u2  generic_signature_index);
+                  int local_variable_table_length,
+                  int exception_table_length,
+                  int checked_exceptions_length,
+                  int method_parameters_length,
+                  u2  generic_signature_index);
 
   int size() const                    { return _constMethod_size;}
   void set_constMethod_size(int size)     { _constMethod_size = size; }
@@ -308,6 +332,7 @@
   u2* checked_exceptions_length_addr() const;
   u2* localvariable_table_length_addr() const;
   u2* exception_table_length_addr() const;
+  u2* method_parameters_length_addr() const;
 
   // checked exceptions
   int checked_exceptions_length() const;
@@ -321,6 +346,10 @@
   int exception_table_length() const;
   ExceptionTableElement* exception_table_start() const;
 
+  // method parameters table
+  int method_parameters_length() const;
+  MethodParametersElement* method_parameters_start() const;
+
   // byte codes
   void    set_code(address code) {
     if (code_size() > 0) {
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -47,6 +47,7 @@
 #include "oops/symbol.hpp"
 #include "prims/jvmtiExport.hpp"
 #include "prims/jvmtiRedefineClassesTrace.hpp"
+#include "prims/methodComparator.hpp"
 #include "runtime/fieldDescriptor.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/javaCalls.hpp"
@@ -160,6 +161,8 @@
 
 #endif //  ndef DTRACE_ENABLED
 
+volatile int InstanceKlass::_total_instanceKlass_count = 0;
+
 Klass* InstanceKlass::allocate_instance_klass(ClassLoaderData* loader_data,
                                                 int vtable_len,
                                                 int itable_len,
@@ -203,6 +206,7 @@
         access_flags, !host_klass.is_null());
   }
 
+  Atomic::inc(&_total_instanceKlass_count);
   return ik;
 }
 
@@ -361,6 +365,9 @@
   set_protection_domain(NULL);
   set_signers(NULL);
   set_init_lock(NULL);
+
+  // We should deallocate the Annotations instance
+  MetadataFactory::free_metadata(loader_data, annotations());
   set_annotations(NULL);
 }
 
@@ -599,7 +606,7 @@
       }
 
       // relocate jsrs and link methods after they are all rewritten
-      this_oop->relocate_and_link_methods(CHECK_false);
+      this_oop->link_methods(CHECK_false);
 
       // Initialize the vtable and interface table after
       // methods have been rewritten since rewrite may
@@ -647,10 +654,31 @@
 // Now relocate and link method entry points after class is rewritten.
 // This is outside is_rewritten flag. In case of an exception, it can be
 // executed more than once.
-void InstanceKlass::relocate_and_link_methods(TRAPS) {
-  assert(is_loaded(), "must be loaded");
-  instanceKlassHandle this_oop(THREAD, this);
-  Rewriter::relocate_and_link(this_oop, CHECK);
+void InstanceKlass::link_methods(TRAPS) {
+  int len = methods()->length();
+  for (int i = len-1; i >= 0; i--) {
+    methodHandle m(THREAD, methods()->at(i));
+
+    // Set up method entry points for compiler and interpreter    .
+    m->link_method(m, CHECK);
+
+    // This is for JVMTI and unrelated to relocator but the last thing we do
+#ifdef ASSERT
+    if (StressMethodComparator) {
+      ResourceMark rm(THREAD);
+      static int nmc = 0;
+      for (int j = i; j >= 0 && j >= i-4; j--) {
+        if ((++nmc % 1000) == 0)  tty->print_cr("Have run MethodComparator %d times...", nmc);
+        bool z = MethodComparator::methods_EMCP(m(),
+                   methods()->at(j));
+        if (j == i && !z) {
+          tty->print("MethodComparator FAIL: "); m->print(); m->print_codes();
+          assert(z, "method must compare equal to itself");
+        }
+      }
+    }
+#endif //ASSERT
+  }
 }
 
 
@@ -2306,6 +2334,9 @@
   if (_array_name != NULL)  _array_name->decrement_refcount();
   if (_source_file_name != NULL) _source_file_name->decrement_refcount();
   if (_source_debug_extension != NULL) FREE_C_HEAP_ARRAY(char, _source_debug_extension, mtClass);
+
+  assert(_total_instanceKlass_count >= 1, "Sanity check");
+  Atomic::dec(&_total_instanceKlass_count);
 }
 
 void InstanceKlass::set_source_file_name(Symbol* n) {
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -31,6 +31,7 @@
 #include "oops/fieldInfo.hpp"
 #include "oops/instanceOop.hpp"
 #include "oops/klassVtable.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/handles.hpp"
 #include "runtime/os.hpp"
 #include "utilities/accessFlags.hpp"
@@ -170,6 +171,11 @@
     initialization_error                // error happened during initialization
   };
 
+  static int number_of_instance_classes() { return _total_instanceKlass_count; }
+
+ private:
+  static volatile int _total_instanceKlass_count;
+
  protected:
   // Protection domain.
   oop             _protection_domain;
@@ -454,7 +460,7 @@
   bool link_class_or_fail(TRAPS); // returns false on failure
   void unlink_class();
   void rewrite_class(TRAPS);
-  void relocate_and_link_methods(TRAPS);
+  void link_methods(TRAPS);
   Method* class_initializer();
 
   // set the class to initialized if no static initializer is present
@@ -657,6 +663,10 @@
     if (annotations() == NULL) return NULL;
     return annotations()->fields_annotations();
   }
+  Annotations* type_annotations() const {
+    if (annotations() == NULL) return NULL;
+    return annotations()->type_annotations();
+  }
 
   // allocation
   instanceOop allocate_instance(TRAPS);
--- a/hotspot/src/share/vm/oops/method.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/oops/method.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -64,6 +64,7 @@
                          int localvariable_table_length,
                          int exception_table_length,
                          int checked_exceptions_length,
+                         int method_parameters_length,
                          u2  generic_signature_index,
                          ConstMethod::MethodType method_type,
                          TRAPS) {
@@ -75,6 +76,7 @@
                                           localvariable_table_length,
                                           exception_table_length,
                                           checked_exceptions_length,
+                                          method_parameters_length,
                                           generic_signature_index,
                                           method_type,
                                           CHECK_NULL);
@@ -192,16 +194,16 @@
   return buf;
 }
 
-int  Method::fast_exception_handler_bci_for(KlassHandle ex_klass, int throw_bci, TRAPS) {
+int Method::fast_exception_handler_bci_for(methodHandle mh, KlassHandle ex_klass, int throw_bci, TRAPS) {
   // exception table holds quadruple entries of the form (beg_bci, end_bci, handler_bci, klass_index)
   // access exception table
-  ExceptionTable table(this);
+  ExceptionTable table(mh());
   int length = table.length();
   // iterate through all entries sequentially
-  constantPoolHandle pool(THREAD, constants());
+  constantPoolHandle pool(THREAD, mh->constants());
   for (int i = 0; i < length; i ++) {
     //reacquire the table in case a GC happened
-    ExceptionTable table(this);
+    ExceptionTable table(mh());
     int beg_bci = table.start_pc(i);
     int end_bci = table.end_pc(i);
     assert(beg_bci <= end_bci, "inconsistent exception table");
@@ -1035,8 +1037,10 @@
 
   methodHandle m;
   {
-    Method* m_oop = Method::allocate(loader_data, 0, accessFlags_from(flags_bits),
-             0, 0, 0, 0, 0, ConstMethod::NORMAL, CHECK_(empty));
+    Method* m_oop = Method::allocate(loader_data, 0,
+                                     accessFlags_from(flags_bits),
+                                     0, 0, 0, 0, 0, 0,
+                                     ConstMethod::NORMAL, CHECK_(empty));
     m = methodHandle(THREAD, m_oop);
   }
   m->set_constants(cp());
@@ -1088,6 +1092,7 @@
   int checked_exceptions_len = m->checked_exceptions_length();
   int localvariable_len = m->localvariable_table_length();
   int exception_table_len = m->exception_table_length();
+  int method_parameters_len = m->method_parameters_length();
 
   ClassLoaderData* loader_data = m->method_holder()->class_loader_data();
   Method* newm_oop = Method::allocate(loader_data,
@@ -1097,6 +1102,7 @@
                                       localvariable_len,
                                       exception_table_len,
                                       checked_exceptions_len,
+                                      method_parameters_len,
                                       generic_signature_index,
                                       m->method_type(),
                                       CHECK_(methodHandle()));
@@ -1331,13 +1337,15 @@
                                  Array<AnnotationArray*>* methods_annotations,
                                  Array<AnnotationArray*>* methods_parameter_annotations,
                                  Array<AnnotationArray*>* methods_default_annotations,
+                                 Array<AnnotationArray*>* methods_type_annotations,
                                  bool idempotent) {
   int length = methods->length();
   if (length > 1) {
     bool do_annotations = false;
     if (methods_annotations != NULL ||
         methods_parameter_annotations != NULL ||
-        methods_default_annotations != NULL) {
+        methods_default_annotations != NULL ||
+        methods_type_annotations != NULL) {
       do_annotations = true;
     }
     if (do_annotations) {
@@ -1356,6 +1364,7 @@
     assert(methods_annotations == NULL           || methods_annotations->length() == methods->length(), "");
     assert(methods_parameter_annotations == NULL || methods_parameter_annotations->length() == methods->length(), "");
     assert(methods_default_annotations == NULL   || methods_default_annotations->length() == methods->length(), "");
+    assert(methods_type_annotations == NULL   || methods_type_annotations->length() == methods->length(), "");
     if (do_annotations) {
       ResourceMark rm;
       // Allocate temporary storage
@@ -1363,6 +1372,7 @@
       reorder_based_on_method_index(methods, methods_annotations, temp_array);
       reorder_based_on_method_index(methods, methods_parameter_annotations, temp_array);
       reorder_based_on_method_index(methods, methods_default_annotations, temp_array);
+      reorder_based_on_method_index(methods, methods_type_annotations, temp_array);
     }
 
     // Reset method ordering
--- a/hotspot/src/share/vm/oops/method.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/oops/method.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -160,6 +160,7 @@
                           int localvariable_table_length,
                           int exception_table_length,
                           int checked_exceptions_length,
+                          int method_parameters_length,
                           u2 generic_signature_index,
                           ConstMethod::MethodType method_type,
                           TRAPS);
@@ -225,6 +226,13 @@
     }
     return ik->annotations()->get_method_default_annotations_of(method_idnum());
   }
+  AnnotationArray* type_annotations() const {
+  InstanceKlass* ik = method_holder();
+  Annotations* type_annos = ik->type_annotations();
+  if (type_annos == NULL)
+    return NULL;
+  return type_annos->get_method_annotations_of(method_idnum());
+}
 
 #ifdef CC_INTERP
   void set_result_index(BasicType type);
@@ -343,7 +351,7 @@
   // exception handler which caused the exception to be thrown, which
   // is needed for proper retries. See, for example,
   // InterpreterRuntime::exception_handler_for_exception.
-  int fast_exception_handler_bci_for(KlassHandle ex_klass, int throw_bci, TRAPS);
+  static int fast_exception_handler_bci_for(methodHandle mh, KlassHandle ex_klass, int throw_bci, TRAPS);
 
   // method data access
   MethodData* method_data() const              {
@@ -473,6 +481,12 @@
   void print_codes_on(outputStream* st) const                      PRODUCT_RETURN;
   void print_codes_on(int from, int to, outputStream* st) const    PRODUCT_RETURN;
 
+  // method parameters
+  int method_parameters_length() const
+                         { return constMethod()->method_parameters_length(); }
+  MethodParametersElement* method_parameters_start() const
+                          { return constMethod()->method_parameters_start(); }
+
   // checked exceptions
   int checked_exceptions_length() const
                          { return constMethod()->checked_exceptions_length(); }
@@ -790,6 +804,7 @@
                            Array<AnnotationArray*>* methods_annotations,
                            Array<AnnotationArray*>* methods_parameter_annotations,
                            Array<AnnotationArray*>* methods_default_annotations,
+                           Array<AnnotationArray*>* methods_type_annotations,
                            bool idempotent = false);
 
   // Deallocation function for redefine classes or if an error occurs
--- a/hotspot/src/share/vm/opto/bytecodeInfo.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/opto/bytecodeInfo.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -46,7 +46,8 @@
   _method(callee),
   _site_invoke_ratio(site_invoke_ratio),
   _max_inline_level(max_inline_level),
-  _count_inline_bcs(method()->code_size_for_inlining())
+  _count_inline_bcs(method()->code_size_for_inlining()),
+  _subtrees(c->comp_arena(), 2, 0, NULL)
 {
   NOT_PRODUCT(_count_inlines = 0;)
   if (_caller_jvms != NULL) {
@@ -209,16 +210,18 @@
   if ( callee_method->dont_inline())                        return "don't inline by annotation";
   if ( callee_method->has_unloaded_classes_in_signature())  return "unloaded signature classes";
 
-  if (callee_method->force_inline() || callee_method->should_inline()) {
+  if (callee_method->should_inline()) {
     // ignore heuristic controls on inlining
     return NULL;
   }
 
   // Now perform checks which are heuristic
 
-  if (callee_method->has_compiled_code() &&
-      callee_method->instructions_size() > InlineSmallCode) {
+  if (!callee_method->force_inline()) {
+    if (callee_method->has_compiled_code() &&
+        callee_method->instructions_size() > InlineSmallCode) {
     return "already compiled into a big method";
+    }
   }
 
   // don't inline exception code unless the top method belongs to an
@@ -277,12 +280,15 @@
 //-----------------------------try_to_inline-----------------------------------
 // return NULL if ok, reason for not inlining otherwise
 // Relocated from "InliningClosure::try_to_inline"
-const char* InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile, WarmCallInfo* wci_result) {
-
+const char* InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile, WarmCallInfo* wci_result, bool& should_delay) {
   // Old algorithm had funny accumulating BC-size counters
   if (UseOldInlining && ClipInlining
       && (int)count_inline_bcs() >= DesiredMethodLimit) {
-    return "size > DesiredMethodLimit";
+    if (!callee_method->force_inline() || !IncrementalInline) {
+      return "size > DesiredMethodLimit";
+    } else if (!C->inlining_incrementally()) {
+      should_delay = true;
+    }
   }
 
   const char *msg = NULL;
@@ -303,8 +309,13 @@
   if (callee_method->code_size() > MaxTrivialSize) {
 
     // don't inline into giant methods
-    if (C->unique() > (uint)NodeCountInliningCutoff) {
-      return "NodeCountInliningCutoff";
+    if (C->over_inlining_cutoff()) {
+      if ((!callee_method->force_inline() && !caller_method->is_compiled_lambda_form())
+          || !IncrementalInline) {
+        return "NodeCountInliningCutoff";
+      } else {
+        should_delay = true;
+      }
     }
 
     if ((!UseInterpreter || CompileTheWorld) &&
@@ -323,7 +334,11 @@
     return "not an accessor";
   }
   if (inline_level() > _max_inline_level) {
-    return "inlining too deep";
+    if (!callee_method->force_inline() || !IncrementalInline) {
+      return "inlining too deep";
+    } else if (!C->inlining_incrementally()) {
+      should_delay = true;
+    }
   }
 
   // detect direct and indirect recursive inlining
@@ -348,7 +363,11 @@
 
   if (UseOldInlining && ClipInlining
       && (int)count_inline_bcs() + size >= DesiredMethodLimit) {
-    return "size > DesiredMethodLimit";
+    if (!callee_method->force_inline() || !IncrementalInline) {
+      return "size > DesiredMethodLimit";
+    } else if (!C->inlining_incrementally()) {
+      should_delay = true;
+    }
   }
 
   // ok, inline this method
@@ -413,8 +432,9 @@
 }
 
 //------------------------------ok_to_inline-----------------------------------
-WarmCallInfo* InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms, ciCallProfile& profile, WarmCallInfo* initial_wci) {
+WarmCallInfo* InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms, ciCallProfile& profile, WarmCallInfo* initial_wci, bool& should_delay) {
   assert(callee_method != NULL, "caller checks for optimized virtual!");
+  assert(!should_delay, "should be initialized to false");
 #ifdef ASSERT
   // Make sure the incoming jvms has the same information content as me.
   // This means that we can eventually make this whole class AllStatic.
@@ -444,7 +464,7 @@
 
   // Check if inlining policy says no.
   WarmCallInfo wci = *(initial_wci);
-  failure_msg = try_to_inline(callee_method, caller_method, caller_bci, profile, &wci);
+  failure_msg = try_to_inline(callee_method, caller_method, caller_bci, profile, &wci, should_delay);
   if (failure_msg != NULL && C->log() != NULL) {
     C->log()->inline_fail(failure_msg);
   }
--- a/hotspot/src/share/vm/opto/c2_globals.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/opto/c2_globals.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -606,6 +606,16 @@
                                                                             \
   develop(bool, VerifyAliases, false,                                       \
           "perform extra checks on the results of alias analysis")          \
+                                                                            \
+  product(bool, IncrementalInline, true,                                    \
+          "do post parse inlining")                                         \
+                                                                            \
+  develop(bool, AlwaysIncrementalInline, false,                             \
+          "do all inlining incrementally")                                  \
+                                                                            \
+  product(intx, LiveNodeCountInliningCutoff, 20000,                         \
+          "max number of live nodes in a method")                           \
+
 
 C2_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_EXPERIMENTAL_FLAG, DECLARE_NOTPRODUCT_FLAG)
 
--- a/hotspot/src/share/vm/opto/callGenerator.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/opto/callGenerator.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -262,8 +262,11 @@
 
 // Allow inlining decisions to be delayed
 class LateInlineCallGenerator : public DirectCallGenerator {
+ protected:
   CallGenerator* _inline_cg;
 
+  virtual bool do_late_inline_check(JVMState* jvms) { return true; }
+
  public:
   LateInlineCallGenerator(ciMethod* method, CallGenerator* inline_cg) :
     DirectCallGenerator(method, true), _inline_cg(inline_cg) {}
@@ -279,7 +282,9 @@
 
     // Record that this call site should be revisited once the main
     // parse is finished.
-    Compile::current()->add_late_inline(this);
+    if (!is_mh_late_inline()) {
+      C->add_late_inline(this);
+    }
 
     // Emit the CallStaticJava and request separate projections so
     // that the late inlining logic can distinguish between fall
@@ -287,15 +292,34 @@
     // as is done for allocations and macro expansion.
     return DirectCallGenerator::generate(jvms);
   }
+
+  virtual void print_inlining_late(const char* msg) {
+    CallNode* call = call_node();
+    Compile* C = Compile::current();
+    C->print_inlining_insert(this);
+    C->print_inlining(method(), call->jvms()->depth()-1, call->jvms()->bci(), msg);
+  }
+
 };
 
-
 void LateInlineCallGenerator::do_late_inline() {
   // Can't inline it
   if (call_node() == NULL || call_node()->outcnt() == 0 ||
       call_node()->in(0) == NULL || call_node()->in(0)->is_top())
     return;
 
+  for (int i1 = 0; i1 < method()->arg_size(); i1++) {
+    if (call_node()->in(TypeFunc::Parms + i1)->is_top()) {
+      assert(Compile::current()->inlining_incrementally(), "shouldn't happen during parsing");
+      return;
+    }
+  }
+
+  if (call_node()->in(TypeFunc::Memory)->is_top()) {
+    assert(Compile::current()->inlining_incrementally(), "shouldn't happen during parsing");
+    return;
+  }
+
   CallStaticJavaNode* call = call_node();
 
   // Make a clone of the JVMState that appropriate to use for driving a parse
@@ -324,6 +348,11 @@
     }
   }
 
+  if (!do_late_inline_check(jvms)) {
+    map->disconnect_inputs(NULL, C);
+    return;
+  }
+
   C->print_inlining_insert(this);
 
   CompileLog* log = C->log();
@@ -360,6 +389,10 @@
     result = (result_size == 1) ? kit.pop() : kit.pop_pair();
   }
 
+  C->set_has_loops(C->has_loops() || _inline_cg->method()->has_loops());
+  C->env()->notice_inlined_method(_inline_cg->method());
+  C->set_inlining_progress(true);
+
   kit.replace_call(call, result);
 }
 
@@ -368,6 +401,83 @@
   return new LateInlineCallGenerator(method, inline_cg);
 }
 
+class LateInlineMHCallGenerator : public LateInlineCallGenerator {
+  ciMethod* _caller;
+  int _attempt;
+  bool _input_not_const;
+
+  virtual bool do_late_inline_check(JVMState* jvms);
+  virtual bool already_attempted() const { return _attempt > 0; }
+
+ public:
+  LateInlineMHCallGenerator(ciMethod* caller, ciMethod* callee, bool input_not_const) :
+    LateInlineCallGenerator(callee, NULL), _caller(caller), _attempt(0), _input_not_const(input_not_const) {}
+
+  virtual bool is_mh_late_inline() const { return true; }
+
+  virtual JVMState* generate(JVMState* jvms) {
+    JVMState* new_jvms = LateInlineCallGenerator::generate(jvms);
+    if (_input_not_const) {
+      // inlining won't be possible so no need to enqueue right now.
+      call_node()->set_generator(this);
+    } else {
+      Compile::current()->add_late_inline(this);
+    }
+    return new_jvms;
+  }
+
+  virtual void print_inlining_late(const char* msg) {
+    if (!_input_not_const) return;
+    LateInlineCallGenerator::print_inlining_late(msg);
+  }
+};
+
+bool LateInlineMHCallGenerator::do_late_inline_check(JVMState* jvms) {
+
+  CallGenerator* cg = for_method_handle_inline(jvms, _caller, method(), _input_not_const);
+
+  if (!_input_not_const) {
+    _attempt++;
+  }
+
+  if (cg != NULL) {
+    assert(!cg->is_late_inline() && cg->is_inline(), "we're doing late inlining");
+    _inline_cg = cg;
+    Compile::current()->dec_number_of_mh_late_inlines();
+    return true;
+  }
+
+  call_node()->set_generator(this);
+  return false;
+}
+
+CallGenerator* CallGenerator::for_mh_late_inline(ciMethod* caller, ciMethod* callee, bool input_not_const) {
+  Compile::current()->inc_number_of_mh_late_inlines();
+  CallGenerator* cg = new LateInlineMHCallGenerator(caller, callee, input_not_const);
+  return cg;
+}
+
+class LateInlineStringCallGenerator : public LateInlineCallGenerator {
+
+ public:
+  LateInlineStringCallGenerator(ciMethod* method, CallGenerator* inline_cg) :
+    LateInlineCallGenerator(method, inline_cg) {}
+
+  virtual JVMState* generate(JVMState* jvms) {
+    Compile *C = Compile::current();
+    C->print_inlining_skip(this);
+
+    C->add_string_late_inline(this);
+
+    JVMState* new_jvms =  DirectCallGenerator::generate(jvms);
+    return new_jvms;
+  }
+};
+
+CallGenerator* CallGenerator::for_string_late_inline(ciMethod* method, CallGenerator* inline_cg) {
+  return new LateInlineStringCallGenerator(method, inline_cg);
+}
+
 
 //---------------------------WarmCallGenerator--------------------------------
 // Internal class which handles initial deferral of inlining decisions.
@@ -586,35 +696,53 @@
 }
 
 
-CallGenerator* CallGenerator::for_method_handle_call(JVMState* jvms, ciMethod* caller, ciMethod* callee) {
+CallGenerator* CallGenerator::for_method_handle_call(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool delayed_forbidden) {
   assert(callee->is_method_handle_intrinsic() ||
          callee->is_compiled_lambda_form(), "for_method_handle_call mismatch");
-  CallGenerator* cg = CallGenerator::for_method_handle_inline(jvms, caller, callee);
-  if (cg != NULL)
-    return cg;
-  return CallGenerator::for_direct_call(callee);
+  bool input_not_const;
+  CallGenerator* cg = CallGenerator::for_method_handle_inline(jvms, caller, callee, input_not_const);
+  Compile* C = Compile::current();
+  if (cg != NULL) {
+    if (!delayed_forbidden && AlwaysIncrementalInline) {
+      return CallGenerator::for_late_inline(callee, cg);
+    } else {
+      return cg;
+    }
+  }
+  int bci = jvms->bci();
+  ciCallProfile profile = caller->call_profile_at_bci(bci);
+  int call_site_count = caller->scale_count(profile.count());
+
+  if (IncrementalInline && call_site_count > 0 &&
+      (input_not_const || !C->inlining_incrementally() || C->over_inlining_cutoff())) {
+    return CallGenerator::for_mh_late_inline(caller, callee, input_not_const);
+  } else {
+    // Out-of-line call.
+    return CallGenerator::for_direct_call(callee);
+  }
 }
 
-CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* caller, ciMethod* callee) {
+CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool& input_not_const) {
   GraphKit kit(jvms);
   PhaseGVN& gvn = kit.gvn();
   Compile* C = kit.C;
   vmIntrinsics::ID iid = callee->intrinsic_id();
+  input_not_const = true;
   switch (iid) {
   case vmIntrinsics::_invokeBasic:
     {
       // Get MethodHandle receiver:
       Node* receiver = kit.argument(0);
       if (receiver->Opcode() == Op_ConP) {
+        input_not_const = false;
         const TypeOopPtr* oop_ptr = receiver->bottom_type()->is_oopptr();
         ciMethod* target = oop_ptr->const_oop()->as_method_handle()->get_vmtarget();
         guarantee(!target->is_method_handle_intrinsic(), "should not happen");  // XXX remove
         const int vtable_index = Method::invalid_vtable_index;
-        CallGenerator* cg = C->call_generator(target, vtable_index, false, jvms, true, PROB_ALWAYS);
+        CallGenerator* cg = C->call_generator(target, vtable_index, false, jvms, true, PROB_ALWAYS, true, true);
+        assert(!cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here");
         if (cg != NULL && cg->is_inline())
           return cg;
-      } else {
-        if (PrintInlining)  C->print_inlining(callee, jvms->depth() - 1, jvms->bci(), "receiver not constant");
       }
     }
     break;
@@ -627,6 +755,7 @@
       // Get MemberName argument:
       Node* member_name = kit.argument(callee->arg_size() - 1);
       if (member_name->Opcode() == Op_ConP) {
+        input_not_const = false;
         const TypeOopPtr* oop_ptr = member_name->bottom_type()->is_oopptr();
         ciMethod* target = oop_ptr->const_oop()->as_member_name()->get_vmtarget();
 
@@ -659,9 +788,25 @@
             }
           }
         }
-        const int vtable_index = Method::invalid_vtable_index;
-        const bool call_is_virtual = target->is_abstract();  // FIXME workaround
-        CallGenerator* cg = C->call_generator(target, vtable_index, call_is_virtual, jvms, true, PROB_ALWAYS);
+
+        // Try to get the most accurate receiver type
+        const bool is_virtual              = (iid == vmIntrinsics::_linkToVirtual);
+        const bool is_virtual_or_interface = (is_virtual || iid == vmIntrinsics::_linkToInterface);
+        int  vtable_index       = Method::invalid_vtable_index;
+        bool call_does_dispatch = false;
+
+        if (is_virtual_or_interface) {
+          ciInstanceKlass* klass = target->holder();
+          Node*             receiver_node = kit.argument(0);
+          const TypeOopPtr* receiver_type = gvn.type(receiver_node)->isa_oopptr();
+          // call_does_dispatch and vtable_index are out-parameters.  They might be changed.
+          target = C->optimize_virtual_call(caller, jvms->bci(), klass, target, receiver_type,
+                                            is_virtual,
+                                            call_does_dispatch, vtable_index);  // out-parameters
+        }
+
+        CallGenerator* cg = C->call_generator(target, vtable_index, call_does_dispatch, jvms, true, PROB_ALWAYS, true, true);
+        assert(!cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here");
         if (cg != NULL && cg->is_inline())
           return cg;
       }
--- a/hotspot/src/share/vm/opto/callGenerator.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/opto/callGenerator.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -68,6 +68,12 @@
 
   // is_late_inline: supports conversion of call into an inline
   virtual bool      is_late_inline() const      { return false; }
+  // same but for method handle calls
+  virtual bool      is_mh_late_inline() const   { return false; }
+
+  // for method handle calls: have we tried inlinining the call already?
+  virtual bool      already_attempted() const   { ShouldNotReachHere(); return false; }
+
   // Replace the call with an inline version of the code
   virtual void do_late_inline() { ShouldNotReachHere(); }
 
@@ -112,11 +118,13 @@
   static CallGenerator* for_virtual_call(ciMethod* m, int vtable_index);  // virtual, interface
   static CallGenerator* for_dynamic_call(ciMethod* m);   // invokedynamic
 
-  static CallGenerator* for_method_handle_call(  JVMState* jvms, ciMethod* caller, ciMethod* callee);
-  static CallGenerator* for_method_handle_inline(JVMState* jvms, ciMethod* caller, ciMethod* callee);
+  static CallGenerator* for_method_handle_call(  JVMState* jvms, ciMethod* caller, ciMethod* callee, bool delayed_forbidden);
+  static CallGenerator* for_method_handle_inline(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool& input_not_const);
 
   // How to generate a replace a direct call with an inline version
   static CallGenerator* for_late_inline(ciMethod* m, CallGenerator* inline_cg);
+  static CallGenerator* for_mh_late_inline(ciMethod* caller, ciMethod* callee, bool input_not_const);
+  static CallGenerator* for_string_late_inline(ciMethod* m, CallGenerator* inline_cg);
 
   // How to make a call but defer the decision whether to inline or not.
   static CallGenerator* for_warm_call(WarmCallInfo* ci,
@@ -147,6 +155,8 @@
                                                 CallGenerator* cg);
   virtual Node* generate_predicate(JVMState* jvms) { return NULL; };
 
+  virtual void print_inlining_late(const char* msg) { ShouldNotReachHere(); }
+
   static void print_inlining(Compile* C, ciMethod* callee, int inline_level, int bci, const char* msg) {
     if (PrintInlining)
       C->print_inlining(callee, inline_level, bci, msg);
--- a/hotspot/src/share/vm/opto/callnode.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/opto/callnode.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "ci/bcEscapeAnalyzer.hpp"
 #include "compiler/oopMap.hpp"
+#include "opto/callGenerator.hpp"
 #include "opto/callnode.hpp"
 #include "opto/escape.hpp"
 #include "opto/locknode.hpp"
@@ -775,16 +776,38 @@
   // and the exception object may not exist if an exception handler
   // swallows the exception but all the other must exist and be found.
   assert(projs->fallthrough_proj      != NULL, "must be found");
-  assert(projs->fallthrough_catchproj != NULL, "must be found");
-  assert(projs->fallthrough_memproj   != NULL, "must be found");
-  assert(projs->fallthrough_ioproj    != NULL, "must be found");
-  assert(projs->catchall_catchproj    != NULL, "must be found");
+  assert(Compile::current()->inlining_incrementally() || projs->fallthrough_catchproj != NULL, "must be found");
+  assert(Compile::current()->inlining_incrementally() || projs->fallthrough_memproj   != NULL, "must be found");
+  assert(Compile::current()->inlining_incrementally() || projs->fallthrough_ioproj    != NULL, "must be found");
+  assert(Compile::current()->inlining_incrementally() || projs->catchall_catchproj    != NULL, "must be found");
   if (separate_io_proj) {
-    assert(projs->catchall_memproj      != NULL, "must be found");
-    assert(projs->catchall_ioproj       != NULL, "must be found");
+    assert(Compile::current()->inlining_incrementally() || projs->catchall_memproj    != NULL, "must be found");
+    assert(Compile::current()->inlining_incrementally() || projs->catchall_ioproj     != NULL, "must be found");
   }
 }
 
+Node *CallNode::Ideal(PhaseGVN *phase, bool can_reshape) {
+  CallGenerator* cg = generator();
+  if (can_reshape && cg != NULL && cg->is_mh_late_inline() && !cg->already_attempted()) {
+    // Check whether this MH handle call becomes a candidate for inlining
+    ciMethod* callee = cg->method();
+    vmIntrinsics::ID iid = callee->intrinsic_id();
+    if (iid == vmIntrinsics::_invokeBasic) {
+      if (in(TypeFunc::Parms)->Opcode() == Op_ConP) {
+        phase->C->prepend_late_inline(cg);
+        set_generator(NULL);
+      }
+    } else {
+      assert(callee->has_member_arg(), "wrong type of call?");
+      if (in(TypeFunc::Parms + callee->arg_size() - 1)->Opcode() == Op_ConP) {
+        phase->C->prepend_late_inline(cg);
+        set_generator(NULL);
+      }
+    }
+  }
+  return SafePointNode::Ideal(phase, can_reshape);
+}
+
 
 //=============================================================================
 uint CallJavaNode::size_of() const { return sizeof(*this); }
--- a/hotspot/src/share/vm/opto/callnode.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/opto/callnode.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -507,6 +507,7 @@
   Node* exobj;
 };
 
+class CallGenerator;
 
 //------------------------------CallNode---------------------------------------
 // Call nodes now subsume the function of debug nodes at callsites, so they
@@ -517,26 +518,31 @@
   const TypeFunc *_tf;        // Function type
   address      _entry_point;  // Address of method being called
   float        _cnt;          // Estimate of number of times called
+  CallGenerator* _generator;  // corresponding CallGenerator for some late inline calls
 
   CallNode(const TypeFunc* tf, address addr, const TypePtr* adr_type)
     : SafePointNode(tf->domain()->cnt(), NULL, adr_type),
       _tf(tf),
       _entry_point(addr),
-      _cnt(COUNT_UNKNOWN)
+      _cnt(COUNT_UNKNOWN),
+      _generator(NULL)
   {
     init_class_id(Class_Call);
   }
 
-  const TypeFunc* tf()        const { return _tf; }
-  const address entry_point() const { return _entry_point; }
-  const float   cnt()         const { return _cnt; }
+  const TypeFunc* tf()         const { return _tf; }
+  const address  entry_point() const { return _entry_point; }
+  const float    cnt()         const { return _cnt; }
+  CallGenerator* generator()   const { return _generator; }
 
-  void set_tf(const TypeFunc* tf) { _tf = tf; }
-  void set_entry_point(address p) { _entry_point = p; }
-  void set_cnt(float c)           { _cnt = c; }
+  void set_tf(const TypeFunc* tf)       { _tf = tf; }
+  void set_entry_point(address p)       { _entry_point = p; }
+  void set_cnt(float c)                 { _cnt = c; }
+  void set_generator(CallGenerator* cg) { _generator = cg; }
 
   virtual const Type *bottom_type() const;
   virtual const Type *Value( PhaseTransform *phase ) const;
+  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
   virtual Node *Identity( PhaseTransform *phase ) { return this; }
   virtual uint        cmp( const Node &n ) const;
   virtual uint        size_of() const = 0;
--- a/hotspot/src/share/vm/opto/cfgnode.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/opto/cfgnode.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -363,6 +363,49 @@
   return true; // The Region node is unreachable - it is dead.
 }
 
+bool RegionNode::try_clean_mem_phi(PhaseGVN *phase) {
+  // Incremental inlining + PhaseStringOpts sometimes produce:
+  //
+  // cmpP with 1 top input
+  //           |
+  //          If
+  //         /  \
+  //   IfFalse  IfTrue  /- Some Node
+  //         \  /      /    /
+  //        Region    / /-MergeMem
+  //             \---Phi
+  //
+  //
+  // It's expected by PhaseStringOpts that the Region goes away and is
+  // replaced by If's control input but because there's still a Phi,
+  // the Region stays in the graph. The top input from the cmpP is
+  // propagated forward and a subgraph that is useful goes away. The
+  // code below replaces the Phi with the MergeMem so that the Region
+  // is simplified.
+
+  PhiNode* phi = has_unique_phi();
+  if (phi && phi->type() == Type::MEMORY && req() == 3 && phi->is_diamond_phi(true)) {
+    MergeMemNode* m = NULL;
+    assert(phi->req() == 3, "same as region");
+    for (uint i = 1; i < 3; ++i) {
+      Node *mem = phi->in(i);
+      if (mem && mem->is_MergeMem() && in(i)->outcnt() == 1) {
+        // Nothing is control-dependent on path #i except the region itself.
+        m = mem->as_MergeMem();
+        uint j = 3 - i;
+        Node* other = phi->in(j);
+        if (other && other == m->base_memory()) {
+          // m is a successor memory to other, and is not pinned inside the diamond, so push it out.
+          // This will allow the diamond to collapse completely.
+          phase->is_IterGVN()->replace_node(phi, m);
+          return true;
+        }
+      }
+    }
+  }
+  return false;
+}
+
 //------------------------------Ideal------------------------------------------
 // Return a node which is more "ideal" than the current node.  Must preserve
 // the CFG, but we can still strip out dead paths.
@@ -375,6 +418,10 @@
   bool has_phis = false;
   if (can_reshape) {            // Need DU info to check for Phi users
     has_phis = (has_phi() != NULL);       // Cache result
+    if (has_phis && try_clean_mem_phi(phase)) {
+      has_phis = false;
+    }
+
     if (!has_phis) {            // No Phi users?  Nothing merging?
       for (uint i = 1; i < req()-1; i++) {
         Node *if1 = in(i);
@@ -1005,7 +1052,9 @@
 //------------------------------is_diamond_phi---------------------------------
 // Does this Phi represent a simple well-shaped diamond merge?  Return the
 // index of the true path or 0 otherwise.
-int PhiNode::is_diamond_phi() const {
+// If check_control_only is true, do not inspect the If node at the
+// top, and return -1 (not an edge number) on success.
+int PhiNode::is_diamond_phi(bool check_control_only) const {
   // Check for a 2-path merge
   Node *region = in(0);
   if( !region ) return 0;
@@ -1018,6 +1067,7 @@
   Node *iff = ifp1->in(0);
   if( !iff || !iff->is_If() ) return 0;
   if( iff != ifp2->in(0) ) return 0;
+  if (check_control_only)  return -1;
   // Check for a proper bool/cmp
   const Node *b = iff->in(1);
   if( !b->is_Bool() ) return 0;
--- a/hotspot/src/share/vm/opto/cfgnode.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/opto/cfgnode.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -95,6 +95,7 @@
   virtual Node *Identity( PhaseTransform *phase );
   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
   virtual const RegMask &out_RegMask() const;
+  bool try_clean_mem_phi(PhaseGVN *phase);
 };
 
 //------------------------------JProjNode--------------------------------------
@@ -181,7 +182,7 @@
   LoopSafety simple_data_loop_check(Node *in) const;
   // Is it unsafe data loop? It becomes a dead loop if this phi node removed.
   bool is_unsafe_data_reference(Node *in) const;
-  int  is_diamond_phi() const;
+  int  is_diamond_phi(bool check_control_only = false) const;
   virtual int Opcode() const;
   virtual bool pinned() const { return in(0) != 0; }
   virtual const TypePtr *adr_type() const { verify_adr_type(true); return _adr_type; }
--- a/hotspot/src/share/vm/opto/compile.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/opto/compile.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -136,7 +136,7 @@
 
 void Compile::register_intrinsic(CallGenerator* cg) {
   if (_intrinsics == NULL) {
-    _intrinsics = new GrowableArray<CallGenerator*>(60);
+    _intrinsics = new (comp_arena())GrowableArray<CallGenerator*>(comp_arena(), 60, 0, NULL);
   }
   // This code is stolen from ciObjectFactory::insert.
   // Really, GrowableArray should have methods for
@@ -365,6 +365,21 @@
   }
 }
 
+void Compile::remove_useless_late_inlines(GrowableArray<CallGenerator*>* inlines, Unique_Node_List &useful) {
+  int shift = 0;
+  for (int i = 0; i < inlines->length(); i++) {
+    CallGenerator* cg = inlines->at(i);
+    CallNode* call = cg->call_node();
+    if (shift > 0) {
+      inlines->at_put(i-shift, cg);
+    }
+    if (!useful.member(call)) {
+      shift++;
+    }
+  }
+  inlines->trunc_to(inlines->length()-shift);
+}
+
 // Disconnect all useless nodes by disconnecting those at the boundary.
 void Compile::remove_useless_nodes(Unique_Node_List &useful) {
   uint next = 0;
@@ -394,6 +409,9 @@
       remove_macro_node(n);
     }
   }
+  // clean up the late inline lists
+  remove_useless_late_inlines(&_string_late_inlines, useful);
+  remove_useless_late_inlines(&_late_inlines, useful);
   debug_only(verify_graph_edges(true/*check for no_dead_code*/);)
 }
 
@@ -611,6 +629,12 @@
                   _printer(IdealGraphPrinter::printer()),
 #endif
                   _congraph(NULL),
+                  _late_inlines(comp_arena(), 2, 0, NULL),
+                  _string_late_inlines(comp_arena(), 2, 0, NULL),
+                  _late_inlines_pos(0),
+                  _number_of_mh_late_inlines(0),
+                  _inlining_progress(false),
+                  _inlining_incrementally(false),
                   _print_inlining_list(NULL),
                   _print_inlining(0) {
   C = this;
@@ -737,29 +761,13 @@
       rethrow_exceptions(kit.transfer_exceptions_into_jvms());
     }
 
-    if (!failing() && has_stringbuilder()) {
-      {
-        // remove useless nodes to make the usage analysis simpler
-        ResourceMark rm;
-        PhaseRemoveUseless pru(initial_gvn(), &for_igvn);
-      }
-
-      {
-        ResourceMark rm;
-        print_method("Before StringOpts", 3);
-        PhaseStringOpts pso(initial_gvn(), &for_igvn);
-        print_method("After StringOpts", 3);
-      }
-
-      // now inline anything that we skipped the first time around
-      while (_late_inlines.length() > 0) {
-        CallGenerator* cg = _late_inlines.pop();
-        cg->do_late_inline();
-        if (failing())  return;
-      }
+    assert(IncrementalInline || (_late_inlines.length() == 0 && !has_mh_late_inlines()), "incremental inlining is off");
+
+    if (_late_inlines.length() == 0 && !has_mh_late_inlines() && !failing() && has_stringbuilder()) {
+      inline_string_calls(true);
     }
-    assert(_late_inlines.length() == 0, "should have been processed");
-    dump_inlining();
+
+    if (failing())  return;
 
     print_method("Before RemoveUseless", 3);
 
@@ -906,6 +914,9 @@
     _dead_node_list(comp_arena()),
     _dead_node_count(0),
     _congraph(NULL),
+    _number_of_mh_late_inlines(0),
+    _inlining_progress(false),
+    _inlining_incrementally(false),
     _print_inlining_list(NULL),
     _print_inlining(0) {
   C = this;
@@ -1760,6 +1771,124 @@
   assert(predicate_count()==0, "should be clean!");
 }
 
+// StringOpts and late inlining of string methods
+void Compile::inline_string_calls(bool parse_time) {
+  {
+    // remove useless nodes to make the usage analysis simpler
+    ResourceMark rm;
+    PhaseRemoveUseless pru(initial_gvn(), for_igvn());
+  }
+
+  {
+    ResourceMark rm;
+    print_method("Before StringOpts", 3);
+    PhaseStringOpts pso(initial_gvn(), for_igvn());
+    print_method("After StringOpts", 3);
+  }
+
+  // now inline anything that we skipped the first time around
+  if (!parse_time) {
+    _late_inlines_pos = _late_inlines.length();
+  }
+
+  while (_string_late_inlines.length() > 0) {
+    CallGenerator* cg = _string_late_inlines.pop();
+    cg->do_late_inline();
+    if (failing())  return;
+  }
+  _string_late_inlines.trunc_to(0);
+}
+
+void Compile::inline_incrementally_one(PhaseIterGVN& igvn) {
+  assert(IncrementalInline, "incremental inlining should be on");
+  PhaseGVN* gvn = initial_gvn();
+
+  set_inlining_progress(false);
+  for_igvn()->clear();
+  gvn->replace_with(&igvn);
+
+  int i = 0;
+
+  for (; i <_late_inlines.length() && !inlining_progress(); i++) {
+    CallGenerator* cg = _late_inlines.at(i);
+    _late_inlines_pos = i+1;
+    cg->do_late_inline();
+    if (failing())  return;
+  }
+  int j = 0;
+  for (; i < _late_inlines.length(); i++, j++) {
+    _late_inlines.at_put(j, _late_inlines.at(i));
+  }
+  _late_inlines.trunc_to(j);
+
+  {
+    ResourceMark rm;
+    PhaseRemoveUseless pru(C->initial_gvn(), C->for_igvn());
+  }
+
+  igvn = PhaseIterGVN(gvn);
+}
+
+// Perform incremental inlining until bound on number of live nodes is reached
+void Compile::inline_incrementally(PhaseIterGVN& igvn) {
+  PhaseGVN* gvn = initial_gvn();
+
+  set_inlining_incrementally(true);
+  set_inlining_progress(true);
+  uint low_live_nodes = 0;
+
+  while(inlining_progress() && _late_inlines.length() > 0) {
+
+    if (live_nodes() > (uint)LiveNodeCountInliningCutoff) {
+      if (low_live_nodes < (uint)LiveNodeCountInliningCutoff * 8 / 10) {
+        // PhaseIdealLoop is expensive so we only try it once we are
+        // out of loop and we only try it again if the previous helped
+        // got the number of nodes down significantly
+        PhaseIdealLoop ideal_loop( igvn, false, true );
+        if (failing())  return;
+        low_live_nodes = live_nodes();
+        _major_progress = true;
+      }
+
+      if (live_nodes() > (uint)LiveNodeCountInliningCutoff) {
+        break;
+      }
+    }
+
+    inline_incrementally_one(igvn);
+
+    if (failing())  return;
+
+    igvn.optimize();
+
+    if (failing())  return;
+  }
+
+  assert( igvn._worklist.size() == 0, "should be done with igvn" );
+
+  if (_string_late_inlines.length() > 0) {
+    assert(has_stringbuilder(), "inconsistent");
+    for_igvn()->clear();
+    initial_gvn()->replace_with(&igvn);
+
+    inline_string_calls(false);
+
+    if (failing())  return;
+
+    {
+      ResourceMark rm;
+      PhaseRemoveUseless pru(initial_gvn(), for_igvn());
+    }
+
+    igvn = PhaseIterGVN(gvn);
+
+    igvn.optimize();
+  }
+
+  set_inlining_incrementally(false);
+}
+
+
 //------------------------------Optimize---------------------------------------
 // Given a graph, optimize it.
 void Compile::Optimize() {
@@ -1792,6 +1921,12 @@
 
   if (failing())  return;
 
+  inline_incrementally(igvn);
+
+  print_method("Incremental Inline", 2);
+
+  if (failing())  return;
+
   // Perform escape analysis
   if (_do_escape_analysis && ConnectionGraph::has_candidates(this)) {
     if (has_loops()) {
@@ -1914,6 +2049,7 @@
 
  } // (End scope of igvn; run destructor if necessary for asserts.)
 
+ dump_inlining();
   // A method with only infinite loops has no edges entering loops from root
   {
     NOT_PRODUCT( TracePhase t2("graphReshape", &_t_graphReshaping, TimeCompiler); )
@@ -3362,6 +3498,28 @@
 
 void Compile::dump_inlining() {
   if (PrintInlining) {
+    // Print inlining message for candidates that we couldn't inline
+    // for lack of space or non constant receiver
+    for (int i = 0; i < _late_inlines.length(); i++) {
+      CallGenerator* cg = _late_inlines.at(i);
+      cg->print_inlining_late("live nodes > LiveNodeCountInliningCutoff");
+    }
+    Unique_Node_List useful;
+    useful.push(root());
+    for (uint next = 0; next < useful.size(); ++next) {
+      Node* n  = useful.at(next);
+      if (n->is_Call() && n->as_Call()->generator() != NULL && n->as_Call()->generator()->call_node() == n) {
+        CallNode* call = n->as_Call();
+        CallGenerator* cg = call->generator();
+        cg->print_inlining_late("receiver not constant");
+      }
+      uint max = n->len();
+      for ( uint i = 0; i < max; ++i ) {
+        Node *m = n->in(i);
+        if ( m == NULL ) continue;
+        useful.push(m);
+      }
+    }
     for (int i = 0; i < _print_inlining_list->length(); i++) {
       tty->print(_print_inlining_list->at(i).ss()->as_string());
     }
--- a/hotspot/src/share/vm/opto/compile.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/opto/compile.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -72,6 +72,7 @@
 class JVMState;
 class TypeData;
 class TypePtr;
+class TypeOopPtr;
 class TypeFunc;
 class Unique_Node_List;
 class nmethod;
@@ -280,6 +281,8 @@
   int                   _orig_pc_slot_offset_in_bytes;
 
   int                   _major_progress;        // Count of something big happening
+  bool                  _inlining_progress;     // progress doing incremental inlining?
+  bool                  _inlining_incrementally;// Are we doing incremental inlining (post parse)
   bool                  _has_loops;             // True if the method _may_ have some loops
   bool                  _has_split_ifs;         // True if the method _may_ have some split-if
   bool                  _has_unsafe_access;     // True if the method _may_ produce faults in unsafe loads or stores.
@@ -367,8 +370,13 @@
   Unique_Node_List*     _for_igvn;              // Initial work-list for next round of Iterative GVN
   WarmCallInfo*         _warm_calls;            // Sorted work-list for heat-based inlining.
 
-  GrowableArray<CallGenerator*> _late_inlines;  // List of CallGenerators to be revisited after
-                                                // main parsing has finished.
+  GrowableArray<CallGenerator*> _late_inlines;        // List of CallGenerators to be revisited after
+                                                      // main parsing has finished.
+  GrowableArray<CallGenerator*> _string_late_inlines; // same but for string operations
+
+  int                           _late_inlines_pos;    // Where in the queue should the next late inlining candidate go (emulate depth first inlining)
+  uint                          _number_of_mh_late_inlines; // number of method handle late inlining still pending
+
 
   // Inlining may not happen in parse order which would make
   // PrintInlining output confusing. Keep track of PrintInlining
@@ -491,6 +499,10 @@
   int               fixed_slots() const         { assert(_fixed_slots >= 0, "");         return _fixed_slots; }
   void          set_fixed_slots(int n)          { _fixed_slots = n; }
   int               major_progress() const      { return _major_progress; }
+  void          set_inlining_progress(bool z)   { _inlining_progress = z; }
+  int               inlining_progress() const   { return _inlining_progress; }
+  void          set_inlining_incrementally(bool z) { _inlining_incrementally = z; }
+  int               inlining_incrementally() const { return _inlining_incrementally; }
   void          set_major_progress()            { _major_progress++; }
   void        clear_major_progress()            { _major_progress = 0; }
   int               num_loop_opts() const       { return _num_loop_opts; }
@@ -729,9 +741,17 @@
 
   // Decide how to build a call.
   // The profile factor is a discount to apply to this site's interp. profile.
-  CallGenerator*    call_generator(ciMethod* call_method, int vtable_index, bool call_is_virtual, JVMState* jvms, bool allow_inline, float profile_factor, bool allow_intrinsics = true);
+  CallGenerator*    call_generator(ciMethod* call_method, int vtable_index, bool call_does_dispatch, JVMState* jvms, bool allow_inline, float profile_factor, bool allow_intrinsics = true, bool delayed_forbidden = false);
   bool should_delay_inlining(ciMethod* call_method, JVMState* jvms);
 
+  // Helper functions to identify inlining potential at call-site
+  ciMethod* optimize_virtual_call(ciMethod* caller, int bci, ciInstanceKlass* klass,
+                                  ciMethod* callee, const TypeOopPtr* receiver_type,
+                                  bool is_virtual,
+                                  bool &call_does_dispatch, int &vtable_index);
+  ciMethod* optimize_inlining(ciMethod* caller, int bci, ciInstanceKlass* klass,
+                              ciMethod* callee, const TypeOopPtr* receiver_type);
+
   // Report if there were too many traps at a current method and bci.
   // Report if a trap was recorded, and/or PerMethodTrapLimit was exceeded.
   // If there is no MDO at all, report no trap unless told to assume it.
@@ -765,10 +785,39 @@
   WarmCallInfo* pop_warm_call();
 
   // Record this CallGenerator for inlining at the end of parsing.
-  void              add_late_inline(CallGenerator* cg) { _late_inlines.push(cg); }
+  void              add_late_inline(CallGenerator* cg)        {
+    _late_inlines.insert_before(_late_inlines_pos, cg);
+    _late_inlines_pos++;
+  }
+
+  void              prepend_late_inline(CallGenerator* cg)    {
+    _late_inlines.insert_before(0, cg);
+  }
+
+  void              add_string_late_inline(CallGenerator* cg) {
+    _string_late_inlines.push(cg);
+  }
+
+  void remove_useless_late_inlines(GrowableArray<CallGenerator*>* inlines, Unique_Node_List &useful);
 
   void dump_inlining();
 
+  bool over_inlining_cutoff() const {
+    if (!inlining_incrementally()) {
+      return unique() > (uint)NodeCountInliningCutoff;
+    } else {
+      return live_nodes() > (uint)LiveNodeCountInliningCutoff;
+    }
+  }
+
+  void inc_number_of_mh_late_inlines() { _number_of_mh_late_inlines++; }
+  void dec_number_of_mh_late_inlines() { assert(_number_of_mh_late_inlines > 0, "_number_of_mh_late_inlines < 0 !"); _number_of_mh_late_inlines--; }
+  bool has_mh_late_inlines() const     { return _number_of_mh_late_inlines > 0; }
+
+  void inline_incrementally_one(PhaseIterGVN& igvn);
+  void inline_incrementally(PhaseIterGVN& igvn);
+  void inline_string_calls(bool parse_time);
+
   // Matching, CFG layout, allocation, code generation
   PhaseCFG*         cfg()                       { return _cfg; }
   bool              select_24_bit_instr() const { return _select_24_bit_instr; }
--- a/hotspot/src/share/vm/opto/doCall.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/opto/doCall.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -61,9 +61,9 @@
   }
 }
 
-CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool call_is_virtual,
+CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool call_does_dispatch,
                                        JVMState* jvms, bool allow_inline,
-                                       float prof_factor, bool allow_intrinsics) {
+                                       float prof_factor, bool allow_intrinsics, bool delayed_forbidden) {
   ciMethod*       caller   = jvms->method();
   int             bci      = jvms->bci();
   Bytecodes::Code bytecode = caller->java_code_at_bci(bci);
@@ -82,7 +82,7 @@
   // See how many times this site has been invoked.
   int site_count = profile.count();
   int receiver_count = -1;
-  if (call_is_virtual && UseTypeProfile && profile.has_receiver(0)) {
+  if (call_does_dispatch && UseTypeProfile && profile.has_receiver(0)) {
     // Receivers in the profile structure are ordered by call counts
     // so that the most called (major) receiver is profile.receiver(0).
     receiver_count = profile.receiver_count(0);
@@ -94,7 +94,7 @@
     int r2id = (rid != -1 && profile.has_receiver(1))? log->identify(profile.receiver(1)):-1;
     log->begin_elem("call method='%d' count='%d' prof_factor='%g'",
                     log->identify(callee), site_count, prof_factor);
-    if (call_is_virtual)  log->print(" virtual='1'");
+    if (call_does_dispatch)  log->print(" virtual='1'");
     if (allow_inline)     log->print(" inline='1'");
     if (receiver_count >= 0) {
       log->print(" receiver='%d' receiver_count='%d'", rid, receiver_count);
@@ -111,12 +111,12 @@
   // We do this before the strict f.p. check below because the
   // intrinsics handle strict f.p. correctly.
   if (allow_inline && allow_intrinsics) {
-    CallGenerator* cg = find_intrinsic(callee, call_is_virtual);
+    CallGenerator* cg = find_intrinsic(callee, call_does_dispatch);
     if (cg != NULL) {
       if (cg->is_predicted()) {
         // Code without intrinsic but, hopefully, inlined.
         CallGenerator* inline_cg = this->call_generator(callee,
-              vtable_index, call_is_virtual, jvms, allow_inline, prof_factor, false);
+              vtable_index, call_does_dispatch, jvms, allow_inline, prof_factor, false);
         if (inline_cg != NULL) {
           cg = CallGenerator::for_predicted_intrinsic(cg, inline_cg);
         }
@@ -130,7 +130,9 @@
   // MethodHandle.invoke* are native methods which obviously don't
   // have bytecodes and so normal inlining fails.
   if (callee->is_method_handle_intrinsic()) {
-    return CallGenerator::for_method_handle_call(jvms, caller, callee);
+    CallGenerator* cg = CallGenerator::for_method_handle_call(jvms, caller, callee, delayed_forbidden);
+    assert(cg == NULL || !delayed_forbidden || !cg->is_late_inline() || cg->is_mh_late_inline(), "unexpected CallGenerator");
+    return cg;
   }
 
   // Do not inline strict fp into non-strict code, or the reverse
@@ -147,7 +149,7 @@
     float expected_uses = past_uses;
 
     // Try inlining a bytecoded method:
-    if (!call_is_virtual) {
+    if (!call_does_dispatch) {
       InlineTree* ilt;
       if (UseOldInlining) {
         ilt = InlineTree::find_subtree_from_root(this->ilt(), jvms->caller(), jvms->method());
@@ -161,32 +163,39 @@
       WarmCallInfo scratch_ci;
       if (!UseOldInlining)
         scratch_ci.init(jvms, callee, profile, prof_factor);
-      WarmCallInfo* ci = ilt->ok_to_inline(callee, jvms, profile, &scratch_ci);
+      bool should_delay = false;
+      WarmCallInfo* ci = ilt->ok_to_inline(callee, jvms, profile, &scratch_ci, should_delay);
       assert(ci != &scratch_ci, "do not let this pointer escape");
       bool allow_inline   = (ci != NULL && !ci->is_cold());
       bool require_inline = (allow_inline && ci->is_hot());
 
       if (allow_inline) {
         CallGenerator* cg = CallGenerator::for_inline(callee, expected_uses);
-        if (require_inline && cg != NULL && should_delay_inlining(callee, jvms)) {
+
+        if (require_inline && cg != NULL) {
           // Delay the inlining of this method to give us the
           // opportunity to perform some high level optimizations
           // first.
-          return CallGenerator::for_late_inline(callee, cg);
+          if (should_delay_inlining(callee, jvms)) {
+            assert(!delayed_forbidden, "strange");
+            return CallGenerator::for_string_late_inline(callee, cg);
+          } else if ((should_delay || AlwaysIncrementalInline) && !delayed_forbidden) {
+            return CallGenerator::for_late_inline(callee, cg);
+          }
         }
-        if (cg == NULL) {
+        if (cg == NULL || should_delay) {
           // Fall through.
         } else if (require_inline || !InlineWarmCalls) {
           return cg;
         } else {
-          CallGenerator* cold_cg = call_generator(callee, vtable_index, call_is_virtual, jvms, false, prof_factor);
+          CallGenerator* cold_cg = call_generator(callee, vtable_index, call_does_dispatch, jvms, false, prof_factor);
           return CallGenerator::for_warm_call(ci, cold_cg, cg);
         }
       }
     }
 
     // Try using the type profile.
-    if (call_is_virtual && site_count > 0 && receiver_count > 0) {
+    if (call_does_dispatch && site_count > 0 && receiver_count > 0) {
       // The major receiver's count >= TypeProfileMajorReceiverPercent of site_count.
       bool have_major_receiver = (100.*profile.receiver_prob(0) >= (float)TypeProfileMajorReceiverPercent);
       ciMethod* receiver_method = NULL;
@@ -200,7 +209,7 @@
       if (receiver_method != NULL) {
         // The single majority receiver sufficiently outweighs the minority.
         CallGenerator* hit_cg = this->call_generator(receiver_method,
-              vtable_index, !call_is_virtual, jvms, allow_inline, prof_factor);
+              vtable_index, !call_does_dispatch, jvms, allow_inline, prof_factor);
         if (hit_cg != NULL) {
           // Look up second receiver.
           CallGenerator* next_hit_cg = NULL;
@@ -210,7 +219,7 @@
                                                                profile.receiver(1));
             if (next_receiver_method != NULL) {
               next_hit_cg = this->call_generator(next_receiver_method,
-                                  vtable_index, !call_is_virtual, jvms,
+                                  vtable_index, !call_does_dispatch, jvms,
                                   allow_inline, prof_factor);
               if (next_hit_cg != NULL && !next_hit_cg->is_inline() &&
                   have_major_receiver && UseOnlyInlinedBimorphic) {
@@ -256,7 +265,7 @@
 
   // There was no special inlining tactic, or it bailed out.
   // Use a more generic tactic, like a simple call.
-  if (call_is_virtual) {
+  if (call_does_dispatch) {
     return CallGenerator::for_virtual_call(callee, vtable_index);
   } else {
     // Class Hierarchy Analysis or Type Profile reveals a unique target,
@@ -388,6 +397,7 @@
   // orig_callee is the resolved callee which's signature includes the
   // appendix argument.
   const int nargs = orig_callee->arg_size();
+  const bool is_signature_polymorphic = MethodHandles::is_signature_polymorphic(orig_callee->intrinsic_id());
 
   // Push appendix argument (MethodType, CallSite, etc.), if one.
   if (iter().has_appendix()) {
@@ -404,25 +414,18 @@
   // Then we may introduce a run-time check and inline on the path where it succeeds.
   // The other path may uncommon_trap, check for another receiver, or do a v-call.
 
-  // Choose call strategy.
-  bool call_is_virtual = is_virtual_or_interface;
-  int vtable_index = Method::invalid_vtable_index;
-  ciMethod* callee = orig_callee;
+  // Try to get the most accurate receiver type
+  ciMethod* callee             = orig_callee;
+  int       vtable_index       = Method::invalid_vtable_index;
+  bool      call_does_dispatch = false;
 
-  // Try to get the most accurate receiver type
   if (is_virtual_or_interface) {
     Node*             receiver_node = stack(sp() - nargs);
     const TypeOopPtr* receiver_type = _gvn.type(receiver_node)->isa_oopptr();
-    ciMethod* optimized_virtual_method = optimize_inlining(method(), bci(), klass, orig_callee, receiver_type);
-
-    // Have the call been sufficiently improved such that it is no longer a virtual?
-    if (optimized_virtual_method != NULL) {
-      callee          = optimized_virtual_method;
-      call_is_virtual = false;
-    } else if (!UseInlineCaches && is_virtual && callee->is_loaded()) {
-      // We can make a vtable call at this site
-      vtable_index = callee->resolve_vtable_index(method()->holder(), klass);
-    }
+    // call_does_dispatch and vtable_index are out-parameters.  They might be changed.
+    callee = C->optimize_virtual_call(method(), bci(), klass, orig_callee, receiver_type,
+                                      is_virtual,
+                                      call_does_dispatch, vtable_index);  // out-parameters
   }
 
   // Note:  It's OK to try to inline a virtual call.
@@ -438,7 +441,7 @@
   // Decide call tactic.
   // This call checks with CHA, the interpreter profile, intrinsics table, etc.
   // It decides whether inlining is desirable or not.
-  CallGenerator* cg = C->call_generator(callee, vtable_index, call_is_virtual, jvms, try_inline, prof_factor());
+  CallGenerator* cg = C->call_generator(callee, vtable_index, call_does_dispatch, jvms, try_inline, prof_factor());
 
   // NOTE:  Don't use orig_callee and callee after this point!  Use cg->method() instead.
   orig_callee = callee = NULL;
@@ -478,7 +481,7 @@
     // the call site, perhaps because it did not match a pattern the
     // intrinsic was expecting to optimize. Should always be possible to
     // get a normal java call that may inline in that case
-    cg = C->call_generator(cg->method(), vtable_index, call_is_virtual, jvms, try_inline, prof_factor(), /* allow_intrinsics= */ false);
+    cg = C->call_generator(cg->method(), vtable_index, call_does_dispatch, jvms, try_inline, prof_factor(), /* allow_intrinsics= */ false);
     if ((new_jvms = cg->generate(jvms)) == NULL) {
       guarantee(failing(), "call failed to generate:  calls should work");
       return;
@@ -513,55 +516,44 @@
     round_double_result(cg->method());
 
     ciType* rtype = cg->method()->return_type();
-    if (Bytecodes::has_optional_appendix(iter().cur_bc_raw())) {
+    ciType* ctype = declared_signature->return_type();
+
+    if (Bytecodes::has_optional_appendix(iter().cur_bc_raw()) || is_signature_polymorphic) {
       // Be careful here with return types.
-      ciType* ctype = declared_signature->return_type();
       if (ctype != rtype) {
         BasicType rt = rtype->basic_type();
         BasicType ct = ctype->basic_type();
-        Node* retnode = peek();
         if (ct == T_VOID) {
           // It's OK for a method  to return a value that is discarded.
           // The discarding does not require any special action from the caller.
           // The Java code knows this, at VerifyType.isNullConversion.
           pop_node(rt);  // whatever it was, pop it
-          retnode = top();
         } else if (rt == T_INT || is_subword_type(rt)) {
-          // FIXME: This logic should be factored out.
-          if (ct == T_BOOLEAN) {
-            retnode = _gvn.transform( new (C) AndINode(retnode, intcon(0x1)) );
-          } else if (ct == T_CHAR) {
-            retnode = _gvn.transform( new (C) AndINode(retnode, intcon(0xFFFF)) );
-          } else if (ct == T_BYTE) {
-            retnode = _gvn.transform( new (C) LShiftINode(retnode, intcon(24)) );
-            retnode = _gvn.transform( new (C) RShiftINode(retnode, intcon(24)) );
-          } else if (ct == T_SHORT) {
-            retnode = _gvn.transform( new (C) LShiftINode(retnode, intcon(16)) );
-            retnode = _gvn.transform( new (C) RShiftINode(retnode, intcon(16)) );
-          } else {
-            assert(ct == T_INT, err_msg_res("rt=%s, ct=%s", type2name(rt), type2name(ct)));
-          }
+          // Nothing.  These cases are handled in lambda form bytecode.
+          assert(ct == T_INT || is_subword_type(ct), err_msg_res("must match: rt=%s, ct=%s", type2name(rt), type2name(ct)));
         } else if (rt == T_OBJECT || rt == T_ARRAY) {
           assert(ct == T_OBJECT || ct == T_ARRAY, err_msg_res("rt=%s, ct=%s", type2name(rt), type2name(ct)));
           if (ctype->is_loaded()) {
             const TypeOopPtr* arg_type = TypeOopPtr::make_from_klass(rtype->as_klass());
             const Type*       sig_type = TypeOopPtr::make_from_klass(ctype->as_klass());
             if (arg_type != NULL && !arg_type->higher_equal(sig_type)) {
+              Node* retnode = pop();
               Node* cast_obj = _gvn.transform(new (C) CheckCastPPNode(control(), retnode, sig_type));
-              pop();
               push(cast_obj);
             }
           }
         } else {
-          assert(ct == rt, err_msg("unexpected mismatch rt=%d, ct=%d", rt, ct));
+          assert(rt == ct, err_msg_res("unexpected mismatch: rt=%s, ct=%s", type2name(rt), type2name(ct)));
           // push a zero; it's better than getting an oop/int mismatch
-          retnode = pop_node(rt);
-          retnode = zerocon(ct);
+          pop_node(rt);
+          Node* retnode = zerocon(ct);
           push_node(ct, retnode);
         }
         // Now that the value is well-behaved, continue with the call-site type.
         rtype = ctype;
       }
+    } else {
+      assert(rtype == ctype, "mismatched return types");  // symbolic resolution enforces this
     }
 
     // If the return type of the method is not loaded, assert that the
@@ -879,17 +871,39 @@
 #endif //PRODUCT
 
 
+ciMethod* Compile::optimize_virtual_call(ciMethod* caller, int bci, ciInstanceKlass* klass,
+                                         ciMethod* callee, const TypeOopPtr* receiver_type,
+                                         bool is_virtual,
+                                         bool& call_does_dispatch, int& vtable_index) {
+  // Set default values for out-parameters.
+  call_does_dispatch = true;
+  vtable_index       = Method::invalid_vtable_index;
+
+  // Choose call strategy.
+  ciMethod* optimized_virtual_method = optimize_inlining(caller, bci, klass, callee, receiver_type);
+
+  // Have the call been sufficiently improved such that it is no longer a virtual?
+  if (optimized_virtual_method != NULL) {
+    callee             = optimized_virtual_method;
+    call_does_dispatch = false;
+  } else if (!UseInlineCaches && is_virtual && callee->is_loaded()) {
+    // We can make a vtable call at this site
+    vtable_index = callee->resolve_vtable_index(caller->holder(), klass);
+  }
+  return callee;
+}
+
 // Identify possible target method and inlining style
-ciMethod* Parse::optimize_inlining(ciMethod* caller, int bci, ciInstanceKlass* klass,
-                                   ciMethod *dest_method, const TypeOopPtr* receiver_type) {
+ciMethod* Compile::optimize_inlining(ciMethod* caller, int bci, ciInstanceKlass* klass,
+                                     ciMethod* callee, const TypeOopPtr* receiver_type) {
   // only use for virtual or interface calls
 
   // If it is obviously final, do not bother to call find_monomorphic_target,
   // because the class hierarchy checks are not needed, and may fail due to
   // incompletely loaded classes.  Since we do our own class loading checks
   // in this module, we may confidently bind to any method.
-  if (dest_method->can_be_statically_bound()) {
-    return dest_method;
+  if (callee->can_be_statically_bound()) {
+    return callee;
   }
 
   // Attempt to improve the receiver
@@ -898,8 +912,8 @@
   if (receiver_type != NULL) {
     // Array methods are all inherited from Object, and are monomorphic.
     if (receiver_type->isa_aryptr() &&
-        dest_method->holder() == env()->Object_klass()) {
-      return dest_method;
+        callee->holder() == env()->Object_klass()) {
+      return callee;
     }
 
     // All other interesting cases are instance klasses.
@@ -919,7 +933,7 @@
   }
 
   ciInstanceKlass*   calling_klass = caller->holder();
-  ciMethod* cha_monomorphic_target = dest_method->find_monomorphic_target(calling_klass, klass, actual_receiver);
+  ciMethod* cha_monomorphic_target = callee->find_monomorphic_target(calling_klass, klass, actual_receiver);
   if (cha_monomorphic_target != NULL) {
     assert(!cha_monomorphic_target->is_abstract(), "");
     // Look at the method-receiver type.  Does it add "too much information"?
@@ -937,10 +951,10 @@
         cha_monomorphic_target->print();
         tty->cr();
       }
-      if (C->log() != NULL) {
-        C->log()->elem("missed_CHA_opportunity klass='%d' method='%d'",
-                       C->log()->identify(klass),
-                       C->log()->identify(cha_monomorphic_target));
+      if (log() != NULL) {
+        log()->elem("missed_CHA_opportunity klass='%d' method='%d'",
+                       log()->identify(klass),
+                       log()->identify(cha_monomorphic_target));
       }
       cha_monomorphic_target = NULL;
     }
@@ -952,7 +966,7 @@
     // by dynamic class loading.  Be sure to test the "static" receiver
     // dest_method here, as opposed to the actual receiver, which may
     // falsely lead us to believe that the receiver is final or private.
-    C->dependencies()->assert_unique_concrete_method(actual_receiver, cha_monomorphic_target);
+    dependencies()->assert_unique_concrete_method(actual_receiver, cha_monomorphic_target);
     return cha_monomorphic_target;
   }
 
@@ -961,7 +975,7 @@
   if (actual_receiver_is_exact) {
     // In case of evolution, there is a dependence on every inlined method, since each
     // such method can be changed when its class is redefined.
-    ciMethod* exact_method = dest_method->resolve_invoke(calling_klass, actual_receiver);
+    ciMethod* exact_method = callee->resolve_invoke(calling_klass, actual_receiver);
     if (exact_method != NULL) {
 #ifndef PRODUCT
       if (PrintOpto) {
--- a/hotspot/src/share/vm/opto/graphKit.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/opto/graphKit.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -1794,10 +1794,15 @@
 
   if (ejvms == NULL) {
     // No exception edges to simply kill off those paths
-    C->gvn_replace_by(callprojs.catchall_catchproj, C->top());
-    C->gvn_replace_by(callprojs.catchall_memproj,   C->top());
-    C->gvn_replace_by(callprojs.catchall_ioproj,    C->top());
-
+    if (callprojs.catchall_catchproj != NULL) {
+      C->gvn_replace_by(callprojs.catchall_catchproj, C->top());
+    }
+    if (callprojs.catchall_memproj != NULL) {
+      C->gvn_replace_by(callprojs.catchall_memproj,   C->top());
+    }
+    if (callprojs.catchall_ioproj != NULL) {
+      C->gvn_replace_by(callprojs.catchall_ioproj,    C->top());
+    }
     // Replace the old exception object with top
     if (callprojs.exobj != NULL) {
       C->gvn_replace_by(callprojs.exobj, C->top());
@@ -1809,10 +1814,15 @@
     SafePointNode* ex_map = ekit.combine_and_pop_all_exception_states();
 
     Node* ex_oop = ekit.use_exception_state(ex_map);
-
-    C->gvn_replace_by(callprojs.catchall_catchproj, ekit.control());
-    C->gvn_replace_by(callprojs.catchall_memproj,   ekit.reset_memory());
-    C->gvn_replace_by(callprojs.catchall_ioproj,    ekit.i_o());
+    if (callprojs.catchall_catchproj != NULL) {
+      C->gvn_replace_by(callprojs.catchall_catchproj, ekit.control());
+    }
+    if (callprojs.catchall_memproj != NULL) {
+      C->gvn_replace_by(callprojs.catchall_memproj,   ekit.reset_memory());
+    }
+    if (callprojs.catchall_ioproj != NULL) {
+      C->gvn_replace_by(callprojs.catchall_ioproj,    ekit.i_o());
+    }
 
     // Replace the old exception object with the newly created one
     if (callprojs.exobj != NULL) {
--- a/hotspot/src/share/vm/opto/memnode.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/opto/memnode.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -2725,10 +2725,8 @@
     zend  = phase->transform( new(C) URShiftXNode(zend,  shift) );
   }
 
+  // Bulk clear double-words
   Node* zsize = phase->transform( new(C) SubXNode(zend, zbase) );
-  Node* zinit = phase->zerocon((unit == BytesPerLong) ? T_LONG : T_INT);
-
-  // Bulk clear double-words
   Node* adr = phase->transform( new(C) AddPNode(dest, dest, start_offset) );
   mem = new (C) ClearArrayNode(ctl, mem, zsize, adr);
   return phase->transform(mem);
--- a/hotspot/src/share/vm/opto/parse.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/opto/parse.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -70,7 +70,7 @@
   InlineTree *build_inline_tree_for_callee(ciMethod* callee_method,
                                            JVMState* caller_jvms,
                                            int caller_bci);
-  const char* try_to_inline(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile, WarmCallInfo* wci_result);
+  const char* try_to_inline(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile, WarmCallInfo* wci_result, bool& should_delay);
   const char* should_inline(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile, WarmCallInfo* wci_result) const;
   const char* should_not_inline(ciMethod* callee_method, ciMethod* caller_method, WarmCallInfo* wci_result) const;
   void        print_inlining(ciMethod *callee_method, int caller_bci, const char *failure_msg) const;
@@ -107,7 +107,7 @@
   // and may be accessed by find_subtree_from_root.
   // The call_method is the dest_method for a special or static invocation.
   // The call_method is an optimized virtual method candidate otherwise.
-  WarmCallInfo* ok_to_inline(ciMethod *call_method, JVMState* caller_jvms, ciCallProfile& profile, WarmCallInfo* wci);
+  WarmCallInfo* ok_to_inline(ciMethod *call_method, JVMState* caller_jvms, ciCallProfile& profile, WarmCallInfo* wci, bool& should_delay);
 
   // Information about inlined method
   JVMState*   caller_jvms()       const { return _caller_jvms; }
@@ -469,10 +469,6 @@
   // Helper function to uncommon-trap or bailout for non-compilable call-sites
   bool can_not_compile_call_site(ciMethod *dest_method, ciInstanceKlass *klass);
 
-  // Helper function to identify inlining potential at call-site
-  ciMethod* optimize_inlining(ciMethod* caller, int bci, ciInstanceKlass* klass,
-                              ciMethod *dest_method, const TypeOopPtr* receiver_type);
-
   // Helper function to setup for type-profile based inlining
   bool prepare_type_profile_inline(ciInstanceKlass* prof_klass, ciMethod* prof_method);
 
--- a/hotspot/src/share/vm/opto/parse1.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/opto/parse1.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -1404,7 +1404,8 @@
 
     do_one_bytecode();
 
-    assert(!have_se || stopped() || failing() || (sp() - pre_bc_sp) == depth, "correct depth prediction");
+    assert(!have_se || stopped() || failing() || (sp() - pre_bc_sp) == depth,
+           err_msg_res("incorrect depth prediction: sp=%d, pre_bc_sp=%d, depth=%d", sp(), pre_bc_sp, depth));
 
     do_exceptions();
 
--- a/hotspot/src/share/vm/opto/phaseX.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/opto/phaseX.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -75,6 +75,13 @@
   // nh->_sentinel must be in the current node space
 }
 
+void NodeHash::replace_with(NodeHash *nh) {
+  debug_only(_table = (Node**)badAddress);   // interact correctly w/ operator=
+  // just copy in all the fields
+  *this = *nh;
+  // nh->_sentinel must be in the current node space
+}
+
 //------------------------------hash_find--------------------------------------
 // Find in hash table
 Node *NodeHash::hash_find( const Node *n ) {
--- a/hotspot/src/share/vm/opto/phaseX.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/opto/phaseX.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -92,6 +92,7 @@
   }
 
   void   remove_useless_nodes(VectorSet &useful); // replace with sentinel
+  void replace_with(NodeHash* nh);
 
   Node  *sentinel() { return _sentinel; }
 
@@ -386,6 +387,11 @@
   Node  *transform( Node *n );
   Node  *transform_no_reclaim( Node *n );
 
+  void replace_with(PhaseGVN* gvn) {
+    _table.replace_with(&gvn->_table);
+    _types = gvn->_types;
+  }
+
   // Check for a simple dead loop when a data node references itself.
   DEBUG_ONLY(void dead_loop_check(Node *n);)
 };
--- a/hotspot/src/share/vm/opto/stringopts.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/opto/stringopts.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -265,7 +265,8 @@
     } else if (n->is_IfTrue()) {
       Compile* C = _stringopts->C;
       C->gvn_replace_by(n, n->in(0)->in(0));
-      C->gvn_replace_by(n->in(0), C->top());
+      // get rid of the other projection
+      C->gvn_replace_by(n->in(0)->as_If()->proj_out(false), C->top());
     }
   }
 }
@@ -439,7 +440,7 @@
       }
       // Find the constructor call
       Node* result = alloc->result_cast();
-      if (result == NULL || !result->is_CheckCastPP()) {
+      if (result == NULL || !result->is_CheckCastPP() || alloc->in(TypeFunc::Memory)->is_top()) {
         // strange looking allocation
 #ifndef PRODUCT
         if (PrintOptimizeStringConcat) {
@@ -834,6 +835,9 @@
           ptr->in(1)->in(0) != NULL && ptr->in(1)->in(0)->is_If()) {
         // Simple diamond.
         // XXX should check for possibly merging stores.  simple data merges are ok.
+        // The IGVN will make this simple diamond go away when it
+        // transforms the Region. Make sure it sees it.
+        Compile::current()->record_for_igvn(ptr);
         ptr = ptr->in(1)->in(0)->in(0);
         continue;
       }
--- a/hotspot/src/share/vm/prims/jvm.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -1515,7 +1515,7 @@
 JVM_END
 
 
-static Method* jvm_get_method_common(jobject method, TRAPS) {
+static Method* jvm_get_method_common(jobject method) {
   // some of this code was adapted from from jni_FromReflectedMethod
 
   oop reflected = JNIHandles::resolve_non_null(method);
@@ -1533,8 +1533,7 @@
   }
   Klass* k = java_lang_Class::as_Klass(mirror);
 
-  KlassHandle kh(THREAD, k);
-  Method* m = InstanceKlass::cast(kh())->method_with_idnum(slot);
+  Method* m = InstanceKlass::cast(k)->method_with_idnum(slot);
   if (m == NULL) {
     assert(false, "cannot find method");
     return NULL;  // robustness
@@ -1548,7 +1547,7 @@
   JVMWrapper("JVM_GetMethodAnnotations");
 
   // method is a handle to a java.lang.reflect.Method object
-  Method* m = jvm_get_method_common(method, CHECK_NULL);
+  Method* m = jvm_get_method_common(method);
   return (jbyteArray) JNIHandles::make_local(env,
     Annotations::make_java_array(m->annotations(), THREAD));
 JVM_END
@@ -1558,7 +1557,7 @@
   JVMWrapper("JVM_GetMethodDefaultAnnotationValue");
 
   // method is a handle to a java.lang.reflect.Method object
-  Method* m = jvm_get_method_common(method, CHECK_NULL);
+  Method* m = jvm_get_method_common(method);
   return (jbyteArray) JNIHandles::make_local(env,
     Annotations::make_java_array(m->annotation_default(), THREAD));
 JVM_END
@@ -1568,11 +1567,54 @@
   JVMWrapper("JVM_GetMethodParameterAnnotations");
 
   // method is a handle to a java.lang.reflect.Method object
-  Method* m = jvm_get_method_common(method, CHECK_NULL);
+  Method* m = jvm_get_method_common(method);
   return (jbyteArray) JNIHandles::make_local(env,
     Annotations::make_java_array(m->parameter_annotations(), THREAD));
 JVM_END
 
+/* Type use annotations support (JDK 1.8) */
+
+JVM_ENTRY(jbyteArray, JVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls))
+  assert (cls != NULL, "illegal class");
+  JVMWrapper("JVM_GetClassTypeAnnotations");
+  ResourceMark rm(THREAD);
+  // Return null for arrays and primitives
+  if (!java_lang_Class::is_primitive(JNIHandles::resolve(cls))) {
+    Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls));
+    if (k->oop_is_instance()) {
+      typeArrayOop a = Annotations::make_java_array(InstanceKlass::cast(k)->type_annotations()->class_annotations(), CHECK_NULL);
+      return (jbyteArray) JNIHandles::make_local(env, a);
+    }
+  }
+  return NULL;
+JVM_END
+
+JVM_ENTRY(jobjectArray, JVM_GetMethodParameters(JNIEnv *env, jobject method))
+{
+  JVMWrapper("JVM_GetMethodParameters");
+  // method is a handle to a java.lang.reflect.Method object
+  Method* method_ptr = jvm_get_method_common(method);
+  methodHandle mh (THREAD, method_ptr);
+  Handle reflected_method (THREAD, JNIHandles::resolve_non_null(method));
+  const int num_params = mh->method_parameters_length();
+
+  if(0 != num_params) {
+    objArrayOop result_oop = oopFactory::new_objArray(SystemDictionary::reflect_Parameter_klass(), num_params, CHECK_NULL);
+    objArrayHandle result (THREAD, result_oop);
+
+    for(int i = 0; i < num_params; i++) {
+      MethodParametersElement* params = mh->method_parameters_start();
+      Symbol* const sym = mh->constants()->symbol_at(params[i].name_cp_index);
+      oop param = Reflection::new_parameter(reflected_method, i, sym,
+                                            params[i].flags, CHECK_NULL);
+      result->obj_at_put(i, param);
+    }
+    return (jobjectArray)JNIHandles::make_local(env, result());
+  } else {
+    return (jobjectArray)NULL;
+  }
+}
+JVM_END
 
 // New (JDK 1.4) reflection implementation /////////////////////////////////////
 
--- a/hotspot/src/share/vm/prims/jvm.h	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/prims/jvm.h	Wed Jul 05 18:36:58 2017 +0200
@@ -86,6 +86,8 @@
 
 #define JVM_INTERFACE_VERSION 4
 
+JNIEXPORT jobjectArray JNICALL
+JVM_GetMethodParameters(JNIEnv *env, jobject method);
 
 JNIEXPORT jint JNICALL
 JVM_GetInterfaceVersion(void);
@@ -519,6 +521,10 @@
 JNIEXPORT jbyteArray JNICALL
 JVM_GetMethodParameterAnnotations(JNIEnv *env, jobject method);
 
+/* Type use annotations support (JDK 1.8) */
+
+JNIEXPORT jbyteArray JNICALL
+JVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls);
 
 /*
  * New (JDK 1.4) reflection implementation
--- a/hotspot/src/share/vm/prims/jvmtiExport.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/prims/jvmtiExport.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -1305,15 +1305,21 @@
         vframeStream st(thread);
         assert(!st.at_end(), "cannot be at end");
         Method* current_method = NULL;
+        // A GC may occur during the Method::fast_exception_handler_bci_for()
+        // call below if it needs to load the constraint class. Using a
+        // methodHandle to keep the 'current_method' from being deallocated
+        // if GC happens.
+        methodHandle current_mh = methodHandle(thread, current_method);
         int current_bci = -1;
         do {
           current_method = st.method();
+          current_mh = methodHandle(thread, current_method);
           current_bci = st.bci();
           do {
             should_repeat = false;
             KlassHandle eh_klass(thread, exception_handle()->klass());
-            current_bci = current_method->fast_exception_handler_bci_for(
-              eh_klass, current_bci, THREAD);
+            current_bci = Method::fast_exception_handler_bci_for(
+              current_mh, eh_klass, current_bci, THREAD);
             if (HAS_PENDING_EXCEPTION) {
               exception_handle = Handle(thread, PENDING_EXCEPTION);
               CLEAR_PENDING_EXCEPTION;
@@ -1328,8 +1334,7 @@
           catch_jmethodID = 0;
           current_bci = 0;
         } else {
-          catch_jmethodID = jem.to_jmethodID(
-                                     methodHandle(thread, current_method));
+          catch_jmethodID = jem.to_jmethodID(current_mh);
         }
 
         JvmtiJavaThreadEventTransition jet(thread);
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -1043,7 +1043,7 @@
 
     Rewriter::rewrite(scratch_class, THREAD);
     if (!HAS_PENDING_EXCEPTION) {
-      Rewriter::relocate_and_link(scratch_class, THREAD);
+      scratch_class->link_methods(THREAD);
     }
     if (HAS_PENDING_EXCEPTION) {
       Symbol* ex_name = PENDING_EXCEPTION->klass()->name();
@@ -3338,7 +3338,20 @@
     the_class->set_access_flags(flags);
   }
 
-  // Replace annotation fields value
+  // Since there is currently no rewriting of type annotations indexes
+  // into the CP, we null out type annotations on scratch_class before
+  // we swap annotations with the_class rather than facing the
+  // possibility of shipping annotations with broken indexes to
+  // Java-land.
+  Annotations* new_annotations = scratch_class->annotations();
+  if (new_annotations != NULL) {
+    Annotations* new_type_annotations = new_annotations->type_annotations();
+    if (new_type_annotations != NULL) {
+      MetadataFactory::free_metadata(scratch_class->class_loader_data(), new_type_annotations);
+      new_annotations->set_type_annotations(NULL);
+    }
+  }
+  // Swap annotation fields values
   Annotations* old_annotations = the_class->annotations();
   the_class->set_annotations(scratch_class->annotations());
   scratch_class->set_annotations(old_annotations);
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -1083,10 +1083,6 @@
   }
 }
 
-// If the user has chosen ParallelGCThreads > 0, we set UseParNewGC
-// if it's not explictly set or unset. If the user has chosen
-// UseParNewGC and not explicitly set ParallelGCThreads we
-// set it, unless this is a single cpu machine.
 void Arguments::set_parnew_gc_flags() {
   assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC,
          "control point invariant");
@@ -1095,42 +1091,41 @@
   // Turn off AdaptiveSizePolicy for parnew until it is complete.
   disable_adaptive_size_policy("UseParNewGC");
 
-  if (ParallelGCThreads == 0) {
-    FLAG_SET_DEFAULT(ParallelGCThreads,
-                     Abstract_VM_Version::parallel_worker_threads());
-    if (ParallelGCThreads == 1) {
-      FLAG_SET_DEFAULT(UseParNewGC, false);
-      FLAG_SET_DEFAULT(ParallelGCThreads, 0);
-    }
+  if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
+    FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads());
+    assert(ParallelGCThreads > 0, "We should always have at least one thread by default");
+  } else if (ParallelGCThreads == 0) {
+    jio_fprintf(defaultStream::error_stream(),
+        "The ParNew GC can not be combined with -XX:ParallelGCThreads=0\n");
+    vm_exit(1);
+  }
+
+  // By default YoungPLABSize and OldPLABSize are set to 4096 and 1024 respectively,
+  // these settings are default for Parallel Scavenger. For ParNew+Tenured configuration
+  // we set them to 1024 and 1024.
+  // See CR 6362902.
+  if (FLAG_IS_DEFAULT(YoungPLABSize)) {
+    FLAG_SET_DEFAULT(YoungPLABSize, (intx)1024);
   }
-  if (UseParNewGC) {
-    // By default YoungPLABSize and OldPLABSize are set to 4096 and 1024 respectively,
-    // these settings are default for Parallel Scavenger. For ParNew+Tenured configuration
-    // we set them to 1024 and 1024.
-    // See CR 6362902.
-    if (FLAG_IS_DEFAULT(YoungPLABSize)) {
-      FLAG_SET_DEFAULT(YoungPLABSize, (intx)1024);
+  if (FLAG_IS_DEFAULT(OldPLABSize)) {
+    FLAG_SET_DEFAULT(OldPLABSize, (intx)1024);
+  }
+
+  // AlwaysTenure flag should make ParNew promote all at first collection.
+  // See CR 6362902.
+  if (AlwaysTenure) {
+    FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, 0);
+  }
+  // When using compressed oops, we use local overflow stacks,
+  // rather than using a global overflow list chained through
+  // the klass word of the object's pre-image.
+  if (UseCompressedOops && !ParGCUseLocalOverflow) {
+    if (!FLAG_IS_DEFAULT(ParGCUseLocalOverflow)) {
+      warning("Forcing +ParGCUseLocalOverflow: needed if using compressed references");
     }
-    if (FLAG_IS_DEFAULT(OldPLABSize)) {
-      FLAG_SET_DEFAULT(OldPLABSize, (intx)1024);
-    }
-
-    // AlwaysTenure flag should make ParNew promote all at first collection.
-    // See CR 6362902.
-    if (AlwaysTenure) {
-      FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, 0);
-    }
-    // When using compressed oops, we use local overflow stacks,
-    // rather than using a global overflow list chained through
-    // the klass word of the object's pre-image.
-    if (UseCompressedOops && !ParGCUseLocalOverflow) {
-      if (!FLAG_IS_DEFAULT(ParGCUseLocalOverflow)) {
-        warning("Forcing +ParGCUseLocalOverflow: needed if using compressed references");
-      }
-      FLAG_SET_DEFAULT(ParGCUseLocalOverflow, true);
-    }
-    assert(ParGCUseLocalOverflow || !UseCompressedOops, "Error");
+    FLAG_SET_DEFAULT(ParGCUseLocalOverflow, true);
   }
+  assert(ParGCUseLocalOverflow || !UseCompressedOops, "Error");
 }
 
 // Adjust some sizes to suit CMS and/or ParNew needs; these work well on
@@ -1331,14 +1326,14 @@
   // then a saved space from compressed oops.
   if ((int)ObjectAlignmentInBytes > 256) {
     jio_fprintf(defaultStream::error_stream(),
-                "error: ObjectAlignmentInBytes=%d must not be greater then 256\n",
+                "error: ObjectAlignmentInBytes=%d must not be greater than 256\n",
                 (int)ObjectAlignmentInBytes);
     return false;
   }
   // In case page size is very small.
   if ((int)ObjectAlignmentInBytes >= os::vm_page_size()) {
     jio_fprintf(defaultStream::error_stream(),
-                "error: ObjectAlignmentInBytes=%d must be less then page size %d\n",
+                "error: ObjectAlignmentInBytes=%d must be less than page size %d\n",
                 (int)ObjectAlignmentInBytes, os::vm_page_size());
     return false;
   }
@@ -1459,30 +1454,34 @@
 
   // If no heap maximum was requested explicitly, use some reasonable fraction
   // of the physical memory, up to a maximum of 1GB.
-  if (UseParallelGC) {
-    FLAG_SET_DEFAULT(ParallelGCThreads,
-                     Abstract_VM_Version::parallel_worker_threads());
-
-    // If InitialSurvivorRatio or MinSurvivorRatio were not specified, but the
-    // SurvivorRatio has been set, reset their default values to SurvivorRatio +
-    // 2.  By doing this we make SurvivorRatio also work for Parallel Scavenger.
-    // See CR 6362902 for details.
-    if (!FLAG_IS_DEFAULT(SurvivorRatio)) {
-      if (FLAG_IS_DEFAULT(InitialSurvivorRatio)) {
-         FLAG_SET_DEFAULT(InitialSurvivorRatio, SurvivorRatio + 2);
-      }
-      if (FLAG_IS_DEFAULT(MinSurvivorRatio)) {
-        FLAG_SET_DEFAULT(MinSurvivorRatio, SurvivorRatio + 2);
-      }
+  FLAG_SET_DEFAULT(ParallelGCThreads,
+                   Abstract_VM_Version::parallel_worker_threads());
+  if (ParallelGCThreads == 0) {
+    jio_fprintf(defaultStream::error_stream(),
+        "The Parallel GC can not be combined with -XX:ParallelGCThreads=0\n");
+    vm_exit(1);
+  }
+
+
+  // If InitialSurvivorRatio or MinSurvivorRatio were not specified, but the
+  // SurvivorRatio has been set, reset their default values to SurvivorRatio +
+  // 2.  By doing this we make SurvivorRatio also work for Parallel Scavenger.
+  // See CR 6362902 for details.
+  if (!FLAG_IS_DEFAULT(SurvivorRatio)) {
+    if (FLAG_IS_DEFAULT(InitialSurvivorRatio)) {
+       FLAG_SET_DEFAULT(InitialSurvivorRatio, SurvivorRatio + 2);
     }
-
-    if (UseParallelOldGC) {
-      // Par compact uses lower default values since they are treated as
-      // minimums.  These are different defaults because of the different
-      // interpretation and are not ergonomically set.
-      if (FLAG_IS_DEFAULT(MarkSweepDeadRatio)) {
-        FLAG_SET_DEFAULT(MarkSweepDeadRatio, 1);
-      }
+    if (FLAG_IS_DEFAULT(MinSurvivorRatio)) {
+      FLAG_SET_DEFAULT(MinSurvivorRatio, SurvivorRatio + 2);
+    }
+  }
+
+  if (UseParallelOldGC) {
+    // Par compact uses lower default values since they are treated as
+    // minimums.  These are different defaults because of the different
+    // interpretation and are not ergonomically set.
+    if (FLAG_IS_DEFAULT(MarkSweepDeadRatio)) {
+      FLAG_SET_DEFAULT(MarkSweepDeadRatio, 1);
     }
   }
 }
@@ -1783,6 +1782,24 @@
   return status;
 }
 
+void Arguments::check_deprecated_gcs() {
+  if (UseConcMarkSweepGC && !UseParNewGC) {
+    warning("Using the DefNew young collector with the CMS collector is deprecated "
+        "and will likely be removed in a future release");
+  }
+
+  if (UseParNewGC && !UseConcMarkSweepGC) {
+    // !UseConcMarkSweepGC means that we are using serial old gc. Unfortunately we don't
+    // set up UseSerialGC properly, so that can't be used in the check here.
+    warning("Using the ParNew young collector with the Serial old collector is deprecated "
+        "and will likely be removed in a future release");
+  }
+
+  if (CMSIncrementalMode) {
+    warning("Using incremental CMS is deprecated and will likely be removed in a future release");
+  }
+}
+
 // Check stack pages settings
 bool Arguments::check_stack_pages()
 {
@@ -2997,11 +3014,6 @@
     FLAG_SET_DEFAULT(UseLargePages, false);
   }
 
-  // Add 2M to any size for SharedReadOnlySize to get around the JPRT setting
-  if (DumpSharedSpaces && !FLAG_IS_DEFAULT(SharedReadOnlySize)) {
-    SharedReadOnlySize = 14*M;
-  }
-
   if (DumpSharedSpaces) {
     if (RequireSharedSpaces) {
       warning("cannot dump shared archive while using shared archive");
@@ -3038,7 +3050,6 @@
   strcpy(shared_archive_path, jvm_path);
   strcat(shared_archive_path, os::file_separator());
   strcat(shared_archive_path, "classes");
-  DEBUG_ONLY(strcat(shared_archive_path, "_g");)
   strcat(shared_archive_path, ".jsa");
   SharedArchivePath = shared_archive_path;
 
@@ -3247,6 +3258,7 @@
   } else if (UseG1GC) {
     set_g1_gc_flags();
   }
+  check_deprecated_gcs();
 #endif // INCLUDE_ALTERNATE_GCS
 
 #ifdef SERIALGC
@@ -3291,6 +3303,18 @@
   if (!EliminateLocks) {
     EliminateNestedLocks = false;
   }
+  if (!Inline) {
+    IncrementalInline = false;
+  }
+#ifndef PRODUCT
+  if (!IncrementalInline) {
+    AlwaysIncrementalInline = false;
+  }
+#endif
+  if (IncrementalInline && FLAG_IS_DEFAULT(MaxNodeLimit)) {
+    // incremental inlining: bump MaxNodeLimit
+    FLAG_SET_DEFAULT(MaxNodeLimit, (intx)75000);
+  }
 #endif
 
   if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) {
--- a/hotspot/src/share/vm/runtime/arguments.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/runtime/arguments.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -413,6 +413,7 @@
   static jint adjust_after_os();
   // Check for consistency in the selection of the garbage collector.
   static bool check_gc_consistency();
+  static void check_deprecated_gcs();
   // Check consistecy or otherwise of VM argument settings
   static bool check_vm_args_consistency();
   // Check stack pages settings
--- a/hotspot/src/share/vm/runtime/fieldDescriptor.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/runtime/fieldDescriptor.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -65,6 +65,17 @@
   return md->at(index());
 }
 
+AnnotationArray* fieldDescriptor::type_annotations() const {
+  InstanceKlass* ik = field_holder();
+  Annotations* type_annos = ik->type_annotations();
+  if (type_annos == NULL)
+    return NULL;
+  Array<AnnotationArray*>* md = type_annos->fields_annotations();
+  if (md == NULL)
+    return NULL;
+  return md->at(index());
+}
+
 constantTag fieldDescriptor::initial_value_tag() const {
   return constants()->tag_at(initial_value_index());
 }
--- a/hotspot/src/share/vm/runtime/fieldDescriptor.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/runtime/fieldDescriptor.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -68,6 +68,7 @@
   Symbol* generic_signature()     const;
   int index()                     const    { return _index; }
   AnnotationArray* annotations()  const;
+  AnnotationArray* type_annotations()  const;
 
   // Initial field value
   bool has_initial_value()        const    { return field()->initval_index() != 0; }
--- a/hotspot/src/share/vm/runtime/globals.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -1101,13 +1101,6 @@
   product(bool, ReduceSignalUsage, false,                                   \
           "Reduce the use of OS signals in Java and/or the VM")             \
                                                                             \
-  notproduct(bool, ValidateMarkSweep, false,                                \
-          "Do extra validation during MarkSweep collection")                \
-                                                                            \
-  notproduct(bool, RecordMarkSweepCompaction, false,                        \
-          "Enable GC-to-GC recording and querying of compaction during "    \
-          "MarkSweep")                                                      \
-                                                                            \
   develop_pd(bool, ShareVtableStubs,                                        \
           "Share vtable stubs (smaller code but worse branch prediction")   \
                                                                             \
@@ -1606,7 +1599,7 @@
   develop(bool, CMSTraceThreadState, false,                                 \
           "Trace the CMS thread state (enable the trace_state() method)")   \
                                                                             \
-  product(bool, CMSClassUnloadingEnabled, false,                            \
+  product(bool, CMSClassUnloadingEnabled, true,                             \
           "Whether class unloading enabled when using CMS GC")              \
                                                                             \
   product(uintx, CMSClassUnloadingMaxInterval, 0,                           \
@@ -1830,7 +1823,7 @@
                                                                             \
   product(intx, CMSIsTooFullPercentage, 98,                                 \
           "An absolute ceiling above which CMS will always consider the "   \
-          "perm gen ripe for collection")                                   \
+          "unloading of classes when class unloading is enabled")           \
                                                                             \
   develop(bool, CMSTestInFreeList, false,                                   \
           "Check if the coalesced range is already in the "                 \
@@ -1899,13 +1892,13 @@
           "Metadata deallocation alot interval")                            \
                                                                             \
   develop(bool, TraceMetadataChunkAllocation, false,                        \
-          "Trace humongous metadata allocations")                           \
+          "Trace chunk metadata allocations")                               \
                                                                             \
   product(bool, TraceMetadataHumongousAllocation, false,                    \
           "Trace humongous metadata allocations")                           \
                                                                             \
   develop(bool, TraceMetavirtualspaceAllocation, false,                     \
-          "Trace humongous metadata allocations")                           \
+          "Trace virtual space metadata allocations")                       \
                                                                             \
   notproduct(bool, ExecuteInternalVMTests, false,                           \
           "Enable execution of internal VM tests.")                         \
@@ -2217,7 +2210,8 @@
   develop(bool, TraceClassLoaderData, false,                                \
           "Trace class loader loader_data lifetime")                        \
                                                                             \
-  product(uintx, InitialBootClassLoaderMetaspaceSize, 3*M,                  \
+  product(uintx, InitialBootClassLoaderMetaspaceSize,                       \
+          NOT_LP64(2200*K) LP64_ONLY(4*M),                                  \
           "Initial size of the boot class loader data metaspace")           \
                                                                             \
   product(bool, TraceGen0Time, false,                                       \
@@ -3537,10 +3531,10 @@
   /* Shared spaces */                                                       \
                                                                             \
   product(bool, UseSharedSpaces, true,                                      \
-          "Use shared spaces in the permanent generation")                  \
+          "Use shared spaces for metadata")                                 \
                                                                             \
   product(bool, RequireSharedSpaces, false,                                 \
-          "Require shared spaces in the permanent generation")              \
+          "Require shared spaces for metadata")                             \
                                                                             \
   product(bool, DumpSharedSpaces, false,                                    \
            "Special mode: JVM reads a class list, loads classes, builds "   \
@@ -3551,16 +3545,16 @@
           "Print usage of shared spaces")                                   \
                                                                             \
   product(uintx, SharedReadWriteSize,  NOT_LP64(12*M) LP64_ONLY(16*M),      \
-          "Size of read-write space in permanent generation (in bytes)")    \
+          "Size of read-write space for metadata (in bytes)")               \
                                                                             \
   product(uintx, SharedReadOnlySize,  NOT_LP64(12*M) LP64_ONLY(16*M),       \
-          "Size of read-only space in permanent generation (in bytes)")     \
+          "Size of read-only space for metadata (in bytes)")                \
                                                                             \
   product(uintx, SharedMiscDataSize,    NOT_LP64(2*M) LP64_ONLY(4*M),       \
-          "Size of the shared data area adjacent to the heap (in bytes)")   \
+          "Size of the shared miscellaneous data area (in bytes)")          \
                                                                             \
   product(uintx, SharedMiscCodeSize,    120*K,                              \
-          "Size of the shared code area adjacent to the heap (in bytes)")   \
+          "Size of the shared miscellaneous code area (in bytes)")          \
                                                                             \
   product(uintx, SharedDummyBlockSize, 0,                                   \
           "Size of dummy block used to shift heap addresses (in bytes)")    \
--- a/hotspot/src/share/vm/runtime/handles.inline.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/runtime/handles.inline.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -80,6 +80,8 @@
       _thread = Thread::current();                                     \
     }                                                                  \
     _thread->metadata_handles()->push((Metadata*)_value);              \
+  } else {                                                             \
+    _thread = NULL;                                                    \
   }                                                                    \
 }                                                                      \
 inline name##Handle& name##Handle::operator=(const name##Handle &s) {  \
@@ -94,6 +96,8 @@
       _thread = Thread::current();                                     \
     }                                                                  \
     _thread->metadata_handles()->push((Metadata*)_value);              \
+  } else {                                                             \
+    _thread = NULL;                                                    \
   }                                                                    \
   return *this;                                                        \
 }                                                                      \
--- a/hotspot/src/share/vm/runtime/reflection.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/runtime/reflection.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -771,6 +771,10 @@
     typeArrayOop an_oop = Annotations::make_java_array(method->annotation_default(), CHECK_NULL);
     java_lang_reflect_Method::set_annotation_default(mh(), an_oop);
   }
+  if (java_lang_reflect_Method::has_type_annotations_field()) {
+    typeArrayOop an_oop = Annotations::make_java_array(method->type_annotations(), CHECK_NULL);
+    java_lang_reflect_Method::set_type_annotations(mh(), an_oop);
+  }
   return mh();
 }
 
@@ -849,6 +853,21 @@
     typeArrayOop an_oop = Annotations::make_java_array(fd->annotations(), CHECK_NULL);
     java_lang_reflect_Field::set_annotations(rh(), an_oop);
   }
+  if (java_lang_reflect_Field::has_type_annotations_field()) {
+    typeArrayOop an_oop = Annotations::make_java_array(fd->type_annotations(), CHECK_NULL);
+    java_lang_reflect_Field::set_type_annotations(rh(), an_oop);
+  }
+  return rh();
+}
+
+oop Reflection::new_parameter(Handle method, int index, Symbol* sym,
+                              int flags, TRAPS) {
+  Handle name = java_lang_String::create_from_symbol(sym, CHECK_NULL);
+  Handle rh = java_lang_reflect_Parameter::create(CHECK_NULL);
+  java_lang_reflect_Parameter::set_name(rh(), name());
+  java_lang_reflect_Parameter::set_modifiers(rh(), flags);
+  java_lang_reflect_Parameter::set_executable(rh(), method());
+  java_lang_reflect_Parameter::set_index(rh(), index);
   return rh();
 }
 
--- a/hotspot/src/share/vm/runtime/reflection.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/runtime/reflection.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -118,6 +118,10 @@
   static oop new_constructor(methodHandle method, TRAPS);
   // Create a java.lang.reflect.Field object based on a field descriptor
   static oop new_field(fieldDescriptor* fd, bool intern_name, TRAPS);
+  // Create a java.lang.reflect.Parameter object based on a
+  // MethodParameterElement
+  static oop new_parameter(Handle method, int index, Symbol* sym,
+                           int flags, TRAPS);
 
 private:
   // method resolution for invoke
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -643,7 +643,8 @@
       bool skip_scope_increment = false;
       // exception handler lookup
       KlassHandle ek (THREAD, exception->klass());
-      handler_bci = sd->method()->fast_exception_handler_bci_for(ek, bci, THREAD);
+      methodHandle mh(THREAD, sd->method());
+      handler_bci = Method::fast_exception_handler_bci_for(mh, ek, bci, THREAD);
       if (HAS_PENDING_EXCEPTION) {
         recursive_exception = true;
         // We threw an exception while trying to find the exception handler.
--- a/hotspot/src/share/vm/services/memBaseline.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/services/memBaseline.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -22,7 +22,6 @@
  *
  */
 #include "precompiled.hpp"
-#include "classfile/systemDictionary.hpp"
 #include "memory/allocation.hpp"
 #include "services/memBaseline.hpp"
 #include "services/memTracker.hpp"
@@ -349,7 +348,7 @@
   reset();
   _baselined = baseline_malloc_summary(snapshot._alloc_ptrs) &&
                baseline_vm_summary(snapshot._vm_ptrs);
-  _number_of_classes = SystemDictionary::number_of_classes();
+  _number_of_classes = snapshot.number_of_classes();
 
   if (!summary_only && MemTracker::track_callsite() && _baselined) {
     _baselined =  baseline_malloc_details(snapshot._alloc_ptrs) &&
--- a/hotspot/src/share/vm/services/memRecorder.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/services/memRecorder.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -84,10 +84,13 @@
     }
     delete _pointer_records;
   }
-  if (_next != NULL) {
-    delete _next;
+  // delete all linked recorders
+  while (_next != NULL) {
+    MemRecorder* tmp = _next;
+    _next = _next->next();
+    tmp->set_next(NULL);
+    delete tmp;
   }
-
   Atomic::dec(&_instance_count);
 }
 
--- a/hotspot/src/share/vm/services/memRecorder.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/services/memRecorder.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -203,6 +203,7 @@
   friend class MemSnapshot;
   friend class MemTracker;
   friend class MemTrackWorker;
+  friend class GenerationData;
 
  protected:
   // the array that holds memory records
--- a/hotspot/src/share/vm/services/memSnapshot.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/services/memSnapshot.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -384,6 +384,7 @@
   _staging_area.init();
   _lock = new (std::nothrow) Mutex(Monitor::max_nonleaf - 1, "memSnapshotLock");
   NOT_PRODUCT(_untracked_count = 0;)
+  _number_of_classes = 0;
 }
 
 MemSnapshot::~MemSnapshot() {
@@ -479,7 +480,7 @@
 
 
 // promote data to next generation
-bool MemSnapshot::promote() {
+bool MemSnapshot::promote(int number_of_classes) {
   assert(_alloc_ptrs != NULL && _vm_ptrs != NULL, "Just check");
   assert(_staging_area.malloc_data() != NULL && _staging_area.vm_data() != NULL,
          "Just check");
@@ -496,6 +497,7 @@
 
   NOT_PRODUCT(check_malloc_pointers();)
   _staging_area.clear();
+  _number_of_classes = number_of_classes;
   return promoted;
 }
 
--- a/hotspot/src/share/vm/services/memSnapshot.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/services/memSnapshot.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -355,6 +355,9 @@
   // the lock to protect this snapshot
   Monitor*              _lock;
 
+  // the number of instance classes
+  int                   _number_of_classes;
+
   NOT_PRODUCT(size_t    _untracked_count;)
   friend class MemBaseline;
 
@@ -375,8 +378,9 @@
   // merge a per-thread memory recorder into staging area
   bool merge(MemRecorder* rec);
   // promote staged data to snapshot
-  bool promote();
+  bool promote(int number_of_classes);
 
+  int  number_of_classes() const { return _number_of_classes; }
 
   void wait(long timeout) {
     assert(_lock != NULL, "Just check");
--- a/hotspot/src/share/vm/services/memTrackWorker.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/services/memTrackWorker.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -29,6 +29,16 @@
 #include "utilities/decoder.hpp"
 #include "utilities/vmError.hpp"
 
+
+void GenerationData::reset() {
+  _number_of_classes = 0;
+  while (_recorder_list != NULL) {
+    MemRecorder* tmp = _recorder_list;
+    _recorder_list = _recorder_list->next();
+    MemTracker::release_thread_recorder(tmp);
+  }
+}
+
 MemTrackWorker::MemTrackWorker() {
   // create thread uses cgc thread type for now. We should revisit
   // the option, or create new thread type.
@@ -39,7 +49,7 @@
   if (!has_error()) {
     _head = _tail = 0;
     for(int index = 0; index < MAX_GENERATIONS; index ++) {
-      _gen[index] = NULL;
+      ::new ((void*)&_gen[index]) GenerationData();
     }
   }
   NOT_PRODUCT(_sync_point_count = 0;)
@@ -49,10 +59,7 @@
 
 MemTrackWorker::~MemTrackWorker() {
   for (int index = 0; index < MAX_GENERATIONS; index ++) {
-    MemRecorder* rc = _gen[index];
-    if (rc != NULL) {
-      delete rc;
-    }
+    _gen[index].reset();
   }
 }
 
@@ -90,12 +97,7 @@
     {
       // take a recorder from earliest generation in buffer
       ThreadCritical tc;
-      rec = _gen[_head];
-      if (rec != NULL) {
-        _gen[_head] = rec->next();
-      }
-      assert(count_recorder(_gen[_head]) <= MemRecorder::_instance_count,
-        "infinite loop after dequeue");
+      rec = _gen[_head].next_recorder();
     }
     if (rec != NULL) {
       // merge the recorder into staging area
@@ -109,16 +111,20 @@
       // no more recorder to merge, promote staging area
       // to snapshot
       if (_head != _tail) {
+        long number_of_classes;
         {
           ThreadCritical tc;
-          if (_gen[_head] != NULL || _head == _tail) {
+          if (_gen[_head].has_more_recorder() || _head == _tail) {
             continue;
           }
+          number_of_classes = _gen[_head].number_of_classes();
+          _gen[_head].reset();
+
           // done with this generation, increment _head pointer
           _head = (_head + 1) % MAX_GENERATIONS;
         }
         // promote this generation data to snapshot
-        if (!snapshot->promote()) {
+        if (!snapshot->promote(number_of_classes)) {
           // failed to promote, means out of memory
           MemTracker::shutdown(MemTracker::NMT_out_of_memory);
         }
@@ -126,8 +132,8 @@
         snapshot->wait(1000);
         ThreadCritical tc;
         // check if more data arrived
-        if (_gen[_head] == NULL) {
-          _gen[_head] = MemTracker::get_pending_recorders();
+        if (!_gen[_head].has_more_recorder()) {
+          _gen[_head].add_recorders(MemTracker::get_pending_recorders());
         }
       }
     }
@@ -147,7 +153,7 @@
 //   1. add all recorders in pending queue to current generation
 //   2. increase generation
 
-void MemTrackWorker::at_sync_point(MemRecorder* rec) {
+void MemTrackWorker::at_sync_point(MemRecorder* rec, int number_of_classes) {
   NOT_PRODUCT(_sync_point_count ++;)
   assert(count_recorder(rec) <= MemRecorder::_instance_count,
     "pending queue has infinite loop");
@@ -155,23 +161,15 @@
   bool out_of_generation_buffer = false;
   // check shutdown state inside ThreadCritical
   if (MemTracker::shutdown_in_progress()) return;
+
+  _gen[_tail].set_number_of_classes(number_of_classes);
   // append the recorders to the end of the generation
-  if( rec != NULL) {
-    MemRecorder* cur_head = _gen[_tail];
-    if (cur_head == NULL) {
-      _gen[_tail] = rec;
-    } else {
-      while (cur_head->next() != NULL) {
-        cur_head = cur_head->next();
-      }
-      cur_head->set_next(rec);
-    }
-  }
-  assert(count_recorder(rec) <= MemRecorder::_instance_count,
+  _gen[_tail].add_recorders(rec);
+  assert(count_recorder(_gen[_tail].peek()) <= MemRecorder::_instance_count,
     "after add to current generation has infinite loop");
   // we have collected all recorders for this generation. If there is data,
   // we need to increment _tail to start a new generation.
-  if (_gen[_tail] != NULL || _head == _tail) {
+  if (_gen[_tail].has_more_recorder()  || _head == _tail) {
     _tail = (_tail + 1) % MAX_GENERATIONS;
     out_of_generation_buffer = (_tail == _head);
   }
@@ -194,7 +192,7 @@
 int MemTrackWorker::count_pending_recorders() const {
   int count = 0;
   for (int index = 0; index < MAX_GENERATIONS; index ++) {
-    MemRecorder* head = _gen[index];
+    MemRecorder* head = _gen[index].peek();
     if (head != NULL) {
       count += count_recorder(head);
     }
--- a/hotspot/src/share/vm/services/memTrackWorker.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/services/memTrackWorker.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -32,17 +32,58 @@
 // Maximum MAX_GENERATIONS generation data can be tracked.
 #define MAX_GENERATIONS  512
 
+class GenerationData : public _ValueObj {
+ private:
+  int           _number_of_classes;
+  MemRecorder*  _recorder_list;
+
+ public:
+  GenerationData(): _number_of_classes(0), _recorder_list(NULL) { }
+
+  inline int  number_of_classes() const { return _number_of_classes; }
+  inline void set_number_of_classes(long num) { _number_of_classes = num; }
+
+  inline MemRecorder* next_recorder() {
+    if (_recorder_list == NULL) {
+      return NULL;
+    } else {
+      MemRecorder* tmp = _recorder_list;
+      _recorder_list = _recorder_list->next();
+      return tmp;
+    }
+  }
+
+  inline bool has_more_recorder() const {
+    return (_recorder_list != NULL);
+  }
+
+  // add recorders to this generation
+  void add_recorders(MemRecorder* head) {
+    if (head != NULL) {
+      if (_recorder_list == NULL) {
+        _recorder_list = head;
+      } else {
+        MemRecorder* tmp = _recorder_list;
+        for (; tmp->next() != NULL; tmp = tmp->next());
+        tmp->set_next(head);
+      }
+    }
+  }
+
+  void reset();
+
+  NOT_PRODUCT(MemRecorder* peek() const { return _recorder_list; })
+};
 
 class MemTrackWorker : public NamedThread {
  private:
-  // circular buffer. This buffer contains recorders to be merged into global
+  // circular buffer. This buffer contains generation data to be merged into global
   // snaphsot.
-  // Each slot holds a linked list of memory recorders, that contains one
-  // generation of memory data.
-  MemRecorder*  _gen[MAX_GENERATIONS];
-  int           _head, _tail; // head and tail pointers to above circular buffer
+  // Each slot holds a generation
+  GenerationData  _gen[MAX_GENERATIONS];
+  int             _head, _tail; // head and tail pointers to above circular buffer
 
-  bool          _has_error;
+  bool            _has_error;
 
  public:
   MemTrackWorker();
@@ -56,7 +97,7 @@
   inline bool has_error() const { return _has_error; }
 
   // task at synchronization point
-  void at_sync_point(MemRecorder* pending_recorders);
+  void at_sync_point(MemRecorder* pending_recorders, int number_of_classes);
 
   // for debugging purpose, they are not thread safe.
   NOT_PRODUCT(static int count_recorder(const MemRecorder* head);)
--- a/hotspot/src/share/vm/services/memTracker.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/services/memTracker.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -23,6 +23,7 @@
  */
 #include "precompiled.hpp"
 
+#include "oops/instanceKlass.hpp"
 #include "runtime/atomic.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/mutexLocker.hpp"
@@ -485,7 +486,7 @@
       }
       // check _worker_thread with lock to avoid racing condition
       if (_worker_thread != NULL) {
-        _worker_thread->at_sync_point(pending_recorders);
+        _worker_thread->at_sync_point(pending_recorders, InstanceKlass::number_of_instance_classes());
       }
 
       assert(SequenceGenerator::peek() == 1, "Should not have memory activities during sync-point");
--- a/hotspot/src/share/vm/services/memTracker.hpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/services/memTracker.hpp	Wed Jul 05 18:36:58 2017 +0200
@@ -142,6 +142,7 @@
  * MemTracker is the 'gate' class to native memory tracking runtime.
  */
 class MemTracker : AllStatic {
+  friend class GenerationData;
   friend class MemTrackWorker;
   friend class MemSnapshot;
   friend class SyncThreadRecorderClosure;
--- a/hotspot/src/share/vm/utilities/debug.cpp	Wed Jan 16 22:17:36 2013 -0800
+++ b/hotspot/src/share/vm/utilities/debug.cpp	Wed Jul 05 18:36:58 2017 +0200
@@ -612,21 +612,6 @@
   Events::print();
 }
 
-// Given a heap address that was valid before the most recent GC, if
-// the oop that used to contain it is still live, prints the new
-// location of the oop and the address. Useful for tracking down
-// certain kinds of naked oop and oop map bugs.
-extern "C" void pnl(intptr_t old_heap_addr) {
-  // Print New Location of old heap address
-  Command c("pnl");
-#ifndef VALIDATE_MARK_SWEEP
-  tty->print_cr("Requires build with VALIDATE_MARK_SWEEP defined (debug build) and RecordMarkSweepCompaction enabled");
-#else
-  MarkSweep::print_new_location_of_heap_address((HeapWord*) old_heap_addr);
-#endif
-}
-
-
 extern "C" Method* findm(intptr_t pc) {
   Command c("findm");
   nmethod* nm = CodeCache::find_nmethod((address)pc);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/8005419/Test8005419.java	Wed Jul 05 18:36:58 2017 +0200
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 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.
+ */
+
+/*
+ * @test
+ * @bug 8005419
+ * @summary Improve intrinsics code performance on x86 by using AVX2
+ * @run main/othervm -Xbatch -Xmx64m Test8005419
+ *
+ */
+
+public class Test8005419 {
+    public static int SIZE = 64;
+
+    public static void main(String[] args) {
+        char[] a = new char[SIZE];
+        char[] b = new char[SIZE];
+
+        for (int i = 16; i < SIZE; i++) {
+          a[i] = (char)i;
+          b[i] = (char)i;
+        }
+        String s1 = new String(a);
+        String s2 = new String(b);
+
+        // Warm up
+        boolean failed = false;
+        int result = 0;
+        for (int i = 0; i < 10000; i++) {
+          result += test(s1, s2);
+        }
+        for (int i = 0; i < 10000; i++) {
+          result += test(s1, s2);
+        }
+        for (int i = 0; i < 10000; i++) {
+          result += test(s1, s2);
+        }
+        if (result != 0) failed = true;
+
+        System.out.println("Start testing");
+        // Compare same string
+        result = test(s1, s1);
+        if (result != 0) {
+          failed = true;
+          System.out.println("Failed same: result = " + result + ", expected 0");
+        }
+        // Compare equal strings
+        for (int i = 1; i <= SIZE; i++) {
+          s1 = new String(a, 0, i);
+          s2 = new String(b, 0, i);
+          result = test(s1, s2);
+          if (result != 0) {
+            failed = true;
+            System.out.println("Failed equals s1[" + i + "], s2[" + i + "]: result = " + result + ", expected 0");
+          }
+        }
+        // Compare equal strings but different sizes
+        for (int i = 1; i <= SIZE; i++) {
+          s1 = new String(a, 0, i);
+          for (int j = 1; j <= SIZE; j++) {
+            s2 = new String(b, 0, j);
+            result = test(s1, s2);
+            if (result != (i-j)) {
+              failed = true;
+              System.out.println("Failed diff size s1[" + i + "], s2[" + j + "]: result = " + result + ", expected " + (i-j));
+            }
+          }
+        }
+        // Compare strings with one char different and different sizes
+        for (int i = 1; i <= SIZE; i++) {
+          s1 = new String(a, 0, i);
+          for (int j = 0; j < i; j++) {
+            b[j] -= 3; // change char
+            s2 = new String(b, 0, i);
+            result = test(s1, s2);
+            int chdiff = a[j] - b[j];
+            if (result != chdiff) {
+              failed = true;
+              System.out.println("Failed diff char s1[" + i + "], s2[" + i + "]: result = " + result + ", expected " + chdiff);
+            }
+            result = test(s2, s1);
+            chdiff = b[j] - a[j];
+            if (result != chdiff) {
+              failed = true;
+              System.out.println("Failed diff char s2[" + i + "], s1[" + i + "]: result = " + result + ", expected " + chdiff);
+            }
+            b[j] += 3; // restore
+          }
+        }
+        if (failed) {
+          System.out.println("FAILED");
+          System.exit(97);
+        }
+        System.out.println("PASSED");
+    }
+
+    private static int test(String str1, String str2) {
+        return str1.compareTo(str2);
+    }
+}
--- a/jdk/.hgtags	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/.hgtags	Wed Jul 05 18:36:58 2017 +0200
@@ -194,3 +194,4 @@
 a996b57e554198f4592a5f3c30f2f9f4075e545d jdk8-b70
 2a5af0f766d0acd68a81fb08fe11fd66795f86af jdk8-b71
 32a57e645e012a1f0665c075969ca598e0dbb948 jdk8-b72
+733885f57e14cc27f5a5ff0dffe641d2fa3c704a jdk8-b73
--- a/jdk/make/common/shared/Defs-windows.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/make/common/shared/Defs-windows.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -549,7 +549,10 @@
   _WSCRIPT2 :=$(DEVTOOLS_PATH)wscript.exe
   WSCRIPT  :=$(call FileExists,$(_WSCRIPT1),$(_WSCRIPT2))
 endif
+# If CONFIGURE_BUILD is defined, checks were already done by configure.
+ifndef CONFIGURE_BUILD
 WSCRIPT:=$(call AltCheckSpaces,WSCRIPT)
+endif #! CONFIGURE_BUILD
 # batch mode no modal dialogs on errors, please.
 WSCRIPT += -B
 
@@ -562,7 +565,10 @@
   _CSCRIPT2 :=$(DEVTOOLS_PATH)cscript.exe
   CSCRIPT  :=$(call FileExists,$(_CSCRIPT1),$(_CSCRIPT2))
 endif
+# If CONFIGURE_BUILD is defined, checks were already done by configure.
+ifndef CONFIGURE_BUILD
 CSCRIPT:=$(call AltCheckSpaces,CSCRIPT)
+endif #! CONFIGURE_BUILD
 
 # CABARC: path to cabarc.exe (used in creating install bundles)
 ifdef ALT_CABARC
@@ -584,7 +590,10 @@
   _MSICERT2 :=$(DEVTOOLS_PATH)msicert.exe
   MSICERT   :=$(call FileExists,$(_MSICERT1),$(_MSICERT2))
 endif
+# If CONFIGURE_BUILD is defined, checks were already done by configure.
+ifndef CONFIGURE_BUILD
 MSICERT:=$(call AltCheckSpaces,MSICERT)
+endif #! CONFIGURE_BUILD
 
 # Import JDK images allow for partial builds, components not built are
 #    imported (or copied from) these import areas when needed.
--- a/jdk/make/javax/swing/beaninfo/SwingBeans.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/make/javax/swing/beaninfo/SwingBeans.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -124,10 +124,10 @@
 $(BEANSRCDIR)/%BeanInfo.java: $(FAKESRC)/$(SWINGPKG)/%.java
 	@$(ECHO) $< >> $(TEMPDIR)/.beans.list
 
-$(BEANSRCDIR)/SwingBeanInfoBase.java: $(DOCLETSRC)/beaninfo/SwingBeanInfoBase.java
+$(BEANSRCDIR)/SwingBeanInfoBase.java: $(DOCLETSRC)/javax/swing/SwingBeanInfoBase.java
 	$(CP) $< $@
 
-$(BEANSRCDIR)/BeanInfoUtils.java: $(DOCLETSRC)/beaninfo/BeanInfoUtils.java
+$(BEANSRCDIR)/BeanInfoUtils.java: $(DOCLETSRC)/sun/swing/BeanInfoUtils.java
 	$(CP) $< $@
 
 #
--- a/jdk/make/tools/swing-beans/beaninfo/BeanInfoUtils.java	Wed Jan 16 22:17:36 2013 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,293 +0,0 @@
-/*
- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
- * 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.swing;
-
-import java.beans.*;
-import java.lang.reflect.Method;
-
-public class BeanInfoUtils
-{
-    /* The values of these createPropertyDescriptor() and
-     * createBeanDescriptor() keywords are the names of the
-     * properties they're used to set.
-     */
-    public static final String BOUND = "bound";
-    public static final String CONSTRAINED = "constrained";
-    public static final String PROPERTYEDITORCLASS = "propertyEditorClass";
-    public static final String READMETHOD = "readMethod";
-    public static final String WRITEMETHOD = "writeMethod";
-    public static final String DISPLAYNAME = "displayName";
-    public static final String EXPERT = "expert";
-    public static final String HIDDEN = "hidden";
-    public static final String PREFERRED = "preferred";
-    public static final String SHORTDESCRIPTION = "shortDescription";
-    public static final String CUSTOMIZERCLASS = "customizerClass";
-
-    static private void initFeatureDescriptor(FeatureDescriptor fd, String key, Object value)
-    {
-        if (DISPLAYNAME.equals(key)) {
-            fd.setDisplayName((String)value);
-        }
-
-        if (EXPERT.equals(key)) {
-            fd.setExpert(((Boolean)value).booleanValue());
-        }
-
-        if (HIDDEN.equals(key)) {
-            fd.setHidden(((Boolean)value).booleanValue());
-        }
-
-        if (PREFERRED.equals(key)) {
-            fd.setPreferred(((Boolean)value).booleanValue());
-        }
-
-        else if (SHORTDESCRIPTION.equals(key)) {
-            fd.setShortDescription((String)value);
-        }
-
-        /* Otherwise assume that we have an arbitrary FeatureDescriptor
-         * "attribute".
-         */
-        else {
-            fd.setValue(key, value);
-        }
-    }
-
-    /**
-     * Create a beans PropertyDescriptor given an of keyword/value
-     * arguments.  The following sample call shows all of the supported
-     * keywords:
-     *<pre>
-     *      createPropertyDescriptor("contentPane", new Object[] {
-     *                     BOUND, Boolean.TRUE,
-     *               CONSTRAINED, Boolean.TRUE,
-     *       PROPERTYEDITORCLASS, package.MyEditor.class,
-     *                READMETHOD, "getContentPane",
-     *               WRITEMETHOD, "setContentPane",
-     *               DISPLAYNAME, "contentPane",
-     *                    EXPERT, Boolean.FALSE,
-     *                    HIDDEN, Boolean.FALSE,
-     *                 PREFERRED, Boolean.TRUE,
-     *          SHORTDESCRIPTION, "A top level window with a window manager border",
-     *         "random attribute","random object value"
-     *        }
-     *     );
-     * </pre>
-     * The keywords correspond to <code>java.beans.PropertyDescriptor</code> and
-     * <code>java.beans.FeatureDescriptor</code> properties, e.g. providing a value
-     * for displayName is comparable to <code>FeatureDescriptor.setDisplayName()</code>.
-     * Using createPropertyDescriptor instead of the PropertyDescriptor
-     * constructor and set methods is preferrable in that it regularizes
-     * the code in a <code>java.beans.BeanInfo.getPropertyDescriptors()</code>
-     * method implementation.  One can use <code>createPropertyDescriptor</code>
-     * to set <code>FeatureDescriptor</code> attributes, as in "random attribute"
-     * "random object value".
-     * <p>
-     * All properties should provide a reasonable value for the
-     * <code>SHORTDESCRIPTION</code> keyword and should set <code>BOUND</code>
-     * to <code>Boolean.TRUE</code> if neccessary.  The remaining keywords
-     * are optional.  There's no need to provide values for keywords like
-     * READMETHOD if the correct value can be computed, i.e. if the properties
-     * get/is method follows the standard beans pattern.
-     * <p>
-     * The PREFERRED keyword is not supported by the JDK1.1 java.beans package.
-     * It's still worth setting it to true for properties that are most
-     * likely to be interested to the average developer, e.g. AbstractButton.title
-     * is a preferred property, AbstractButton.focusPainted is not.
-     *
-     * @see java.beans#BeanInfo
-     * @see java.beans#PropertyDescriptor
-     * @see java.beans#FeatureDescriptor
-     */
-    public static PropertyDescriptor createPropertyDescriptor(Class cls, String name, Object[] args)
-    {
-        PropertyDescriptor pd = null;
-        try {
-            pd = new PropertyDescriptor(name, cls);
-        } catch (IntrospectionException e) {
-            // Try creating a read-only property, in case setter isn't defined.
-            try {
-                pd = createReadOnlyPropertyDescriptor(name, cls);
-            } catch (IntrospectionException ie) {
-                throwError(ie, "Can't create PropertyDescriptor for " + name + " ");
-            }
-        }
-
-        for(int i = 0; i < args.length; i += 2) {
-            String key = (String)args[i];
-            Object value = args[i + 1];
-
-            if (BOUND.equals(key)) {
-                pd.setBound(((Boolean)value).booleanValue());
-            }
-
-            else if (CONSTRAINED.equals(key)) {
-                pd.setConstrained(((Boolean)value).booleanValue());
-            }
-
-            else if (PROPERTYEDITORCLASS.equals(key)) {
-                pd.setPropertyEditorClass((Class)value);
-            }
-
-            else if (READMETHOD.equals(key)) {
-                String methodName = (String)value;
-                Method method;
-                try {
-                    method = cls.getMethod(methodName, new Class[0]);
-                    pd.setReadMethod(method);
-                }
-                catch(Exception e) {
-                    throwError(e, cls + " no such method as \"" + methodName + "\"");
-                }
-            }
-
-            else if (WRITEMETHOD.equals(key)) {
-                String methodName = (String)value;
-                Method method;
-                try {
-                    Class type = pd.getPropertyType();
-                    method = cls.getMethod(methodName, new Class[]{type});
-                    pd.setWriteMethod(method);
-                }
-                catch(Exception e) {
-                    throwError(e, cls + " no such method as \"" + methodName + "\"");
-                }
-            }
-
-            else {
-                initFeatureDescriptor(pd, key, value);
-            }
-        }
-
-        return pd;
-    }
-
-
-    /**
-     * Create a BeanDescriptor object given an of keyword/value
-     * arguments.  The following sample call shows all of the supported
-     * keywords:
-     *<pre>
-     *      createBeanDescriptor(JWindow..class, new Object[] {
-     *           CUSTOMIZERCLASS, package.MyCustomizer.class,
-     *               DISPLAYNAME, "JFrame",
-     *                    EXPERT, Boolean.FALSE,
-     *                    HIDDEN, Boolean.FALSE,
-     *                 PREFERRED, Boolean.TRUE,
-     *          SHORTDESCRIPTION, "A top level window with a window manager border",
-     *         "random attribute","random object value"
-     *        }
-     *     );
-     * </pre>
-     * The keywords correspond to <code>java.beans.BeanDescriptor</code> and
-     * <code>java.beans.FeatureDescriptor</code> properties, e.g. providing a value
-     * for displayName is comparable to <code>FeatureDescriptor.setDisplayName()</code>.
-     * Using createBeanDescriptor instead of the BeanDescriptor
-     * constructor and set methods is preferrable in that it regularizes
-     * the code in a <code>java.beans.BeanInfo.getBeanDescriptor()</code>
-     * method implementation.  One can use <code>createBeanDescriptor</code>
-     * to set <code>FeatureDescriptor</code> attributes, as in "random attribute"
-     * "random object value".
-     *
-     * @see java.beans#BeanInfo
-     * @see java.beans#PropertyDescriptor
-     */
-    public static BeanDescriptor createBeanDescriptor(Class cls, Object[] args)
-    {
-        Class customizerClass = null;
-
-        /* For reasons I don't understand, customizerClass is a
-         * readOnly property.  So we have to find it and pass it
-         * to the constructor here.
-         */
-        for(int i = 0; i < args.length; i += 2) {
-            if (CUSTOMIZERCLASS.equals((String)args[i])) {
-                customizerClass = (Class)args[i + 1];
-                break;
-            }
-        }
-
-        BeanDescriptor bd = new BeanDescriptor(cls, customizerClass);
-
-        for(int i = 0; i < args.length; i += 2) {
-            String key = (String)args[i];
-            Object value = args[i + 1];
-            initFeatureDescriptor(bd, key, value);
-        }
-
-        return bd;
-    }
-
-    static private PropertyDescriptor createReadOnlyPropertyDescriptor(
-        String name, Class cls) throws IntrospectionException {
-
-        Method readMethod = null;
-        String base = capitalize(name);
-        Class[] parameters = new Class[0];
-
-        // Is it a boolean?
-        try {
-            readMethod = cls.getMethod("is" + base, parameters);
-        } catch (Exception ex) {}
-        if (readMethod == null) {
-            try {
-                // Try normal accessor pattern.
-                readMethod = cls.getMethod("get" + base, parameters);
-            } catch (Exception ex2) {}
-        }
-        if (readMethod != null) {
-            return new PropertyDescriptor(name, readMethod, null);
-        }
-
-        try {
-            // Try indexed accessor pattern.
-            parameters = new Class[1];
-            parameters[0] = int.class;
-            readMethod = cls.getMethod("get" + base, parameters);
-        } catch (NoSuchMethodException nsme) {
-            throw new IntrospectionException(
-                "cannot find accessor method for " + name + " property.");
-        }
-        return new IndexedPropertyDescriptor(name, null, null, readMethod, null);
-    }
-
-    // Modified methods from java.beans.Introspector
-    private static String capitalize(String s) {
-        if (s.length() == 0) {
-            return s;
-        }
-        char chars[] = s.toCharArray();
-        chars[0] = Character.toUpperCase(chars[0]);
-        return new String(chars);
-    }
-
-    /**
-     * Fatal errors are handled by calling this method.
-     */
-    public static void throwError(Exception e, String s) {
-        throw new Error(e.toString() + " " + s);
-    }
-}
--- a/jdk/make/tools/swing-beans/beaninfo/SwingBeanInfoBase.java	Wed Jan 16 22:17:36 2013 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.swing;
-
-import java.beans.*;
-import java.lang.reflect.*;
-import java.awt.Image;
-
-/**
- * The superclass for all Swing BeanInfo classes.  It provides
- * default implementations of <code>getIcon</code> and
- * <code>getDefaultPropertyIndex</code> as well as utility
- * methods, like createPropertyDescriptor, for writing BeanInfo
- * implementations.  This classes is intended to be used along
- * with <code>GenSwingBeanInfo</code> a BeanInfo class code generator.
- *
- * @see GenSwingBeanInfo
- * @author Hans Muller
- */
-public class SwingBeanInfoBase extends SimpleBeanInfo
-{
-    /**
-     * The default index is always 0.  In other words the first property
-     * listed in the getPropertyDescriptors() method is the one
-     * to show a (JFC builder) user in a situation where just a single
-     * property will be shown.
-     */
-    public int getDefaultPropertyIndex() {
-        return 0;
-    }
-
-    /**
-     * Returns a generic Swing icon, all icon "kinds" are supported.
-     * Subclasses should defer to this method when they don't have
-     * a particular beans icon kind.
-     */
-    public Image getIcon(int kind) {
-        // PENDING(hmuller) need generic swing icon images.
-        return null;
-    }
-
-    /**
-     * Returns the BeanInfo for the superclass of our bean, so that
-     * its PropertyDescriptors will be included.
-     */
-    public BeanInfo[] getAdditionalBeanInfo() {
-        Class superClass = getBeanDescriptor().getBeanClass().getSuperclass();
-        BeanInfo superBeanInfo = null;
-        try {
-            superBeanInfo = Introspector.getBeanInfo(superClass);
-        } catch (IntrospectionException ie) {}
-        if (superBeanInfo != null) {
-            BeanInfo[] ret = new BeanInfo[1];
-            ret[0] = superBeanInfo;
-            return ret;
-        }
-        return null;
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/tools/swing-beans/javax/swing/SwingBeanInfoBase.java	Wed Jul 05 18:36:58 2017 +0200
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.swing;
+
+import java.beans.*;
+import java.lang.reflect.*;
+import java.awt.Image;
+
+/**
+ * The superclass for all Swing BeanInfo classes.  It provides
+ * default implementations of <code>getIcon</code> and
+ * <code>getDefaultPropertyIndex</code> as well as utility
+ * methods, like createPropertyDescriptor, for writing BeanInfo
+ * implementations.  This classes is intended to be used along
+ * with <code>GenSwingBeanInfo</code> a BeanInfo class code generator.
+ *
+ * @see GenSwingBeanInfo
+ * @author Hans Muller
+ */
+public class SwingBeanInfoBase extends SimpleBeanInfo
+{
+    /**
+     * The default index is always 0.  In other words the first property
+     * listed in the getPropertyDescriptors() method is the one
+     * to show a (JFC builder) user in a situation where just a single
+     * property will be shown.
+     */
+    public int getDefaultPropertyIndex() {
+        return 0;
+    }
+
+    /**
+     * Returns a generic Swing icon, all icon "kinds" are supported.
+     * Subclasses should defer to this method when they don't have
+     * a particular beans icon kind.
+     */
+    public Image getIcon(int kind) {
+        // PENDING(hmuller) need generic swing icon images.
+        return null;
+    }
+
+    /**
+     * Returns the BeanInfo for the superclass of our bean, so that
+     * its PropertyDescriptors will be included.
+     */
+    public BeanInfo[] getAdditionalBeanInfo() {
+        Class superClass = getBeanDescriptor().getBeanClass().getSuperclass();
+        BeanInfo superBeanInfo = null;
+        try {
+            superBeanInfo = Introspector.getBeanInfo(superClass);
+        } catch (IntrospectionException ie) {}
+        if (superBeanInfo != null) {
+            BeanInfo[] ret = new BeanInfo[1];
+            ret[0] = superBeanInfo;
+            return ret;
+        }
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/tools/swing-beans/sun/swing/BeanInfoUtils.java	Wed Jul 05 18:36:58 2017 +0200
@@ -0,0 +1,293 @@
+/*
+ * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * 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.swing;
+
+import java.beans.*;
+import java.lang.reflect.Method;
+
+public class BeanInfoUtils
+{
+    /* The values of these createPropertyDescriptor() and
+     * createBeanDescriptor() keywords are the names of the
+     * properties they're used to set.
+     */
+    public static final String BOUND = "bound";
+    public static final String CONSTRAINED = "constrained";
+    public static final String PROPERTYEDITORCLASS = "propertyEditorClass";
+    public static final String READMETHOD = "readMethod";
+    public static final String WRITEMETHOD = "writeMethod";
+    public static final String DISPLAYNAME = "displayName";
+    public static final String EXPERT = "expert";
+    public static final String HIDDEN = "hidden";
+    public static final String PREFERRED = "preferred";
+    public static final String SHORTDESCRIPTION = "shortDescription";
+    public static final String CUSTOMIZERCLASS = "customizerClass";
+
+    static private void initFeatureDescriptor(FeatureDescriptor fd, String key, Object value)
+    {
+        if (DISPLAYNAME.equals(key)) {
+            fd.setDisplayName((String)value);
+        }
+
+        if (EXPERT.equals(key)) {
+            fd.setExpert(((Boolean)value).booleanValue());
+        }
+
+        if (HIDDEN.equals(key)) {
+            fd.setHidden(((Boolean)value).booleanValue());
+        }
+
+        if (PREFERRED.equals(key)) {
+            fd.setPreferred(((Boolean)value).booleanValue());
+        }
+
+        else if (SHORTDESCRIPTION.equals(key)) {
+            fd.setShortDescription((String)value);
+        }
+
+        /* Otherwise assume that we have an arbitrary FeatureDescriptor
+         * "attribute".
+         */
+        else {
+            fd.setValue(key, value);
+        }
+    }
+
+    /**
+     * Create a beans PropertyDescriptor given an of keyword/value
+     * arguments.  The following sample call shows all of the supported
+     * keywords:
+     *<pre>
+     *      createPropertyDescriptor("contentPane", new Object[] {
+     *                     BOUND, Boolean.TRUE,
+     *               CONSTRAINED, Boolean.TRUE,
+     *       PROPERTYEDITORCLASS, package.MyEditor.class,
+     *                READMETHOD, "getContentPane",
+     *               WRITEMETHOD, "setContentPane",
+     *               DISPLAYNAME, "contentPane",
+     *                    EXPERT, Boolean.FALSE,
+     *                    HIDDEN, Boolean.FALSE,
+     *                 PREFERRED, Boolean.TRUE,
+     *          SHORTDESCRIPTION, "A top level window with a window manager border",
+     *         "random attribute","random object value"
+     *        }
+     *     );
+     * </pre>
+     * The keywords correspond to <code>java.beans.PropertyDescriptor</code> and
+     * <code>java.beans.FeatureDescriptor</code> properties, e.g. providing a value
+     * for displayName is comparable to <code>FeatureDescriptor.setDisplayName()</code>.
+     * Using createPropertyDescriptor instead of the PropertyDescriptor
+     * constructor and set methods is preferrable in that it regularizes
+     * the code in a <code>java.beans.BeanInfo.getPropertyDescriptors()</code>
+     * method implementation.  One can use <code>createPropertyDescriptor</code>
+     * to set <code>FeatureDescriptor</code> attributes, as in "random attribute"
+     * "random object value".
+     * <p>
+     * All properties should provide a reasonable value for the
+     * <code>SHORTDESCRIPTION</code> keyword and should set <code>BOUND</code>
+     * to <code>Boolean.TRUE</code> if neccessary.  The remaining keywords
+     * are optional.  There's no need to provide values for keywords like
+     * READMETHOD if the correct value can be computed, i.e. if the properties
+     * get/is method follows the standard beans pattern.
+     * <p>
+     * The PREFERRED keyword is not supported by the JDK1.1 java.beans package.
+     * It's still worth setting it to true for properties that are most
+     * likely to be interested to the average developer, e.g. AbstractButton.title
+     * is a preferred property, AbstractButton.focusPainted is not.
+     *
+     * @see java.beans#BeanInfo
+     * @see java.beans#PropertyDescriptor
+     * @see java.beans#FeatureDescriptor
+     */
+    public static PropertyDescriptor createPropertyDescriptor(Class cls, String name, Object[] args)
+    {
+        PropertyDescriptor pd = null;
+        try {
+            pd = new PropertyDescriptor(name, cls);
+        } catch (IntrospectionException e) {
+            // Try creating a read-only property, in case setter isn't defined.
+            try {
+                pd = createReadOnlyPropertyDescriptor(name, cls);
+            } catch (IntrospectionException ie) {
+                throwError(ie, "Can't create PropertyDescriptor for " + name + " ");
+            }
+        }
+
+        for(int i = 0; i < args.length; i += 2) {
+            String key = (String)args[i];
+            Object value = args[i + 1];
+
+            if (BOUND.equals(key)) {
+                pd.setBound(((Boolean)value).booleanValue());
+            }
+
+            else if (CONSTRAINED.equals(key)) {
+                pd.setConstrained(((Boolean)value).booleanValue());
+            }
+
+            else if (PROPERTYEDITORCLASS.equals(key)) {
+                pd.setPropertyEditorClass((Class)value);
+            }
+
+            else if (READMETHOD.equals(key)) {
+                String methodName = (String)value;
+                Method method;
+                try {
+                    method = cls.getMethod(methodName, new Class[0]);
+                    pd.setReadMethod(method);
+                }
+                catch(Exception e) {
+                    throwError(e, cls + " no such method as \"" + methodName + "\"");
+                }
+            }
+
+            else if (WRITEMETHOD.equals(key)) {
+                String methodName = (String)value;
+                Method method;
+                try {
+                    Class type = pd.getPropertyType();
+                    method = cls.getMethod(methodName, new Class[]{type});
+                    pd.setWriteMethod(method);
+                }
+                catch(Exception e) {
+                    throwError(e, cls + " no such method as \"" + methodName + "\"");
+                }
+            }
+
+            else {
+                initFeatureDescriptor(pd, key, value);
+            }
+        }
+
+        return pd;
+    }
+
+
+    /**
+     * Create a BeanDescriptor object given an of keyword/value
+     * arguments.  The following sample call shows all of the supported
+     * keywords:
+     *<pre>
+     *      createBeanDescriptor(JWindow..class, new Object[] {
+     *           CUSTOMIZERCLASS, package.MyCustomizer.class,
+     *               DISPLAYNAME, "JFrame",
+     *                    EXPERT, Boolean.FALSE,
+     *                    HIDDEN, Boolean.FALSE,
+     *                 PREFERRED, Boolean.TRUE,
+     *          SHORTDESCRIPTION, "A top level window with a window manager border",
+     *         "random attribute","random object value"
+     *        }
+     *     );
+     * </pre>
+     * The keywords correspond to <code>java.beans.BeanDescriptor</code> and
+     * <code>java.beans.FeatureDescriptor</code> properties, e.g. providing a value
+     * for displayName is comparable to <code>FeatureDescriptor.setDisplayName()</code>.
+     * Using createBeanDescriptor instead of the BeanDescriptor
+     * constructor and set methods is preferrable in that it regularizes
+     * the code in a <code>java.beans.BeanInfo.getBeanDescriptor()</code>
+     * method implementation.  One can use <code>createBeanDescriptor</code>
+     * to set <code>FeatureDescriptor</code> attributes, as in "random attribute"
+     * "random object value".
+     *
+     * @see java.beans#BeanInfo
+     * @see java.beans#PropertyDescriptor
+     */
+    public static BeanDescriptor createBeanDescriptor(Class cls, Object[] args)
+    {
+        Class customizerClass = null;
+
+        /* For reasons I don't understand, customizerClass is a
+         * readOnly property.  So we have to find it and pass it
+         * to the constructor here.
+         */
+        for(int i = 0; i < args.length; i += 2) {
+            if (CUSTOMIZERCLASS.equals((String)args[i])) {
+                customizerClass = (Class)args[i + 1];
+                break;
+            }
+        }
+
+        BeanDescriptor bd = new BeanDescriptor(cls, customizerClass);
+
+        for(int i = 0; i < args.length; i += 2) {
+            String key = (String)args[i];
+            Object value = args[i + 1];
+            initFeatureDescriptor(bd, key, value);
+        }
+
+        return bd;
+    }
+
+    static private PropertyDescriptor createReadOnlyPropertyDescriptor(
+        String name, Class cls) throws IntrospectionException {
+
+        Method readMethod = null;
+        String base = capitalize(name);
+        Class[] parameters = new Class[0];
+
+        // Is it a boolean?
+        try {
+            readMethod = cls.getMethod("is" + base, parameters);
+        } catch (Exception ex) {}
+        if (readMethod == null) {
+            try {
+                // Try normal accessor pattern.
+                readMethod = cls.getMethod("get" + base, parameters);
+            } catch (Exception ex2) {}
+        }
+        if (readMethod != null) {
+            return new PropertyDescriptor(name, readMethod, null);
+        }
+
+        try {
+            // Try indexed accessor pattern.
+            parameters = new Class[1];
+            parameters[0] = int.class;
+            readMethod = cls.getMethod("get" + base, parameters);
+        } catch (NoSuchMethodException nsme) {
+            throw new IntrospectionException(
+                "cannot find accessor method for " + name + " property.");
+        }
+        return new IndexedPropertyDescriptor(name, null, null, readMethod, null);
+    }
+
+    // Modified methods from java.beans.Introspector
+    private static String capitalize(String s) {
+        if (s.length() == 0) {
+            return s;
+        }
+        char chars[] = s.toCharArray();
+        chars[0] = Character.toUpperCase(chars[0]);
+        return new String(chars);
+    }
+
+    /**
+     * Fatal errors are handled by calling this method.
+     */
+    public static void throwError(Exception e, String s) {
+        throw new Error(e.toString() + " " + s);
+    }
+}
--- a/jdk/makefiles/BuildJdk.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/makefiles/BuildJdk.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -39,10 +39,7 @@
 # Setup the java compilers for the JDK build.
 include Setup.gmk
 
-# Setup the build tools.
-include Tools.gmk
-
-import: $(BUILD_TOOLS) import-only
+import: import-only
 import-only:
 #       Import (corba jaxp jaxws langtools hotspot)
 	+$(MAKE) -f Import.gmk
@@ -91,17 +88,19 @@
 # into packages, or installed.
 images:
 	+$(MAKE) -f CreateJars.gmk
-	+$(MAKE) -f Images.gmk 
+	+$(MAKE) -f Images.gmk
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+	+$(MAKE) -f Bundles.gmk
+endif
 
 overlay-images:
 	+$(MAKE) -f CompileLaunchers.gmk OVERLAY_IMAGES=true
 	+$(MAKE) -f Images.gmk overlay-images
 
-# Create platform specific image layouts
-bundles:
-	+$(MAKE) -f Bundles.gmk
+sign-jars:
+	+$(MAKE) -f SignJars.gmk
 
-BINARIES:=$(notdir $(wildcard $(IMAGES_OUTPUTDIR)/j2sdk-image/bin/*))
+BINARIES:=$(notdir $(wildcard $(JDK_IMAGE_DIR)/bin/*))
 INSTALLDIR:=openjdk-$(RELEASE)
 
 # Install the jdk image, in a very crude way. Not taking into
@@ -111,7 +110,7 @@
 	echo and creating $(words $(BINARIES)) links from $(INSTALL_PREFIX)/bin into the jdk.
 	$(MKDIR) -p $(INSTALL_PREFIX)/jvm/$(INSTALLDIR)
 	$(RM) -r $(INSTALL_PREFIX)/jvm/$(INSTALLDIR)/*
-	$(CP) -rp $(IMAGES_OUTPUTDIR)/j2sdk-image/* $(INSTALL_PREFIX)/jvm/$(INSTALLDIR)
+	$(CP) -rp $(JDK_IMAGE_DIR)/* $(INSTALL_PREFIX)/jvm/$(INSTALLDIR)
 	$(MKDIR) -p $(INSTALL_PREFIX)/bin
 	$(RM) $(addprefix $(INSTALL_PREFIX)/bin/,$(BINARIES))
 	$(foreach b,$(BINARIES),$(LN) -s $(INSTALL_PREFIX)/jvm/$(INSTALLDIR)/bin/$b $(INSTALL_PREFIX)/bin/$b &&) true
--- a/jdk/makefiles/Bundles.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/makefiles/Bundles.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -33,9 +33,7 @@
 
 bundles: jre-bundle jdk-bundle
 
-
-JDK_BUNDLE_DIR := $(IMAGES_OUTPUTDIR)/j2sdk-bundle/jdk$(JDK_VERSION).jdk/Contents
-JRE_BUNDLE_DIR := $(IMAGES_OUTPUTDIR)/j2re-bundle/jre$(JDK_VERSION).jre/Contents
+# JDK_BUNDLE_DIR and JRE_BUNDLE_DIR are defined in SPEC.
 
 MACOSX_SRC := $(JDK_TOPDIR)/src/macosx
 
@@ -70,30 +68,31 @@
 endif
 
 
-JDK_FILE_LIST := $(shell $(FIND) $(IMAGES_OUTPUTDIR)/j2sdk-image ! -type d)
-JRE_FILE_LIST := $(shell $(FIND) $(IMAGES_OUTPUTDIR)/j2re-image ! -type d)
+JDK_FILE_LIST := $(shell $(FIND) $(JDK_IMAGE_DIR))
+JRE_FILE_LIST := $(shell $(FIND) $(JRE_IMAGE_DIR))
 
-JDK_TARGET_LIST := $(subst $(IMAGES_OUTPUTDIR)/j2sdk-image,$(JDK_BUNDLE_DIR)/Home,$(JDK_FILE_LIST))
-JRE_TARGET_LIST := $(subst $(IMAGES_OUTPUTDIR)/j2re-image,$(JRE_BUNDLE_DIR)/Home,$(JRE_FILE_LIST))
+JDK_TARGET_LIST := $(subst $(JDK_IMAGE_DIR)/,$(JDK_BUNDLE_DIR)/Home/,$(JDK_FILE_LIST))
+JRE_TARGET_LIST := $(subst $(JRE_IMAGE_DIR)/,$(JRE_BUNDLE_DIR)/Home/,$(JRE_FILE_LIST))
 
 # The old builds implementation of this did not preserve symlinks so
 # make sure they are followed and the contents copied instead.
-# To fix this, just replace copy with install-file macro.
-$(JDK_BUNDLE_DIR)/Home/%: $(IMAGES_OUTPUTDIR)/j2sdk-image/%
+# To fix this, remove -L
+# Copy empty directories (jre/lib/applet).
+$(JDK_BUNDLE_DIR)/Home/%: $(JDK_IMAGE_DIR)/%
 	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
 	$(MKDIR) -p $(@D)
-	$(CP) -f -R -L '$<' '$@'
+	if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -L '$<' '$@'; fi
 
-$(JRE_BUNDLE_DIR)/Home/%: $(IMAGES_OUTPUTDIR)/j2re-image/%
+$(JRE_BUNDLE_DIR)/Home/%: $(JRE_IMAGE_DIR)/%
 	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
 	$(MKDIR) -p $(@D)
-	$(CP) -f -R -L '$<' '$@'
+	if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -L '$<' '$@'; fi
 
 $(JDK_BUNDLE_DIR)/MacOS/libjli.dylib:
 	$(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@)
 	$(MKDIR) -p $(@D)
 	$(RM) $@
-	$(LN) -s ../Home/lib/jli/libjli.dylib $@
+	$(LN) -s ../Home/jre/lib/jli/libjli.dylib $@
 
 $(JRE_BUNDLE_DIR)/MacOS/libjli.dylib:
 	$(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@)
--- a/jdk/makefiles/CompileDemos.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/makefiles/CompileDemos.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -33,6 +33,9 @@
 # Setup the java compilers for the JDK build.
 include Setup.gmk
 
+# Prepare the find cache. Only used if running on windows.
+$(eval $(call FillCacheFind,$(JDK_TOPDIR)/src))
+
 # Append demo goals to this variable.
 BUILD_DEMOS=
 
@@ -185,7 +188,7 @@
 
     BUILD_DEMOS += $(patsubst $(JDK_TOPDIR)/src/closed/share/demo/nbproject/%,\
 			$(JDK_OUTPUTDIR)/demo/nbproject/%,\
-			$(shell $(FIND) $(JDK_TOPDIR)/src/closed/share/demo/nbproject/ -type f))
+			$(call CacheFind,$(JDK_TOPDIR)/src/closed/share/demo/nbproject))
     $(JDK_OUTPUTDIR)/demo/nbproject/% : $(JDK_TOPDIR)/src/closed/share/demo/nbproject/%
 		$(MKDIR) -p $(@D)
 		$(CP) $< $@
@@ -317,7 +320,7 @@
 
 # The jpda demo (com/sun/tools/example) is oddly enough stored in src/share/classes.
 # At least, we do not need to compile the jpda demo, just jar/zip up the sources.
-JPDA_SOURCES:=$(shell $(FIND) $(JDK_TOPDIR)/src/share/classes/com/sun/tools/example -type f)
+JPDA_SOURCES:=$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/com/sun/tools/example)
 # The number of files are few enough so that we can use echo safely below to list them.
 JPDA_FILES:=$(subst $(JDK_TOPDIR)/src/share/classes/,,$(JPDA_SOURCES))
 
@@ -363,7 +366,7 @@
 # The netbeans project files are copied into the demo directory.
 BUILD_DEMOS += $(patsubst $(JDK_TOPDIR)/src/share/demo/nbproject/%,\
 		$(JDK_OUTPUTDIR)/demo/nbproject/%,\
-		$(shell $(FIND) $(JDK_TOPDIR)/src/share/demo/nbproject/ -type f))
+		$(call CacheFind,$(JDK_TOPDIR)/src/share/demo/nbproject))
 
 $(JDK_OUTPUTDIR)/demo/nbproject/% : $(JDK_TOPDIR)/src/share/demo/nbproject/%
 	$(MKDIR) -p $(@D)
@@ -439,7 +442,7 @@
 ##################################################################################################
 
 ifndef OPENJDK
-    DB_DEMO_ZIPFILE := $(shell $(FIND) $(JDK_TOPDIR)/src/closed/share/db -name "*demo*.zip")
+    DB_DEMO_ZIPFILE := $(wildcard $(JDK_TOPDIR)/src/closed/share/db/*demo*.zip)
 
     $(JDK_OUTPUTDIR)/demo/_the.db.unzipped: $(DB_DEMO_ZIPFILE)
 	$(MKDIR) -p $(@D)
--- a/jdk/makefiles/CompileJavaClasses.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/makefiles/CompileJavaClasses.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -42,8 +42,7 @@
 		com/sun/tools/example/trace\
 		com/sun/tools/example/debug/bdi\
 		com/sun/tools/example/debug/event\
-		com/sun/tools/example/debug/gui \
-		com/oracle/security
+		com/sun/tools/example/debug/gui
 
 ifdef OPENJDK
     EXCLUDES+=	sun/dc \
@@ -86,6 +85,8 @@
         sun/nio/ch/SolarisEventPort.java \
 	sun/tools/attach/SolarisAttachProvider.java \
 	sun/tools/attach/SolarisVirtualMachine.java
+
+   EXCLUDES += com/oracle/security
 endif
 
 # In the old build, this isn't excluded on macosx, even though it probably
@@ -227,14 +228,20 @@
 	sun/nio/ch/SimpleAsynchronousFileChannelImpl.java
 endif
 
-# Exclude nimbus files from rt.jar
+# These files do not appear in the build result of the old build. This
+# is because they are generated sources, but the AUTO_JAVA_FILES won't
+# pick them up since they aren't generated when the source dirs are 
+# searched and they aren't referenced by any other classes so they won't
+# be picked up by implicit compilation. On a rebuild, they are picked up
+# and compiled. Exclude them here to produce the same rt.jar as the old 
+# build does when building just once.
 EXFILES+=javax/swing/plaf/nimbus/InternalFrameTitlePanePainter.java \
-				 javax/swing/plaf/nimbus/OptionPaneMessageAreaPainter.java \
-				 javax/swing/plaf/nimbus/ScrollBarPainter.java \
-				 javax/swing/plaf/nimbus/SliderPainter.java \
-				 javax/swing/plaf/nimbus/SpinnerPainter.java \
-				 javax/swing/plaf/nimbus/SplitPanePainter.java \
-				 javax/swing/plaf/nimbus/TabbedPanePainter.java
+	 javax/swing/plaf/nimbus/OptionPaneMessageAreaPainter.java \
+	 javax/swing/plaf/nimbus/ScrollBarPainter.java \
+	 javax/swing/plaf/nimbus/SliderPainter.java \
+	 javax/swing/plaf/nimbus/SpinnerPainter.java \
+	 javax/swing/plaf/nimbus/SplitPanePainter.java \
+	 javax/swing/plaf/nimbus/TabbedPanePainter.java
 
 # Acquire a list of files that should be copied straight over to the classes.
 include CopyIntoClasses.gmk
@@ -285,6 +292,7 @@
 		     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes \
 		     $(MACOSX_SRC_DIRS) \
 		     $(JDK_OUTPUTDIR)/gensrc \
+		     $(JDK_OUTPUTDIR)/gensrc_no_srczip \
 		     $(CLOSED_SRC_DIRS),\
 		INCLUDES:=$(JDK_USER_DEFINED_FILTER),\
 		EXCLUDES:=$(EXCLUDES),\
@@ -295,35 +303,6 @@
 		HEADERS:=$(JDK_OUTPUTDIR)/gensrc_headers))
 
 ##########################################################################################
-# Special handling of header file generation for classes in the jigsaw base module which
-# currently can't add the annotaion GenerateNativeHeaders. For these specific classes the
-# java file and the class have the same names which enables shortcutting the dependencies.
-
-JDK_BASE_HEADER_CLASSES:=java.lang.Integer \
-			 java.lang.Long \
-			 java.net.SocketOptions \
-			 sun.nio.ch.IOStatus \
-			 java.io.FileSystem
-
-JDK_BASE_HEADER_JAVA_FILES:=$(patsubst %,$(JDK_TOPDIR)/src/share/classes/%.java,\
-				$(subst .,/,$(JDK_BASE_HEADER_CLASSES)))
-
-ifeq ($(OPENJDK_TARGET_OS),windows)
-    JDK_BASE_HEADER_CLASSES_WINDOWS:=sun.nio.ch.PollArrayWrapper
-    JDK_BASE_HEADER_CLASSES+=$(JDK_BASE_HEADER_CLASSES_WINDOWS)
-    JDK_BASE_HEADER_JAVA_FILES+=$(patsubst %,$(JDK_TOPDIR)/src/windows/classes/%.java,\
-				$(subst .,/,$(JDK_BASE_HEADER_CLASSES_WINDOWS)))
-endif
-
-# Set prereqs to the java files since make doesn't know about the class files. Add BUILD_JDK
-# as an order only dependency to avoid race with the java compilation.
-$(JDK_OUTPUTDIR)/gensrc_headers/_the.jdk.base.headers: $(JDK_BASE_HEADER_JAVA_FILES) | $(BUILD_JDK)
-	$(ECHO) Generating headers for jdk base classes
-	$(JAVAH) -bootclasspath $(JDK_OUTPUTDIR)/classes -d $(JDK_OUTPUTDIR)/gensrc_headers \
-		$(JDK_BASE_HEADER_CLASSES)
-	$(TOUCH) $@
-
-##########################################################################################
 
 ifndef OPENJDK
 
@@ -387,7 +366,6 @@
 
 # copy with -a to preserve timestamps so dependencies down the line aren't messed up
 all: $(BUILD_JDK) $(BUILD_ALTCLASSES) $(BUILD_JOBJC) $(BUILD_JOBJC_HEADERS) $(COPY_EXTRA) \
-	$(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin \
-	$(JDK_OUTPUTDIR)/gensrc_headers/_the.jdk.base.headers
+	$(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin
 
 .PHONY: all
--- a/jdk/makefiles/CompileLaunchers.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/makefiles/CompileLaunchers.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -32,6 +32,9 @@
 # Setup the java compilers for the JDK build.
 include Setup.gmk
 
+# Prepare the find cache. Only used on windows.
+$(eval $(call FillCacheFind,$(JDK_TOPDIR)/src/share/bin))
+
 # Build tools
 include Tools.gmk
 
--- a/jdk/makefiles/CompileNativeLibraries.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/makefiles/CompileNativeLibraries.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -35,6 +35,9 @@
 # Copy files (can now depend on $(COPY_FILES))
 include CopyFiles.gmk
 
+# Prepare the find cache. Only used if running on windows.
+$(eval $(call FillCacheFind,$(JDK_TOPDIR)/src))
+
 # Build tools
 include Tools.gmk
 
@@ -2607,7 +2610,6 @@
 		LIBRARY:=sunmscapi,\
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
 		SRC:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/mscapi,\
-		INCLUDE_FILES:=security.cpp, \
 		LANG:=C++,\
 		OPTIMIZATION:=LOW, \
 		CFLAGS:=$(CFLAGS_JDKLIB) \
--- a/jdk/makefiles/CopyFiles.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/makefiles/CopyFiles.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -317,7 +317,7 @@
 		$(MKDIR) -p $(@D)
 		$(RM) $(JVMCFG)
 		$(PRINTF) "-client KNOWN\n">$(JVMCFG)
-		$(PRINTF) "-server IGNORE\n">>$(JVMCFG)
+		$(PRINTF) "-server ALIASED_TO -client\n">>$(JVMCFG)
 		$(PRINTF) "-hotspot ALIASED_TO -client\n">>$(JVMCFG)
 		$(PRINTF) "-classic WARN\n">>$(JVMCFG)
 		$(PRINTF) "-native ERROR\n">>$(JVMCFG)
--- a/jdk/makefiles/CopyIntoClasses.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/makefiles/CopyIntoClasses.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -169,7 +169,7 @@
 # are uncommented and the configuration file is stored in the output META-INF directory.
 
 # Make sure the output directory is created.
-$(shell $(MKDIR) -p $(JDK_OUTPUTDIR)/classes/META-INF/services)
+$(eval $(call MakeDir,$(JDK_OUTPUTDIR)/classes/META-INF/services))
 # Find all META-INF/services/* files
 ALL_META-INF_DIRS_share:=$(shell $(FIND) $(JDK_TOPDIR)/src/share/classes -type d -a -name META-INF)
 ALL_META-INF_DIRS_targetapi:=$(shell $(FIND) $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes -type d -a -name META-INF)
--- a/jdk/makefiles/CreateJars.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/makefiles/CreateJars.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -30,6 +30,9 @@
 
 default: all
 
+# Prepare the find cache. Only used if running on windows.
+$(eval $(call FillCacheFind,$(JDK_OUTPUTDIR)/classes))
+
 include Tools.gmk
 
 #
@@ -126,81 +129,22 @@
 
 # Exclude list for rt.jar and resources.jar
 RT_JAR_EXCLUDES := \
+	com/oracle/security \
+	com/sun/codemodel \
+	com/sun/crypto/provider \
+	com/sun/istack/internal/tools \
+	com/sun/jarsigner \
 	com/sun/javadoc \
 	com/sun/jdi \
-	com/sun/jarsigner \
+	com/sun/net/ssl/internal/ssl \
 	com/sun/source \
-	com/sun/istack/internal/tools \
-	META-INF/services/com.sun.jdi.connect.Connector \
-	META-INF/services/com.sun.jdi.connect.spi.TransportService \
-	META-INF/services/com.sun.tools.xjc.Plugin \
 	com/sun/tools \
-	sun/jvmstat \
-	sun/nio/cs/ext \
-	sun/awt/HKSCS.class \
-	sun/awt/motif/X11GB2312\$$$$Decoder.class \
-	sun/awt/motif/X11GB2312\$$$$Encoder.class \
-	sun/awt/motif/X11GB2312.class \
-	sun/awt/motif/X11GBK\$$$$Encoder.class \
-	sun/awt/motif/X11GBK.class \
-	sun/awt/motif/X11KSC5601\$$$$Decoder.class \
-	sun/awt/motif/X11KSC5601\$$$$Encoder.class \
-	sun/awt/motif/X11KSC5601.class \
-	META-INF/services/java.nio.charset.spi.CharsetProvider \
-	sun/rmi/rmic \
-	sun/tools/asm \
-	sun/tools/java \
-	sun/tools/javac \
-	com/sun/tools/classfile \
-	com/sun/tools/javap \
-	sun/tools/jcmd \
-	sun/tools/jconsole \
-	sun/tools/jps \
-	sun/tools/jstat \
-	sun/tools/jstatd \
-	sun/tools/native2ascii \
-	sun/tools/serialver \
-	sun/tools/tree \
-	sun/tools/util \
-	sun/security/tools/jarsigner \
-	sun/security/provider/Sun.class \
-	sun/security/rsa/SunRsaSign.class \
-	sun/security/ssl \
-	sun/security/ec/ECDHKeyAgreement.class \
-	sun/security/ec/ECDSASignature\$$$$Raw.class \
-	sun/security/ec/ECDSASignature\$$$$SHA1.class \
-	sun/security/ec/ECDSASignature\$$$$SHA224.class \
-	sun/security/ec/ECDSASignature\$$$$SHA256.class \
-	sun/security/ec/ECDSASignature\$$$$SHA384.class \
-	sun/security/ec/ECDSASignature\$$$$SHA512.class \
-	sun/security/ec/ECDSASignature.class \
-	sun/security/ec/ECKeyFactory.class \
-	sun/security/ec/ECKeyPairGenerator.class \
-	sun/security/ec/SunEC\$$$$1.class \
-	sun/security/ec/SunEC.class \
-	sun/security/ec/SunECEntries.class \
-	sun/security/mscapi \
-	sun/security/pkcs11 \
-	com/sun/net/ssl/internal/ssl \
-	javax/crypto \
-	sun/security/internal \
-	com/sun/crypto/provider \
-	META-INF/services/com.sun.tools.attach.spi.AttachProvider \
-	com/sun/tools/attach \
-	org/relaxng/datatype \
-	com/sun/codemodel \
 	com/sun/xml/internal/dtdparser \
 	com/sun/xml/internal/rngom \
 	com/sun/xml/internal/xsom \
-	com/sun/tools/script/shell \
-	sun/tools/attach \
-	sun/tools/jstack \
-	sun/tools/jinfo \
-	sun/tools/jmap \
-	sun/net/spi/nameservice/dns \
-	META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor \
+	javax/crypto \
+	javax/swing/AbstractButtonBeanInfo.class \
 	javax/swing/beaninfo \
-	javax/swing/AbstractButtonBeanInfo.class \
 	javax/swing/BoxBeanInfo.class \
 	javax/swing/JAppletBeanInfo.class \
 	javax/swing/JButtonBeanInfo.class \
@@ -246,11 +190,67 @@
 	javax/swing/JWindowBeanInfo.class \
 	javax/swing/SwingBeanInfoBase.class \
 	javax/swing/text/JTextComponentBeanInfo.class \
+	META-INF/services/com.sun.jdi.connect.Connector \
+	META-INF/services/com.sun.jdi.connect.spi.TransportService \
+	META-INF/services/com.sun.tools.attach.spi.AttachProvider \
+	META-INF/services/com.sun.tools.xjc.Plugin \
+	META-INF/services/java.nio.charset.spi.CharsetProvider \
+	META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor \
+	org/relaxng/datatype \
+	sun/awt/HKSCS.class \
+	sun/awt/motif/X11GB2312.class \
+	sun/awt/motif/X11GB2312\$$$$Decoder.class \
+	sun/awt/motif/X11GB2312\$$$$Encoder.class \
+	sun/awt/motif/X11GBK.class \
+	sun/awt/motif/X11GBK\$$$$Encoder.class \
+	sun/awt/motif/X11KSC5601.class \
+	sun/awt/motif/X11KSC5601\$$$$Decoder.class \
+	sun/awt/motif/X11KSC5601\$$$$Encoder.class \
+	sun/jvmstat \
+	sun/net/spi/nameservice/dns \
+	sun/nio/cs/ext \
+	sun/rmi/rmic \
+	sun/security/ec/ECDHKeyAgreement.class \
+	sun/security/ec/ECDSASignature.class \
+	sun/security/ec/ECDSASignature\$$$$Raw.class \
+	sun/security/ec/ECDSASignature\$$$$SHA1.class \
+	sun/security/ec/ECDSASignature\$$$$SHA224.class \
+	sun/security/ec/ECDSASignature\$$$$SHA256.class \
+	sun/security/ec/ECDSASignature\$$$$SHA384.class \
+	sun/security/ec/ECDSASignature\$$$$SHA512.class \
+	sun/security/ec/ECKeyFactory.class \
+	sun/security/ec/ECKeyPairGenerator.class \
+	sun/security/ec/SunEC\$$$$1.class \
+	sun/security/ec/SunEC.class \
+	sun/security/ec/SunECEntries.class \
+	sun/security/internal \
+	sun/security/mscapi \
+	sun/security/pkcs11 \
+	sun/security/provider/Sun.class \
+	sun/security/rsa/SunRsaSign.class \
+	sun/security/ssl \
+	sun/security/tools/jarsigner \
 	sun/swing/BeanInfoUtils.class \
-	$(LOCALEDATA_INCLUDES) \
 	sun/text/resources/cldr \
+	sun/tools/asm \
+	sun/tools/attach \
+	sun/tools/java \
+	sun/tools/javac \
+	sun/tools/jcmd \
+	sun/tools/jconsole \
+	sun/tools/jinfo \
+	sun/tools/jmap \
+	sun/tools/jps \
+	sun/tools/jstack \
+	sun/tools/jstat \
+	sun/tools/jstatd \
+	sun/tools/native2ascii \
+	sun/tools/serialver \
+	sun/tools/tree \
+	sun/tools/util \
+	sun/util/cldr/CLDRLocaleDataMetaInfo.class \
 	sun/util/resources/cldr \
-	sun/util/cldr/CLDRLocaleDataMetaInfo.class
+	$(LOCALEDATA_INCLUDES)
 
 # These files should never be put into rt.jar
 # but due to a misstake...some are put there if embedded
@@ -275,8 +275,8 @@
 endif
 
 # Find all files in the classes dir to use as dependencies. This could be more fine granular.
-ALL_FILES_IN_CLASSES := $(shell $(FIND) $(JDK_OUTPUTDIR)/classes -type f \
-			| $(GREP) -v -e '/_the\.*' -e '^_the\.*' -e 'javac_state')
+ALL_FILES_IN_CLASSES := $(call not-containing,_the.,$(filter-out %javac_state,\
+                        $(call CacheFind,$(JDK_OUTPUTDIR)/classes)))
 
 RT_JAR_MANIFEST_FILE := $(IMAGES_OUTPUTDIR)/lib/_the.rt.jar_manifest
 RESOURCE_JAR_MANIFEST_FILE := $(IMAGES_OUTPUTDIR)/lib/_the.resources.jar_manifest
@@ -437,60 +437,61 @@
 	$(MV) $@.tmp $@
 
 ##########################################################################################
+# For all security jars, always build the jar, but for closed, install the prebuilt signed
+# version instead of the newly built jar. For open, signing is not needed. See SignJars.gmk
+# for more information.
 
 SUNPKCS11_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/sunpkcs11.jar
+SUNPKCS11_JAR_UNSIGNED := $(IMAGES_OUTPUTDIR)/unsigned/sunpkcs11.jar
+
+$(eval $(call SetupArchive,BUILD_SUNPKCS11_JAR,,\
+	SRCS:=$(JDK_OUTPUTDIR)/classes, \
+	SUFFIXES:=.class,\
+	INCLUDES:=sun/security/pkcs11,\
+	JAR:=$(SUNPKCS11_JAR_UNSIGNED), \
+        MANIFEST:=$(JCE_MANIFEST), \
+	SKIP_METAINF := true))
+
+$(SUNPKCS11_JAR_UNSIGNED): $(JCE_MANIFEST)
 
 ifndef OPENJDK
-
     SUNPKCS11_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/pkcs11/sunpkcs11.jar
-
     $(SUNPKCS11_JAR_DST) : $(SUNPKCS11_JAR_SRC)
 	@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunPKCS11 provider..."
 	$(install-file)
-
 else
-
-    $(eval $(call SetupArchive,BUILD_SUNPKCS11_JAR,,\
-	SRCS:=$(JDK_OUTPUTDIR)/classes, \
-	SUFFIXES:=.class,\
-	INCLUDES:=sun/security/pkcs11,\
-	JAR:=$(SUNPKCS11_JAR_DST), \
-        MANIFEST:=$(JCE_MANIFEST), \
-	SKIP_METAINF := true))
-
-    $(SUNPKCS11_JAR_DST): $(JCE_MANIFEST)
-
+    $(SUNPKCS11_JAR_DST) : $(SUNPKCS11_JAR_UNSIGNED)
+	$(install-file)
 endif
 
-JARS += $(SUNPKCS11_JAR_DST)
+JARS += $(SUNPKCS11_JAR_DST) $(SUNPKCS11_JAR_UNSIGNED)
 
 ##########################################################################################
 
 SUNEC_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/sunec.jar
+SUNEC_JAR_UNSIGNED := $(IMAGES_OUTPUTDIR)/unsigned/sunec.jar
+
+$(eval $(call SetupArchive,BUILD_SUNEC_JAR,,\
+		SRCS:=$(JDK_OUTPUTDIR)/classes, \
+		SUFFIXES:=.class,\
+		INCLUDES:=sun/security/ec,\
+		JAR:=$(SUNEC_JAR_UNSIGNED), \
+                MANIFEST:=$(JCE_MANIFEST), \
+		SKIP_METAINF := true))
+
+$(SUNEC_JAR_UNSIGNED): $(JCE_MANIFEST)
 
 ifndef OPENJDK
-
     SUNEC_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/ec/sunec.jar
-
     $(SUNEC_JAR_DST) : $(SUNEC_JAR_SRC)
 	@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunEC provider..."
 	$(install-file)
-
 else
-
-    $(eval $(call SetupArchive,BUILD_SUNEC_JAR,,\
-		SRCS:=$(JDK_OUTPUTDIR)/classes, \
-		SUFFIXES:=.class,\
-		INCLUDES:=sun/security/ec,\
-		JAR:=$(SUNEC_JAR_DST), \
-                MANIFEST:=$(JCE_MANIFEST), \
-		SKIP_METAINF := true))
-
-    $(SUNEC_JAR_DST): $(JCE_MANIFEST)
-
+    $(SUNEC_JAR_DST) : $(SUNEC_JAR_UNSIGNED)
+	$(install-file)
 endif
 
-JARS += $(SUNEC_JAR_DST)
+JARS += $(SUNEC_JAR_DST) $(SUNEC_JAR_UNSIGNED)
 
 ##########################################################################################
 
@@ -508,162 +509,166 @@
 ##########################################################################################
 
 SUNJCE_PROVIDER_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/sunjce_provider.jar
-
-ifndef OPENJDK
-    SUNJCE_PROVIDER_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/jce/sunjce_provider.jar
+SUNJCE_PROVIDER_JAR_UNSIGNED := $(IMAGES_OUTPUTDIR)/unsigned/sunjce_provider.jar
 
-    $(SUNJCE_PROVIDER_JAR_DST) : $(SUNJCE_PROVIDER_JAR_SRC)
-	@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunJCE provider..."
-	$(install-file)
-
-else
-
-    $(eval $(call SetupArchive,BUILD_SUNJCE_PROVIDER_JAR,,\
+$(eval $(call SetupArchive,BUILD_SUNJCE_PROVIDER_JAR,,\
 		SRCS:=$(JDK_OUTPUTDIR)/classes, \
 		SUFFIXES:=.class,\
 		INCLUDES:= com/sun/crypto/provider,\
-		JAR:=$(SUNJCE_PROVIDER_JAR_DST), \
+		JAR:=$(SUNJCE_PROVIDER_JAR_UNSIGNED), \
                 MANIFEST:=$(JCE_MANIFEST), \
 		SKIP_METAINF := true))
 
-    $(SUNJCE_PROVIDER_JAR_DST): $(JCE_MANIFEST)
+$(SUNJCE_PROVIDER_JAR_UNSIGNED): $(JCE_MANIFEST)
 
+ifndef OPENJDK
+    SUNJCE_PROVIDER_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/jce/sunjce_provider.jar
+    $(SUNJCE_PROVIDER_JAR_DST) : $(SUNJCE_PROVIDER_JAR_SRC)
+	@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunJCE provider..."
+	$(install-file)
+else
+    $(SUNJCE_PROVIDER_JAR_DST) : $(SUNJCE_PROVIDER_JAR_UNSIGNED)
+	$(install-file)
 endif
 
-JARS += $(SUNJCE_PROVIDER_JAR_DST)
+JARS += $(SUNJCE_PROVIDER_JAR_DST) $(SUNJCE_PROVIDER_JAR_UNSIGNED)
+
+##########################################################################################
 
 JCE_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/jce.jar
+JCE_JAR_UNSIGNED := $(IMAGES_OUTPUTDIR)/unsigned/jce.jar
+
+$(eval $(call SetupArchive,BUILD_JCE_JAR,,\
+		SRCS:=$(JDK_OUTPUTDIR)/classes, \
+		SUFFIXES:=.class,\
+		INCLUDES:= javax/crypto sun/security/internal,\
+		JAR:=$(JCE_JAR_UNSIGNED), \
+                MANIFEST:=$(JCE_MANIFEST), \
+		SKIP_METAINF := true))
+
+$(JCE_JAR_UNSIGNED): $(JCE_MANIFEST)
 
 ifndef OPENJDK
-
     JCE_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/jce/jce.jar
-
     $(JCE_JAR_DST) : $(JCE_JAR_SRC)
 	@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt jce.jar..."
 	$(install-file)
-
 else
-
-    $(eval $(call SetupArchive,BUILD_JCE_JAR,,\
-		SRCS:=$(JDK_OUTPUTDIR)/classes, \
-		SUFFIXES:=.class,\
-		INCLUDES:= javax/crypto sun/security/internal,\
-		JAR:=$(JCE_JAR_DST), \
-                MANIFEST:=$(JCE_MANIFEST), \
-		SKIP_METAINF := true))
-
-    $(JCE_JAR_DST): $(JCE_MANIFEST)
-
+    $(JCE_JAR_DST) : $(JCE_JAR_UNSIGNED)
+	$(install-file)
 endif
 
-JARS += $(JCE_JAR_DST)
+JARS += $(JCE_JAR_DST) $(JCE_JAR_UNSIGNED)
 
 ##########################################################################################
 
 US_EXPORT_POLICY_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/security/US_export_policy.jar
+US_EXPORT_POLICY_JAR_UNSIGNED := $(IMAGES_OUTPUTDIR)/unsigned/US_export_policy.jar
+
+#
+# TODO fix so that SetupArchive does not write files into SRCS
+#   then we don't need this extra copying
+#
+# NOTE:  We currently do not place restrictions on our limited export
+# policy.  This was not a typo.
+#
+US_EXPORT_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
+US_EXPORT_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/US_export_policy_jar.tmp
+
+$(US_EXPORT_POLICY_JAR_TMP)/% : $(US_EXPORT_POLICY_JAR_SRC_DIR)/%
+	$(install-file)
+
+US_EXPORT_POLICY_JAR_DEPS := $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy
+
+$(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR,$(US_EXPORT_POLICY_JAR_DEPS),\
+		SRCS:=$(US_EXPORT_POLICY_JAR_TMP), \
+		SUFFIXES:= .policy,\
+		JAR:=$(US_EXPORT_POLICY_JAR_UNSIGNED), \
+		EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \
+		SKIP_METAINF := true))
 
 ifndef OPENJDK
-
-
     $(US_EXPORT_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/US_export_policy.jar
 	$(ECHO) $(LOG_INFO) Copying $(@F)
 	$(install-file)
-
 else
-
-    #
-    # TODO fix so that SetupArchive does not write files into SRCS
-    #   then we don't need this extra copying
-    #
-    # NOTE:  We currently do not place restrictions on our limited export
-    # policy.  This was not a typo.
-    #
-    US_EXPORT_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
-    US_EXPORT_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/US_export_policy_jar.tmp
-
-    $(US_EXPORT_POLICY_JAR_TMP)/% : $(US_EXPORT_POLICY_JAR_SRC_DIR)/%
+    $(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_UNSIGNED)
 	$(install-file)
-
-    US_EXPORT_POLICY_JAR_DEPS := $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy
-
-    $(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR,$(US_EXPORT_POLICY_JAR_DEPS),\
-		SRCS:=$(US_EXPORT_POLICY_JAR_TMP), \
-		SUFFIXES:= .policy,\
-		JAR:=$(US_EXPORT_POLICY_JAR_DST), \
-		EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \
-		SKIP_METAINF := true))
-
 endif
 
-JARS += $(US_EXPORT_POLICY_JAR_DST)
+JARS += $(US_EXPORT_POLICY_JAR_DST) $(US_EXPORT_POLICY_JAR_UNSIGNED)
 
 ##########################################################################################
 
 LOCAL_POLICY_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/security/local_policy.jar
+LOCAL_POLICY_JAR_UNSIGNED := $(IMAGES_OUTPUTDIR)/unsigned/local_policy.jar
+
+#
+# TODO fix so that SetupArchive does not write files into SRCS
+#   then we don't need this extra copying
+#
+LOCAL_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/local_policy_jar.tmp
+
+ifeq ($(UNLIMITED_CRYPTO), true)
+    LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
+    LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/default_local.policy
+    LOCAL_POLICY_JAR_ATTR := Crypto-Strength: unlimited
+else
+    LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/limited
+    LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/exempt_local.policy \
+                             $(LOCAL_POLICY_JAR_TMP)/default_local.policy
+    LOCAL_POLICY_JAR_ATTR := Crypto-Strength: limited
+endif
+
+$(LOCAL_POLICY_JAR_TMP)/% : $(LOCAL_POLICY_JAR_SRC_DIR)/%
+	$(install-file)
+
+$(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR,$(LOCAL_POLICY_JAR_DEPS),\
+		SRCS:=$(LOCAL_POLICY_JAR_TMP),\
+		SUFFIXES:= .policy,\
+		JAR:=$(LOCAL_POLICY_JAR_UNSIGNED), \
+		EXTRA_MANIFEST_ATTR := $(LOCAL_POLICY_JAR_ATTR), \
+		SKIP_METAINF := true))
 
 ifndef OPENJDK
-
     $(LOCAL_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/local_policy.jar
 	$(ECHO) $(LOG_INFO) Copying $(@F)
 	$(install-file)
-
 else
-
-    #
-    # TODO fix so that SetupArchive does not write files into SRCS
-    #   then we don't need this extra copying
-    #
-    LOCAL_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/local_policy_jar.tmp
-
-    ifeq ($(UNLIMITED_CRYPTO), true)
-        LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
-        LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/default_local.policy
-        LOCAL_POLICY_JAR_ATTR := Crypto-Strength: unlimited
-    else
-        LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/limited
-        LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/exempt_local.policy \
-                                 $(LOCAL_POLICY_JAR_TMP)/default_local.policy
-        LOCAL_POLICY_JAR_ATTR := Crypto-Strength: limited
-    endif
-
-    $(LOCAL_POLICY_JAR_TMP)/% : $(LOCAL_POLICY_JAR_SRC_DIR)/%
+    $(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_UNSIGNED)
 	$(install-file)
-
-    $(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR,$(LOCAL_POLICY_JAR_DEPS),\
-		SRCS:=$(LOCAL_POLICY_JAR_TMP),\
-		SUFFIXES:= .policy,\
-		JAR:=$(LOCAL_POLICY_JAR_DST), \
-		EXTRA_MANIFEST_ATTR := $(LOCAL_POLICY_JAR_ATTR), \
-		SKIP_METAINF := true))
-
 endif
 
-JARS += $(LOCAL_POLICY_JAR_DST)
+JARS += $(LOCAL_POLICY_JAR_DST) $(LOCAL_POLICY_JAR_UNSIGNED)
 
 ##########################################################################################
 
 ifeq ($(OPENJDK_TARGET_OS),windows)
 
 SUNMSCAPI_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/sunmscapi.jar
-
-ifndef OPENJDK
-SUNMSCAPI_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/mscapi/sunmscapi.jar
-
-$(SUNMSCAPI_JAR_DST) : $(SUNMSCAPI_JAR_SRC)
-	@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunMSCAPI provider..."
-	$(install-file)
-
-else
+SUNMSCAPI_JAR_UNSIGNED := $(IMAGES_OUTPUTDIR)/unsigned/sunmscapi.jar
 
 $(eval $(call SetupArchive,BUILD_SUNMSCAPI_JAR,,\
 		SRCS:=$(JDK_OUTPUTDIR)/classes, \
 		SUFFIXES:=.class,\
 		INCLUDES:= sun/security/mscapi,\
-		JAR:=$(SUNMSCAPI_JAR_DST), \
+		JAR:=$(SUNMSCAPI_JAR_UNSIGNED), \
+		MANIFEST:=$(JCE_MANIFEST), \
 		SKIP_METAINF:=true))
+
+$(SUNMSCAPI_JAR_UNSIGNED): $(JCE_MANIFEST)
+
+ifndef OPENJDK
+    SUNMSCAPI_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/mscapi/sunmscapi.jar
+    $(SUNMSCAPI_JAR_DST) : $(SUNMSCAPI_JAR_SRC)
+	@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunMSCAPI provider..."
+	$(install-file)
+else
+    $(SUNMSCAPI_JAR_DST) : $(SUNMSCAPI_JAR_UNSIGNED)
+	$(install-file)
 endif
 
-JARS += $(SUNMSCAPI_JAR_DST)
+JARS += $(SUNMSCAPI_JAR_DST) $(SUNMSCAPI_JAR_UNSIGNED)
 
 endif
 
@@ -673,13 +678,24 @@
 ifndef OPENJDK
 
 UCRYPTO_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/ucrypto.jar
+UCRYPTO_JAR_UNSIGNED := $(IMAGES_OUTPUTDIR)/unsigned/ucrypto.jar
 UCRYPTO_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/ucrypto/ucrypto.jar
 
+$(eval $(call SetupArchive,BUILD_UCRYPTO_JAR,,\
+		SRCS:=$(JDK_OUTPUTDIR)/classes, \
+		SUFFIXES:=.class,\
+		INCLUDES:=com/oracle/security/ucrypto,\
+		JAR:=$(UCRYPTO_JAR_UNSIGNED), \
+		MANIFEST:=$(JCE_MANIFEST), \
+		SKIP_METAINF:=true))
+
+$(UCRYPTO_JAR_UNSIGNED): $(JCE_MANIFEST)
+
 $(UCRYPTO_JAR_DST) : $(UCRYPTO_JAR_SRC)
 	@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt OracleUcrypto provider..."
 	$(install-file)
 
-JARS += $(UCRYPTO_JAR_DST)
+JARS += $(UCRYPTO_JAR_DST) $(UCRYPTO_JAR_UNSIGNED)
 
 endif
 endif
@@ -707,57 +723,57 @@
 ##########################################################################################
 
 TOOLS_JAR_INCLUDES := \
-	sun/tools/asm		\
-	sun/tools/jar		\
-	sun/tools/java		\
-	sun/tools/javac		\
-	sun/tools/jcmd		\
-	sun/tools/jps		\
-	sun/tools/jstat		\
-	sun/tools/jstatd	\
-	sun/tools/native2ascii	\
-	sun/tools/serialver	\
-	sun/tools/tree		\
-	sun/tools/util		\
-	sun/security/tools/jarsigner \
-	sun/rmi/rmic		\
-	sun/applet		\
-	sun/jvmstat		\
+        com/sun/codemodel       \
+	com/sun/istack/internal/tools       \
+	com/sun/jarsigner	\
 	com/sun/javadoc		\
 	com/sun/jdi		\
-	com/sun/jarsigner	\
 	com/sun/source          \
+	com/sun/tools/attach	\
 	com/sun/tools/classfile \
+	com/sun/tools/corba     \
 	com/sun/tools/doclets   \
 	com/sun/tools/doclint   \
 	com/sun/tools/example/debug/expr \
 	com/sun/tools/example/debug/tty  \
 	com/sun/tools/extcheck  \
 	com/sun/tools/hat       \
+        com/sun/tools/internal/jxc             \
+	com/sun/tools/internal/jxc/ap   \
+	com/sun/tools/internal/ws       \
+	com/sun/tools/internal/ws/wscompile/plugin/at_generated \
+	com/sun/tools/internal/xjc       \
 	com/sun/tools/javac     \
 	com/sun/tools/javadoc   \
 	com/sun/tools/javah     \
 	com/sun/tools/javap     \
 	com/sun/tools/jdeps	\
-	com/sun/tools/corba     \
-	com/sun/tools/internal/xjc       \
-	com/sun/tools/internal/ws       \
-	com/sun/istack/internal/tools       \
-	com/sun/tools/internal/jxc/ap   \
-	com/sun/tools/internal/ws/wscompile/plugin/at_generated \
-        com/sun/codemodel       \
-        com/sun/tools/internal/jxc             \
+	com/sun/tools/jdi	\
+	com/sun/tools/script/shell	\
+	com/sun/xml/internal/dtdparser \
         com/sun/xml/internal/rngom       \
         com/sun/xml/internal/xsom       \
         org/relaxng/datatype   \
-	com/sun/xml/internal/dtdparser \
-	com/sun/tools/jdi	\
-	com/sun/tools/script/shell	\
-	com/sun/tools/attach	\
+	sun/applet		\
+	sun/jvmstat		\
+	sun/rmi/rmic		\
+	sun/security/tools/jarsigner \
+	sun/tools/asm		\
 	sun/tools/attach	\
-	sun/tools/jstack        \
+	sun/tools/jar		\
+	sun/tools/java		\
+	sun/tools/javac		\
+	sun/tools/jcmd		\
 	sun/tools/jinfo         \
-	sun/tools/jmap
+	sun/tools/jmap		\
+	sun/tools/jps		\
+	sun/tools/jstack        \
+	sun/tools/jstat		\
+	sun/tools/jstatd	\
+	sun/tools/native2ascii	\
+	sun/tools/serialver	\
+	sun/tools/tree		\
+	sun/tools/util
 
 # The sjavac tools is not ready for public consumption.
 TOOLS_JAR_EXCLUDES=com/sun/tools/sjavac
@@ -821,7 +837,7 @@
 	    $(CORE_PKGS) $(NON_CORE_PKGS) $(EXCLUDE_PROPWARN_PKGS) $(EXPORTED_PRIVATE_PKGS)
 	$(TOUCH) $@
 
-$(shell $(MKDIR) -p $(IMAGES_OUTPUTDIR)/symbols)
+$(eval $(call MakeDir,$(IMAGES_OUTPUTDIR)/symbols))
 $(eval $(call SetupArchive,BUILD_CT_SYM,$(IMAGES_OUTPUTDIR)/symbols/_the.symbols,\
 		SRCS:=$(IMAGES_OUTPUTDIR)/symbols,\
 		INCLUDES:=META-INF/sym,\
@@ -833,6 +849,19 @@
 ##########################################################################################
 
 SRC_ZIP_INCLUDES = \
+	com/sun/corba			\
+	com/sun/image/codec/jpeg	\
+	com/sun/imageio                 \
+	com/sun/java_cup		\
+	com/sun/javadoc			\
+	com/sun/java/swing		\
+	com/sun/jlex	        	\
+	com/sun/jmx			\
+	com/sun/naming			\
+	com/sun/org/apache		\
+	com/sun/security/auth		\
+	com/sun/security/jgss		\
+	com/sun/source			\
 	java/applet			\
 	java/awt			\
 	java/beans			\
@@ -846,34 +875,21 @@
 	java/sql			\
 	java/text			\
 	java/util			\
-	com/sun/corba			\
-	com/sun/image/codec/jpeg	\
-	com/sun/imageio                 \
-	com/sun/java/swing		\
-	com/sun/javadoc			\
-	com/sun/jmx			\
-	com/sun/source			\
-	com/sun/naming			\
-	com/sun/security/auth		\
-	com/sun/security/jgss		\
 	javax/accessibility		\
 	javax/annotation		\
-	javax/script			\
 	javax/imageio			\
 	javax/lang			\
 	javax/management		\
 	javax/naming			\
 	javax/print			\
 	javax/rmi			\
+	javax/script			\
 	javax/security			\
 	javax/sound			\
 	javax/sql			\
 	javax/swing			\
 	javax/tools			\
 	javax/xml			\
-	com/sun/org/apache		\
-	com/sun/java_cup		\
-	com/sun/jlex	        	\
 	org/ietf			\
 	org/omg				\
 	org/w3c/dom			\
@@ -966,6 +982,62 @@
 JARS += $(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar
 
 ##########################################################################################
+#
+# sec-bin.zip is used by builds where the corresponding sources are not available
+#
+$(eval $(call SetupZipArchive,BUILD_SEC_BIN_ZIP,\
+		SRC:=$(JDK_OUTPUTDIR),\
+		INCLUDES:=classes/javax/net \
+			  classes/javax/security/cert \
+			  classes/com/sun/net/ssl \
+			  classes/com/sun/security/cert \
+			  classes/sun/net/www/protocol/https \
+			  classes/sun/security/pkcs12 \
+			  classes/sun/security/ssl \
+			  classes/sun/security/krb5 \
+			  classes/sun/security/krb5/internal \
+			  classes/sun/security/krb5/internal/ccache \
+			  classes/sun/security/krb5/internal/crypto \
+			  classes/sun/security/krb5/internal/ktab \
+			  classes/sun/security/krb5/internal/rcache \
+			  classes/sun/security/krb5/internal/util,\
+		INCLUDE_FILES:=classes/sun/security/jgss/spi/GSSContextSpi.class,\
+		EXCLUDES:=classes/sun/security/krb5/internal/tools,\
+		ZIP:=$(IMAGES_OUTPUTDIR)/sec-bin.zip))
+
+JARS += $(IMAGES_OUTPUTDIR)/sec-bin.zip
+
+##########################################################################################
+#
+# Windows specific binary security packages.
+#
+ifeq ($(OPENJDK_TARGET_OS),windows)
+    # sec-windows-bin.zip is used by builds where the corresponding sources are not available
+    $(eval $(call SetupZipArchive,BUILD_SEC_WINDOWS_BIN_ZIP,\
+		SRC:=$(JDK_OUTPUTDIR),\
+		INCLUDES:=classes/sun/security/krb5/internal/tools,\
+		ZIP:=$(IMAGES_OUTPUTDIR)/sec-windows-bin.zip))
+
+    JARS += $(IMAGES_OUTPUTDIR)/sec-windows-bin.zip
+
+    # JGSS files contain the native Kerberos library
+    ifeq ($(OPENJDK_TARGET_CPU),x86_64)
+        JGSS_ZIP_NAME=jgss-windows-x64-bin.zip
+    else
+        JGSS_ZIP_NAME=jgss-windows-i586-bin.zip
+    endif
+
+    $(eval $(call SetupZipArchive,BUILD_JGSS_BIN_ZIP,\
+		SRC:=$(JDK_OUTPUTDIR),\
+		INCLUDE_FILES:=bin/w2k_lsa_auth.dll \
+			       bin/w2k_lsa_auth.map \
+			       bin/w2k_lsa_auth.pdb,\
+		ZIP:=$(IMAGES_OUTPUTDIR)/$(JGSS_ZIP_NAME)))
+
+    JARS += $(IMAGES_OUTPUTDIR)/$(JGSS_ZIP_NAME)
+endif
+
+##########################################################################################
 
 -include $(CUSTOM_MAKE_DIR)/CreateJars.gmk
 
--- a/jdk/makefiles/GensrcProperties.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/makefiles/GensrcProperties.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -23,6 +23,9 @@
 # questions.
 #
 
+# Prepare the find cache. This is only used on windows.
+$(eval $(call FillCacheFind,$(JDK_TOPDIR)/src/share/classes $(JDK_TOPDIR)/src/windows/classes))
+
 # All .properties files to be compiled are appended to this variable.
 ALL_COMPILED_PROPSOURCES:=
 # All generated .java files from compilation are appended to this variable.
@@ -117,44 +120,54 @@
 #com/apple/laf/resources
 ifeq ($(OPENJDK_TARGET_OS),macosx)
     $(eval $(call add_properties_to_compile,COM_APPLE_LAF,\
-	$(shell find $(JDK_TOPDIR)/src/macosx/classes/com/apple/laf/resources -name "*.properties"),\
-		ListResourceBundle))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/macosx/classes/com/apple/laf/resources)),\
+	ListResourceBundle))
 endif
 
 #com/sun/accessibility/internal/resources
 $(eval $(call add_properties_to_compile,COM_SUN_ACCESSIBILITY,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/com/sun/accessibility/internal/resources -name "*.properties"),\
-		ListResourceBundle))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/com/sun/accessibility/internal/resources)),\
+	ListResourceBundle))
 $(eval $(call add_properties_to_compile,COM_SUN_ACCESSIBILITY_HK,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/com/sun/accessibility/internal/resources -name "*.properties"),\
-		ListResourceBundle,%zh_TW,%zh_HK))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/com/sun/accessibility/internal/resources)),\
+	ListResourceBundle,%zh_TW,%zh_HK))
 #com/sun/imageio/plugins/common
 $(eval $(call add_properties_to_clean,COM_SUN_IMAGEIO,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/com/sun/imageio -name "*.properties")))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/com/sun/imageio))))
 #com/sun/java/swing/plaf/gtk/resources
 ifneq ($(OPENJDK_TARGET_OS), windows)
 # Only compile GTK resource bundles on Solaris/Linux
 $(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_GTK,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/gtk/resources -name "*.properties"),\
-		ListResourceBundle))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/gtk/resources)),\
+	ListResourceBundle))
 $(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_GTK_HK,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/gtk/resources -name "*.properties"),\
-		ListResourceBundle,%zh_TW,%zh_HK))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/gtk/resources)),\
+	ListResourceBundle,%zh_TW,%zh_HK))
 endif
 #com/sun/java/swing/plaf/motif/resources
 $(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_MOTIF,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/motif/resources -name "*.properties"),\
-		ListResourceBundle))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/motif/resources)),\
+	ListResourceBundle))
 $(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_MOTIF_HK,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/motif/resources -name "*.properties"),\
-		ListResourceBundle,%zh_TW,%zh_HK))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/motif/resources)),\
+	ListResourceBundle,%zh_TW,%zh_HK))
 #com/sun/java/swing/plaf/windows/resources
 $(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_WINDOWS,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/windows/resources -name "*.properties"),\
-		ListResourceBundle))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/windows/resources)),\
+	ListResourceBundle))
 $(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_WINDOWS_HK,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/windows/resources -name "*.properties"),\
-		ListResourceBundle,%zh_TW,%zh_HK))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/windows/resources)),\
+	ListResourceBundle,%zh_TW,%zh_HK))
 #com/sun/java/util/jar/pack
 $(eval $(call add_properties_to_clean,JNDI_COSNAMING,\
 	$(JDK_TOPDIR)/src/share/classes/com/sun/java/util/jar/pack/intrinsic.properties))
@@ -169,138 +182,171 @@
 #FIXME: The "xmlsecurity*.properties" pattern is not ideal; we might want to find
 #a better way to select the properties files that are needed.
 $(eval $(call add_properties_to_clean,XML_SECURITY,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/com/sun/org/apache/xml/internal/security/resource -name "xmlsecurity*.properties")))
+	$(filter $(JDK_TOPDIR)/src/share/classes/com/sun/org/apache/xml/internal/security/resource/xmlsecurity%.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/com/sun/org/apache/xml/internal/security/resource))))
 
 #com/sun/rowset
 $(eval $(call add_properties_to_clean,COM_SUN_ROWSET,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/com/sun/rowset -name "*.properties")))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/com/sun/rowset))))
 $(eval $(call add_properties_to_clean,COM_SUN_ROWSET_HK,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/com/sun/rowset -name "*zh_TW.properties"),\
+	$(filter %zh_TW.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/com/sun/rowset)),\
 	%zh_TW,%zh_HK))
 
 #com/sun/servicetag/resources
 #com/sun/swing/internal/plaf/basic/resources
 $(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_BASIC,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/basic/resources -name "*.properties"),\
-		ListResourceBundle))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/basic/resources)),\
+	ListResourceBundle))
 $(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_BASIC_HK,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/basic/resources -name "*.properties"),\
-		ListResourceBundle,%zh_TW,%zh_HK))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/basic/resources)),\
+	ListResourceBundle,%zh_TW,%zh_HK))
 #com/sun/swing/internal/plaf/metal/resources
 $(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_METAL,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/metal/resources -name "*.properties"),\
-		ListResourceBundle))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/metal/resources)),\
+	ListResourceBundle))
 $(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_METAL_HK,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/metal/resources -name "*.properties"),\
-		ListResourceBundle,%zh_TW,%zh_HK))
+	$(filter %.properties,$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/metal/resources)),\
+	ListResourceBundle,%zh_TW,%zh_HK))
 #com/sun/swing/internal/plaf/synth/resources
 $(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_SYNTH,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/synth/resources -name "*.properties"),\
-		ListResourceBundle))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/synth/resources)),\
+	ListResourceBundle))
 $(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_SYNTH_HK,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/synth/resources -name "*.properties"),\
-		ListResourceBundle,%zh_TW,%zh_HK))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/synth/resources)),\
+	ListResourceBundle,%zh_TW,%zh_HK))
 
 #com/sun/tools/jdi/resources
 $(eval $(call add_properties_to_compile,COM_SUN_TOOLS_JDI,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/com/sun/tools/jdi/resources -name "*.properties"),\
-		ListResourceBundle))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/com/sun/tools/jdi/resources)),\
+	ListResourceBundle))
 
 #com/sun/tools/script/shell
 #java/util
 #javax/sql/rowset
 $(eval $(call add_properties_to_clean,JAVAX_SQL_ROWSET,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/javax/sql/rowset -name "*.properties")))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/javax/sql/rowset))))
 #sun/awt/resources
 $(eval $(call add_properties_to_compile,SUN_AWT,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/sun/awt/resources -name "*.properties"),\
-		ListResourceBundle))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/sun/awt/resources)),\
+	ListResourceBundle))
 $(eval $(call add_properties_to_compile,SUN_AWT_HK,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/sun/awt/resources -name "*.properties"),\
-		ListResourceBundle,%zh_TW,%zh_HK))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/sun/awt/resources)),\
+	ListResourceBundle,%zh_TW,%zh_HK))
 #sun/awt/windows/
 ifeq ($(OPENJDK_TARGET_OS),windows)
     $(eval $(call add_properties_to_compile,SUN_AWT,\
-	$(shell find $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows -name "awtLocalization*.properties"),\
-		ListResourceBundle))
+	$(filter $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows/awtLocalization%.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/windows/classes/sun/awt/windows)),\
+	ListResourceBundle))
     $(eval $(call add_properties_to_compile,SUN_AWT_HK,\
-	$(shell find $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows -name "awtLocalization*.properties"),\
-		ListResourceBundle,%zh_TW,%zh_HK))
+	$(filter $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows/awtLocalization%.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/windows/classes/sun/awt/windows)),\
+	ListResourceBundle,%zh_TW,%zh_HK))
 endif
 
 #sun/launcher/resources
 $(eval $(call add_properties_to_compile,SUN_LAUNCHER,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/sun/launcher/resources -name "*.properties"),\
-		ListResourceBundle))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/sun/launcher/resources)),\
+	ListResourceBundle))
 $(eval $(call add_properties_to_compile,SUN_LAUNCHER_HK,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/sun/launcher/resources -name "*.properties"),\
-		ListResourceBundle,%zh_TW,%zh_HK))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/sun/launcher/resources)),\
+	ListResourceBundle,%zh_TW,%zh_HK))
 #sun/management/resources
 $(eval $(call add_properties_to_compile,SUN_MANAGEMENT,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/sun/management/resources -name "*.properties"),\
-		ListResourceBundle))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/sun/management/resources)),\
+	ListResourceBundle))
 $(eval $(call add_properties_to_compile,SUN_MANAGEMENT_KH,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/sun/management/resources -name "*.properties"),\
-		ListResourceBundle,%zh_TW,%zh_HK))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/sun/management/resources)),\
+	ListResourceBundle,%zh_TW,%zh_HK))
 #sun/print
 #sun/print/resources
 $(eval $(call add_properties_to_compile,SUN_PRINT,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/sun/print/resources -name "*.properties"),\
-		ListResourceBundle))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/sun/print/resources)),\
+	ListResourceBundle))
 $(eval $(call add_properties_to_compile,SUN_PRINT_HK,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/sun/print/resources -name "*.properties"),\
-		ListResourceBundle,%zh_TW,%zh_HK))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/sun/print/resources)),\
+	ListResourceBundle,%zh_TW,%zh_HK))
 #sun/rmi/registry/resources
 $(eval $(call add_properties_to_clean,SUN_RMI_REGISTRY,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/sun/rmi/registry/resources -name "*.properties")))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/sun/rmi/registry/resources))))
 $(eval $(call add_properties_to_clean,SUN_RMI_REGISTRY_HK,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/sun/rmi/registry/resources -name "*zh_TW.properties"),\
+	$(filter %zh_TW.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/sun/rmi/registry/resources)),\
 	%zh_TW,%zh_HK))
 
 #sun/rmi/rmic/resources
 $(eval $(call add_properties_to_clean,SUN_RMI_RMIC,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/sun/rmi/rmic/resources -name "*.properties")))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/sun/rmi/rmic/resources))))
 
 #sun/rmi/server/resources
 $(eval $(call add_properties_to_clean,SUN_RMI_SERVER,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/sun/rmi/server/resources -name "*.properties")))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/sun/rmi/server/resources))))
 $(eval $(call add_properties_to_clean,SUN_RMI_SERVER_HK,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/sun/rmi/server/resources -name "*zh_TW.properties"),\
+	$(filter %zh_TW.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/sun/rmi/server/resources)),\
 	%zh_TW,%zh_HK))
 
 # sun/tools/jar/resources
 $(eval $(call add_properties_to_compile,SUN_TOOLS_JAR,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/sun/tools/jar/resources -name "*.properties"),\
-		ListResourceBundle))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/sun/tools/jar/resources)),\
+	ListResourceBundle))
 $(eval $(call add_properties_to_compile,SUN_TOOLS_JAR_HK,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/sun/tools/jar/resources -name "*.properties"),\
-		ListResourceBundle,%zh_TW,%zh_HK))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/sun/tools/jar/resources)),\
+	ListResourceBundle,%zh_TW,%zh_HK))
 
 #sun/tools/javac/resources
 # It's unclear if the other localized property files here are supposed to be copied or not
 # but the old build system didn't copy them.
 $(eval $(call add_properties_to_clean,SUN_TOOLS_SERIALVER,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/sun/tools/javac/resources -name "javac.properties")))
+	$(filter %javac.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/sun/tools/javac/resources))))
 
 #sun/tools/jconsole/resources
 $(eval $(call add_properties_to_clean,SUN_TOOLS_JCONSOLE,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/sun/tools/jconsole/resources -name "*.properties")))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/sun/tools/jconsole/resources))))
 
 #sun/tools/serialver
 $(eval $(call add_properties_to_clean,SUN_TOOLS_SERIALVER,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/sun/tools/serialver -name "*.properties"),,,resources))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/sun/tools/serialver)),,,resources))
 
 #sun/util/logging/resources
 $(eval $(call add_properties_to_compile,SUN_UTIL_LOGGING,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/sun/util/logging/resources -name "*.properties"),\
-		ListResourceBundle))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/sun/util/logging/resources)),\
+	ListResourceBundle))
 $(eval $(call add_properties_to_compile,SUN_UTIL_LOGGING_HK,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/sun/util/logging/resources -name "*.properties"),\
-		ListResourceBundle,%zh_TW,%zh_HK))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/sun/util/logging/resources)),\
+	ListResourceBundle,%zh_TW,%zh_HK))
 # sun/util/resources
 $(eval $(call add_properties_to_compile,SUN_UTIL,\
-	$(shell find $(JDK_TOPDIR)/src/share/classes/sun/util/resources -name "*.properties"),\
-		sun.util.resources.LocaleNamesBundle))
+	$(filter %.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/share/classes/sun/util/resources)),\
+	sun.util.resources.LocaleNamesBundle))
 
 # Now setup the rule for the generation of the resource bundles.
 $(JDK_OUTPUTDIR)/gensrc/_the.compiled_properties : $(ALL_COMPILED_PROPSOURCES) $(BUILD_TOOLS)
--- a/jdk/makefiles/GensrcSwing.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/makefiles/GensrcSwing.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -45,7 +45,6 @@
 # Generate beaninfo java files
 #
 
-BEAN_GENSRC_DIR = $(JDK_OUTPUTDIR)/gensrc/javax/swing/beaninfo
 DOCLETSRC_DIR = $(JDK_TOPDIR)/make/tools/swing-beans
 
 # javax.swing package
@@ -69,25 +68,31 @@
 # Dummy variable so far, in the old build system it was false by default
 SWINGBEAN_DEBUG_FLAG = false
 # GenDocletBeanInfo is compiled in Tools.gmk and picks up from $(JDK_OUTPUTDIR)/btclasses
-$(JDK_OUTPUTDIR)/gensrc/_the.generated_beaninfo: $(BEANS_SRC) $(BEAN_GENSRC_DIR)/SwingBeanInfoBase.java $(BEAN_GENSRC_DIR)/BeanInfoUtils.java $(BUILD_TOOLS)
+$(JDK_OUTPUTDIR)/gensrc_no_srczip/_the.generated_beaninfo: $(BEANS_SRC) $(JDK_OUTPUTDIR)/gensrc_no_srczip/javax/swing/SwingBeanInfoBase.java $(JDK_OUTPUTDIR)/gensrc/sun/swing/BeanInfoUtils.java $(BUILD_TOOLS)
 	$(ECHO) Generating beaninfo
-	$(JAVA) -Djava.awt.headless=true -jar $(JAVADOC_JARS) -doclet GenDocletBeanInfo -x $(SWINGBEAN_DEBUG_FLAG) -d $(BEAN_GENSRC_DIR) -t $(DOCLETSRC_DIR)/SwingBeanInfo.template -docletpath $(JDK_OUTPUTDIR)/btclasses \
+	$(MKDIR) -p $(JDK_OUTPUTDIR)/gensrc_no_srczip/javax/swing
+	$(JAVA) -Djava.awt.headless=true -jar $(JAVADOC_JARS) -doclet GenDocletBeanInfo \
+	-x $(SWINGBEAN_DEBUG_FLAG) -d $(JDK_OUTPUTDIR)/gensrc_no_srczip/javax/swing \
+	-t $(DOCLETSRC_DIR)/SwingBeanInfo.template -docletpath $(JDK_OUTPUTDIR)/btclasses \
 	-XDignore.symbol.file=true \
 	-classpath $(JDK_OUTPUTDIR)/btclasses $(BEANS_SRC) $(LOG_INFO)
+#       Move the JTextComponent into its proper package directory.
+	$(MKDIR) -p $(JDK_OUTPUTDIR)/gensrc_no_srczip/javax/swing/text
+	$(MV) $(JDK_OUTPUTDIR)/gensrc_no_srczip/javax/swing/JTextComponentBeanInfo.java $(JDK_OUTPUTDIR)/gensrc_no_srczip/javax/swing/text/JTextComponentBeanInfo.java 
 	$(TOUCH) $@
 
 # This file is the part of dt.jar
-# For some reason it is under $(JDK_TOPDIR)/make/tools/swing-beans/beaninfo
+# For some reason it is under $(JDK_TOPDIR)/make/tools/swing-beans/javax/swing
 # Should it be moved under $(JDK_TOPDIR)/src/share/classes/javax/swing instead?
-$(BEAN_GENSRC_DIR)/SwingBeanInfoBase.java: $(DOCLETSRC_DIR)/beaninfo/SwingBeanInfoBase.java
+$(JDK_OUTPUTDIR)/gensrc_no_srczip/javax/swing/SwingBeanInfoBase.java: $(DOCLETSRC_DIR)/javax/swing/SwingBeanInfoBase.java
 	$(MKDIR) -p $(@D)
 	$(CP) $< $@
 
 # This file is the part of dt.jar 
-# For some reason it is under $(JDK_TOPDIR)/make/tools/swing-beans/beaninfo
+# For some reason it is under $(JDK_TOPDIR)/make/tools/swing-beans/sun/swing
 # Should it be moved under $(JDK_TOPDIR)/src/share/classes/sun/swing instead?
-$(BEAN_GENSRC_DIR)/BeanInfoUtils.java: $(DOCLETSRC_DIR)/beaninfo/BeanInfoUtils.java
+$(JDK_OUTPUTDIR)/gensrc/sun/swing/BeanInfoUtils.java: $(DOCLETSRC_DIR)/sun/swing/BeanInfoUtils.java
 	$(MKDIR) -p $(@D)
 	$(CP) $< $@
 
-GENSRC_SWING_BEANINFO = $(JDK_OUTPUTDIR)/gensrc/_the.generated_beaninfo
+GENSRC_SWING_BEANINFO = $(JDK_OUTPUTDIR)/gensrc_no_srczip/_the.generated_beaninfo
--- a/jdk/makefiles/GensrcX11Wrappers.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/makefiles/GensrcX11Wrappers.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -23,84 +23,95 @@
 # questions.
 #
 
+# This file is responsible for extracting the x11 native struct offsets to
+# the xawt Java library. The tool needs to be run on the os/arch that
+# will host the final jvm, thus the tool cannot be used when cross compiling.
 
-# This file is responsible for extracting the x11 native struct offsets to
-# the xawt Java library. This is done by compiling and running a native
-# binary, which dumps output to a text file. The offsets differ on 32 and 64
-# bit systems, so care must be taken here.
+# To enable cross compiling, the two versions of the generated offset file,
+# sizes.32 and sizes.64 are committed into the source code repository.
+# These are the ones used.
 
-# Note: Some of the more complex logic here is most likely not needed anymore.
+# However when not cross compiling, the offset generator tool is built and
+# run, to verify that it still generates the same sizes.32 and sizes.64.
 
 GENSRC_X11WRAPPERS :=
+# Put temporary c-code and executable to calculate offsets here.
+# Also put verification offset file here as well.
 GENSRC_X11WRAPPERS_TMP := $(JDK_OUTPUTDIR)/gensrc_x11wrappers
-GENSRC_X11WRAPPERS_DST := $(JDK_OUTPUTDIR)/gensrc
+# Put the generated Java classes used to interface X11 from awt here.
+GENSRC_X11WRAPPERS_DST := $(JDK_OUTPUTDIR)/gensrc/sun/awt/X11
 
-GENSRC_SIZER_SRC := $(JDK_TOPDIR)/src/solaris/classes/sun/awt/X11/generator
+# The pre-calculated offset file are stored here:
+GENSRC_SIZER_DIR := $(JDK_TOPDIR)/src/solaris/classes/sun/awt/X11/generator
 
-# Normal case is to generate version according to target bits
-GENSRC_SIZES := sizes.$(OPENJDK_TARGET_CPU_BITS)
-
+# Normal case is to generate only according to target bits
+GENSRC_X11_VERSION := $(OPENJDK_TARGET_CPU_BITS)
 ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
-ifneq ($(OPENJDK_TARGET_OS), linux)
-# On all 64-bit systems except Linux, generate both 32 and 64 bit versions
-GENSRC_SIZES := sizes.32 sizes.64
-endif
+  ifneq ($(OPENJDK_TARGET_OS), linux)
+  # On all 64-bit systems except Linux, generate both 32 and 64 bit versions
+  GENSRC_X11_VERSION := 32 64
+  endif
 else
-ifeq ($(OPENJDK_TARGET_OS), solaris)
-# As a special case, solaris 32-bit also generates the 64-bit version
-GENSRC_SIZES := sizes.32 sizes.64
-endif
+  ifeq ($(OPENJDK_TARGET_OS), solaris)
+  # As a special case, solaris 32-bit also generates the 64-bit version
+  GENSRC_X11_VERSION := 32 64
+  endif
 endif
 
-##########################################################################################
+GENSRC_X11_SIZES_USED := $(addprefix $(GENSRC_X11WRAPPERS_TMP)/sizes.,$(GENSRC_X11_VERSION))
+
+# Copy only the sizes.* files that are actually needed. WrapperGenerator picks up any it finds from the 
+# file prefix it is given so those not needed need to be hidden.
+$(GENSRC_X11WRAPPERS_TMP)/sizes.%: $(GENSRC_SIZER_DIR)/sizes.%
+	$(MKDIR) -p $(@D)
+	$(RM) '$@'
+	$(SORT) $< > $@
 
-$(GENSRC_X11WRAPPERS_TMP)/sizer/sizer.%.c : $(GENSRC_SIZER_SRC)/xlibtypes.txt
+# Run the tool on the offset files copied from the source repository to generate several Java classes 
+# used in awt.
+$(JDK_OUTPUTDIR)/gensrc/_the.generated.x11 : $(GENSRC_X11_SIZES_USED) $(BUILD_TOOLS)
+	$(MKDIR) -p $(GENSRC_X11WRAPPERS_DST)
+	$(TOOL_WRAPPERGENERATOR) $(GENSRC_X11WRAPPERS_DST) $(GENSRC_SIZER_DIR)/xlibtypes.txt "gen" $(GENSRC_X11WRAPPERS_TMP)/sizes
+	$(TOUCH) $@
+
+GENSRC_X11WRAPPERS += $(JDK_OUTPUTDIR)/gensrc/_the.generated.x11
+
+ifneq ($(COMPILE_TYPE),cross)
+    # This is not a cross compile, regenerate the offset file, so that we
+    # can compare it with the version in the source code repository.
+
+    # Generate the C code for the program that will output the offset file.
+    $(GENSRC_X11WRAPPERS_TMP)/sizer.%.c : $(GENSRC_SIZER_DIR)/xlibtypes.txt $(BUILD_TOOLS)
 	$(ECHO) "Generating X11 wrapper ($*-bit version)"
 	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(TOOL_WRAPPERGENERATOR) $(@D) $< "sizer" $*
+	$(TOOL_WRAPPERGENERATOR) $(@D) $(GENSRC_SIZER_DIR)/xlibtypes.txt "sizer" $*
 
-$(GENSRC_X11WRAPPERS_TMP)/sizer/sizer.%.exe : $(GENSRC_X11WRAPPERS_TMP)/sizer/sizer.%.c
+    # Compile the C code into an executable.
+    $(GENSRC_X11WRAPPERS_TMP)/sizer.%.exe : $(GENSRC_X11WRAPPERS_TMP)/sizer.%.c
 	$(MKDIR) -p $(@D)
-	$(RM) $@ $@.tmp
-	(cd $(@D) && $(BUILD_CC) -m$* -o $@.tmp $< \
+	(cd $(@D) && $(CC) -m$* -o $@ $< \
               $(X_CFLAGS) \
               $(X_LIBS) \
               -I$(JDK_OUTPUTDIR)/include \
               -I$(JDK_TOPDIR)/src/share/javavm/export \
               -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/javavm/export \
-              -I$(JDK_TOPDIR)//src/share/native/common \
+              -I$(JDK_TOPDIR)/src/share/native/common \
               -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/common \
               -I$(JDK_TOPDIR)/src/solaris/native/sun/awt \
 	      -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
 	      -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils -lc)
-	$(MV) $@.tmp $@
+
+    .PRECIOUS: $(GENSRC_X11WRAPPERS_TMP)/sizer.%.exe $(GENSRC_X11WRAPPERS_TMP)/sizer.%.c
 
-# Run the generated sizer binary to create the sizes text file
-$(GENSRC_X11WRAPPERS_TMP)/sizer/sizes.% : $(GENSRC_X11WRAPPERS_TMP)/sizer/sizer.%.exe
+    # Run the executable create the offset file and check that it is identical
+    # to the offset file in the source code repository.
+    $(GENSRC_X11WRAPPERS_TMP)/sizes.%.verification : $(GENSRC_X11WRAPPERS_TMP)/sizer.%.exe
 	$(MKDIR) -p $(@D)
-	$(RM) $@ $@.tmp
-	$< > $@.tmp
-	$(MV) $@.tmp $@
+	$(GENSRC_X11WRAPPERS_TMP)/sizer.$*.exe | $(SORT) > $@.tmp
+	$(ECHO) Verifying $(GENSRC_X11WRAPPERS_TMP)/sizes.$*.verification.tmp to $(GENSRC_X11WRAPPERS_TMP)/sizes.$*
+	$(DIFF) $(GENSRC_X11WRAPPERS_TMP)/sizes.$*.verification.tmp $(GENSRC_X11WRAPPERS_TMP)/sizes.$*
+	mv $@.tmp $@
 
-ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), solaris-x86)
-  # On solaris-x86 we also need to create the 64-bit version, but we can't run a 64-bit binary
-  # As a workaround, copy this from a pre-generated file.
-$(GENSRC_X11WRAPPERS_TMP)/sizer/sizes.64 : $(JDK_TOPDIR)/src/solaris/classes/sun/awt/X11/generator/sizes.64-solaris-i386
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(CP) $< $@
+    GENSRC_X11WRAPPERS += $(GENSRC_X11WRAPPERS_TMP)/sizes.$(OPENJDK_TARGET_CPU_BITS).verification
 endif
 
-$(GENSRC_X11WRAPPERS_DST)/_the.generated.x11 : $(foreach S,$(GENSRC_SIZES),$(GENSRC_X11WRAPPERS_TMP)/sizer/$(S))
-	$(RM) $@
-	$(MKDIR) -p $(@D)/sun/awt/X11
-	$(TOOL_WRAPPERGENERATOR) $(@D)/sun/awt/X11 $(GENSRC_SIZER_SRC)/xlibtypes.txt "gen" $(GENSRC_X11WRAPPERS_TMP)/sizer/sizes
-ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), solaris-x86_64)
-  # On solaris-x86_64, as a safety measure, compare the generated file with the checked-in version 
-	$(ECHO) COMPARING $(GENSRC_X11WRAPPERS_TMP)/sizer/sizes.64 and $(GENSRC_SIZER_SRC)/sizes.64-solaris-i386
-	$(DIFF) $(GENSRC_X11WRAPPERS_TMP)/sizer/sizes.64 $(GENSRC_SIZER_SRC)/sizes.64-solaris-i386
-endif
-	$(TOUCH) $@
-
-GENSRC_X11WRAPPERS += $(GENSRC_X11WRAPPERS_DST)/_the.generated.x11
--- a/jdk/makefiles/Images.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/makefiles/Images.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -30,6 +30,15 @@
 
 default: images
 
+# Prepare the find cache. Only used if running on windows.
+$(eval $(call FillCacheFind,\
+    $(wildcard $(JDK_OUTPUTDIR)/bin \
+               $(JDK_OUTPUTDIR)/lib \
+               $(IMAGES_OUTPUTDIR)/lib \
+               $(JDK_OUTPUTDIR)/include \
+               $(JDK_OUTPUTDIR)/sample \
+               $(JDK_OUTPUTDIR)/demo)))
+
 include Tools.gmk
 
 # Note: This double-colon rule is intentional, to support
@@ -68,12 +77,6 @@
   $4 += $2/$$($2_$3_FILE)
 endef
 
-JDK_IMAGE_DIR:=$(IMAGES_OUTPUTDIR)/j2sdk-image
-JRE_IMAGE_DIR:=$(IMAGES_OUTPUTDIR)/j2re-image
-
-JDK_OVERLAY_IMAGE_DIR:=$(IMAGES_OUTPUTDIR)/j2sdk-overlay-image
-JRE_OVERLAY_IMAGE_DIR:=$(IMAGES_OUTPUTDIR)/j2re-overlay-image
-
 ################################################################################
 #
 # JRE and JDK build rules
@@ -133,7 +136,7 @@
 	$(SALIB_NAME)
 
 # Find all files in bin dir
-ALL_BIN_LIST := $(shell $(FIND) $(JDK_OUTPUTDIR)/bin -type f)
+ALL_BIN_LIST := $(call CacheFind,$(JDK_OUTPUTDIR)/bin)
 
 # Prevent sjavac from entering the images.
 ALL_BIN_LIST := $(filter-out %/sjavac,$(ALL_BIN_LIST))
@@ -145,7 +148,7 @@
 else
 # On windows, the libraries are in the bin dir, only filter out debuginfo files
 # for executables. "java" is both a library and executable.
-    ALL_BIN_EXEC_FILES := $(filter-out java.exe,$(notdir $(shell $(FIND) $(JDK_OUTPUTDIR)/bin -type f -name "*.exe")))
+    ALL_BIN_EXEC_FILES := $(filter-out java.exe,$(notdir $(filter %.exe,$(ALL_BIN_LIST))))
     ALL_BIN_DEBUG_FILTER := $(addprefix %,$(patsubst %.exe,%.debuginfo,$(ALL_BIN_EXEC_FILES)) \
 					   $(patsubst %.exe,%.diz,$(ALL_BIN_EXEC_FILES))) %.pdb
     ALL_BIN_LIST := $(filter-out $(ALL_BIN_DEBUG_FILTER),$(ALL_BIN_LIST))
@@ -213,13 +216,13 @@
 
 # Find all files to copy from $(JDK_OUTPUTDIR)/lib
 # Jar files are not expected to be here
-ALL_JDKOUT_LIB_LIST := $(shell $(FIND) $(JDK_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \
-                       \( -name "_the*" -o -name "javac_state " -o -name "*.jar" \) )
+ALL_JDKOUT_LIB_LIST := $(call not-containing,_the.,$(filter-out %.jar,\
+                            $(call CacheFind,$(JDK_OUTPUTDIR)/lib)))
 # Find all files to copy from $(IMAGES_OUTPUTDIR)/lib
 # This is were the jar files are and might not exist if building overlay-images
 ifneq ($(wildcard $(IMAGES_OUTPUTDIR)/lib),)
-    ALL_IMAGES_LIB_LIST := $(shell $(FIND) $(IMAGES_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \
-                       \( -name "_the*" -o -name "javac_state " \) )
+    ALL_IMAGES_LIB_LIST := $(call not-containing,_the.,\
+                            $(call CacheFind,$(IMAGES_OUTPUTDIR)/lib))
 endif
 
 # Filter files to copy for each destination
@@ -494,13 +497,13 @@
 
     JDK_OVERLAY_DEMO_TARGETS += $$($1_TARGET)
 endef
-JDK_OVERLAY_DEMO_SOURCES := $(shell $(FIND) $(JDK_OUTPUTDIR)/demo -name "*$(SHARED_LIBRARY_SUFFIX)")
+JDK_OVERLAY_DEMO_SOURCES := $(filter %$(SHARED_LIBRARY_SUFFIX),$(call CacheFind,$(JDK_OUTPUTDIR)/demo))
 $(foreach lib,$(JDK_OVERLAY_DEMO_SOURCES),$(eval $(call CreateOverlayDemoRule,$(lib))))
 
 ################################################################################
 # /sample dir
 
-$(foreach f,$(shell $(FIND) $(JDK_OUTPUTDIR)/sample -type f),\
+$(foreach f,$(call CacheFind,$(JDK_OUTPUTDIR)/sample),\
     $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR),$f,JDK_SAMPLE_TARGETS)))
 
 ################################################################################
@@ -519,7 +522,7 @@
 	$(install-file)
 
     JDK_DB_TARGETS := $(patsubst $(JDK_TOPDIR)/src/closed/share/db/%,$(IMAGES_OUTPUTDIR)/_unzip/%.unzipped,\
-			$(shell $(FIND) $(JDK_TOPDIR)/src/closed/share/db -name "*.zip" ! -name "*demo*")) \
+			$(call not-containing,demo,$(wildcard $(JDK_TOPDIR)/src/closed/share/db/*.zip))) \
 		      $(JDK_IMAGE_DIR)/db/README-JDK.html
 
 endif
@@ -527,7 +530,7 @@
 ################################################################################
 # /include dir
 
-$(foreach f,$(shell $(FIND) $(JDK_OUTPUTDIR)/include -type f),\
+$(foreach f,$(call CacheFind,$(JDK_OUTPUTDIR)/include),\
     $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR),$f,JDK_INCLUDE_TARGETS)))
 
 ################################################################################
@@ -626,8 +629,7 @@
 
 ifneq ($(POST_STRIP_CMD),)
     ifeq ($(OPENJDK_TARGET_OS), windows)
-        EXEC_LIST_BIN:=$(shell $(FIND) $(JDK_OUTPUTDIR)/bin -type f -name \*.exe \
-		-o -name \*.dll | $(EGREP) -v -i "$(MSVCR_DLL)")
+        EXEC_LIST_BIN:=$(filter-out %$(notdir $(MSVCR_DLL)),$(filter %.exe %.dll,$(ALL_BIN_LIST)))
     else
         # Find all executables in JDK_OUTPUTDIR since they exist when this makefile is parsed
         EXEC_LIST_BIN:=$(shell $(FILE) `$(FIND) $(JDK_OUTPUTDIR)/bin -type f -name \*$(EXE_SUFFIX)` \
--- a/jdk/makefiles/Import.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/makefiles/Import.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -170,18 +170,11 @@
 $(INSTALL_LIBRARIES_HERE)/server/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
 	$(MKDIR) -p $(@D)
 	$(RM) $@
-ifeq (REALLY_WEIRD,1)
-	$(LN) -s ../$(@F) $@
-else
-#
-# TODO: Check if this is what they really want...a zip containing a symlink
-#
 	$(RM) $@.tmp $(basename $@).debuginfo
 	$(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
-	$(ZIP) -q -y $@.tmp $(basename $@).debuginfo
+	$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
 	$(RM) $(basename $@).debuginfo
 	$(MV) $@.tmp $@
-endif
 
 $(INSTALL_LIBRARIES_HERE)/client/%$(SHARED_LIBRARY_SUFFIX) : $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
 	$(MKDIR) -p $(@D)
@@ -196,18 +189,11 @@
 $(INSTALL_LIBRARIES_HERE)/client/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
 	$(MKDIR) -p $(@D)
 	$(RM) $@
-ifeq (REALLY_WEIRD,1)
-	$(LN) -s ../$(@F) $@
-else
-#
-# TODO: Check if this is what they really want...a zip containing a symlink
-#
 	$(RM) $@.tmp $(basename $@).debuginfo
 	$(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
-	$(ZIP) -q -y $@.tmp $(basename $@).debuginfo
+	$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
 	$(RM) $(basename $@).debuginfo
 	$(MV) $@.tmp $@
-endif
 
 #######
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/makefiles/SignJars.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -0,0 +1,104 @@
+#
+# Copyright (c) 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.  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.
+#
+
+include $(SPEC)
+include MakeBase.gmk
+
+# (The terms "OpenJDK" and "JDK" below refer to OpenJDK and Oracle JDK 
+# builds respectively.)
+#
+# JCE builds are very different between OpenJDK and JDK.  The OpenJDK JCE
+# jar files do not require signing, but those for JDK do.  If an unsigned
+# jar file is installed into JDK, things will break when the crypto
+# routines are called.
+#
+# All jars are created in CreateJars.gmk. This Makefile does the signing
+# of the jars for JDK.
+#
+# For JDK, the binaries use pre-built/pre-signed binary files stored in
+# the closed workspace that are not shipped in the OpenJDK workspaces.
+# We still build the JDK files to verify the files compile, and in
+# preparation for possible signing.  Developers working on JCE in JDK
+# must sign the JCE files before testing.  The JCE signing key is kept
+# separate from the JDK workspace to prevent its disclosure.
+#
+# SPECIAL NOTE TO JCE/JDK developers:  The source files must eventually
+# be built, signed, and then the resulting jar files MUST BE CHECKED
+# INTO THE CLOSED PART OF THE WORKSPACE*.  This separate step *MUST NOT
+# BE FORGOTTEN*, otherwise a bug fixed in the source code will not be
+# reflected in the shipped binaries.  The "sign-jars" target in the top
+# level Makefile should be used to generate the required files.
+#
+
+# Default target
+all:
+
+ifndef OPENJDK
+
+README-MAKEFILE_WARNING := \
+    "\nPlease read makefiles/SignJars.gmk for further build instructions.\n"
+
+#
+# Location for JCE codesigning key.
+#
+SIGNING_KEY_DIR    := /security/ws/JCE-signing/src
+SIGNING_KEYSTORE   := $(SIGNING_KEY_DIR)/KeyStore.jks
+SIGNING_PASSPHRASE := $(SIGNING_KEY_DIR)/passphrase.txt
+SIGNING_ALIAS      := oracle_jce_rsa
+
+#
+# Defines for signing the various jar files.
+#
+check-keystore:
+	@if [ ! -f $(SIGNING_KEYSTORE) -o ! -f $(SIGNING_PASSPHRASE) ]; then \
+	    $(PRINTF) "\n$(SIGNING_KEYSTORE): Signing mechanism *NOT* available..."; \
+	    $(PRINTF) $(README-MAKEFILE_WARNING); \
+	    exit 2; \
+	fi
+
+$(JCE_OUTPUTDIR)/%: $(IMAGES_OUTPUTDIR)/unsigned/%
+	$(MKDIR) -p $(@D)
+	$(CP) $< $@
+	$(JARSIGNER) -keystore $(SIGNING_KEYSTORE) \
+	    $@ $(SIGNING_ALIAS) < $(SIGNING_PASSPHRASE)
+	@$(PRINTF) "\nJar codesigning finished.\n"
+
+JAR_LIST := jce.jar \
+            local_policy.jar \
+            sunec.jar \
+            sunjce_provider.jar \
+            sunpkcs11.jar \
+            US_export_policy.jar
+
+SIGNED_JARS := $(addprefix $(JCE_OUTPUTDIR)/,$(JAR_LIST))
+
+$(SIGNED_JARS): check-keystore
+
+all: $(SIGNED_JARS)
+	@$(PRINTF) "\n***The jar files built by the 'jar-sign' target must***"
+	@$(PRINTF) "\n***still be checked into the closed workspace!     ***"
+	@$(PRINTF)  $(README-MAKEFILE_WARNING)
+
+endif  # !OPENJDK
--- a/jdk/makefiles/Tools.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/makefiles/Tools.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -23,15 +23,25 @@
 # questions.
 #
 
+# Cache all finds needed for this file. Only used on windows.
+$(eval $(call FillCacheFind,$(JDK_TOPDIR)/make/tools \
+    $(JDK_TOPDIR)/src/solaris/classes \
+    $(JDK_TOPDIR)/makefiles/sun))
+
+TOOLS_SRC:=$(JDK_TOPDIR)/make/tools/src \
+           $(JDK_TOPDIR)/makefiles/sun/awt/X11 \
+           $(JDK_TOPDIR)/makefiles/sun/osxapp \
+           $(JDK_TOPDIR)/make/tools/swing-beans
+
+ifneq ($(OPENJDK_TARGET_OS),windows)
+  TOOLS_SRC+=$(JDK_TOPDIR)/src/solaris/classes/sun/awt/X11/generator
+endif
+
 # The exception handling of swing beaninfo which have the own tool directory
 ifeq (,$(BUILD_TOOLS))
 $(eval $(call SetupJavaCompilation,BUILD_TOOLS,\
                 SETUP:=GENERATE_OLDBYTECODE,\
-		SRC:=$(JDK_TOPDIR)/make/tools/src \
-                     $(JDK_TOPDIR)/src/solaris/classes/sun/awt/X11/generator \
-                     $(JDK_TOPDIR)/makefiles/sun/awt/X11 \
-                     $(JDK_TOPDIR)/makefiles/sun/osxapp \
-                     $(JDK_TOPDIR)/make/tools/swing-beans,\
+		SRC:=$(TOOLS_SRC),\
 		BIN:=$(JDK_OUTPUTDIR)/btclasses))
 
 endif
--- a/jdk/src/share/classes/java/io/FileSystem.java	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/src/share/classes/java/io/FileSystem.java	Wed Jul 05 18:36:58 2017 +0200
@@ -25,6 +25,7 @@
 
 package java.io;
 
+import java.lang.annotation.Native;
 
 /**
  * Package-private abstract class for the local filesystem abstraction.
@@ -98,10 +99,10 @@
     /* -- Attribute accessors -- */
 
     /* Constants for simple boolean attributes */
-    public static final int BA_EXISTS    = 0x01;
-    public static final int BA_REGULAR   = 0x02;
-    public static final int BA_DIRECTORY = 0x04;
-    public static final int BA_HIDDEN    = 0x08;
+    @Native public static final int BA_EXISTS    = 0x01;
+    @Native public static final int BA_REGULAR   = 0x02;
+    @Native public static final int BA_DIRECTORY = 0x04;
+    @Native public static final int BA_HIDDEN    = 0x08;
 
     /**
      * Return the simple boolean attributes for the file or directory denoted
@@ -110,9 +111,9 @@
      */
     public abstract int getBooleanAttributes(File f);
 
-    public static final int ACCESS_READ    = 0x04;
-    public static final int ACCESS_WRITE   = 0x02;
-    public static final int ACCESS_EXECUTE = 0x01;
+    @Native public static final int ACCESS_READ    = 0x04;
+    @Native public static final int ACCESS_WRITE   = 0x02;
+    @Native public static final int ACCESS_EXECUTE = 0x01;
 
     /**
      * Check whether the file or directory denoted by the given abstract
@@ -203,9 +204,9 @@
     public abstract File[] listRoots();
 
     /* -- Disk usage -- */
-    public static final int SPACE_TOTAL  = 0;
-    public static final int SPACE_FREE   = 1;
-    public static final int SPACE_USABLE = 2;
+    @Native public static final int SPACE_TOTAL  = 0;
+    @Native public static final int SPACE_FREE   = 1;
+    @Native public static final int SPACE_USABLE = 2;
 
     public abstract long getSpace(File f, int t);
 
--- a/jdk/src/share/classes/java/lang/Integer.java	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/src/share/classes/java/lang/Integer.java	Wed Jul 05 18:36:58 2017 +0200
@@ -25,6 +25,7 @@
 
 package java.lang;
 
+import java.lang.annotation.Native;
 import java.util.Properties;
 
 /**
@@ -54,13 +55,13 @@
      * A constant holding the minimum value an {@code int} can
      * have, -2<sup>31</sup>.
      */
-    public static final int   MIN_VALUE = 0x80000000;
+    @Native public static final int   MIN_VALUE = 0x80000000;
 
     /**
      * A constant holding the maximum value an {@code int} can
      * have, 2<sup>31</sup>-1.
      */
-    public static final int   MAX_VALUE = 0x7fffffff;
+    @Native public static final int   MAX_VALUE = 0x7fffffff;
 
     /**
      * The {@code Class} instance representing the primitive type
@@ -1295,7 +1296,7 @@
      *
      * @since 1.5
      */
-    public static final int SIZE = 32;
+    @Native public static final int SIZE = 32;
 
     /**
      * The number of bytes used to represent a {@code int} value in two's
@@ -1513,5 +1514,5 @@
     }
 
     /** use serialVersionUID from JDK 1.0.2 for interoperability */
-    private static final long serialVersionUID = 1360826667806852920L;
+    @Native private static final long serialVersionUID = 1360826667806852920L;
 }
--- a/jdk/src/share/classes/java/lang/Long.java	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/src/share/classes/java/lang/Long.java	Wed Jul 05 18:36:58 2017 +0200
@@ -25,6 +25,7 @@
 
 package java.lang;
 
+import java.lang.annotation.Native;
 import java.math.*;
 
 /**
@@ -54,13 +55,13 @@
      * A constant holding the minimum value a {@code long} can
      * have, -2<sup>63</sup>.
      */
-    public static final long MIN_VALUE = 0x8000000000000000L;
+    @Native public static final long MIN_VALUE = 0x8000000000000000L;
 
     /**
      * A constant holding the maximum value a {@code long} can
      * have, 2<sup>63</sup>-1.
      */
-    public static final long MAX_VALUE = 0x7fffffffffffffffL;
+    @Native public static final long MAX_VALUE = 0x7fffffffffffffffL;
 
     /**
      * The {@code Class} instance representing the primitive type
@@ -1317,7 +1318,7 @@
      *
      * @since 1.5
      */
-    public static final int SIZE = 64;
+    @Native public static final int SIZE = 64;
 
     /**
      * The number of bytes used to represent a {@code long} value in two's
@@ -1540,5 +1541,5 @@
     }
 
     /** use serialVersionUID from JDK 1.0.2 for interoperability */
-    private static final long serialVersionUID = 4290774380558885855L;
+    @Native private static final long serialVersionUID = 4290774380558885855L;
 }
--- a/jdk/src/share/classes/java/net/SocketOptions.java	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/src/share/classes/java/net/SocketOptions.java	Wed Jul 05 18:36:58 2017 +0200
@@ -25,6 +25,8 @@
 
 package java.net;
 
+import java.lang.annotation.Native;
+
 /**
  * Interface of methods to get/set socket options.  This interface is
  * implemented by: <B>SocketImpl</B> and  <B>DatagramSocketImpl</B>.
@@ -137,7 +139,7 @@
      * @see Socket#getTcpNoDelay
      */
 
-    public final static int TCP_NODELAY = 0x0001;
+    @Native public final static int TCP_NODELAY = 0x0001;
 
     /**
      * Fetch the local address binding of a socket (this option cannot
@@ -158,7 +160,7 @@
      * @see DatagramSocket#getLocalAddress
      */
 
-    public final static int SO_BINDADDR = 0x000F;
+    @Native public final static int SO_BINDADDR = 0x000F;
 
     /** Sets SO_REUSEADDR for a socket.  This is used only for MulticastSockets
      * in java, and it is set by default for MulticastSockets.
@@ -166,7 +168,7 @@
      * Valid for: DatagramSocketImpl
      */
 
-    public final static int SO_REUSEADDR = 0x04;
+    @Native public final static int SO_REUSEADDR = 0x04;
 
     /**
      * Sets SO_BROADCAST for a socket. This option enables and disables
@@ -177,7 +179,7 @@
      * @since 1.4
      */
 
-    public final static int SO_BROADCAST = 0x0020;
+    @Native public final static int SO_BROADCAST = 0x0020;
 
     /** Set which outgoing interface on which to send multicast packets.
      * Useful on hosts with multiple network interfaces, where applications
@@ -189,7 +191,7 @@
      * @see MulticastSocket#getInterface()
      */
 
-    public final static int IP_MULTICAST_IF = 0x10;
+    @Native public final static int IP_MULTICAST_IF = 0x10;
 
     /** Same as above. This option is introduced so that the behaviour
      *  with IP_MULTICAST_IF will be kept the same as before, while
@@ -201,7 +203,7 @@
      * @see MulticastSocket#getNetworkInterface()
      * @since 1.4
      */
-    public final static int IP_MULTICAST_IF2 = 0x1f;
+    @Native public final static int IP_MULTICAST_IF2 = 0x1f;
 
     /**
      * This option enables or disables local loopback of multicast datagrams.
@@ -209,7 +211,7 @@
      * @since 1.4
      */
 
-    public final static int IP_MULTICAST_LOOP = 0x12;
+    @Native public final static int IP_MULTICAST_LOOP = 0x12;
 
     /**
      * This option sets the type-of-service or traffic class field
@@ -217,7 +219,7 @@
      * @since 1.4
      */
 
-    public final static int IP_TOS = 0x3;
+    @Native public final static int IP_TOS = 0x3;
 
     /**
      * Specify a linger-on-close timeout.  This option disables/enables
@@ -235,7 +237,7 @@
      * @see Socket#setSoLinger
      * @see Socket#getSoLinger
      */
-    public final static int SO_LINGER = 0x0080;
+    @Native public final static int SO_LINGER = 0x0080;
 
     /** Set a timeout on blocking Socket operations:
      * <PRE>
@@ -256,7 +258,7 @@
      * @see ServerSocket#setSoTimeout
      * @see DatagramSocket#setSoTimeout
      */
-    public final static int SO_TIMEOUT = 0x1006;
+    @Native public final static int SO_TIMEOUT = 0x1006;
 
     /**
      * Set a hint the size of the underlying buffers used by the
@@ -273,7 +275,7 @@
      * @see DatagramSocket#setSendBufferSize
      * @see DatagramSocket#getSendBufferSize
      */
-    public final static int SO_SNDBUF = 0x1001;
+    @Native public final static int SO_SNDBUF = 0x1001;
 
     /**
      * Set a hint the size of the underlying buffers used by the
@@ -291,7 +293,7 @@
      * @see DatagramSocket#setReceiveBufferSize
      * @see DatagramSocket#getReceiveBufferSize
      */
-    public final static int SO_RCVBUF = 0x1002;
+    @Native public final static int SO_RCVBUF = 0x1002;
 
     /**
      * When the keepalive option is set for a TCP socket and no data
@@ -314,7 +316,7 @@
      * @see Socket#setKeepAlive
      * @see Socket#getKeepAlive
      */
-    public final static int SO_KEEPALIVE = 0x0008;
+    @Native public final static int SO_KEEPALIVE = 0x0008;
 
     /**
      * When the OOBINLINE option is set, any TCP urgent data received on
@@ -325,5 +327,5 @@
      * @see Socket#setOOBInline
      * @see Socket#getOOBInline
      */
-    public final static int SO_OOBINLINE = 0x1003;
+    @Native public final static int SO_OOBINLINE = 0x1003;
 }
--- a/jdk/src/share/classes/sun/nio/ch/IOStatus.java	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/src/share/classes/sun/nio/ch/IOStatus.java	Wed Jul 05 18:36:58 2017 +0200
@@ -25,6 +25,7 @@
 
 package sun.nio.ch;
 
+import java.lang.annotation.Native;
 
 // Constants for reporting I/O status
 
@@ -32,12 +33,12 @@
 
     private IOStatus() { }
 
-    public static final int EOF = -1;              // End of file
-    public static final int UNAVAILABLE = -2;      // Nothing available (non-blocking)
-    public static final int INTERRUPTED = -3;      // System call interrupted
-    public static final int UNSUPPORTED = -4;      // Operation not supported
-    public static final int THROWN = -5;           // Exception thrown in JNI code
-    public static final int UNSUPPORTED_CASE = -6; // This case not supported
+    @Native public static final int EOF = -1;              // End of file
+    @Native public static final int UNAVAILABLE = -2;      // Nothing available (non-blocking)
+    @Native public static final int INTERRUPTED = -3;      // System call interrupted
+    @Native public static final int UNSUPPORTED = -4;      // Operation not supported
+    @Native public static final int THROWN = -5;           // Exception thrown in JNI code
+    @Native public static final int UNSUPPORTED_CASE = -6; // This case not supported
 
     // The following two methods are for use in try/finally blocks where a
     // status value needs to be normalized before being returned to the invoker
--- a/jdk/src/share/classes/sun/util/resources/sq/LocaleNames_sq.properties	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/src/share/classes/sun/util/resources/sq/LocaleNames_sq.properties	Wed Jul 05 18:36:58 2017 +0200
@@ -1,4 +1,4 @@
-# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
@@ -38,7 +38,7 @@
 # language names
 # key is ISO 639 language code
 
-sq=shqipe
+sq=shqip
 
 # country names
 # key is ISO 3166 country code
--- a/jdk/src/share/demo/jfc/CodePointIM/CodePointInputMethod.java	Wed Jan 16 22:17:36 2013 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,499 +0,0 @@
-/*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *   - Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *
- *   - Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *
- *   - Neither the name of Oracle nor the names of its
- *     contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This source code is provided to illustrate the usage of a given feature
- * or technique and has been deliberately simplified. Additional steps
- * required for a production-quality application, such as security checks,
- * input validation and proper error handling, might not be present in
- * this sample code.
- */
-
-package com.sun.inputmethods.internal.codepointim;
-
-
-import java.awt.AWTEvent;
-import java.awt.Toolkit;
-import java.awt.Rectangle;
-import java.awt.event.InputMethodEvent;
-import java.awt.event.KeyEvent;
-import java.awt.font.TextAttribute;
-import java.awt.font.TextHitInfo;
-import java.awt.im.InputMethodHighlight;
-import java.awt.im.spi.InputMethod;
-import java.awt.im.spi.InputMethodContext;
-import java.io.IOException;
-import java.text.AttributedString;
-import java.util.Locale;
-
-
-/**
- * The Code Point Input Method is a simple input method that allows Unicode
- * characters to be entered using their code point or code unit values. See the
- * accompanying file README.txt for more information.
- *
- * @author Brian Beck
- */
-public class CodePointInputMethod implements InputMethod {
-
-    private static final int UNSET = 0;
-    private static final int ESCAPE = 1; // \u0000       - \uFFFF
-    private static final int SPECIAL_ESCAPE = 2; // \U000000     - \U10FFFF
-    private static final int SURROGATE_PAIR = 3; // \uD800\uDC00 - \uDBFF\uDFFF
-    private InputMethodContext context;
-    private Locale locale;
-    private StringBuffer buffer;
-    private int insertionPoint;
-    private int format = UNSET;
-
-    public CodePointInputMethod() throws IOException {
-    }
-
-    /**
-     * This is the input method's main routine.  The composed text is stored
-     * in buffer.
-     */
-    public void dispatchEvent(AWTEvent event) {
-        // This input method handles KeyEvent only.
-        if (!(event instanceof KeyEvent)) {
-            return;
-        }
-
-        KeyEvent e = (KeyEvent) event;
-        int eventID = event.getID();
-        boolean notInCompositionMode = buffer.length() == 0;
-
-        if (eventID == KeyEvent.KEY_PRESSED) {
-            // If we are not in composition mode, pass through
-            if (notInCompositionMode) {
-                return;
-            }
-
-            switch (e.getKeyCode()) {
-                case KeyEvent.VK_LEFT:
-                    moveCaretLeft();
-                    break;
-                case KeyEvent.VK_RIGHT:
-                    moveCaretRight();
-                    break;
-            }
-        } else if (eventID == KeyEvent.KEY_TYPED) {
-            char c = e.getKeyChar();
-
-            // If we are not in composition mode, wait a back slash
-            if (notInCompositionMode) {
-                // If the type character is not a back slash, pass through
-                if (c != '\\') {
-                    return;
-                }
-
-                startComposition();     // Enter to composition mode
-            } else {
-                switch (c) {
-                    case ' ':       // Exit from composition mode
-                        finishComposition();
-                        break;
-                    case '\u007f':  // Delete
-                        deleteCharacter();
-                        break;
-                    case '\b':      // BackSpace
-                        deletePreviousCharacter();
-                        break;
-                    case '\u001b':  // Escape
-                        cancelComposition();
-                        break;
-                    case '\n':      // Return
-                    case '\t':      // Tab
-                        sendCommittedText();
-                        break;
-                    default:
-                        composeUnicodeEscape(c);
-                        break;
-                }
-            }
-        } else {  // KeyEvent.KEY_RELEASED
-            // If we are not in composition mode, pass through
-            if (notInCompositionMode) {
-                return;
-            }
-        }
-
-        e.consume();
-    }
-
-    private void composeUnicodeEscape(char c) {
-        switch (buffer.length()) {
-            case 1:  // \\
-                waitEscapeCharacter(c);
-                break;
-            case 2:  // \\u or \\U
-            case 3:  // \\ux or \\Ux
-            case 4:  // \\uxx or \\Uxx
-                waitDigit(c);
-                break;
-            case 5:  // \\uxxx or \\Uxxx
-                if (format == SPECIAL_ESCAPE) {
-                    waitDigit(c);
-                } else {
-                    waitDigit2(c);
-                }
-                break;
-            case 6:  // \\uxxxx or \\Uxxxx
-                if (format == SPECIAL_ESCAPE) {
-                    waitDigit(c);
-                } else if (format == SURROGATE_PAIR) {
-                    waitBackSlashOrLowSurrogate(c);
-                } else {
-                    beep();
-                }
-                break;
-            case 7:  // \\Uxxxxx
-                // Only SPECIAL_ESCAPE format uses this state.
-                // Since the second "\\u" of SURROGATE_PAIR format is inserted
-                // automatically, users don't have to type these keys.
-                waitDigit(c);
-                break;
-            case 8:  // \\uxxxx\\u
-            case 9:  // \\uxxxx\\ux
-            case 10: // \\uxxxx\\uxx
-            case 11: // \\uxxxx\\uxxx
-                if (format == SURROGATE_PAIR) {
-                    waitDigit(c);
-                } else {
-                    beep();
-                }
-                break;
-            default:
-                beep();
-                break;
-        }
-    }
-
-    private void waitEscapeCharacter(char c) {
-        if (c == 'u' || c == 'U') {
-            buffer.append(c);
-            insertionPoint++;
-            sendComposedText();
-            format = (c == 'u') ? ESCAPE : SPECIAL_ESCAPE;
-        } else {
-            if (c != '\\') {
-                buffer.append(c);
-                insertionPoint++;
-            }
-            sendCommittedText();
-        }
-    }
-
-    private void waitDigit(char c) {
-        if (Character.digit(c, 16) != -1) {
-            buffer.insert(insertionPoint++, c);
-            sendComposedText();
-        } else {
-            beep();
-        }
-    }
-
-    private void waitDigit2(char c) {
-        if (Character.digit(c, 16) != -1) {
-            buffer.insert(insertionPoint++, c);
-            char codePoint = (char) getCodePoint(buffer, 2, 5);
-            if (Character.isHighSurrogate(codePoint)) {
-                format = SURROGATE_PAIR;
-                buffer.append("\\u");
-                insertionPoint = 8;
-            } else {
-                format = ESCAPE;
-            }
-            sendComposedText();
-        } else {
-            beep();
-        }
-    }
-
-    private void waitBackSlashOrLowSurrogate(char c) {
-        if (insertionPoint == 6) {
-            if (c == '\\') {
-                buffer.append(c);
-                buffer.append('u');
-                insertionPoint = 8;
-                sendComposedText();
-            } else if (Character.digit(c, 16) != -1) {
-                buffer.append("\\u");
-                buffer.append(c);
-                insertionPoint = 9;
-                sendComposedText();
-            } else {
-                beep();
-            }
-        } else {
-            beep();
-        }
-    }
-
-    /**
-     * Send the composed text to the client.
-     */
-    private void sendComposedText() {
-        AttributedString as = new AttributedString(buffer.toString());
-        as.addAttribute(TextAttribute.INPUT_METHOD_HIGHLIGHT,
-                InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT);
-        context.dispatchInputMethodEvent(
-                InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
-                as.getIterator(), 0,
-                TextHitInfo.leading(insertionPoint), null);
-    }
-
-    /**
-     * Send the committed text to the client.
-     */
-    private void sendCommittedText() {
-        AttributedString as = new AttributedString(buffer.toString());
-        context.dispatchInputMethodEvent(
-                InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
-                as.getIterator(), buffer.length(),
-                TextHitInfo.leading(insertionPoint), null);
-
-        buffer.setLength(0);
-        insertionPoint = 0;
-        format = UNSET;
-    }
-
-    /**
-     * Move the insertion point one position to the left in the composed text.
-     * Do not let the caret move to the left of the "\\u" or "\\U".
-     */
-    private void moveCaretLeft() {
-        int len = buffer.length();
-        if (--insertionPoint < 2) {
-            insertionPoint++;
-            beep();
-        } else if (format == SURROGATE_PAIR && insertionPoint == 7) {
-            insertionPoint = 8;
-            beep();
-        }
-
-        context.dispatchInputMethodEvent(
-                InputMethodEvent.CARET_POSITION_CHANGED,
-                null, 0,
-                TextHitInfo.leading(insertionPoint), null);
-    }
-
-    /**
-     * Move the insertion point one position to the right in the composed text.
-     */
-    private void moveCaretRight() {
-        int len = buffer.length();
-        if (++insertionPoint > len) {
-            insertionPoint = len;
-            beep();
-        }
-
-        context.dispatchInputMethodEvent(
-                InputMethodEvent.CARET_POSITION_CHANGED,
-                null, 0,
-                TextHitInfo.leading(insertionPoint), null);
-    }
-
-    /**
-     * Delete the character preceding the insertion point in the composed text.
-     * If the insertion point is not at the end of the composed text and the
-     * preceding text is "\\u" or "\\U", ring the bell.
-     */
-    private void deletePreviousCharacter() {
-        if (insertionPoint == 2) {
-            if (buffer.length() == 2) {
-                cancelComposition();
-            } else {
-                // Do not allow deletion of the leading "\\u" or "\\U" if there
-                // are other digits in the composed text.
-                beep();
-            }
-        } else if (insertionPoint == 8) {
-            if (buffer.length() == 8) {
-                if (format == SURROGATE_PAIR) {
-                    buffer.deleteCharAt(--insertionPoint);
-                }
-                buffer.deleteCharAt(--insertionPoint);
-                sendComposedText();
-            } else {
-                // Do not allow deletion of the second "\\u" if there are other
-                // digits in the composed text.
-                beep();
-            }
-        } else {
-            buffer.deleteCharAt(--insertionPoint);
-            if (buffer.length() == 0) {
-                sendCommittedText();
-            } else {
-                sendComposedText();
-            }
-        }
-    }
-
-    /**
-     * Delete the character following the insertion point in the composed text.
-     * If the insertion point is at the end of the composed text, ring the bell.
-     */
-    private void deleteCharacter() {
-        if (insertionPoint < buffer.length()) {
-            buffer.deleteCharAt(insertionPoint);
-            sendComposedText();
-        } else {
-            beep();
-        }
-    }
-
-    private void startComposition() {
-        buffer.append('\\');
-        insertionPoint = 1;
-        sendComposedText();
-    }
-
-    private void cancelComposition() {
-        buffer.setLength(0);
-        insertionPoint = 0;
-        sendCommittedText();
-    }
-
-    private void finishComposition() {
-        int len = buffer.length();
-        if (len == 6 && format != SPECIAL_ESCAPE) {
-            char codePoint = (char) getCodePoint(buffer, 2, 5);
-            if (Character.isValidCodePoint(codePoint) && codePoint != 0xFFFF) {
-                buffer.setLength(0);
-                buffer.append(codePoint);
-                sendCommittedText();
-                return;
-            }
-        } else if (len == 8 && format == SPECIAL_ESCAPE) {
-            int codePoint = getCodePoint(buffer, 2, 7);
-            if (Character.isValidCodePoint(codePoint) && codePoint != 0xFFFF) {
-                buffer.setLength(0);
-                buffer.appendCodePoint(codePoint);
-                sendCommittedText();
-                return;
-            }
-        } else if (len == 12 && format == SURROGATE_PAIR) {
-            char[] codePoint = {
-                (char) getCodePoint(buffer, 2, 5),
-                (char) getCodePoint(buffer, 8, 11)
-            };
-            if (Character.isHighSurrogate(codePoint[0]) && Character.
-                    isLowSurrogate(codePoint[1])) {
-                buffer.setLength(0);
-                buffer.append(codePoint);
-                sendCommittedText();
-                return;
-            }
-        }
-
-        beep();
-    }
-
-    private int getCodePoint(StringBuffer sb, int from, int to) {
-        int value = 0;
-        for (int i = from; i <= to; i++) {
-            value = (value << 4) + Character.digit(sb.charAt(i), 16);
-        }
-        return value;
-    }
-
-    private static void beep() {
-        Toolkit.getDefaultToolkit().beep();
-    }
-
-    public void activate() {
-        if (buffer == null) {
-            buffer = new StringBuffer(12);
-            insertionPoint = 0;
-        }
-    }
-
-    public void deactivate(boolean isTemporary) {
-        if (!isTemporary) {
-            buffer = null;
-        }
-    }
-
-    public void dispose() {
-    }
-
-    public Object getControlObject() {
-        return null;
-    }
-
-    public void endComposition() {
-        sendCommittedText();
-    }
-
-    public Locale getLocale() {
-        return locale;
-    }
-
-    public void hideWindows() {
-    }
-
-    public boolean isCompositionEnabled() {
-        // always enabled
-        return true;
-    }
-
-    public void notifyClientWindowChange(Rectangle location) {
-    }
-
-    public void reconvert() {
-        // not supported yet
-        throw new UnsupportedOperationException();
-    }
-
-    public void removeNotify() {
-    }
-
-    public void setCharacterSubsets(Character.Subset[] subsets) {
-    }
-
-    public void setCompositionEnabled(boolean enable) {
-        // not supported yet
-        throw new UnsupportedOperationException();
-    }
-
-    public void setInputMethodContext(InputMethodContext context) {
-        this.context = context;
-    }
-
-    /*
-     * The Code Point Input Method supports all locales.
-     */
-    public boolean setLocale(Locale locale) {
-        this.locale = locale;
-        return true;
-    }
-}
--- a/jdk/src/share/demo/jfc/CodePointIM/CodePointInputMethodDescriptor.java	Wed Jan 16 22:17:36 2013 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *   - Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *
- *   - Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *
- *   - Neither the name of Oracle nor the names of its
- *     contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This source code is provided to illustrate the usage of a given feature
- * or technique and has been deliberately simplified. Additional steps
- * required for a production-quality application, such as security checks,
- * input validation and proper error handling, might not be present in
- * this sample code.
- */
-
-package com.sun.inputmethods.internal.codepointim;
-
-
-import java.awt.Image;
-import java.awt.im.spi.InputMethodDescriptor;
-import java.awt.im.spi.InputMethod;
-import java.util.Locale;
-
-
-/**
- * The CodePointInputMethod is a simple input method that allows Unicode
- * characters to be entered via their hexadecimal code point values.
- *
- * The class, CodePointInputMethodDescriptor, provides information about the
- * CodePointInputMethod which allows it to be selected and loaded by the
- * Input Method Framework.
- */
-public class CodePointInputMethodDescriptor implements InputMethodDescriptor {
-
-    public CodePointInputMethodDescriptor() {
-    }
-
-    /**
-     * Creates a new instance of the Code Point input method.
-     *
-     * @return a new instance of the Code Point input method
-     * @exception Exception any exception that may occur while creating the
-     * input method instance
-     */
-    public InputMethod createInputMethod() throws Exception {
-        return new CodePointInputMethod();
-    }
-
-    /**
-     * This input method can be used by any locale.
-     */
-    public Locale[] getAvailableLocales() {
-        Locale[] locales = {
-            new Locale("", "", ""), };
-        return locales;
-    }
-
-    public synchronized String getInputMethodDisplayName(Locale inputLocale,
-            Locale displayLanguage) {
-        return "CodePoint Input Method";
-    }
-
-    public Image getInputMethodIcon(Locale inputLocale) {
-        return null;
-    }
-
-    public boolean hasDynamicLocaleList() {
-        return false;
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/demo/jfc/CodePointIM/com/sun/inputmethods/internal/codepointim/CodePointInputMethod.java	Wed Jul 05 18:36:58 2017 +0200
@@ -0,0 +1,499 @@
+/*
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+package com.sun.inputmethods.internal.codepointim;
+
+
+import java.awt.AWTEvent;
+import java.awt.Toolkit;
+import java.awt.Rectangle;
+import java.awt.event.InputMethodEvent;
+import java.awt.event.KeyEvent;
+import java.awt.font.TextAttribute;
+import java.awt.font.TextHitInfo;
+import java.awt.im.InputMethodHighlight;
+import java.awt.im.spi.InputMethod;
+import java.awt.im.spi.InputMethodContext;
+import java.io.IOException;
+import java.text.AttributedString;
+import java.util.Locale;
+
+
+/**
+ * The Code Point Input Method is a simple input method that allows Unicode
+ * characters to be entered using their code point or code unit values. See the
+ * accompanying file README.txt for more information.
+ *
+ * @author Brian Beck
+ */
+public class CodePointInputMethod implements InputMethod {
+
+    private static final int UNSET = 0;
+    private static final int ESCAPE = 1; // \u0000       - \uFFFF
+    private static final int SPECIAL_ESCAPE = 2; // \U000000     - \U10FFFF
+    private static final int SURROGATE_PAIR = 3; // \uD800\uDC00 - \uDBFF\uDFFF
+    private InputMethodContext context;
+    private Locale locale;
+    private StringBuffer buffer;
+    private int insertionPoint;
+    private int format = UNSET;
+
+    public CodePointInputMethod() throws IOException {
+    }
+
+    /**
+     * This is the input method's main routine.  The composed text is stored
+     * in buffer.
+     */
+    public void dispatchEvent(AWTEvent event) {
+        // This input method handles KeyEvent only.
+        if (!(event instanceof KeyEvent)) {
+            return;
+        }
+
+        KeyEvent e = (KeyEvent) event;
+        int eventID = event.getID();
+        boolean notInCompositionMode = buffer.length() == 0;
+
+        if (eventID == KeyEvent.KEY_PRESSED) {
+            // If we are not in composition mode, pass through
+            if (notInCompositionMode) {
+                return;
+            }
+
+            switch (e.getKeyCode()) {
+                case KeyEvent.VK_LEFT:
+                    moveCaretLeft();
+                    break;
+                case KeyEvent.VK_RIGHT:
+                    moveCaretRight();
+                    break;
+            }
+        } else if (eventID == KeyEvent.KEY_TYPED) {
+            char c = e.getKeyChar();
+
+            // If we are not in composition mode, wait a back slash
+            if (notInCompositionMode) {
+                // If the type character is not a back slash, pass through
+                if (c != '\\') {
+                    return;
+                }
+
+                startComposition();     // Enter to composition mode
+            } else {
+                switch (c) {
+                    case ' ':       // Exit from composition mode
+                        finishComposition();
+                        break;
+                    case '\u007f':  // Delete
+                        deleteCharacter();
+                        break;
+                    case '\b':      // BackSpace
+                        deletePreviousCharacter();
+                        break;
+                    case '\u001b':  // Escape
+                        cancelComposition();
+                        break;
+                    case '\n':      // Return
+                    case '\t':      // Tab
+                        sendCommittedText();
+                        break;
+                    default:
+                        composeUnicodeEscape(c);
+                        break;
+                }
+            }
+        } else {  // KeyEvent.KEY_RELEASED
+            // If we are not in composition mode, pass through
+            if (notInCompositionMode) {
+                return;
+            }
+        }
+
+        e.consume();
+    }
+
+    private void composeUnicodeEscape(char c) {
+        switch (buffer.length()) {
+            case 1:  // \\
+                waitEscapeCharacter(c);
+                break;
+            case 2:  // \\u or \\U
+            case 3:  // \\ux or \\Ux
+            case 4:  // \\uxx or \\Uxx
+                waitDigit(c);
+                break;
+            case 5:  // \\uxxx or \\Uxxx
+                if (format == SPECIAL_ESCAPE) {
+                    waitDigit(c);
+                } else {
+                    waitDigit2(c);
+                }
+                break;
+            case 6:  // \\uxxxx or \\Uxxxx
+                if (format == SPECIAL_ESCAPE) {
+                    waitDigit(c);
+                } else if (format == SURROGATE_PAIR) {
+                    waitBackSlashOrLowSurrogate(c);
+                } else {
+                    beep();
+                }
+                break;
+            case 7:  // \\Uxxxxx
+                // Only SPECIAL_ESCAPE format uses this state.
+                // Since the second "\\u" of SURROGATE_PAIR format is inserted
+                // automatically, users don't have to type these keys.
+                waitDigit(c);
+                break;
+            case 8:  // \\uxxxx\\u
+            case 9:  // \\uxxxx\\ux
+            case 10: // \\uxxxx\\uxx
+            case 11: // \\uxxxx\\uxxx
+                if (format == SURROGATE_PAIR) {
+                    waitDigit(c);
+                } else {
+                    beep();
+                }
+                break;
+            default:
+                beep();
+                break;
+        }
+    }
+
+    private void waitEscapeCharacter(char c) {
+        if (c == 'u' || c == 'U') {
+            buffer.append(c);
+            insertionPoint++;
+            sendComposedText();
+            format = (c == 'u') ? ESCAPE : SPECIAL_ESCAPE;
+        } else {
+            if (c != '\\') {
+                buffer.append(c);
+                insertionPoint++;
+            }
+            sendCommittedText();
+        }
+    }
+
+    private void waitDigit(char c) {
+        if (Character.digit(c, 16) != -1) {
+            buffer.insert(insertionPoint++, c);
+            sendComposedText();
+        } else {
+            beep();
+        }
+    }
+
+    private void waitDigit2(char c) {
+        if (Character.digit(c, 16) != -1) {
+            buffer.insert(insertionPoint++, c);
+            char codePoint = (char) getCodePoint(buffer, 2, 5);
+            if (Character.isHighSurrogate(codePoint)) {
+                format = SURROGATE_PAIR;
+                buffer.append("\\u");
+                insertionPoint = 8;
+            } else {
+                format = ESCAPE;
+            }
+            sendComposedText();
+        } else {
+            beep();
+        }
+    }
+
+    private void waitBackSlashOrLowSurrogate(char c) {
+        if (insertionPoint == 6) {
+            if (c == '\\') {
+                buffer.append(c);
+                buffer.append('u');
+                insertionPoint = 8;
+                sendComposedText();
+            } else if (Character.digit(c, 16) != -1) {
+                buffer.append("\\u");
+                buffer.append(c);
+                insertionPoint = 9;
+                sendComposedText();
+            } else {
+                beep();
+            }
+        } else {
+            beep();
+        }
+    }
+
+    /**
+     * Send the composed text to the client.
+     */
+    private void sendComposedText() {
+        AttributedString as = new AttributedString(buffer.toString());
+        as.addAttribute(TextAttribute.INPUT_METHOD_HIGHLIGHT,
+                InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT);
+        context.dispatchInputMethodEvent(
+                InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
+                as.getIterator(), 0,
+                TextHitInfo.leading(insertionPoint), null);
+    }
+
+    /**
+     * Send the committed text to the client.
+     */
+    private void sendCommittedText() {
+        AttributedString as = new AttributedString(buffer.toString());
+        context.dispatchInputMethodEvent(
+                InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
+                as.getIterator(), buffer.length(),
+                TextHitInfo.leading(insertionPoint), null);
+
+        buffer.setLength(0);
+        insertionPoint = 0;
+        format = UNSET;
+    }
+
+    /**
+     * Move the insertion point one position to the left in the composed text.
+     * Do not let the caret move to the left of the "\\u" or "\\U".
+     */
+    private void moveCaretLeft() {
+        int len = buffer.length();
+        if (--insertionPoint < 2) {
+            insertionPoint++;
+            beep();
+        } else if (format == SURROGATE_PAIR && insertionPoint == 7) {
+            insertionPoint = 8;
+            beep();
+        }
+
+        context.dispatchInputMethodEvent(
+                InputMethodEvent.CARET_POSITION_CHANGED,
+                null, 0,
+                TextHitInfo.leading(insertionPoint), null);
+    }
+
+    /**
+     * Move the insertion point one position to the right in the composed text.
+     */
+    private void moveCaretRight() {
+        int len = buffer.length();
+        if (++insertionPoint > len) {
+            insertionPoint = len;
+            beep();
+        }
+
+        context.dispatchInputMethodEvent(
+                InputMethodEvent.CARET_POSITION_CHANGED,
+                null, 0,
+                TextHitInfo.leading(insertionPoint), null);
+    }
+
+    /**
+     * Delete the character preceding the insertion point in the composed text.
+     * If the insertion point is not at the end of the composed text and the
+     * preceding text is "\\u" or "\\U", ring the bell.
+     */
+    private void deletePreviousCharacter() {
+        if (insertionPoint == 2) {
+            if (buffer.length() == 2) {
+                cancelComposition();
+            } else {
+                // Do not allow deletion of the leading "\\u" or "\\U" if there
+                // are other digits in the composed text.
+                beep();
+            }
+        } else if (insertionPoint == 8) {
+            if (buffer.length() == 8) {
+                if (format == SURROGATE_PAIR) {
+                    buffer.deleteCharAt(--insertionPoint);
+                }
+                buffer.deleteCharAt(--insertionPoint);
+                sendComposedText();
+            } else {
+                // Do not allow deletion of the second "\\u" if there are other
+                // digits in the composed text.
+                beep();
+            }
+        } else {
+            buffer.deleteCharAt(--insertionPoint);
+            if (buffer.length() == 0) {
+                sendCommittedText();
+            } else {
+                sendComposedText();
+            }
+        }
+    }
+
+    /**
+     * Delete the character following the insertion point in the composed text.
+     * If the insertion point is at the end of the composed text, ring the bell.
+     */
+    private void deleteCharacter() {
+        if (insertionPoint < buffer.length()) {
+            buffer.deleteCharAt(insertionPoint);
+            sendComposedText();
+        } else {
+            beep();
+        }
+    }
+
+    private void startComposition() {
+        buffer.append('\\');
+        insertionPoint = 1;
+        sendComposedText();
+    }
+
+    private void cancelComposition() {
+        buffer.setLength(0);
+        insertionPoint = 0;
+        sendCommittedText();
+    }
+
+    private void finishComposition() {
+        int len = buffer.length();
+        if (len == 6 && format != SPECIAL_ESCAPE) {
+            char codePoint = (char) getCodePoint(buffer, 2, 5);
+            if (Character.isValidCodePoint(codePoint) && codePoint != 0xFFFF) {
+                buffer.setLength(0);
+                buffer.append(codePoint);
+                sendCommittedText();
+                return;
+            }
+        } else if (len == 8 && format == SPECIAL_ESCAPE) {
+            int codePoint = getCodePoint(buffer, 2, 7);
+            if (Character.isValidCodePoint(codePoint) && codePoint != 0xFFFF) {
+                buffer.setLength(0);
+                buffer.appendCodePoint(codePoint);
+                sendCommittedText();
+                return;
+            }
+        } else if (len == 12 && format == SURROGATE_PAIR) {
+            char[] codePoint = {
+                (char) getCodePoint(buffer, 2, 5),
+                (char) getCodePoint(buffer, 8, 11)
+            };
+            if (Character.isHighSurrogate(codePoint[0]) && Character.
+                    isLowSurrogate(codePoint[1])) {
+                buffer.setLength(0);
+                buffer.append(codePoint);
+                sendCommittedText();
+                return;
+            }
+        }
+
+        beep();
+    }
+
+    private int getCodePoint(StringBuffer sb, int from, int to) {
+        int value = 0;
+        for (int i = from; i <= to; i++) {
+            value = (value << 4) + Character.digit(sb.charAt(i), 16);
+        }
+        return value;
+    }
+
+    private static void beep() {
+        Toolkit.getDefaultToolkit().beep();
+    }
+
+    public void activate() {
+        if (buffer == null) {
+            buffer = new StringBuffer(12);
+            insertionPoint = 0;
+        }
+    }
+
+    public void deactivate(boolean isTemporary) {
+        if (!isTemporary) {
+            buffer = null;
+        }
+    }
+
+    public void dispose() {
+    }
+
+    public Object getControlObject() {
+        return null;
+    }
+
+    public void endComposition() {
+        sendCommittedText();
+    }
+
+    public Locale getLocale() {
+        return locale;
+    }
+
+    public void hideWindows() {
+    }
+
+    public boolean isCompositionEnabled() {
+        // always enabled
+        return true;
+    }
+
+    public void notifyClientWindowChange(Rectangle location) {
+    }
+
+    public void reconvert() {
+        // not supported yet
+        throw new UnsupportedOperationException();
+    }
+
+    public void removeNotify() {
+    }
+
+    public void setCharacterSubsets(Character.Subset[] subsets) {
+    }
+
+    public void setCompositionEnabled(boolean enable) {
+        // not supported yet
+        throw new UnsupportedOperationException();
+    }
+
+    public void setInputMethodContext(InputMethodContext context) {
+        this.context = context;
+    }
+
+    /*
+     * The Code Point Input Method supports all locales.
+     */
+    public boolean setLocale(Locale locale) {
+        this.locale = locale;
+        return true;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/demo/jfc/CodePointIM/com/sun/inputmethods/internal/codepointim/CodePointInputMethodDescriptor.java	Wed Jul 05 18:36:58 2017 +0200
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+package com.sun.inputmethods.internal.codepointim;
+
+
+import java.awt.Image;
+import java.awt.im.spi.InputMethodDescriptor;
+import java.awt.im.spi.InputMethod;
+import java.util.Locale;
+
+
+/**
+ * The CodePointInputMethod is a simple input method that allows Unicode
+ * characters to be entered via their hexadecimal code point values.
+ *
+ * The class, CodePointInputMethodDescriptor, provides information about the
+ * CodePointInputMethod which allows it to be selected and loaded by the
+ * Input Method Framework.
+ */
+public class CodePointInputMethodDescriptor implements InputMethodDescriptor {
+
+    public CodePointInputMethodDescriptor() {
+    }
+
+    /**
+     * Creates a new instance of the Code Point input method.
+     *
+     * @return a new instance of the Code Point input method
+     * @exception Exception any exception that may occur while creating the
+     * input method instance
+     */
+    public InputMethod createInputMethod() throws Exception {
+        return new CodePointInputMethod();
+    }
+
+    /**
+     * This input method can be used by any locale.
+     */
+    public Locale[] getAvailableLocales() {
+        Locale[] locales = {
+            new Locale("", "", ""), };
+        return locales;
+    }
+
+    public synchronized String getInputMethodDisplayName(Locale inputLocale,
+            Locale displayLanguage) {
+        return "CodePoint Input Method";
+    }
+
+    public Image getInputMethodIcon(Locale inputLocale) {
+        return null;
+    }
+
+    public boolean hasDynamicLocaleList() {
+        return false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/solaris/classes/sun/awt/X11/generator/sizes.32	Wed Jul 05 18:36:58 2017 +0200
@@ -0,0 +1,1016 @@
+long	4
+int	4
+short	2
+ptr	4
+Bool	4
+Atom	4
+Window	4
+XExtData.number	0
+XExtData.next	4
+XExtData.free_private	8
+XExtData.private_data	12
+XExtData	16
+XIMStringConversionCallbackStruct.position	0
+XIMStringConversionCallbackStruct.direction	4
+XIMStringConversionCallbackStruct.operation	8
+XIMStringConversionCallbackStruct.factor	10
+XIMStringConversionCallbackStruct.text	12
+XIMStringConversionCallbackStruct	16
+XkbNewKeyboardNotifyEvent.type	0
+XkbNewKeyboardNotifyEvent.serial	4
+XkbNewKeyboardNotifyEvent.send_event	8
+XkbNewKeyboardNotifyEvent.display	12
+XkbNewKeyboardNotifyEvent.time	16
+XkbNewKeyboardNotifyEvent.xkb_type	20
+XkbNewKeyboardNotifyEvent.device	24
+XkbNewKeyboardNotifyEvent.old_device	28
+XkbNewKeyboardNotifyEvent.min_key_code	32
+XkbNewKeyboardNotifyEvent.max_key_code	36
+XkbNewKeyboardNotifyEvent.old_min_key_code	40
+XkbNewKeyboardNotifyEvent.old_max_key_code	44
+XkbNewKeyboardNotifyEvent.changed	48
+XkbNewKeyboardNotifyEvent.req_major	52
+XkbNewKeyboardNotifyEvent.req_minor	53
+XkbNewKeyboardNotifyEvent	56
+XTimeCoord.time	0
+XTimeCoord.x	4
+XTimeCoord.y	6
+XTimeCoord	8
+XkbCompatMapNotifyEvent.type	0
+XkbCompatMapNotifyEvent.serial	4
+XkbCompatMapNotifyEvent.send_event	8
+XkbCompatMapNotifyEvent.display	12
+XkbCompatMapNotifyEvent.time	16
+XkbCompatMapNotifyEvent.xkb_type	20
+XkbCompatMapNotifyEvent.device	24
+XkbCompatMapNotifyEvent.changed_groups	28
+XkbCompatMapNotifyEvent.first_si	32
+XkbCompatMapNotifyEvent.num_si	36
+XkbCompatMapNotifyEvent.num_total_si	40
+XkbCompatMapNotifyEvent	44
+XIMStatusDrawCallbackStruct.type	0
+XIMStatusDrawCallbackStruct.data	4
+XIMStatusDrawCallbackStruct	8
+XKeyboardControl.key_click_percent	0
+XKeyboardControl.bell_percent	4
+XKeyboardControl.bell_pitch	8
+XKeyboardControl.bell_duration	12
+XKeyboardControl.led	16
+XKeyboardControl.led_mode	20
+XKeyboardControl.key	24
+XKeyboardControl.auto_repeat_mode	28
+XKeyboardControl	32
+XSelectionClearEvent.type	0
+XSelectionClearEvent.serial	4
+XSelectionClearEvent.send_event	8
+XSelectionClearEvent.display	12
+XSelectionClearEvent.window	16
+XSelectionClearEvent.selection	20
+XSelectionClearEvent.time	24
+XSelectionClearEvent	28
+XWindowChanges.x	0
+XWindowChanges.y	4
+XWindowChanges.width	8
+XWindowChanges.height	12
+XWindowChanges.border_width	16
+XWindowChanges.sibling	20
+XWindowChanges.stack_mode	24
+XWindowChanges	28
+XIMPreeditCaretCallbackStruct.position	0
+XIMPreeditCaretCallbackStruct.direction	4
+XIMPreeditCaretCallbackStruct.style	8
+XIMPreeditCaretCallbackStruct	12
+XOMCharSetList.charset_count	0
+XOMCharSetList.charset_list	4
+XOMCharSetList	8
+XOMFontInfo.num_font	0
+XOMFontInfo.font_struct_list	4
+XOMFontInfo.font_name_list	8
+XOMFontInfo	12
+AwtScreenData.numConfigs	0
+AwtScreenData.root	4
+AwtScreenData.whitepixel	8
+AwtScreenData.blackpixel	12
+AwtScreenData.defaultConfig	16
+AwtScreenData.configs	20
+AwtScreenData	24
+XIMHotKeyTrigger.keysym	0
+XIMHotKeyTrigger.modifier	4
+XIMHotKeyTrigger.modifier_mask	8
+XIMHotKeyTrigger	12
+XCirculateEvent.type	0
+XCirculateEvent.serial	4
+XCirculateEvent.send_event	8
+XCirculateEvent.display	12
+XCirculateEvent.event	16
+XCirculateEvent.window	20
+XCirculateEvent.place	24
+XCirculateEvent	28
+Screen.ext_data	0
+Screen.display	4
+Screen.root	8
+Screen.width	12
+Screen.height	16
+Screen.mwidth	20
+Screen.mheight	24
+Screen.ndepths	28
+Screen.depths	32
+Screen.root_depth	36
+Screen.root_visual	40
+Screen.default_gc	44
+Screen.cmap	48
+Screen.white_pixel	52
+Screen.black_pixel	56
+Screen.max_maps	60
+Screen.min_maps	64
+Screen.backing_store	68
+Screen.save_unders	72
+Screen.root_input_mask	76
+Screen	80
+XMapRequestEvent.type	0
+XMapRequestEvent.serial	4
+XMapRequestEvent.send_event	8
+XMapRequestEvent.display	12
+XMapRequestEvent.parent	16
+XMapRequestEvent.window	20
+XMapRequestEvent	24
+XIMText.length	0
+XIMText.feedback	4
+XIMText.encoding_is_wchar	8
+XIMText.string	12
+XIMText	16
+XGraphicsExposeEvent.type	0
+XGraphicsExposeEvent.serial	4
+XGraphicsExposeEvent.send_event	8
+XGraphicsExposeEvent.display	12
+XGraphicsExposeEvent.drawable	16
+XGraphicsExposeEvent.x	20
+XGraphicsExposeEvent.y	24
+XGraphicsExposeEvent.width	28
+XGraphicsExposeEvent.height	32
+XGraphicsExposeEvent.count	36
+XGraphicsExposeEvent.major_code	40
+XGraphicsExposeEvent.minor_code	44
+XGraphicsExposeEvent	48
+XEvent.type	0
+XEvent.xany	0
+XEvent.xkey	0
+XEvent.xbutton	0
+XEvent.xmotion	0
+XEvent.xcrossing	0
+XEvent.xfocus	0
+XEvent.xexpose	0
+XEvent.xgraphicsexpose	0
+XEvent.xnoexpose	0
+XEvent.xvisibility	0
+XEvent.xcreatewindow	0
+XEvent.xdestroywindow	0
+XEvent.xunmap	0
+XEvent.xmap	0
+XEvent.xmaprequest	0
+XEvent.xreparent	0
+XEvent.xconfigure	0
+XEvent.xgravity	0
+XEvent.xresizerequest	0
+XEvent.xconfigurerequest	0
+XEvent.xcirculate	0
+XEvent.xcirculaterequest	0
+XEvent.xproperty	0
+XEvent.xselectionclear	0
+XEvent.xselectionrequest	0
+XEvent.xselection	0
+XEvent.xcolormap	0
+XEvent.xclient	0
+XEvent.xmapping	0
+XEvent.xerror	0
+XEvent.xkeymap	0
+XEvent.pad	0
+XEvent	96
+XRenderDirectFormat.red	0
+XRenderDirectFormat.redMask	2
+XRenderDirectFormat.green	4
+XRenderDirectFormat.greenMask	6
+XRenderDirectFormat.blue	8
+XRenderDirectFormat.blueMask	10
+XRenderDirectFormat.alpha	12
+XRenderDirectFormat.alphaMask	14
+XRenderDirectFormat	16
+ColorData.awt_Colors	0
+ColorData.awt_numICMcolors	4
+ColorData.awt_icmLUT	8
+ColorData.awt_icmLUT2Colors	12
+ColorData.img_grays	16
+ColorData.img_clr_tbl	20
+ColorData.img_oda_red	24
+ColorData.img_oda_green	28
+ColorData.img_oda_blue	32
+ColorData.pGrayInverseLutData	36
+ColorData.screendata	40
+ColorData	44
+XFontStruct.ext_data	0
+XFontStruct.fid	4
+XFontStruct.direction	8
+XFontStruct.min_char_or_byte2	12
+XFontStruct.max_char_or_byte2	16
+XFontStruct.min_byte1	20
+XFontStruct.max_byte1	24
+XFontStruct.all_chars_exist	28
+XFontStruct.n_properties	36
+XFontStruct.properties	40
+XFontStruct.min_bounds	44
+XFontStruct.max_bounds	56
+XFontStruct.per_char	68
+XFontStruct.ascent	72
+XFontStruct.descent	76
+XFontStruct	80
+XExtCodes.extension	0
+XExtCodes.major_opcode	4
+XExtCodes.first_event	8
+XExtCodes.first_error	12
+XExtCodes	16
+XFontSetExtents.max_ink_extent	0
+XFontSetExtents.max_logical_extent	8
+XFontSetExtents	16
+XSelectionEvent.type	0
+XSelectionEvent.serial	4
+XSelectionEvent.send_event	8
+XSelectionEvent.display	12
+XSelectionEvent.requestor	16
+XSelectionEvent.selection	20
+XSelectionEvent.target	24
+XSelectionEvent.property	28
+XSelectionEvent.time	32
+XSelectionEvent	36
+XArc.x	0
+XArc.y	2
+XArc.width	4
+XArc.height	6
+XArc.angle1	8
+XArc.angle2	10
+XArc	12
+XErrorEvent.type	0
+XErrorEvent.display	4
+XErrorEvent.resourceid	8
+XErrorEvent.serial	12
+XErrorEvent.error_code	16
+XErrorEvent.request_code	17
+XErrorEvent.minor_code	18
+XErrorEvent	20
+XConfigureRequestEvent.type	0
+XConfigureRequestEvent.serial	4
+XConfigureRequestEvent.send_event	8
+XConfigureRequestEvent.display	12
+XConfigureRequestEvent.parent	16
+XConfigureRequestEvent.window	20
+XConfigureRequestEvent.x	24
+XConfigureRequestEvent.y	28
+XConfigureRequestEvent.width	32
+XConfigureRequestEvent.height	36
+XConfigureRequestEvent.border_width	40
+XConfigureRequestEvent.above	44
+XConfigureRequestEvent.detail	48
+XConfigureRequestEvent.value_mask	52
+XConfigureRequestEvent	56
+ScreenFormat.ext_data	0
+ScreenFormat.depth	4
+ScreenFormat.bits_per_pixel	8
+ScreenFormat.scanline_pad	12
+ScreenFormat	16
+XButtonEvent.type	0
+XButtonEvent.serial	4
+XButtonEvent.send_event	8
+XButtonEvent.display	12
+XButtonEvent.window	16
+XButtonEvent.root	20
+XButtonEvent.subwindow	24
+XButtonEvent.time	28
+XButtonEvent.x	32
+XButtonEvent.y	36
+XButtonEvent.x_root	40
+XButtonEvent.y_root	44
+XButtonEvent.state	48
+XButtonEvent.button	52
+XButtonEvent.same_screen	56
+XButtonEvent	60
+XFontProp.name	0
+XFontProp.card32	4
+XFontProp	8
+XIMValuesList.count_values	0
+XIMValuesList.supported_values	4
+XIMValuesList	8
+XKeymapEvent.type	0
+XKeymapEvent.serial	4
+XKeymapEvent.send_event	8
+XKeymapEvent.display	12
+XKeymapEvent.window	16
+XKeymapEvent.key_vector	20
+XKeymapEvent	52
+XTextItem16.chars	0
+XTextItem16.nchars	4
+XTextItem16.delta	8
+XTextItem16.font	12
+XTextItem16	16
+XIMPreeditDrawCallbackStruct.caret	0
+XIMPreeditDrawCallbackStruct.chg_first	4
+XIMPreeditDrawCallbackStruct.chg_length	8
+XIMPreeditDrawCallbackStruct.text	12
+XIMPreeditDrawCallbackStruct	16
+XVisualInfo.visual	0
+XVisualInfo.visualid	4
+XVisualInfo.screen	8
+XVisualInfo.depth	12
+XVisualInfo.class	16
+XVisualInfo.red_mask	20
+XVisualInfo.green_mask	24
+XVisualInfo.blue_mask	28
+XVisualInfo.colormap_size	32
+XVisualInfo.bits_per_rgb	36
+XVisualInfo	40
+XkbControlsNotifyEvent.type	0
+XkbControlsNotifyEvent.serial	4
+XkbControlsNotifyEvent.send_event	8
+XkbControlsNotifyEvent.display	12
+XkbControlsNotifyEvent.time	16
+XkbControlsNotifyEvent.xkb_type	20
+XkbControlsNotifyEvent.device	24
+XkbControlsNotifyEvent.changed_ctrls	28
+XkbControlsNotifyEvent.enabled_ctrls	32
+XkbControlsNotifyEvent.enabled_ctrl_changes	36
+XkbControlsNotifyEvent.num_groups	40
+XkbControlsNotifyEvent.keycode	44
+XkbControlsNotifyEvent.event_type	45
+XkbControlsNotifyEvent.req_major	46
+XkbControlsNotifyEvent.req_minor	47
+XkbControlsNotifyEvent	48
+PropMwmHints.flags	0
+PropMwmHints.functions	4
+PropMwmHints.decorations	8
+PropMwmHints.inputMode	12
+PropMwmHints.status	16
+PropMwmHints	20
+XClientMessageEvent.type	0
+XClientMessageEvent.serial	4
+XClientMessageEvent.send_event	8
+XClientMessageEvent.display	12
+XClientMessageEvent.window	16
+XClientMessageEvent.message_type	20
+XClientMessageEvent.format	24
+XClientMessageEvent.data	28
+XClientMessageEvent	48
+XAnyEvent.type	0
+XAnyEvent.serial	4
+XAnyEvent.send_event	8
+XAnyEvent.display	12
+XAnyEvent.window	16
+XAnyEvent	20
+XkbIndicatorNotifyEvent.type	0
+XkbIndicatorNotifyEvent.serial	4
+XkbIndicatorNotifyEvent.send_event	8
+XkbIndicatorNotifyEvent.display	12
+XkbIndicatorNotifyEvent.time	16
+XkbIndicatorNotifyEvent.xkb_type	20
+XkbIndicatorNotifyEvent.device	24
+XkbIndicatorNotifyEvent.changed	28
+XkbIndicatorNotifyEvent.state	32
+XkbIndicatorNotifyEvent	36
+XIMPreeditStateNotifyCallbackStruct.state	0
+XIMPreeditStateNotifyCallbackStruct	4
+XkbAnyEvent.type	0
+XkbAnyEvent.serial	4
+XkbAnyEvent.send_event	8
+XkbAnyEvent.display	12
+XkbAnyEvent.time	16
+XkbAnyEvent.xkb_type	20
+XkbAnyEvent.device	24
+XkbAnyEvent	28
+XMotionEvent.type	0
+XMotionEvent.serial	4
+XMotionEvent.send_event	8
+XMotionEvent.display	12
+XMotionEvent.window	16
+XMotionEvent.root	20
+XMotionEvent.subwindow	24
+XMotionEvent.time	28
+XMotionEvent.x	32
+XMotionEvent.y	36
+XMotionEvent.x_root	40
+XMotionEvent.y_root	44
+XMotionEvent.state	48
+XMotionEvent.is_hint	52
+XMotionEvent.same_screen	56
+XMotionEvent	60
+XIMHotKeyTriggers.num_hot_key	0
+XIMHotKeyTriggers.key	4
+XIMHotKeyTriggers	8
+XIMStyles.count_styles	0
+XIMStyles.supported_styles	4
+XIMStyles	8
+XkbExtensionDeviceNotifyEvent.type	0
+XkbExtensionDeviceNotifyEvent.serial	4
+XkbExtensionDeviceNotifyEvent.send_event	8
+XkbExtensionDeviceNotifyEvent.display	12
+XkbExtensionDeviceNotifyEvent.time	16
+XkbExtensionDeviceNotifyEvent.xkb_type	20
+XkbExtensionDeviceNotifyEvent.device	24
+XkbExtensionDeviceNotifyEvent.reason	28
+XkbExtensionDeviceNotifyEvent.supported	32
+XkbExtensionDeviceNotifyEvent.unsupported	36
+XkbExtensionDeviceNotifyEvent.first_btn	40
+XkbExtensionDeviceNotifyEvent.num_btns	44
+XkbExtensionDeviceNotifyEvent.leds_defined	48
+XkbExtensionDeviceNotifyEvent.led_state	52
+XkbExtensionDeviceNotifyEvent.led_class	56
+XkbExtensionDeviceNotifyEvent.led_id	60
+XkbExtensionDeviceNotifyEvent	64
+XwcTextItem.chars	0
+XwcTextItem.nchars	4
+XwcTextItem.delta	8
+XwcTextItem.font_set	12
+XwcTextItem	16
+XClassHint.res_name	0
+XClassHint.res_class	4
+XClassHint	8
+XChar2b.byte1	0
+XChar2b.byte2	1
+XChar2b	2
+XSetWindowAttributes.background_pixmap	0
+XSetWindowAttributes.background_pixel	4
+XSetWindowAttributes.border_pixmap	8
+XSetWindowAttributes.border_pixel	12
+XSetWindowAttributes.bit_gravity	16
+XSetWindowAttributes.win_gravity	20
+XSetWindowAttributes.backing_store	24
+XSetWindowAttributes.backing_planes	28
+XSetWindowAttributes.backing_pixel	32
+XSetWindowAttributes.save_under	36
+XSetWindowAttributes.event_mask	40
+XSetWindowAttributes.do_not_propagate_mask	44
+XSetWindowAttributes.override_redirect	48
+XSetWindowAttributes.colormap	52
+XSetWindowAttributes.cursor	56
+XSetWindowAttributes	60
+XRenderPictFormat.id	0
+XRenderPictFormat.type	4
+XRenderPictFormat.depth	8
+XRenderPictFormat.direct	12
+XRenderPictFormat.colormap	28
+XRenderPictFormat	32
+XReparentEvent.type	0
+XReparentEvent.serial	4
+XReparentEvent.send_event	8
+XReparentEvent.display	12
+XReparentEvent.event	16
+XReparentEvent.window	20
+XReparentEvent.parent	24
+XReparentEvent.x	28
+XReparentEvent.y	32
+XReparentEvent.override_redirect	36
+XReparentEvent	40
+XCirculateRequestEvent.type	0
+XCirculateRequestEvent.serial	4
+XCirculateRequestEvent.send_event	8
+XCirculateRequestEvent.display	12
+XCirculateRequestEvent.parent	16
+XCirculateRequestEvent.window	20
+XCirculateRequestEvent.place	24
+XCirculateRequestEvent	28
+XImage.width	0
+XImage.height	4
+XImage.xoffset	8
+XImage.format	12
+XImage.data	16
+XImage.byte_order	20
+XImage.bitmap_unit	24
+XImage.bitmap_bit_order	28
+XImage.bitmap_pad	32
+XImage.depth	36
+XImage.bytes_per_line	40
+XImage.bits_per_pixel	44
+XImage.red_mask	48
+XImage.green_mask	52
+XImage.blue_mask	56
+XImage.obdata	60
+XImage.f.create_image	64
+XImage.f.destroy_image	68
+XImage.f.get_pixel	72
+XImage.f.put_pixel	76
+XImage.f.sub_image	80
+XImage.f.add_pixel	84
+XImage	88
+XKeyEvent.type	0
+XKeyEvent.serial	4
+XKeyEvent.send_event	8
+XKeyEvent.display	12
+XKeyEvent.window	16
+XKeyEvent.root	20
+XKeyEvent.subwindow	24
+XKeyEvent.time	28
+XKeyEvent.x	32
+XKeyEvent.y	36
+XKeyEvent.x_root	40
+XKeyEvent.y_root	44
+XKeyEvent.state	48
+XKeyEvent.keycode	52
+XKeyEvent.same_screen	56
+XKeyEvent	60
+XkbActionMessageEvent.type	0
+XkbActionMessageEvent.serial	4
+XkbActionMessageEvent.send_event	8
+XkbActionMessageEvent.display	12
+XkbActionMessageEvent.time	16
+XkbActionMessageEvent.xkb_type	20
+XkbActionMessageEvent.device	24
+XkbActionMessageEvent.keycode	28
+XkbActionMessageEvent.press	32
+XkbActionMessageEvent.key_event_follows	36
+XkbActionMessageEvent.group	40
+XkbActionMessageEvent.mods	44
+XkbActionMessageEvent.message	48
+XkbActionMessageEvent	56
+XdbeSwapInfo.swap_window	0
+XdbeSwapInfo.swap_action	4
+XdbeSwapInfo	8
+XTextItem.chars	0
+XTextItem.nchars	4
+XTextItem.delta	8
+XTextItem.font	12
+XTextItem	16
+XModifierKeymap.max_keypermod	0
+XModifierKeymap.modifiermap	4
+XModifierKeymap	8
+XCharStruct.lbearing	0
+XCharStruct.rbearing	2
+XCharStruct.width	4
+XCharStruct.ascent	6
+XCharStruct.descent	8
+XCharStruct.attributes	10
+XCharStruct	12
+XGravityEvent.type	0
+XGravityEvent.serial	4
+XGravityEvent.send_event	8
+XGravityEvent.display	12
+XGravityEvent.event	16
+XGravityEvent.window	20
+XGravityEvent.x	24
+XGravityEvent.y	28
+XGravityEvent	32
+Visual.ext_data	0
+Visual.visualid	4
+Visual.class	8
+Visual.red_mask	12
+Visual.green_mask	16
+Visual.blue_mask	20
+Visual.bits_per_rgb	24
+Visual.map_entries	28
+Visual	32
+XOMOrientation.num_orientation	0
+XOMOrientation.orientation	4
+XOMOrientation	8
+XkbAccessXNotifyEvent.type	0
+XkbAccessXNotifyEvent.serial	4
+XkbAccessXNotifyEvent.send_event	8
+XkbAccessXNotifyEvent.display	12
+XkbAccessXNotifyEvent.time	16
+XkbAccessXNotifyEvent.xkb_type	20
+XkbAccessXNotifyEvent.device	24
+XkbAccessXNotifyEvent.detail	28
+XkbAccessXNotifyEvent.keycode	32
+XkbAccessXNotifyEvent.sk_delay	36
+XkbAccessXNotifyEvent.debounce_delay	40
+XkbAccessXNotifyEvent	44
+XWindowAttributes.x	0
+XWindowAttributes.y	4
+XWindowAttributes.width	8
+XWindowAttributes.height	12
+XWindowAttributes.border_width	16
+XWindowAttributes.depth	20
+XWindowAttributes.visual	24
+XWindowAttributes.root	28
+XWindowAttributes.class	32
+XWindowAttributes.bit_gravity	36
+XWindowAttributes.win_gravity	40
+XWindowAttributes.backing_store	44
+XWindowAttributes.backing_planes	48
+XWindowAttributes.backing_pixel	52
+XWindowAttributes.save_under	56
+XWindowAttributes.colormap	60
+XWindowAttributes.map_installed	64
+XWindowAttributes.map_state	68
+XWindowAttributes.all_event_masks	72
+XWindowAttributes.your_event_mask	76
+XWindowAttributes.do_not_propagate_mask	80
+XWindowAttributes.override_redirect	84
+XWindowAttributes.screen	88
+XWindowAttributes	92
+XmbTextItem.chars	0
+XmbTextItem.nchars	4
+XmbTextItem.delta	8
+XmbTextItem.font_set	12
+XmbTextItem	16
+XMappingEvent.type	0
+XMappingEvent.serial	4
+XMappingEvent.send_event	8
+XMappingEvent.display	12
+XMappingEvent.window	16
+XMappingEvent.request	20
+XMappingEvent.first_keycode	24
+XMappingEvent.count	28
+XMappingEvent	32
+XSizeHints.flags	0
+XSizeHints.x	4
+XSizeHints.y	8
+XSizeHints.width	12
+XSizeHints.height	16
+XSizeHints.min_width	20
+XSizeHints.min_height	24
+XSizeHints.max_width	28
+XSizeHints.max_height	32
+XSizeHints.width_inc	36
+XSizeHints.height_inc	40
+XSizeHints.min_aspect.x	44
+XSizeHints.min_aspect.y	48
+XSizeHints.max_aspect.x	52
+XSizeHints.max_aspect.y	56
+XSizeHints.base_width	60
+XSizeHints.base_height	64
+XSizeHints.win_gravity	68
+XSizeHints	72
+XUnmapEvent.type	0
+XUnmapEvent.serial	4
+XUnmapEvent.send_event	8
+XUnmapEvent.display	12
+XUnmapEvent.event	16
+XUnmapEvent.window	20
+XUnmapEvent.from_configure	24
+XUnmapEvent	28
+awtImageData.Depth	0
+awtImageData.wsImageFormat	4
+awtImageData.clrdata	16
+awtImageData.convert	48
+awtImageData	304
+XkbStateNotifyEvent.type	0
+XkbStateNotifyEvent.serial	4
+XkbStateNotifyEvent.send_event	8
+XkbStateNotifyEvent.display	12
+XkbStateNotifyEvent.time	16
+XkbStateNotifyEvent.xkb_type	20
+XkbStateNotifyEvent.device	24
+XkbStateNotifyEvent.changed	28
+XkbStateNotifyEvent.group	32
+XkbStateNotifyEvent.base_group	36
+XkbStateNotifyEvent.latched_group	40
+XkbStateNotifyEvent.locked_group	44
+XkbStateNotifyEvent.mods	48
+XkbStateNotifyEvent.base_mods	52
+XkbStateNotifyEvent.latched_mods	56
+XkbStateNotifyEvent.locked_mods	60
+XkbStateNotifyEvent.compat_state	64
+XkbStateNotifyEvent.grab_mods	68
+XkbStateNotifyEvent.compat_grab_mods	69
+XkbStateNotifyEvent.lookup_mods	70
+XkbStateNotifyEvent.compat_lookup_mods	71
+XkbStateNotifyEvent.ptr_buttons	72
+XkbStateNotifyEvent.keycode	76
+XkbStateNotifyEvent.event_type	77
+XkbStateNotifyEvent.req_major	78
+XkbStateNotifyEvent.req_minor	79
+XkbStateNotifyEvent	80
+XExposeEvent.type	0
+XExposeEvent.serial	4
+XExposeEvent.send_event	8
+XExposeEvent.display	12
+XExposeEvent.window	16
+XExposeEvent.x	20
+XExposeEvent.y	24
+XExposeEvent.width	28
+XExposeEvent.height	32
+XExposeEvent.count	36
+XExposeEvent	40
+XkbMapNotifyEvent.type	0
+XkbMapNotifyEvent.serial	4
+XkbMapNotifyEvent.send_event	8
+XkbMapNotifyEvent.display	12
+XkbMapNotifyEvent.time	16
+XkbMapNotifyEvent.xkb_type	20
+XkbMapNotifyEvent.device	24
+XkbMapNotifyEvent.changed	28
+XkbMapNotifyEvent.flags	32
+XkbMapNotifyEvent.first_type	36
+XkbMapNotifyEvent.num_types	40
+XkbMapNotifyEvent.min_key_code	44
+XkbMapNotifyEvent.max_key_code	45
+XkbMapNotifyEvent.first_key_sym	46
+XkbMapNotifyEvent.first_key_act	47
+XkbMapNotifyEvent.first_key_behavior	48
+XkbMapNotifyEvent.first_key_explicit	49
+XkbMapNotifyEvent.first_modmap_key	50
+XkbMapNotifyEvent.first_vmodmap_key	51
+XkbMapNotifyEvent.num_key_syms	52
+XkbMapNotifyEvent.num_key_acts	56
+XkbMapNotifyEvent.num_key_behaviors	60
+XkbMapNotifyEvent.num_key_explicit	64
+XkbMapNotifyEvent.num_modmap_keys	68
+XkbMapNotifyEvent.num_vmodmap_keys	72
+XkbMapNotifyEvent.vmods	76
+XkbMapNotifyEvent	80
+XGCValues.function	0
+XGCValues.plane_mask	4
+XGCValues.foreground	8
+XGCValues.background	12
+XGCValues.line_width	16
+XGCValues.line_style	20
+XGCValues.cap_style	24
+XGCValues.join_style	28
+XGCValues.fill_style	32
+XGCValues.fill_rule	36
+XGCValues.arc_mode	40
+XGCValues.tile	44
+XGCValues.stipple	48
+XGCValues.ts_x_origin	52
+XGCValues.ts_y_origin	56
+XGCValues.font	60
+XGCValues.subwindow_mode	64
+XGCValues.graphics_exposures	68
+XGCValues.clip_x_origin	72
+XGCValues.clip_y_origin	76
+XGCValues.clip_mask	80
+XGCValues.dash_offset	84
+XGCValues.dashes	88
+XGCValues	92
+XFocusChangeEvent.type	0
+XFocusChangeEvent.serial	4
+XFocusChangeEvent.send_event	8
+XFocusChangeEvent.display	12
+XFocusChangeEvent.window	16
+XFocusChangeEvent.mode	20
+XFocusChangeEvent.detail	24
+XFocusChangeEvent	28
+XPixmapFormatValues.depth	0
+XPixmapFormatValues.bits_per_pixel	4
+XPixmapFormatValues.scanline_pad	8
+XPixmapFormatValues	12
+XMapEvent.type	0
+XMapEvent.serial	4
+XMapEvent.send_event	8
+XMapEvent.display	12
+XMapEvent.event	16
+XMapEvent.window	20
+XMapEvent.override_redirect	24
+XMapEvent	28
+XkbBellNotifyEvent.type	0
+XkbBellNotifyEvent.serial	4
+XkbBellNotifyEvent.send_event	8
+XkbBellNotifyEvent.display	12
+XkbBellNotifyEvent.time	16
+XkbBellNotifyEvent.xkb_type	20
+XkbBellNotifyEvent.device	24
+XkbBellNotifyEvent.percent	28
+XkbBellNotifyEvent.pitch	32
+XkbBellNotifyEvent.duration	36
+XkbBellNotifyEvent.bell_class	40
+XkbBellNotifyEvent.bell_id	44
+XkbBellNotifyEvent.name	48
+XkbBellNotifyEvent.window	52
+XkbBellNotifyEvent.event_only	56
+XkbBellNotifyEvent	60
+XIMStringConversionText.length	0
+XIMStringConversionText.feedback	4
+XIMStringConversionText.encoding_is_wchar	8
+XIMStringConversionText.string	12
+XIMStringConversionText	16
+XKeyboardState.key_click_percent	0
+XKeyboardState.bell_percent	4
+XKeyboardState.bell_pitch	8
+XKeyboardState.bell_duration	12
+XKeyboardState.led_mask	16
+XKeyboardState.global_auto_repeat	20
+XKeyboardState.auto_repeats	24
+XKeyboardState	56
+XkbEvent.type	0
+XkbEvent.any	0
+XkbEvent.new_kbd	0
+XkbEvent.map	0
+XkbEvent.state	0
+XkbEvent.ctrls	0
+XkbEvent.indicators	0
+XkbEvent.names	0
+XkbEvent.compat	0
+XkbEvent.bell	0
+XkbEvent.message	0
+XkbEvent.accessx	0
+XkbEvent.device	0
+XkbEvent.core	0
+XkbEvent	96
+XPoint.x	0
+XPoint.y	2
+XPoint	4
+XSegment.x1	0
+XSegment.y1	2
+XSegment.x2	4
+XSegment.y2	6
+XSegment	8
+XIconSize.min_width	0
+XIconSize.min_height	4
+XIconSize.max_width	8
+XIconSize.max_height	12
+XIconSize.width_inc	16
+XIconSize.height_inc	20
+XIconSize	24
+XIMCallback.client_data	0
+XIMCallback.callback	4
+XIMCallback	8
+XConfigureEvent.type	0
+XConfigureEvent.serial	4
+XConfigureEvent.send_event	8
+XConfigureEvent.display	12
+XConfigureEvent.event	16
+XConfigureEvent.window	20
+XConfigureEvent.x	24
+XConfigureEvent.y	28
+XConfigureEvent.width	32
+XConfigureEvent.height	36
+XConfigureEvent.border_width	40
+XConfigureEvent.above	44
+XConfigureEvent.override_redirect	48
+XConfigureEvent	52
+XRectangle.x	0
+XRectangle.y	2
+XRectangle.width	4
+XRectangle.height	6
+XRectangle	8
+XkbNamesNotifyEvent.type	0
+XkbNamesNotifyEvent.serial	4
+XkbNamesNotifyEvent.send_event	8
+XkbNamesNotifyEvent.display	12
+XkbNamesNotifyEvent.time	16
+XkbNamesNotifyEvent.xkb_type	20
+XkbNamesNotifyEvent.device	24
+XkbNamesNotifyEvent.changed	28
+XkbNamesNotifyEvent.first_type	32
+XkbNamesNotifyEvent.num_types	36
+XkbNamesNotifyEvent.first_lvl	40
+XkbNamesNotifyEvent.num_lvls	44
+XkbNamesNotifyEvent.num_aliases	48
+XkbNamesNotifyEvent.num_radio_groups	52
+XkbNamesNotifyEvent.changed_vmods	56
+XkbNamesNotifyEvent.changed_groups	60
+XkbNamesNotifyEvent.changed_indicators	64
+XkbNamesNotifyEvent.first_key	68
+XkbNamesNotifyEvent.num_keys	72
+XkbNamesNotifyEvent	76
+XCreateWindowEvent.type	0
+XCreateWindowEvent.serial	4
+XCreateWindowEvent.send_event	8
+XCreateWindowEvent.display	12
+XCreateWindowEvent.parent	16
+XCreateWindowEvent.window	20
+XCreateWindowEvent.x	24
+XCreateWindowEvent.y	28
+XCreateWindowEvent.width	32
+XCreateWindowEvent.height	36
+XCreateWindowEvent.border_width	40
+XCreateWindowEvent.override_redirect	44
+XCreateWindowEvent	48
+XVisibilityEvent.type	0
+XVisibilityEvent.serial	4
+XVisibilityEvent.send_event	8
+XVisibilityEvent.display	12
+XVisibilityEvent.window	16
+XVisibilityEvent.state	20
+XVisibilityEvent	24
+XWMHints.flags	0
+XWMHints.initial_state	8
+XWMHints.icon_pixmap	12
+XWMHints.icon_window	16
+XWMHints.icon_x	20
+XWMHints.icon_y	24
+XWMHints.icon_mask	28
+XWMHints.input	4
+XWMHints.window_group	32
+XWMHints	36
+XCrossingEvent.type	0
+XCrossingEvent.serial	4
+XCrossingEvent.send_event	8
+XCrossingEvent.display	12
+XCrossingEvent.window	16
+XCrossingEvent.root	20
+XCrossingEvent.subwindow	24
+XCrossingEvent.time	28
+XCrossingEvent.x	32
+XCrossingEvent.y	36
+XCrossingEvent.x_root	40
+XCrossingEvent.y_root	44
+XCrossingEvent.mode	48
+XCrossingEvent.detail	52
+XCrossingEvent.same_screen	56
+XCrossingEvent.focus	60
+XCrossingEvent.state	64
+XCrossingEvent	68
+XSelectionRequestEvent.type	0
+XSelectionRequestEvent.serial	4
+XSelectionRequestEvent.send_event	8
+XSelectionRequestEvent.display	12
+XSelectionRequestEvent.owner	16
+XSelectionRequestEvent.requestor	20
+XSelectionRequestEvent.selection	24
+XSelectionRequestEvent.target	28
+XSelectionRequestEvent.property	32
+XSelectionRequestEvent.time	36
+XSelectionRequestEvent	40
+XNoExposeEvent.type	0
+XNoExposeEvent.serial	4
+XNoExposeEvent.send_event	8
+XNoExposeEvent.display	12
+XNoExposeEvent.drawable	16
+XNoExposeEvent.major_code	20
+XNoExposeEvent.minor_code	24
+XNoExposeEvent	28
+XHostAddress.family	0
+XHostAddress.length	4
+XHostAddress.address	8
+XHostAddress	12
+XColormapEvent.type	0
+XColormapEvent.serial	4
+XColormapEvent.send_event	8
+XColormapEvent.display	12
+XColormapEvent.window	16
+XColormapEvent.colormap	20
+XColormapEvent.new	24
+XColormapEvent.state	28
+XColormapEvent	32
+ColorEntry.r	0
+ColorEntry.g	1
+ColorEntry.b	2
+ColorEntry.flags	3
+ColorEntry	4
+XResizeRequestEvent.type	0
+XResizeRequestEvent.serial	4
+XResizeRequestEvent.send_event	8
+XResizeRequestEvent.display	12
+XResizeRequestEvent.window	16
+XResizeRequestEvent.width	20
+XResizeRequestEvent.height	24
+XResizeRequestEvent	28
+Depth.depth	0
+Depth.nvisuals	4
+Depth.visuals	8
+Depth	12
+XPropertyEvent.type	0
+XPropertyEvent.serial	4
+XPropertyEvent.send_event	8
+XPropertyEvent.display	12
+XPropertyEvent.window	16
+XPropertyEvent.atom	20
+XPropertyEvent.time	24
+XPropertyEvent.state	28
+XPropertyEvent	32
+XDestroyWindowEvent.type	0
+XDestroyWindowEvent.serial	4
+XDestroyWindowEvent.send_event	8
+XDestroyWindowEvent.display	12
+XDestroyWindowEvent.event	16
+XDestroyWindowEvent.window	20
+XDestroyWindowEvent	24
+XStandardColormap.colormap	0
+XStandardColormap.red_max	4
+XStandardColormap.red_mult	8
+XStandardColormap.green_max	12
+XStandardColormap.green_mult	16
+XStandardColormap.blue_max	20
+XStandardColormap.blue_mult	24
+XStandardColormap.base_pixel	28
+XStandardColormap.visualid	32
+XStandardColormap.killid	36
+XStandardColormap	40
+XComposeStatus.compose_ptr	0
+XComposeStatus.chars_matched	4
+XComposeStatus	8
+AwtGraphicsConfigData.awt_depth	0
+AwtGraphicsConfigData.awt_cmap	4
+AwtGraphicsConfigData.awt_visInfo	8
+AwtGraphicsConfigData.awt_num_colors	48
+AwtGraphicsConfigData.awtImage	52
+AwtGraphicsConfigData.AwtColorMatch	56
+AwtGraphicsConfigData.monoImage	60
+AwtGraphicsConfigData.monoPixmap	64
+AwtGraphicsConfigData.monoPixmapWidth	68
+AwtGraphicsConfigData.monoPixmapHeight	72
+AwtGraphicsConfigData.monoPixmapGC	76
+AwtGraphicsConfigData.pixelStride	80
+AwtGraphicsConfigData.color_data	84
+AwtGraphicsConfigData.glxInfo	88
+AwtGraphicsConfigData.isTranslucencySupported	92
+AwtGraphicsConfigData.renderPictFormat	96
+AwtGraphicsConfigData	128
+XColor.pixel	0
+XColor.red	4
+XColor.green	6
+XColor.blue	8
+XColor.flags	10
+XColor.pad	11
+XColor	12
+XTextProperty.value	0
+XTextProperty.encoding	4
+XTextProperty.format	8
+XTextProperty.nitems	12
+XTextProperty	16
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/solaris/classes/sun/awt/X11/generator/sizes.64	Wed Jul 05 18:36:58 2017 +0200
@@ -0,0 +1,1016 @@
+long	8
+int	4
+short	2
+ptr	8
+Bool	4
+Atom	8
+Window	8
+XExtData.number	0
+XExtData.next	8
+XExtData.free_private	16
+XExtData.private_data	24
+XExtData	32
+XIMStringConversionCallbackStruct.position	0
+XIMStringConversionCallbackStruct.direction	4
+XIMStringConversionCallbackStruct.operation	8
+XIMStringConversionCallbackStruct.factor	10
+XIMStringConversionCallbackStruct.text	16
+XIMStringConversionCallbackStruct	24
+XkbNewKeyboardNotifyEvent.type	0
+XkbNewKeyboardNotifyEvent.serial	8
+XkbNewKeyboardNotifyEvent.send_event	16
+XkbNewKeyboardNotifyEvent.display	24
+XkbNewKeyboardNotifyEvent.time	32
+XkbNewKeyboardNotifyEvent.xkb_type	40
+XkbNewKeyboardNotifyEvent.device	44
+XkbNewKeyboardNotifyEvent.old_device	48
+XkbNewKeyboardNotifyEvent.min_key_code	52
+XkbNewKeyboardNotifyEvent.max_key_code	56
+XkbNewKeyboardNotifyEvent.old_min_key_code	60
+XkbNewKeyboardNotifyEvent.old_max_key_code	64
+XkbNewKeyboardNotifyEvent.changed	68
+XkbNewKeyboardNotifyEvent.req_major	72
+XkbNewKeyboardNotifyEvent.req_minor	73
+XkbNewKeyboardNotifyEvent	80
+XTimeCoord.time	0
+XTimeCoord.x	8
+XTimeCoord.y	10
+XTimeCoord	16
+XkbCompatMapNotifyEvent.type	0
+XkbCompatMapNotifyEvent.serial	8
+XkbCompatMapNotifyEvent.send_event	16
+XkbCompatMapNotifyEvent.display	24
+XkbCompatMapNotifyEvent.time	32
+XkbCompatMapNotifyEvent.xkb_type	40
+XkbCompatMapNotifyEvent.device	44
+XkbCompatMapNotifyEvent.changed_groups	48
+XkbCompatMapNotifyEvent.first_si	52
+XkbCompatMapNotifyEvent.num_si	56
+XkbCompatMapNotifyEvent.num_total_si	60
+XkbCompatMapNotifyEvent	64
+XIMStatusDrawCallbackStruct.type	0
+XIMStatusDrawCallbackStruct.data	8
+XIMStatusDrawCallbackStruct	16
+XKeyboardControl.key_click_percent	0
+XKeyboardControl.bell_percent	4
+XKeyboardControl.bell_pitch	8
+XKeyboardControl.bell_duration	12
+XKeyboardControl.led	16
+XKeyboardControl.led_mode	20
+XKeyboardControl.key	24
+XKeyboardControl.auto_repeat_mode	28
+XKeyboardControl	32
+XSelectionClearEvent.type	0
+XSelectionClearEvent.serial	8
+XSelectionClearEvent.send_event	16
+XSelectionClearEvent.display	24
+XSelectionClearEvent.window	32
+XSelectionClearEvent.selection	40
+XSelectionClearEvent.time	48
+XSelectionClearEvent	56
+XWindowChanges.x	0
+XWindowChanges.y	4
+XWindowChanges.width	8
+XWindowChanges.height	12
+XWindowChanges.border_width	16
+XWindowChanges.sibling	24
+XWindowChanges.stack_mode	32
+XWindowChanges	40
+XIMPreeditCaretCallbackStruct.position	0
+XIMPreeditCaretCallbackStruct.direction	4
+XIMPreeditCaretCallbackStruct.style	8
+XIMPreeditCaretCallbackStruct	12
+XOMCharSetList.charset_count	0
+XOMCharSetList.charset_list	8
+XOMCharSetList	16
+XOMFontInfo.num_font	0
+XOMFontInfo.font_struct_list	8
+XOMFontInfo.font_name_list	16
+XOMFontInfo	24
+AwtScreenData.numConfigs	0
+AwtScreenData.root	8
+AwtScreenData.whitepixel	16
+AwtScreenData.blackpixel	24
+AwtScreenData.defaultConfig	32
+AwtScreenData.configs	40
+AwtScreenData	48
+XIMHotKeyTrigger.keysym	0
+XIMHotKeyTrigger.modifier	8
+XIMHotKeyTrigger.modifier_mask	12
+XIMHotKeyTrigger	16
+XCirculateEvent.type	0
+XCirculateEvent.serial	8
+XCirculateEvent.send_event	16
+XCirculateEvent.display	24
+XCirculateEvent.event	32
+XCirculateEvent.window	40
+XCirculateEvent.place	48
+XCirculateEvent	56
+Screen.ext_data	0
+Screen.display	8
+Screen.root	16
+Screen.width	24
+Screen.height	28
+Screen.mwidth	32
+Screen.mheight	36
+Screen.ndepths	40
+Screen.depths	48
+Screen.root_depth	56
+Screen.root_visual	64
+Screen.default_gc	72
+Screen.cmap	80
+Screen.white_pixel	88
+Screen.black_pixel	96
+Screen.max_maps	104
+Screen.min_maps	108
+Screen.backing_store	112
+Screen.save_unders	116
+Screen.root_input_mask	120
+Screen	128
+XMapRequestEvent.type	0
+XMapRequestEvent.serial	8
+XMapRequestEvent.send_event	16
+XMapRequestEvent.display	24
+XMapRequestEvent.parent	32
+XMapRequestEvent.window	40
+XMapRequestEvent	48
+XIMText.length	0
+XIMText.feedback	8
+XIMText.encoding_is_wchar	16
+XIMText.string	24
+XIMText	32
+XGraphicsExposeEvent.type	0
+XGraphicsExposeEvent.serial	8
+XGraphicsExposeEvent.send_event	16
+XGraphicsExposeEvent.display	24
+XGraphicsExposeEvent.drawable	32
+XGraphicsExposeEvent.x	40
+XGraphicsExposeEvent.y	44
+XGraphicsExposeEvent.width	48
+XGraphicsExposeEvent.height	52
+XGraphicsExposeEvent.count	56
+XGraphicsExposeEvent.major_code	60
+XGraphicsExposeEvent.minor_code	64
+XGraphicsExposeEvent	72
+XEvent.type	0
+XEvent.xany	0
+XEvent.xkey	0
+XEvent.xbutton	0
+XEvent.xmotion	0
+XEvent.xcrossing	0
+XEvent.xfocus	0
+XEvent.xexpose	0
+XEvent.xgraphicsexpose	0
+XEvent.xnoexpose	0
+XEvent.xvisibility	0
+XEvent.xcreatewindow	0
+XEvent.xdestroywindow	0
+XEvent.xunmap	0
+XEvent.xmap	0
+XEvent.xmaprequest	0
+XEvent.xreparent	0
+XEvent.xconfigure	0
+XEvent.xgravity	0
+XEvent.xresizerequest	0
+XEvent.xconfigurerequest	0
+XEvent.xcirculate	0
+XEvent.xcirculaterequest	0
+XEvent.xproperty	0
+XEvent.xselectionclear	0
+XEvent.xselectionrequest	0
+XEvent.xselection	0
+XEvent.xcolormap	0
+XEvent.xclient	0
+XEvent.xmapping	0
+XEvent.xerror	0
+XEvent.xkeymap	0
+XEvent.pad	0
+XEvent	192
+XRenderDirectFormat.red	0
+XRenderDirectFormat.redMask	2
+XRenderDirectFormat.green	4
+XRenderDirectFormat.greenMask	6
+XRenderDirectFormat.blue	8
+XRenderDirectFormat.blueMask	10
+XRenderDirectFormat.alpha	12
+XRenderDirectFormat.alphaMask	14
+XRenderDirectFormat	16
+ColorData.awt_Colors	0
+ColorData.awt_numICMcolors	8
+ColorData.awt_icmLUT	16
+ColorData.awt_icmLUT2Colors	24
+ColorData.img_grays	32
+ColorData.img_clr_tbl	40
+ColorData.img_oda_red	48
+ColorData.img_oda_green	56
+ColorData.img_oda_blue	64
+ColorData.pGrayInverseLutData	72
+ColorData.screendata	80
+ColorData	88
+XFontStruct.ext_data	0
+XFontStruct.fid	8
+XFontStruct.direction	16
+XFontStruct.min_char_or_byte2	20
+XFontStruct.max_char_or_byte2	24
+XFontStruct.min_byte1	28
+XFontStruct.max_byte1	32
+XFontStruct.all_chars_exist	36
+XFontStruct.n_properties	44
+XFontStruct.properties	48
+XFontStruct.min_bounds	56
+XFontStruct.max_bounds	68
+XFontStruct.per_char	80
+XFontStruct.ascent	88
+XFontStruct.descent	92
+XFontStruct	96
+XExtCodes.extension	0
+XExtCodes.major_opcode	4
+XExtCodes.first_event	8
+XExtCodes.first_error	12
+XExtCodes	16
+XFontSetExtents.max_ink_extent	0
+XFontSetExtents.max_logical_extent	8
+XFontSetExtents	16
+XSelectionEvent.type	0
+XSelectionEvent.serial	8
+XSelectionEvent.send_event	16
+XSelectionEvent.display	24
+XSelectionEvent.requestor	32
+XSelectionEvent.selection	40
+XSelectionEvent.target	48
+XSelectionEvent.property	56
+XSelectionEvent.time	64
+XSelectionEvent	72
+XArc.x	0
+XArc.y	2
+XArc.width	4
+XArc.height	6
+XArc.angle1	8
+XArc.angle2	10
+XArc	12
+XErrorEvent.type	0
+XErrorEvent.display	8
+XErrorEvent.resourceid	16
+XErrorEvent.serial	24
+XErrorEvent.error_code	32
+XErrorEvent.request_code	33
+XErrorEvent.minor_code	34
+XErrorEvent	40
+XConfigureRequestEvent.type	0
+XConfigureRequestEvent.serial	8
+XConfigureRequestEvent.send_event	16
+XConfigureRequestEvent.display	24
+XConfigureRequestEvent.parent	32
+XConfigureRequestEvent.window	40
+XConfigureRequestEvent.x	48
+XConfigureRequestEvent.y	52
+XConfigureRequestEvent.width	56
+XConfigureRequestEvent.height	60
+XConfigureRequestEvent.border_width	64
+XConfigureRequestEvent.above	72
+XConfigureRequestEvent.detail	80
+XConfigureRequestEvent.value_mask	88
+XConfigureRequestEvent	96
+ScreenFormat.ext_data	0
+ScreenFormat.depth	8
+ScreenFormat.bits_per_pixel	12
+ScreenFormat.scanline_pad	16
+ScreenFormat	24
+XButtonEvent.type	0
+XButtonEvent.serial	8
+XButtonEvent.send_event	16
+XButtonEvent.display	24
+XButtonEvent.window	32
+XButtonEvent.root	40
+XButtonEvent.subwindow	48
+XButtonEvent.time	56
+XButtonEvent.x	64
+XButtonEvent.y	68
+XButtonEvent.x_root	72
+XButtonEvent.y_root	76
+XButtonEvent.state	80
+XButtonEvent.button	84
+XButtonEvent.same_screen	88
+XButtonEvent	96
+XFontProp.name	0
+XFontProp.card32	8
+XFontProp	16
+XIMValuesList.count_values	0
+XIMValuesList.supported_values	8
+XIMValuesList	16
+XKeymapEvent.type	0
+XKeymapEvent.serial	8
+XKeymapEvent.send_event	16
+XKeymapEvent.display	24
+XKeymapEvent.window	32
+XKeymapEvent.key_vector	40
+XKeymapEvent	72
+XTextItem16.chars	0
+XTextItem16.nchars	8
+XTextItem16.delta	12
+XTextItem16.font	16
+XTextItem16	24
+XIMPreeditDrawCallbackStruct.caret	0
+XIMPreeditDrawCallbackStruct.chg_first	4
+XIMPreeditDrawCallbackStruct.chg_length	8
+XIMPreeditDrawCallbackStruct.text	16
+XIMPreeditDrawCallbackStruct	24
+XVisualInfo.visual	0
+XVisualInfo.visualid	8
+XVisualInfo.screen	16
+XVisualInfo.depth	20
+XVisualInfo.class	24
+XVisualInfo.red_mask	32
+XVisualInfo.green_mask	40
+XVisualInfo.blue_mask	48
+XVisualInfo.colormap_size	56
+XVisualInfo.bits_per_rgb	60
+XVisualInfo	64
+XkbControlsNotifyEvent.type	0
+XkbControlsNotifyEvent.serial	8
+XkbControlsNotifyEvent.send_event	16
+XkbControlsNotifyEvent.display	24
+XkbControlsNotifyEvent.time	32
+XkbControlsNotifyEvent.xkb_type	40
+XkbControlsNotifyEvent.device	44
+XkbControlsNotifyEvent.changed_ctrls	48
+XkbControlsNotifyEvent.enabled_ctrls	52
+XkbControlsNotifyEvent.enabled_ctrl_changes	56
+XkbControlsNotifyEvent.num_groups	60
+XkbControlsNotifyEvent.keycode	64
+XkbControlsNotifyEvent.event_type	65
+XkbControlsNotifyEvent.req_major	66
+XkbControlsNotifyEvent.req_minor	67
+XkbControlsNotifyEvent	72
+PropMwmHints.flags	0
+PropMwmHints.functions	8
+PropMwmHints.decorations	16
+PropMwmHints.inputMode	24
+PropMwmHints.status	32
+PropMwmHints	40
+XClientMessageEvent.type	0
+XClientMessageEvent.serial	8
+XClientMessageEvent.send_event	16
+XClientMessageEvent.display	24
+XClientMessageEvent.window	32
+XClientMessageEvent.message_type	40
+XClientMessageEvent.format	48
+XClientMessageEvent.data	56
+XClientMessageEvent	96
+XAnyEvent.type	0
+XAnyEvent.serial	8
+XAnyEvent.send_event	16
+XAnyEvent.display	24
+XAnyEvent.window	32
+XAnyEvent	40
+XkbIndicatorNotifyEvent.type	0
+XkbIndicatorNotifyEvent.serial	8
+XkbIndicatorNotifyEvent.send_event	16
+XkbIndicatorNotifyEvent.display	24
+XkbIndicatorNotifyEvent.time	32
+XkbIndicatorNotifyEvent.xkb_type	40
+XkbIndicatorNotifyEvent.device	44
+XkbIndicatorNotifyEvent.changed	48
+XkbIndicatorNotifyEvent.state	52
+XkbIndicatorNotifyEvent	56
+XIMPreeditStateNotifyCallbackStruct.state	0
+XIMPreeditStateNotifyCallbackStruct	8
+XkbAnyEvent.type	0
+XkbAnyEvent.serial	8
+XkbAnyEvent.send_event	16
+XkbAnyEvent.display	24
+XkbAnyEvent.time	32
+XkbAnyEvent.xkb_type	40
+XkbAnyEvent.device	44
+XkbAnyEvent	48
+XMotionEvent.type	0
+XMotionEvent.serial	8
+XMotionEvent.send_event	16
+XMotionEvent.display	24
+XMotionEvent.window	32
+XMotionEvent.root	40
+XMotionEvent.subwindow	48
+XMotionEvent.time	56
+XMotionEvent.x	64
+XMotionEvent.y	68
+XMotionEvent.x_root	72
+XMotionEvent.y_root	76
+XMotionEvent.state	80
+XMotionEvent.is_hint	84
+XMotionEvent.same_screen	88
+XMotionEvent	96
+XIMHotKeyTriggers.num_hot_key	0
+XIMHotKeyTriggers.key	8
+XIMHotKeyTriggers	16
+XIMStyles.count_styles	0
+XIMStyles.supported_styles	8
+XIMStyles	16
+XkbExtensionDeviceNotifyEvent.type	0
+XkbExtensionDeviceNotifyEvent.serial	8
+XkbExtensionDeviceNotifyEvent.send_event	16
+XkbExtensionDeviceNotifyEvent.display	24
+XkbExtensionDeviceNotifyEvent.time	32
+XkbExtensionDeviceNotifyEvent.xkb_type	40
+XkbExtensionDeviceNotifyEvent.device	44
+XkbExtensionDeviceNotifyEvent.reason	48
+XkbExtensionDeviceNotifyEvent.supported	52
+XkbExtensionDeviceNotifyEvent.unsupported	56
+XkbExtensionDeviceNotifyEvent.first_btn	60
+XkbExtensionDeviceNotifyEvent.num_btns	64
+XkbExtensionDeviceNotifyEvent.leds_defined	68
+XkbExtensionDeviceNotifyEvent.led_state	72
+XkbExtensionDeviceNotifyEvent.led_class	76
+XkbExtensionDeviceNotifyEvent.led_id	80
+XkbExtensionDeviceNotifyEvent	88
+XwcTextItem.chars	0
+XwcTextItem.nchars	8
+XwcTextItem.delta	12
+XwcTextItem.font_set	16
+XwcTextItem	24
+XClassHint.res_name	0
+XClassHint.res_class	8
+XClassHint	16
+XChar2b.byte1	0
+XChar2b.byte2	1
+XChar2b	2
+XSetWindowAttributes.background_pixmap	0
+XSetWindowAttributes.background_pixel	8
+XSetWindowAttributes.border_pixmap	16
+XSetWindowAttributes.border_pixel	24
+XSetWindowAttributes.bit_gravity	32
+XSetWindowAttributes.win_gravity	36
+XSetWindowAttributes.backing_store	40
+XSetWindowAttributes.backing_planes	48
+XSetWindowAttributes.backing_pixel	56
+XSetWindowAttributes.save_under	64
+XSetWindowAttributes.event_mask	72
+XSetWindowAttributes.do_not_propagate_mask	80
+XSetWindowAttributes.override_redirect	88
+XSetWindowAttributes.colormap	96
+XSetWindowAttributes.cursor	104
+XSetWindowAttributes	112
+XRenderPictFormat.id	0
+XRenderPictFormat.type	8
+XRenderPictFormat.depth	12
+XRenderPictFormat.direct	16
+XRenderPictFormat.colormap	32
+XRenderPictFormat	40
+XReparentEvent.type	0
+XReparentEvent.serial	8
+XReparentEvent.send_event	16
+XReparentEvent.display	24
+XReparentEvent.event	32
+XReparentEvent.window	40
+XReparentEvent.parent	48
+XReparentEvent.x	56
+XReparentEvent.y	60
+XReparentEvent.override_redirect	64
+XReparentEvent	72
+XCirculateRequestEvent.type	0
+XCirculateRequestEvent.serial	8
+XCirculateRequestEvent.send_event	16
+XCirculateRequestEvent.display	24
+XCirculateRequestEvent.parent	32
+XCirculateRequestEvent.window	40
+XCirculateRequestEvent.place	48
+XCirculateRequestEvent	56
+XImage.width	0
+XImage.height	4
+XImage.xoffset	8
+XImage.format	12
+XImage.data	16
+XImage.byte_order	24
+XImage.bitmap_unit	28
+XImage.bitmap_bit_order	32
+XImage.bitmap_pad	36
+XImage.depth	40
+XImage.bytes_per_line	44
+XImage.bits_per_pixel	48
+XImage.red_mask	56
+XImage.green_mask	64
+XImage.blue_mask	72
+XImage.obdata	80
+XImage.f.create_image	88
+XImage.f.destroy_image	96
+XImage.f.get_pixel	104
+XImage.f.put_pixel	112
+XImage.f.sub_image	120
+XImage.f.add_pixel	128
+XImage	136
+XKeyEvent.type	0
+XKeyEvent.serial	8
+XKeyEvent.send_event	16
+XKeyEvent.display	24
+XKeyEvent.window	32
+XKeyEvent.root	40
+XKeyEvent.subwindow	48
+XKeyEvent.time	56
+XKeyEvent.x	64
+XKeyEvent.y	68
+XKeyEvent.x_root	72
+XKeyEvent.y_root	76
+XKeyEvent.state	80
+XKeyEvent.keycode	84
+XKeyEvent.same_screen	88
+XKeyEvent	96
+XkbActionMessageEvent.type	0
+XkbActionMessageEvent.serial	8
+XkbActionMessageEvent.send_event	16
+XkbActionMessageEvent.display	24
+XkbActionMessageEvent.time	32
+XkbActionMessageEvent.xkb_type	40
+XkbActionMessageEvent.device	44
+XkbActionMessageEvent.keycode	48
+XkbActionMessageEvent.press	52
+XkbActionMessageEvent.key_event_follows	56
+XkbActionMessageEvent.group	60
+XkbActionMessageEvent.mods	64
+XkbActionMessageEvent.message	68
+XkbActionMessageEvent	80
+XdbeSwapInfo.swap_window	0
+XdbeSwapInfo.swap_action	8
+XdbeSwapInfo	16
+XTextItem.chars	0
+XTextItem.nchars	8
+XTextItem.delta	12
+XTextItem.font	16
+XTextItem	24
+XModifierKeymap.max_keypermod	0
+XModifierKeymap.modifiermap	8
+XModifierKeymap	16
+XCharStruct.lbearing	0
+XCharStruct.rbearing	2
+XCharStruct.width	4
+XCharStruct.ascent	6
+XCharStruct.descent	8
+XCharStruct.attributes	10
+XCharStruct	12
+XGravityEvent.type	0
+XGravityEvent.serial	8
+XGravityEvent.send_event	16
+XGravityEvent.display	24
+XGravityEvent.event	32
+XGravityEvent.window	40
+XGravityEvent.x	48
+XGravityEvent.y	52
+XGravityEvent	56
+Visual.ext_data	0
+Visual.visualid	8
+Visual.class	16
+Visual.red_mask	24
+Visual.green_mask	32
+Visual.blue_mask	40
+Visual.bits_per_rgb	48
+Visual.map_entries	52
+Visual	56
+XOMOrientation.num_orientation	0
+XOMOrientation.orientation	8
+XOMOrientation	16
+XkbAccessXNotifyEvent.type	0
+XkbAccessXNotifyEvent.serial	8
+XkbAccessXNotifyEvent.send_event	16
+XkbAccessXNotifyEvent.display	24
+XkbAccessXNotifyEvent.time	32
+XkbAccessXNotifyEvent.xkb_type	40
+XkbAccessXNotifyEvent.device	44
+XkbAccessXNotifyEvent.detail	48
+XkbAccessXNotifyEvent.keycode	52
+XkbAccessXNotifyEvent.sk_delay	56
+XkbAccessXNotifyEvent.debounce_delay	60
+XkbAccessXNotifyEvent	64
+XWindowAttributes.x	0
+XWindowAttributes.y	4
+XWindowAttributes.width	8
+XWindowAttributes.height	12
+XWindowAttributes.border_width	16
+XWindowAttributes.depth	20
+XWindowAttributes.visual	24
+XWindowAttributes.root	32
+XWindowAttributes.class	40
+XWindowAttributes.bit_gravity	44
+XWindowAttributes.win_gravity	48
+XWindowAttributes.backing_store	52
+XWindowAttributes.backing_planes	56
+XWindowAttributes.backing_pixel	64
+XWindowAttributes.save_under	72
+XWindowAttributes.colormap	80
+XWindowAttributes.map_installed	88
+XWindowAttributes.map_state	92
+XWindowAttributes.all_event_masks	96
+XWindowAttributes.your_event_mask	104
+XWindowAttributes.do_not_propagate_mask	112
+XWindowAttributes.override_redirect	120
+XWindowAttributes.screen	128
+XWindowAttributes	136
+XmbTextItem.chars	0
+XmbTextItem.nchars	8
+XmbTextItem.delta	12
+XmbTextItem.font_set	16
+XmbTextItem	24
+XMappingEvent.type	0
+XMappingEvent.serial	8
+XMappingEvent.send_event	16
+XMappingEvent.display	24
+XMappingEvent.window	32
+XMappingEvent.request	40
+XMappingEvent.first_keycode	44
+XMappingEvent.count	48
+XMappingEvent	56
+XSizeHints.flags	0
+XSizeHints.x	8
+XSizeHints.y	12
+XSizeHints.width	16
+XSizeHints.height	20
+XSizeHints.min_width	24
+XSizeHints.min_height	28
+XSizeHints.max_width	32
+XSizeHints.max_height	36
+XSizeHints.width_inc	40
+XSizeHints.height_inc	44
+XSizeHints.min_aspect.x	48
+XSizeHints.min_aspect.y	52
+XSizeHints.max_aspect.x	56
+XSizeHints.max_aspect.y	60
+XSizeHints.base_width	64
+XSizeHints.base_height	68
+XSizeHints.win_gravity	72
+XSizeHints	80
+XUnmapEvent.type	0
+XUnmapEvent.serial	8
+XUnmapEvent.send_event	16
+XUnmapEvent.display	24
+XUnmapEvent.event	32
+XUnmapEvent.window	40
+XUnmapEvent.from_configure	48
+XUnmapEvent	56
+awtImageData.Depth	0
+awtImageData.wsImageFormat	4
+awtImageData.clrdata	16
+awtImageData.convert	48
+awtImageData	560
+XkbStateNotifyEvent.type	0
+XkbStateNotifyEvent.serial	8
+XkbStateNotifyEvent.send_event	16
+XkbStateNotifyEvent.display	24
+XkbStateNotifyEvent.time	32
+XkbStateNotifyEvent.xkb_type	40
+XkbStateNotifyEvent.device	44
+XkbStateNotifyEvent.changed	48
+XkbStateNotifyEvent.group	52
+XkbStateNotifyEvent.base_group	56
+XkbStateNotifyEvent.latched_group	60
+XkbStateNotifyEvent.locked_group	64
+XkbStateNotifyEvent.mods	68
+XkbStateNotifyEvent.base_mods	72
+XkbStateNotifyEvent.latched_mods	76
+XkbStateNotifyEvent.locked_mods	80
+XkbStateNotifyEvent.compat_state	84
+XkbStateNotifyEvent.grab_mods	88
+XkbStateNotifyEvent.compat_grab_mods	89
+XkbStateNotifyEvent.lookup_mods	90
+XkbStateNotifyEvent.compat_lookup_mods	91
+XkbStateNotifyEvent.ptr_buttons	92
+XkbStateNotifyEvent.keycode	96
+XkbStateNotifyEvent.event_type	97
+XkbStateNotifyEvent.req_major	98
+XkbStateNotifyEvent.req_minor	99
+XkbStateNotifyEvent	104
+XExposeEvent.type	0
+XExposeEvent.serial	8
+XExposeEvent.send_event	16
+XExposeEvent.display	24
+XExposeEvent.window	32
+XExposeEvent.x	40
+XExposeEvent.y	44
+XExposeEvent.width	48
+XExposeEvent.height	52
+XExposeEvent.count	56
+XExposeEvent	64
+XkbMapNotifyEvent.type	0
+XkbMapNotifyEvent.serial	8
+XkbMapNotifyEvent.send_event	16
+XkbMapNotifyEvent.display	24
+XkbMapNotifyEvent.time	32
+XkbMapNotifyEvent.xkb_type	40
+XkbMapNotifyEvent.device	44
+XkbMapNotifyEvent.changed	48
+XkbMapNotifyEvent.flags	52
+XkbMapNotifyEvent.first_type	56
+XkbMapNotifyEvent.num_types	60
+XkbMapNotifyEvent.min_key_code	64
+XkbMapNotifyEvent.max_key_code	65
+XkbMapNotifyEvent.first_key_sym	66
+XkbMapNotifyEvent.first_key_act	67
+XkbMapNotifyEvent.first_key_behavior	68
+XkbMapNotifyEvent.first_key_explicit	69
+XkbMapNotifyEvent.first_modmap_key	70
+XkbMapNotifyEvent.first_vmodmap_key	71
+XkbMapNotifyEvent.num_key_syms	72
+XkbMapNotifyEvent.num_key_acts	76
+XkbMapNotifyEvent.num_key_behaviors	80
+XkbMapNotifyEvent.num_key_explicit	84
+XkbMapNotifyEvent.num_modmap_keys	88
+XkbMapNotifyEvent.num_vmodmap_keys	92
+XkbMapNotifyEvent.vmods	96
+XkbMapNotifyEvent	104
+XGCValues.function	0
+XGCValues.plane_mask	8
+XGCValues.foreground	16
+XGCValues.background	24
+XGCValues.line_width	32
+XGCValues.line_style	36
+XGCValues.cap_style	40
+XGCValues.join_style	44
+XGCValues.fill_style	48
+XGCValues.fill_rule	52
+XGCValues.arc_mode	56
+XGCValues.tile	64
+XGCValues.stipple	72
+XGCValues.ts_x_origin	80
+XGCValues.ts_y_origin	84
+XGCValues.font	88
+XGCValues.subwindow_mode	96
+XGCValues.graphics_exposures	100
+XGCValues.clip_x_origin	104
+XGCValues.clip_y_origin	108
+XGCValues.clip_mask	112
+XGCValues.dash_offset	120
+XGCValues.dashes	124
+XGCValues	128
+XFocusChangeEvent.type	0
+XFocusChangeEvent.serial	8
+XFocusChangeEvent.send_event	16
+XFocusChangeEvent.display	24
+XFocusChangeEvent.window	32
+XFocusChangeEvent.mode	40
+XFocusChangeEvent.detail	44
+XFocusChangeEvent	48
+XPixmapFormatValues.depth	0
+XPixmapFormatValues.bits_per_pixel	4
+XPixmapFormatValues.scanline_pad	8
+XPixmapFormatValues	12
+XMapEvent.type	0
+XMapEvent.serial	8
+XMapEvent.send_event	16
+XMapEvent.display	24
+XMapEvent.event	32
+XMapEvent.window	40
+XMapEvent.override_redirect	48
+XMapEvent	56
+XkbBellNotifyEvent.type	0
+XkbBellNotifyEvent.serial	8
+XkbBellNotifyEvent.send_event	16
+XkbBellNotifyEvent.display	24
+XkbBellNotifyEvent.time	32
+XkbBellNotifyEvent.xkb_type	40
+XkbBellNotifyEvent.device	44
+XkbBellNotifyEvent.percent	48
+XkbBellNotifyEvent.pitch	52
+XkbBellNotifyEvent.duration	56
+XkbBellNotifyEvent.bell_class	60
+XkbBellNotifyEvent.bell_id	64
+XkbBellNotifyEvent.name	72
+XkbBellNotifyEvent.window	80
+XkbBellNotifyEvent.event_only	88
+XkbBellNotifyEvent	96
+XIMStringConversionText.length	0
+XIMStringConversionText.feedback	8
+XIMStringConversionText.encoding_is_wchar	16
+XIMStringConversionText.string	24
+XIMStringConversionText	32
+XKeyboardState.key_click_percent	0
+XKeyboardState.bell_percent	4
+XKeyboardState.bell_pitch	8
+XKeyboardState.bell_duration	12
+XKeyboardState.led_mask	16
+XKeyboardState.global_auto_repeat	24
+XKeyboardState.auto_repeats	28
+XKeyboardState	64
+XkbEvent.type	0
+XkbEvent.any	0
+XkbEvent.new_kbd	0
+XkbEvent.map	0
+XkbEvent.state	0
+XkbEvent.ctrls	0
+XkbEvent.indicators	0
+XkbEvent.names	0
+XkbEvent.compat	0
+XkbEvent.bell	0
+XkbEvent.message	0
+XkbEvent.accessx	0
+XkbEvent.device	0
+XkbEvent.core	0
+XkbEvent	192
+XPoint.x	0
+XPoint.y	2
+XPoint	4
+XSegment.x1	0
+XSegment.y1	2
+XSegment.x2	4
+XSegment.y2	6
+XSegment	8
+XIconSize.min_width	0
+XIconSize.min_height	4
+XIconSize.max_width	8
+XIconSize.max_height	12
+XIconSize.width_inc	16
+XIconSize.height_inc	20
+XIconSize	24
+XIMCallback.client_data	0
+XIMCallback.callback	8
+XIMCallback	16
+XConfigureEvent.type	0
+XConfigureEvent.serial	8
+XConfigureEvent.send_event	16
+XConfigureEvent.display	24
+XConfigureEvent.event	32
+XConfigureEvent.window	40
+XConfigureEvent.x	48
+XConfigureEvent.y	52
+XConfigureEvent.width	56
+XConfigureEvent.height	60
+XConfigureEvent.border_width	64
+XConfigureEvent.above	72
+XConfigureEvent.override_redirect	80
+XConfigureEvent	88
+XRectangle.x	0
+XRectangle.y	2
+XRectangle.width	4
+XRectangle.height	6
+XRectangle	8
+XkbNamesNotifyEvent.type	0
+XkbNamesNotifyEvent.serial	8
+XkbNamesNotifyEvent.send_event	16
+XkbNamesNotifyEvent.display	24
+XkbNamesNotifyEvent.time	32
+XkbNamesNotifyEvent.xkb_type	40
+XkbNamesNotifyEvent.device	44
+XkbNamesNotifyEvent.changed	48
+XkbNamesNotifyEvent.first_type	52
+XkbNamesNotifyEvent.num_types	56
+XkbNamesNotifyEvent.first_lvl	60
+XkbNamesNotifyEvent.num_lvls	64
+XkbNamesNotifyEvent.num_aliases	68
+XkbNamesNotifyEvent.num_radio_groups	72
+XkbNamesNotifyEvent.changed_vmods	76
+XkbNamesNotifyEvent.changed_groups	80
+XkbNamesNotifyEvent.changed_indicators	84
+XkbNamesNotifyEvent.first_key	88
+XkbNamesNotifyEvent.num_keys	92
+XkbNamesNotifyEvent	96
+XCreateWindowEvent.type	0
+XCreateWindowEvent.serial	8
+XCreateWindowEvent.send_event	16
+XCreateWindowEvent.display	24
+XCreateWindowEvent.parent	32
+XCreateWindowEvent.window	40
+XCreateWindowEvent.x	48
+XCreateWindowEvent.y	52
+XCreateWindowEvent.width	56
+XCreateWindowEvent.height	60
+XCreateWindowEvent.border_width	64
+XCreateWindowEvent.override_redirect	68
+XCreateWindowEvent	72
+XVisibilityEvent.type	0
+XVisibilityEvent.serial	8
+XVisibilityEvent.send_event	16
+XVisibilityEvent.display	24
+XVisibilityEvent.window	32
+XVisibilityEvent.state	40
+XVisibilityEvent	48
+XWMHints.flags	0
+XWMHints.initial_state	12
+XWMHints.icon_pixmap	16
+XWMHints.icon_window	24
+XWMHints.icon_x	32
+XWMHints.icon_y	36
+XWMHints.icon_mask	40
+XWMHints.input	8
+XWMHints.window_group	48
+XWMHints	56
+XCrossingEvent.type	0
+XCrossingEvent.serial	8
+XCrossingEvent.send_event	16
+XCrossingEvent.display	24
+XCrossingEvent.window	32
+XCrossingEvent.root	40
+XCrossingEvent.subwindow	48
+XCrossingEvent.time	56
+XCrossingEvent.x	64
+XCrossingEvent.y	68
+XCrossingEvent.x_root	72
+XCrossingEvent.y_root	76
+XCrossingEvent.mode	80
+XCrossingEvent.detail	84
+XCrossingEvent.same_screen	88
+XCrossingEvent.focus	92
+XCrossingEvent.state	96
+XCrossingEvent	104
+XSelectionRequestEvent.type	0
+XSelectionRequestEvent.serial	8
+XSelectionRequestEvent.send_event	16
+XSelectionRequestEvent.display	24
+XSelectionRequestEvent.owner	32
+XSelectionRequestEvent.requestor	40
+XSelectionRequestEvent.selection	48
+XSelectionRequestEvent.target	56
+XSelectionRequestEvent.property	64
+XSelectionRequestEvent.time	72
+XSelectionRequestEvent	80
+XNoExposeEvent.type	0
+XNoExposeEvent.serial	8
+XNoExposeEvent.send_event	16
+XNoExposeEvent.display	24
+XNoExposeEvent.drawable	32
+XNoExposeEvent.major_code	40
+XNoExposeEvent.minor_code	44
+XNoExposeEvent	48
+XHostAddress.family	0
+XHostAddress.length	4
+XHostAddress.address	8
+XHostAddress	16
+XColormapEvent.type	0
+XColormapEvent.serial	8
+XColormapEvent.send_event	16
+XColormapEvent.display	24
+XColormapEvent.window	32
+XColormapEvent.colormap	40
+XColormapEvent.new	48
+XColormapEvent.state	52
+XColormapEvent	56
+ColorEntry.r	0
+ColorEntry.g	1
+ColorEntry.b	2
+ColorEntry.flags	3
+ColorEntry	4
+XResizeRequestEvent.type	0
+XResizeRequestEvent.serial	8
+XResizeRequestEvent.send_event	16
+XResizeRequestEvent.display	24
+XResizeRequestEvent.window	32
+XResizeRequestEvent.width	40
+XResizeRequestEvent.height	44
+XResizeRequestEvent	48
+Depth.depth	0
+Depth.nvisuals	4
+Depth.visuals	8
+Depth	16
+XPropertyEvent.type	0
+XPropertyEvent.serial	8
+XPropertyEvent.send_event	16
+XPropertyEvent.display	24
+XPropertyEvent.window	32
+XPropertyEvent.atom	40
+XPropertyEvent.time	48
+XPropertyEvent.state	56
+XPropertyEvent	64
+XDestroyWindowEvent.type	0
+XDestroyWindowEvent.serial	8
+XDestroyWindowEvent.send_event	16
+XDestroyWindowEvent.display	24
+XDestroyWindowEvent.event	32
+XDestroyWindowEvent.window	40
+XDestroyWindowEvent	48
+XStandardColormap.colormap	0
+XStandardColormap.red_max	8
+XStandardColormap.red_mult	16
+XStandardColormap.green_max	24
+XStandardColormap.green_mult	32
+XStandardColormap.blue_max	40
+XStandardColormap.blue_mult	48
+XStandardColormap.base_pixel	56
+XStandardColormap.visualid	64
+XStandardColormap.killid	72
+XStandardColormap	80
+XComposeStatus.compose_ptr	0
+XComposeStatus.chars_matched	8
+XComposeStatus	16
+AwtGraphicsConfigData.awt_depth	0
+AwtGraphicsConfigData.awt_cmap	8
+AwtGraphicsConfigData.awt_visInfo	16
+AwtGraphicsConfigData.awt_num_colors	80
+AwtGraphicsConfigData.awtImage	88
+AwtGraphicsConfigData.AwtColorMatch	96
+AwtGraphicsConfigData.monoImage	104
+AwtGraphicsConfigData.monoPixmap	112
+AwtGraphicsConfigData.monoPixmapWidth	120
+AwtGraphicsConfigData.monoPixmapHeight	124
+AwtGraphicsConfigData.monoPixmapGC	128
+AwtGraphicsConfigData.pixelStride	136
+AwtGraphicsConfigData.color_data	144
+AwtGraphicsConfigData.glxInfo	152
+AwtGraphicsConfigData.isTranslucencySupported	160
+AwtGraphicsConfigData.renderPictFormat	168
+AwtGraphicsConfigData	208
+XColor.pixel	0
+XColor.red	8
+XColor.green	10
+XColor.blue	12
+XColor.flags	14
+XColor.pad	15
+XColor	16
+XTextProperty.value	0
+XTextProperty.encoding	8
+XTextProperty.format	16
+XTextProperty.nitems	24
+XTextProperty	32
--- a/jdk/src/windows/classes/sun/nio/ch/PollArrayWrapper.java	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/src/windows/classes/sun/nio/ch/PollArrayWrapper.java	Wed Jul 05 18:36:58 2017 +0200
@@ -28,6 +28,8 @@
 
 package sun.nio.ch;
 
+import java.lang.annotation.Native;
+
 /**
  * Manipulates a native array of structs corresponding to (fd, events) pairs.
  *
@@ -46,19 +48,19 @@
 
     long pollArrayAddress; // pollArrayAddress
 
-    private static final short FD_OFFSET     = 0; // fd offset in pollfd
-    private static final short EVENT_OFFSET  = 4; // events offset in pollfd
+    @Native private static final short FD_OFFSET     = 0; // fd offset in pollfd
+    @Native private static final short EVENT_OFFSET  = 4; // events offset in pollfd
 
     static short SIZE_POLLFD = 8; // sizeof pollfd struct
 
     // events masks
-    static final short POLLIN     = AbstractPollArrayWrapper.POLLIN;
-    static final short POLLOUT    = AbstractPollArrayWrapper.POLLOUT;
-    static final short POLLERR    = AbstractPollArrayWrapper.POLLERR;
-    static final short POLLHUP    = AbstractPollArrayWrapper.POLLHUP;
-    static final short POLLNVAL   = AbstractPollArrayWrapper.POLLNVAL;
-    static final short POLLREMOVE = AbstractPollArrayWrapper.POLLREMOVE;
-    static final short POLLCONN   = 0x0002;
+    @Native static final short POLLIN     = AbstractPollArrayWrapper.POLLIN;
+    @Native static final short POLLOUT    = AbstractPollArrayWrapper.POLLOUT;
+    @Native static final short POLLERR    = AbstractPollArrayWrapper.POLLERR;
+    @Native static final short POLLHUP    = AbstractPollArrayWrapper.POLLHUP;
+    @Native static final short POLLNVAL   = AbstractPollArrayWrapper.POLLNVAL;
+    @Native static final short POLLREMOVE = AbstractPollArrayWrapper.POLLREMOVE;
+    @Native static final short POLLCONN   = 0x0002;
 
     private int size; // Size of the pollArray
 
--- a/jdk/test/sun/text/resources/LocaleData	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/test/sun/text/resources/LocaleData	Wed Jul 05 18:36:58 2017 +0200
@@ -7660,3 +7660,6 @@
 
 # bug 7195759
 CurrencyNames//ZMW=ZMW
+
+# bug 7114053
+LocaleNames/sq/sq=shqip
--- a/jdk/test/sun/text/resources/LocaleDataTest.java	Wed Jan 16 22:17:36 2013 -0800
+++ b/jdk/test/sun/text/resources/LocaleDataTest.java	Wed Jul 05 18:36:58 2017 +0200
@@ -34,7 +34,7 @@
  *      6509039 6609737 6610748 6645271 6507067 6873931 6450945 6645268 6646611
  *      6645405 6650730 6910489 6573250 6870908 6585666 6716626 6914413 6916787
  *      6919624 6998391 7019267 7020960 7025837 7020583 7036905 7066203 7101495
- *      7003124 7085757 7028073 7171028 7189611 8000983 7195759
+ *      7003124 7085757 7028073 7171028 7189611 8000983 7195759 7114053
  * @summary Verify locale data
  *
  */
--- a/make/install-rules.gmk	Wed Jan 16 22:17:36 2013 -0800
+++ b/make/install-rules.gmk	Wed Jul 05 18:36:58 2017 +0200
@@ -96,6 +96,9 @@
 combo_build:
 	@$(ECHO) $@ installer combo build started: `$(DATE) '+%y-%m-%d %H:%M'`
 	$(CD) $(INSTALL_TOPDIR)/make/installer/bundles/windows/ishield/wrapper/wrapper.jreboth ; $(MAKE) all
+	$(CD) $(INSTALL_TOPDIR)/make/installer/bundles/windows/ishield/wrapper/wrapper.new64jre ; $(MAKE) all
+	$(CD) $(INSTALL_TOPDIR)/make/installer/bundles/windows/ishield/jre ; $(MAKE) au_combo
+	$(CD) $(INSTALL_TOPDIR)/make/installer/bundles/windows/xmlinffile ; $(MAKE) all
 
 install-clobber:
 ifeq ($(BUILD_INSTALL), true)
--- a/make/jprt.properties	Wed Jan 16 22:17:36 2013 -0800
+++ b/make/jprt.properties	Wed Jul 05 18:36:58 2017 +0200
@@ -28,6 +28,9 @@
 # Locked down to jdk8
 jprt.tools.default.release=jdk8
 
+# Unix toolkit to use for building on windows
+jprt.windows.jdk8.build.unix.toolkit=cygwin
+
 # The different build flavors we want, we override here so we just get these 2
 jprt.build.flavors=product,fastdebug