Track jdk8u111-b09
diff --git a/ASSEMBLY_EXCEPTION b/ASSEMBLY_EXCEPTION
index 065b8d9..8b7ac1d 100644
--- a/ASSEMBLY_EXCEPTION
+++ b/ASSEMBLY_EXCEPTION
@@ -1,27 +1,27 @@
 
 OPENJDK ASSEMBLY EXCEPTION
 
-The OpenJDK source code made available by Oracle America, Inc. (Oracle) at
-openjdk.java.net ("OpenJDK Code") is distributed under the terms of the GNU
-General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
+The OpenJDK source code made available by Sun at openjdk.java.net and
+openjdk.dev.java.net ("OpenJDK Code") is distributed under the terms of the
+GNU General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
 only ("GPL2"), with the following clarification and special exception.
 
     Linking this OpenJDK Code statically or dynamically with other code
     is making a combined work based on this library.  Thus, the terms
     and conditions of GPL2 cover the whole combination.
 
-    As a special exception, Oracle gives you permission to link this
-    OpenJDK Code with certain code licensed by Oracle as indicated at
+    As a special exception, Sun gives you permission to link this
+    OpenJDK Code with certain code licensed by Sun as indicated at
     http://openjdk.java.net/legal/exception-modules-2007-05-08.html
     ("Designated Exception Modules") to produce an executable,
     regardless of the license terms of the Designated Exception Modules,
     and to copy and distribute the resulting executable under GPL2,
     provided that the Designated Exception Modules continue to be
-    governed by the licenses under which they were offered by Oracle.
+    governed by the licenses under which they were offered by Sun.
 
-As such, it allows licensees and sublicensees of Oracle's GPL2 OpenJDK Code
-to build an executable that includes those portions of necessary code that
-Oracle could not provide under GPL2 (or that Oracle has provided under GPL2
-with the Classpath exception).  If you modify or add to the OpenJDK code,
-that new GPL2 code may still be combined with Designated Exception Modules
-if the new code is made subject to this exception by its copyright holder.
+As such, it allows licensees and sublicensees of Sun's GPL2 OpenJDK Code to
+build an executable that includes those portions of necessary code that Sun
+could not provide under GPL2 (or that Sun has provided under GPL2 with the
+Classpath exception).  If you modify or add to the OpenJDK code, that new
+GPL2 code may still be combined with Designated Exception Modules if the
+new code is made subject to this exception by its copyright holder.
diff --git a/LICENSE b/LICENSE
index 8b400c7..b40a0f4 100644
--- a/LICENSE
+++ b/LICENSE
@@ -3,7 +3,7 @@
 Version 2, June 1991
 
 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
 Everyone is permitted to copy and distribute verbatim copies of this license
 document, but changing it is not allowed.
@@ -287,8 +287,8 @@
     more details.
 
     You should have received a copy of the GNU General Public License along
-    with this program; if not, write to the Free Software Foundation, Inc.,
-    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+    with this program; if not, write to the Free Software Foundation, Inc., 59
+    Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
 Also add information on how to contact you by electronic and paper mail.
 
diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
index c9d7429..d3d0ccd 100644
--- a/common/autoconf/generated-configure.sh
+++ b/common/autoconf/generated-configure.sh
@@ -679,9 +679,6 @@
 CFLAGS_JDKLIB
 MACOSX_VERSION_MIN
 PACKAGE_PATH
-NO_LIFETIME_DSE_CFLAG
-NO_DELETE_NULL_POINTER_CHECKS_CFLAG
-CXXSTD_CXXFLAG
 LEGACY_EXTRA_LDFLAGS
 LEGACY_EXTRA_CXXFLAGS
 LEGACY_EXTRA_CFLAGS
@@ -746,8 +743,6 @@
 ac_ct_OBJC
 OBJCFLAGS
 OBJC
-CXX_VERSION
-CC_VERSION
 ac_ct_CXX
 CXXFLAGS
 CXX
@@ -3677,7 +3672,7 @@
 
 
 #
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# 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
@@ -3800,19 +3795,6 @@
 # questions.
 #
 
-# Prepare the system so that TOOLCHAIN_CHECK_COMPILER_VERSION can be called.
-# Must have CC_VERSION_NUMBER and CXX_VERSION_NUMBER.
-
-
-# Check if the configured compiler (C and C++) is of a specific version or
-# newer. TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS must have been called before.
-#
-# Arguments:
-#   $1:   The version string to check against the found version
-#   $2:   block to run if the compiler is at least this version (>=)
-#   $3:   block to run if the compiler is older than this version (<)
-
-
 # $1 = compiler to test (CC or CXX)
 # $2 = human readable name of compiler (C or C++)
 
@@ -3836,22 +3818,10 @@
 
 
 
-# TOOLCHAIN_C_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
-#                                      [RUN-IF-FALSE])
-# ------------------------------------------------------------
-# Check that the C compiler supports an argument
-
-
-# TOOLCHAIN_CXX_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
-#                                        [RUN-IF-FALSE])
-# ------------------------------------------------------------
-# Check that the C++ compiler supports an argument
-
-
 # TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
-#                                    [RUN-IF-FALSE])
+#                                   [RUN-IF-FALSE])
 # ------------------------------------------------------------
-# Check that the C and C++ compilers support an argument
+# Check that the c and c++ compilers support an argument
 
 
 
@@ -3859,8 +3829,6 @@
 # Setup the JTREG paths
 
 
-
-
 #
 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -3912,7 +3880,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1468207795
+DATE_WHEN_GENERATED=1449096260
 
 ###############################################################################
 #
@@ -20400,8 +20368,7 @@
 
     # First line typically looks something like:
     # gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2
-    COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | \
-        $SED -e 's/^.* \([1-9]\.[0-9.]*\)[^0-9.].*$/\1/'`
+    COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* \([1-9][0-9.]*\)/\1/p"`
     COMPILER_VENDOR=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^\(.*\) [1-9][0-9.]*/\1/p"`
   fi
   # This sets CC_VERSION or CXX_VERSION. (This comment is a grep marker)
@@ -22002,8 +21969,7 @@
 
     # First line typically looks something like:
     # gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2
-    COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | \
-        $SED -e 's/^.* \([1-9]\.[0-9.]*\)[^0-9.].*$/\1/'`
+    COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* \([1-9][0-9.]*\)/\1/p"`
     COMPILER_VENDOR=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^\(.*\) [1-9][0-9.]*/\1/p"`
   fi
   # This sets CC_VERSION or CXX_VERSION. (This comment is a grep marker)
@@ -22274,32 +22240,6 @@
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 
-  # This is the compiler version number on the form X.Y[.Z]
-
-
-
-
-  if test "x$CC_VERSION" != "x$CXX_VERSION"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C and C++ compiler has different version numbers, $CC_VERSION vs $CXX_VERSION." >&5
-$as_echo "$as_me: WARNING: C and C++ compiler has different version numbers, $CC_VERSION vs $CXX_VERSION." >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: This typically indicates a broken setup, and is not supported" >&5
-$as_echo "$as_me: WARNING: This typically indicates a broken setup, and is not supported" >&2;}
-  fi
-
-  # We only check CC_VERSION since we assume CXX_VERSION is equal.
-  if  [[ "$CC_VERSION" =~ (.*\.){3} ]] ; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C compiler version number has more than three parts (X.Y.Z): $CC_VERSION. Comparisons might be wrong." >&5
-$as_echo "$as_me: WARNING: C compiler version number has more than three parts (X.Y.Z): $CC_VERSION. Comparisons might be wrong." >&2;}
-  fi
-
-  if  [[  "$CC_VERSION" =~ [0-9]{6} ]] ; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C compiler version number has a part larger than 99999: $CC_VERSION. Comparisons might be wrong." >&5
-$as_echo "$as_me: WARNING: C compiler version number has a part larger than 99999: $CC_VERSION. Comparisons might be wrong." >&2;}
-  fi
-
-  COMPARABLE_ACTUAL_VERSION=`$AWK -F. '{ printf("%05d%05d%05d\n", $1, $2, $3) }' <<< "$CC_VERSION"`
-
-
   ### Locate other tools
 
   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
@@ -24891,8 +24831,7 @@
 
 
       COMPILER_TYPE=CL
-      # silence copyright notice and other headers.
-      COMMON_CCXXFLAGS="$COMMON_CCXXFLAGS -nologo"
+      CCXXFLAGS="$CCXXFLAGS -nologo"
 
 fi
 
@@ -29725,57 +29664,12 @@
   #
   # Now setup the CFLAGS and LDFLAGS for the JDK build.
   # Later we will also have CFLAGS and LDFLAGS for the hotspot subrepo build.
-  #    CFLAGS_JDK    - C Compiler flags
-  #    CXXFLAGS_JDK  - C++ Compiler flags
-  #    COMMON_CCXXFLAGS_JDK - common to C and C++
   #
   case $COMPILER_NAME in
     gcc )
-      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -W -Wall -Wno-unused -Wno-parentheses \
+      CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -W -Wall -Wno-unused -Wno-parentheses \
       -pipe \
       -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
-      CXXSTD_CXXFLAG="-std=gnu++98"
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the C++ compiler supports \"$CXXSTD_CXXFLAG $CFLAGS_WARNINGS_ARE_ERRORS\"" >&5
-$as_echo_n "checking if the C++ compiler supports \"$CXXSTD_CXXFLAG $CFLAGS_WARNINGS_ARE_ERRORS\"... " >&6; }
-  supports=yes
-
-  saved_cxxflags="$CXXFLAGS"
-  CXXFLAGS="$CXXFLAG $CXXSTD_CXXFLAG $CFLAGS_WARNINGS_ARE_ERRORS"
-  ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-int i;
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-
-else
-  supports=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-  CXXFLAGS="$saved_cxxflags"
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
-$as_echo "$supports" >&6; }
-  if test "x$supports" = "xyes" ; then
-    :
-  else
-    CXXSTD_CXXFLAG=""
-  fi
-
-      CXXFLAGS_JDK="${CXXFLAGS_JDK} ${CXXSTD_CXXFLAG}"
-
       case $OPENJDK_TARGET_CPU_ARCH in
         arm )
           # on arm we don't prevent gcc to omit frame pointer but do prevent strict aliasing
@@ -29785,234 +29679,16 @@
           # on ppc we don't prevent gcc to omit frame pointer nor strict-aliasing
           ;;
         * )
-          COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
+          CCXXFLAGS_JDK="$CCXXFLAGS_JDK -fno-omit-frame-pointer"
           CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
           ;;
       esac
-
-  REFERENCE_VERSION=6
-
-  if  [[ "$REFERENCE_VERSION" =~ (.*\.){3} ]] ; then
-    as_fn_error $? "Internal error: Cannot compare to $REFERENCE_VERSION, only three parts (X.Y.Z) is supported" "$LINENO" 5
-  fi
-
-  if  [[ "$REFERENCE_VERSION" =~ [0-9]{6} ]] ; then
-    as_fn_error $? "Internal error: Cannot compare to $REFERENCE_VERSION, only parts < 99999 is supported" "$LINENO" 5
-  fi
-
-  # Version comparison method inspired by http://stackoverflow.com/a/24067243
-  COMPARABLE_REFERENCE_VERSION=`$AWK -F. '{ printf("%05d%05d%05d\n", $1, $2, $3) }' <<< "$REFERENCE_VERSION"`
-
-  if test $COMPARABLE_ACTUAL_VERSION -ge $COMPARABLE_REFERENCE_VERSION ; then
-
-  # These flags are required for GCC 6 builds as undefined behaviour in OpenJDK code
-  # runs afoul of the more aggressive versions of these optimisations.
-  # Notably, value range propagation now assumes that the this pointer of C++
-  # member functions is non-null.
-  NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks"
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the C compiler supports \"$NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror\"" >&5
-$as_echo_n "checking if the C compiler supports \"$NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror\"... " >&6; }
-  supports=yes
-
-  saved_cflags="$CFLAGS"
-  CFLAGS="$CFLAGS $NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror"
-  ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-int i;
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-else
-  supports=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-  CFLAGS="$saved_cflags"
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
-$as_echo "$supports" >&6; }
-  if test "x$supports" = "xyes" ; then
-    C_COMP_SUPPORTS="yes"
-  else
-    C_COMP_SUPPORTS="no"
-  fi
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the C++ compiler supports \"$NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror\"" >&5
-$as_echo_n "checking if the C++ compiler supports \"$NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror\"... " >&6; }
-  supports=yes
-
-  saved_cxxflags="$CXXFLAGS"
-  CXXFLAGS="$CXXFLAG $NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror"
-  ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-int i;
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-
-else
-  supports=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-  CXXFLAGS="$saved_cxxflags"
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
-$as_echo "$supports" >&6; }
-  if test "x$supports" = "xyes" ; then
-    CXX_COMP_SUPPORTS="yes"
-  else
-    CXX_COMP_SUPPORTS="no"
-  fi
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if both compilers support \"$NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror\"" >&5
-$as_echo_n "checking if both compilers support \"$NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror\"... " >&6; }
-  supports=no
-  if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then supports=yes; fi
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
-$as_echo "$supports" >&6; }
-  if test "x$supports" = "xyes" ; then
-    :
-  else
-    NO_DELETE_NULL_POINTER_CHECKS_CFLAG=""
-  fi
-
-
-  NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the C compiler supports \"$NO_LIFETIME_DSE_CFLAG -Werror\"" >&5
-$as_echo_n "checking if the C compiler supports \"$NO_LIFETIME_DSE_CFLAG -Werror\"... " >&6; }
-  supports=yes
-
-  saved_cflags="$CFLAGS"
-  CFLAGS="$CFLAGS $NO_LIFETIME_DSE_CFLAG -Werror"
-  ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-int i;
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-else
-  supports=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-  CFLAGS="$saved_cflags"
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
-$as_echo "$supports" >&6; }
-  if test "x$supports" = "xyes" ; then
-    C_COMP_SUPPORTS="yes"
-  else
-    C_COMP_SUPPORTS="no"
-  fi
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the C++ compiler supports \"$NO_LIFETIME_DSE_CFLAG -Werror\"" >&5
-$as_echo_n "checking if the C++ compiler supports \"$NO_LIFETIME_DSE_CFLAG -Werror\"... " >&6; }
-  supports=yes
-
-  saved_cxxflags="$CXXFLAGS"
-  CXXFLAGS="$CXXFLAG $NO_LIFETIME_DSE_CFLAG -Werror"
-  ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-int i;
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-
-else
-  supports=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-  CXXFLAGS="$saved_cxxflags"
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
-$as_echo "$supports" >&6; }
-  if test "x$supports" = "xyes" ; then
-    CXX_COMP_SUPPORTS="yes"
-  else
-    CXX_COMP_SUPPORTS="no"
-  fi
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if both compilers support \"$NO_LIFETIME_DSE_CFLAG -Werror\"" >&5
-$as_echo_n "checking if both compilers support \"$NO_LIFETIME_DSE_CFLAG -Werror\"... " >&6; }
-  supports=no
-  if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then supports=yes; fi
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
-$as_echo "$supports" >&6; }
-  if test "x$supports" = "xyes" ; then
-    :
-  else
-    NO_LIFETIME_DSE_CFLAG=""
-  fi
-
-  CFLAGS_JDK="${CFLAGS_JDK} ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
-
-
-
-  else
-    :
-  fi
-
       ;;
     ossc )
-      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
+      CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
       case $OPENJDK_TARGET_CPU_ARCH in
         x86 )
-          COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_TARGET_CPU_LEGACY_LIB"
+          CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_TARGET_CPU_LEGACY_LIB"
           CFLAGS_JDK="$CFLAGS_JDK -erroff=E_BAD_PRAGMA_PACK_VALUE"
           ;;
       esac
@@ -30031,16 +29707,16 @@
       LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK"
       ;;
     cl )
-      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
+      CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
       -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB -DWIN32_LEAN_AND_MEAN \
       -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
       -DWIN32 -DIAL"
       case $OPENJDK_TARGET_CPU in
         x86 )
-          COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_X86_ -Dx86"
+          CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_X86_ -Dx86"
           ;;
         x86_64 )
-          COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_AMD64_ -Damd64"
+          CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_AMD64_ -Damd64"
           ;;
       esac
       ;;
@@ -30070,7 +29746,7 @@
       ;;
   esac
 
-  COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK $ADD_LP64"
+  CCXXFLAGS_JDK="$CCXXFLAGS_JDK $ADD_LP64"
 
   # The package path is used only on macosx?
   PACKAGE_PATH=/opt/local
@@ -30083,27 +29759,27 @@
     #   Note: -Dmacro         is the same as    #define macro 1
     #         -Dmacro=        is the same as    #define macro
     if test "x$OPENJDK_TARGET_OS" = xsolaris; then
-      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_LITTLE_ENDIAN="
+      CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN="
     else
-      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_LITTLE_ENDIAN"
+      CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN"
     fi
   else
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_BIG_ENDIAN"
+    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN"
   fi
   if test "x$OPENJDK_TARGET_OS" = xlinux; then
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DLINUX"
+    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DLINUX"
   fi
   if test "x$OPENJDK_TARGET_OS" = xwindows; then
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DWINDOWS"
+    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DWINDOWS"
   fi
   if test "x$OPENJDK_TARGET_OS" = xsolaris; then
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DSOLARIS"
+    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DSOLARIS"
   fi
   if test "x$OPENJDK_TARGET_OS" = xaix; then
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DAIX -DPPC64"
+    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DAIX -DPPC64"
   fi
   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DMACOSX -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
+    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMACOSX -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
     # Setting these parameters makes it an error to link to macosx APIs that are
     # newer than the given OS version and makes the linked binaries compatible even
     # if built on a newer version of the OS.
@@ -30113,25 +29789,25 @@
     # The macro takes the version with no dots, ex: 1070
     # Let the flags variables get resolved in make for easier override on make
     # command line.
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
+    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
     LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
   fi
   if test "x$OPENJDK_TARGET_OS" = xbsd; then
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DBSD -D_ALLBSD_SOURCE"
+    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DBSD -D_ALLBSD_SOURCE"
   fi
   if test "x$DEBUG_LEVEL" = xrelease; then
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DNDEBUG"
+    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DNDEBUG"
   if test "x$OPENJDK_TARGET_OS" = xsolaris; then
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DTRIMMED"
+    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DTRIMMED"
   fi
   else
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DDEBUG"
+    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DDEBUG"
   fi
 
-  COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY"
-  COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DRELEASE='\"\$(RELEASE)\"'"
+  CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY"
+  CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DRELEASE='\"\$(RELEASE)\"'"
 
-  COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK \
+  CCXXFLAGS_JDK="$CCXXFLAGS_JDK \
       -I${JDK_OUTPUTDIR}/include \
       -I${JDK_OUTPUTDIR}/include/$OPENJDK_TARGET_OS \
       -I${JDK_TOPDIR}/src/share/javavm/export \
@@ -30140,12 +29816,12 @@
       -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_API_DIR/native/common"
 
   # The shared libraries are compiled using the picflag.
-  CFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
-  CXXFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA "
+  CFLAGS_JDKLIB="$CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
+  CXXFLAGS_JDKLIB="$CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA "
 
   # Executable flags
-  CFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK"
-  CXXFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK"
+  CFLAGS_JDKEXE="$CCXXFLAGS_JDK $CFLAGS_JDK"
+  CXXFLAGS_JDKEXE="$CCXXFLAGS_JDK $CXXFLAGS_JDK"
 
   # Now this is odd. The JDK native libraries have to link against libjvm.so
   # On 32-bit machines there is normally two distinct libjvm.so:s, client and server.
@@ -30229,6 +29905,7 @@
 
 
 
+
   # Some Zero and Shark settings.
   # ZERO_ARCHFLAG tells the compiler which mode to build for
   case "${OPENJDK_TARGET_CPU}" in
@@ -30239,9 +29916,8 @@
       ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
   esac
 
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the C compiler supports \"$ZERO_ARCHFLAG\"" >&5
-$as_echo_n "checking if the C compiler supports \"$ZERO_ARCHFLAG\"... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports \"$ZERO_ARCHFLAG\"" >&5
+$as_echo_n "checking if compiler supports \"$ZERO_ARCHFLAG\"... " >&6; }
   supports=yes
 
   saved_cflags="$CFLAGS"
@@ -30270,19 +29946,6 @@
 
   CFLAGS="$saved_cflags"
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
-$as_echo "$supports" >&6; }
-  if test "x$supports" = "xyes" ; then
-    C_COMP_SUPPORTS="yes"
-  else
-    C_COMP_SUPPORTS="no"
-  fi
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the C++ compiler supports \"$ZERO_ARCHFLAG\"" >&5
-$as_echo_n "checking if the C++ compiler supports \"$ZERO_ARCHFLAG\"... " >&6; }
-  supports=yes
-
   saved_cxxflags="$CXXFLAGS"
   CXXFLAGS="$CXXFLAG $ZERO_ARCHFLAG"
   ac_ext=cpp
@@ -30312,20 +29975,6 @@
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
 $as_echo "$supports" >&6; }
   if test "x$supports" = "xyes" ; then
-    CXX_COMP_SUPPORTS="yes"
-  else
-    CXX_COMP_SUPPORTS="no"
-  fi
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if both compilers support \"$ZERO_ARCHFLAG\"" >&5
-$as_echo_n "checking if both compilers support \"$ZERO_ARCHFLAG\"... " >&6; }
-  supports=no
-  if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then supports=yes; fi
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
-$as_echo "$supports" >&6; }
-  if test "x$supports" = "xyes" ; then
     :
   else
     ZERO_ARCHFLAG=""
@@ -30336,9 +29985,8 @@
   # Check that the compiler supports -mX (or -qX on AIX) flags
   # Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
 
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the C compiler supports \"${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}\"" >&5
-$as_echo_n "checking if the C compiler supports \"${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}\"... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports \"${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}\"" >&5
+$as_echo_n "checking if compiler supports \"${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}\"... " >&6; }
   supports=yes
 
   saved_cflags="$CFLAGS"
@@ -30367,19 +30015,6 @@
 
   CFLAGS="$saved_cflags"
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
-$as_echo "$supports" >&6; }
-  if test "x$supports" = "xyes" ; then
-    C_COMP_SUPPORTS="yes"
-  else
-    C_COMP_SUPPORTS="no"
-  fi
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the C++ compiler supports \"${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}\"" >&5
-$as_echo_n "checking if the C++ compiler supports \"${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}\"... " >&6; }
-  supports=yes
-
   saved_cxxflags="$CXXFLAGS"
   CXXFLAGS="$CXXFLAG ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
   ac_ext=cpp
@@ -30409,20 +30044,6 @@
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
 $as_echo "$supports" >&6; }
   if test "x$supports" = "xyes" ; then
-    CXX_COMP_SUPPORTS="yes"
-  else
-    CXX_COMP_SUPPORTS="no"
-  fi
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if both compilers support \"${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}\"" >&5
-$as_echo_n "checking if both compilers support \"${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}\"... " >&6; }
-  supports=no
-  if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then supports=yes; fi
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
-$as_echo "$supports" >&6; }
-  if test "x$supports" = "xyes" ; then
     COMPILER_SUPPORTS_TARGET_BITS_FLAG=true
   else
     COMPILER_SUPPORTS_TARGET_BITS_FLAG=false
diff --git a/common/autoconf/hotspot-spec.gmk.in b/common/autoconf/hotspot-spec.gmk.in
index 8146fe5..65d14dc 100644
--- a/common/autoconf/hotspot-spec.gmk.in
+++ b/common/autoconf/hotspot-spec.gmk.in
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -109,8 +109,7 @@
 MT:=@HOTSPOT_MT@
 RC:=@HOTSPOT_RC@
 
-EXTRA_CFLAGS=@LEGACY_EXTRA_CFLAGS@ $(NO_DELETE_NULL_POINTER_CHECKS_CFLAG) \
-				   $(NO_LIFETIME_DSE_CFLAG) $(CXXSTD_CXXFLAG)
+EXTRA_CFLAGS=@LEGACY_EXTRA_CFLAGS@
 EXTRA_CXXFLAGS=@LEGACY_EXTRA_CXXFLAGS@
 EXTRA_LDFLAGS=@LEGACY_EXTRA_LDFLAGS@
 
diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in
index 1c418f2..ed3ef8b 100644
--- a/common/autoconf/spec.gmk.in
+++ b/common/autoconf/spec.gmk.in
@@ -331,10 +331,6 @@
 CFLAGS_JDKEXE:=@CFLAGS_JDKEXE@
 CXXFLAGS_JDKEXE:=@CXXFLAGS_JDKEXE@
 
-NO_DELETE_NULL_POINTER_CHECKS_CFLAG=@NO_DELETE_NULL_POINTER_CHECKS_CFLAG@
-NO_LIFETIME_DSE_CFLAG=@NO_LIFETIME_DSE_CFLAG@
-CXXSTD_CXXFLAG=@CXXSTD_CXXFLAG@
-
 CXX:=@FIXPATH@ @CCACHE@ @CXX@
 #CXXFLAGS:=@CXXFLAGS@
 
diff --git a/common/autoconf/toolchain.m4 b/common/autoconf/toolchain.m4
index 1af8fa3..44ceadf 100644
--- a/common/autoconf/toolchain.m4
+++ b/common/autoconf/toolchain.m4
@@ -23,59 +23,9 @@
 # questions.
 #
 
-# Prepare the system so that TOOLCHAIN_CHECK_COMPILER_VERSION can be called.
-# Must have CC_VERSION_NUMBER and CXX_VERSION_NUMBER.
-AC_DEFUN([TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS],
-[
-  if test "x$CC_VERSION" != "x$CXX_VERSION"; then
-    AC_MSG_WARN([C and C++ compiler has different version numbers, $CC_VERSION vs $CXX_VERSION.])
-    AC_MSG_WARN([This typically indicates a broken setup, and is not supported])
-  fi
-
-  # We only check CC_VERSION since we assume CXX_VERSION is equal.
-  if [ [[ "$CC_VERSION" =~ (.*\.){3} ]] ]; then
-    AC_MSG_WARN([C compiler version number has more than three parts (X.Y.Z): $CC_VERSION. Comparisons might be wrong.])
-  fi
-
-  if [ [[  "$CC_VERSION" =~ [0-9]{6} ]] ]; then
-    AC_MSG_WARN([C compiler version number has a part larger than 99999: $CC_VERSION. Comparisons might be wrong.])
-  fi
-
-  COMPARABLE_ACTUAL_VERSION=`$AWK -F. '{ printf("%05d%05d%05d\n", [$]1, [$]2, [$]3) }' <<< "$CC_VERSION"`
-])
-
-# Check if the configured compiler (C and C++) is of a specific version or
-# newer. TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS must have been called before.
-#
-# Arguments:
-#   $1:   The version string to check against the found version
-#   $2:   block to run if the compiler is at least this version (>=)
-#   $3:   block to run if the compiler is older than this version (<)
-AC_DEFUN([TOOLCHAIN_CHECK_COMPILER_VERSION],
-[
-  REFERENCE_VERSION=$1
-
-  if [ [[ "$REFERENCE_VERSION" =~ (.*\.){3} ]] ]; then
-    AC_MSG_ERROR([Internal error: Cannot compare to $REFERENCE_VERSION, only three parts (X.Y.Z) is supported])
-  fi
-
-  if [ [[ "$REFERENCE_VERSION" =~ [0-9]{6} ]] ]; then
-    AC_MSG_ERROR([Internal error: Cannot compare to $REFERENCE_VERSION, only parts < 99999 is supported])
-  fi
-
-  # Version comparison method inspired by http://stackoverflow.com/a/24067243
-  COMPARABLE_REFERENCE_VERSION=`$AWK -F. '{ printf("%05d%05d%05d\n", [$]1, [$]2, [$]3) }' <<< "$REFERENCE_VERSION"`
-
-  if test $COMPARABLE_ACTUAL_VERSION -ge $COMPARABLE_REFERENCE_VERSION ; then
-    m4_ifval([$2], [$2], [:])
-  else
-    m4_ifval([$3], [$3], [:])
-  fi
-])
-
 # $1 = compiler to test (CC or CXX)
 # $2 = human readable name of compiler (C or C++)
-AC_DEFUN([TOOLCHAIN_EXTRACT_COMPILER_VERSION],
+AC_DEFUN([TOOLCHAIN_CHECK_COMPILER_VERSION],
 [
   COMPILER=[$]$1
   COMPILER_NAME=$2
@@ -131,8 +81,7 @@
 
     # First line typically looks something like:
     # gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2
-    COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | \
-        $SED -e 's/^.* \(@<:@1-9@:>@\.@<:@0-9.@:>@*\)@<:@^0-9.@:>@.*$/\1/'`
+    COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* \(@<:@1-9@:>@@<:@0-9.@:>@*\)/\1/p"`
     COMPILER_VENDOR=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^\(.*\) @<:@1-9@:>@@<:@0-9.@:>@*/\1/p"`
   fi
   # This sets CC_VERSION or CXX_VERSION. (This comment is a grep marker)
@@ -232,7 +181,7 @@
     AC_MSG_RESULT([no, keeping $1])
     $1="$TEST_COMPILER"
   fi
-  TOOLCHAIN_EXTRACT_COMPILER_VERSION([$1], [$COMPILER_NAME])
+  TOOLCHAIN_CHECK_COMPILER_VERSION([$1], [$COMPILER_NAME])
 ])
 
 
@@ -436,12 +385,6 @@
   # Now that we have resolved CXX ourself, let autoconf have its go at it
   AC_PROG_CXX([$CXX])
 
-  # This is the compiler version number on the form X.Y[.Z]
-  AC_SUBST(CC_VERSION)
-  AC_SUBST(CXX_VERSION)
-
-  TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS
-
   ### Locate other tools
 
   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
@@ -564,8 +507,7 @@
       BASIC_FIXUP_EXECUTABLE(DUMPBIN)
 
       COMPILER_TYPE=CL
-      # silence copyright notice and other headers.
-      COMMON_CCXXFLAGS="$COMMON_CCXXFLAGS -nologo"
+      CCXXFLAGS="$CCXXFLAGS -nologo"
   ])
   AC_SUBST(RC_FLAGS)
   AC_SUBST(COMPILER_TYPE)
@@ -1012,20 +954,12 @@
   #
   # Now setup the CFLAGS and LDFLAGS for the JDK build.
   # Later we will also have CFLAGS and LDFLAGS for the hotspot subrepo build.
-  #    CFLAGS_JDK    - C Compiler flags
-  #    CXXFLAGS_JDK  - C++ Compiler flags
-  #    COMMON_CCXXFLAGS_JDK - common to C and C++
   #
   case $COMPILER_NAME in
     gcc )
-      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -W -Wall -Wno-unused -Wno-parentheses \
+      CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -W -Wall -Wno-unused -Wno-parentheses \
       -pipe \
       -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
-      CXXSTD_CXXFLAG="-std=gnu++98"
-      TOOLCHAIN_CXX_COMPILER_CHECK_ARGUMENTS([$CXXSTD_CXXFLAG $CFLAGS_WARNINGS_ARE_ERRORS],
-    					     [], [CXXSTD_CXXFLAG=""])
-      CXXFLAGS_JDK="${CXXFLAGS_JDK} ${CXXSTD_CXXFLAG}"
-      AC_SUBST([CXXSTD_CXXFLAG])
       case $OPENJDK_TARGET_CPU_ARCH in
         arm )
           # on arm we don't prevent gcc to omit frame pointer but do prevent strict aliasing
@@ -1035,17 +969,16 @@
           # on ppc we don't prevent gcc to omit frame pointer nor strict-aliasing
           ;;
         * )
-          COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
+          CCXXFLAGS_JDK="$CCXXFLAGS_JDK -fno-omit-frame-pointer"
           CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
           ;;
       esac
-      TOOLCHAIN_CHECK_COMPILER_VERSION(6, TOOLCHAIN_SETUP_GCC6_COMPILER_FLAGS)
       ;;
     ossc )
-      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
+      CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
       case $OPENJDK_TARGET_CPU_ARCH in
         x86 )
-          COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_TARGET_CPU_LEGACY_LIB"
+          CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_TARGET_CPU_LEGACY_LIB"
           CFLAGS_JDK="$CFLAGS_JDK -erroff=E_BAD_PRAGMA_PACK_VALUE"
           ;;
       esac
@@ -1064,16 +997,16 @@
       LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK"
       ;;
     cl )
-      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
+      CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
       -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB -DWIN32_LEAN_AND_MEAN \
       -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
       -DWIN32 -DIAL"
       case $OPENJDK_TARGET_CPU in
         x86 )
-          COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_X86_ -Dx86"
+          CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_X86_ -Dx86"
           ;;
         x86_64 )
-          COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_AMD64_ -Damd64"
+          CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_AMD64_ -Damd64"
           ;;
       esac
       ;;
@@ -1103,7 +1036,7 @@
       ;;
   esac
 
-  COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK $ADD_LP64"
+  CCXXFLAGS_JDK="$CCXXFLAGS_JDK $ADD_LP64"
 
   # The package path is used only on macosx?
   PACKAGE_PATH=/opt/local
@@ -1116,27 +1049,27 @@
     #   Note: -Dmacro         is the same as    #define macro 1
     #         -Dmacro=        is the same as    #define macro
     if test "x$OPENJDK_TARGET_OS" = xsolaris; then
-      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_LITTLE_ENDIAN="
+      CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN="
     else
-      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_LITTLE_ENDIAN"
+      CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN"
     fi
   else
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_BIG_ENDIAN"
+    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN"
   fi
   if test "x$OPENJDK_TARGET_OS" = xlinux; then
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DLINUX"
+    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DLINUX"
   fi
   if test "x$OPENJDK_TARGET_OS" = xwindows; then
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DWINDOWS"
+    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DWINDOWS"
   fi
   if test "x$OPENJDK_TARGET_OS" = xsolaris; then
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DSOLARIS"
+    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DSOLARIS"
   fi
   if test "x$OPENJDK_TARGET_OS" = xaix; then
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DAIX -DPPC64"
+    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DAIX -DPPC64"
   fi
   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DMACOSX -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
+    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMACOSX -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
     # Setting these parameters makes it an error to link to macosx APIs that are
     # newer than the given OS version and makes the linked binaries compatible even
     # if built on a newer version of the OS.
@@ -1146,25 +1079,25 @@
     # The macro takes the version with no dots, ex: 1070
     # Let the flags variables get resolved in make for easier override on make
     # command line.
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
+    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
     LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
   fi
   if test "x$OPENJDK_TARGET_OS" = xbsd; then
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DBSD -D_ALLBSD_SOURCE"
+    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DBSD -D_ALLBSD_SOURCE"
   fi
   if test "x$DEBUG_LEVEL" = xrelease; then
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DNDEBUG"
+    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DNDEBUG"
   if test "x$OPENJDK_TARGET_OS" = xsolaris; then
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DTRIMMED"
+    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DTRIMMED"
   fi
   else
-    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DDEBUG"
+    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DDEBUG"
   fi
 
-  COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY"
-  COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DRELEASE='\"\$(RELEASE)\"'"
+  CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY"
+  CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DRELEASE='\"\$(RELEASE)\"'"
 
-  COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK \
+  CCXXFLAGS_JDK="$CCXXFLAGS_JDK \
       -I${JDK_OUTPUTDIR}/include \
       -I${JDK_OUTPUTDIR}/include/$OPENJDK_TARGET_OS \
       -I${JDK_TOPDIR}/src/share/javavm/export \
@@ -1173,12 +1106,12 @@
       -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_API_DIR/native/common"
 
   # The shared libraries are compiled using the picflag.
-  CFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
-  CXXFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA "
+  CFLAGS_JDKLIB="$CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
+  CXXFLAGS_JDKLIB="$CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA "
 
   # Executable flags
-  CFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK"
-  CXXFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK"
+  CFLAGS_JDKEXE="$CCXXFLAGS_JDK $CFLAGS_JDK"
+  CXXFLAGS_JDKEXE="$CCXXFLAGS_JDK $CXXFLAGS_JDK"
 
   # Now this is odd. The JDK native libraries have to link against libjvm.so
   # On 32-bit machines there is normally two distinct libjvm.so:s, client and server.
@@ -1263,13 +1196,13 @@
 ])
 
 
-# TOOLCHAIN_C_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
-#                                      [RUN-IF-FALSE])
+# TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
+#                                   [RUN-IF-FALSE])
 # ------------------------------------------------------------
-# Check that the C compiler supports an argument
-AC_DEFUN([TOOLCHAIN_C_COMPILER_CHECK_ARGUMENTS],
+# Check that the c and c++ compilers support an argument
+AC_DEFUN([TOOLCHAIN_COMPILER_CHECK_ARGUMENTS],
 [
-  AC_MSG_CHECKING([if the C compiler supports "$1"])
+  AC_MSG_CHECKING([if compiler supports "$1"])
   supports=yes
 
   saved_cflags="$CFLAGS"
@@ -1280,23 +1213,6 @@
   AC_LANG_POP([C])
   CFLAGS="$saved_cflags"
 
-  AC_MSG_RESULT([$supports])
-  if test "x$supports" = "xyes" ; then
-    m4_ifval([$2], [$2], [:])
-  else
-    m4_ifval([$3], [$3], [:])
-  fi
-])
-
-# TOOLCHAIN_CXX_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
-#                                        [RUN-IF-FALSE])
-# ------------------------------------------------------------
-# Check that the C++ compiler supports an argument
-AC_DEFUN([TOOLCHAIN_CXX_COMPILER_CHECK_ARGUMENTS],
-[
-  AC_MSG_CHECKING([if the C++ compiler supports "$1"])
-  supports=yes
-
   saved_cxxflags="$CXXFLAGS"
   CXXFLAGS="$CXXFLAG $1"
   AC_LANG_PUSH([C++])
@@ -1304,32 +1220,7 @@
       [supports=no])
   AC_LANG_POP([C++])
   CXXFLAGS="$saved_cxxflags"
-  
-  AC_MSG_RESULT([$supports])
-  if test "x$supports" = "xyes" ; then
-    m4_ifval([$2], [$2], [:])
-  else
-    m4_ifval([$3], [$3], [:])
-  fi
-])
 
-# TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
-#                                    [RUN-IF-FALSE])
-# ------------------------------------------------------------
-# Check that the C and C++ compilers support an argument
-AC_DEFUN([TOOLCHAIN_COMPILER_CHECK_ARGUMENTS],
-[
-  TOOLCHAIN_C_COMPILER_CHECK_ARGUMENTS([$1],
-  				       [C_COMP_SUPPORTS="yes"],
-				       [C_COMP_SUPPORTS="no"])
-  TOOLCHAIN_CXX_COMPILER_CHECK_ARGUMENTS([$1],
-  					 [CXX_COMP_SUPPORTS="yes"],
-					 [CXX_COMP_SUPPORTS="no"])
-
-  AC_MSG_CHECKING([if both compilers support "$1"])
-  supports=no
-  if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then supports=yes; fi
-  
   AC_MSG_RESULT([$supports])
   if test "x$supports" = "xyes" ; then
     m4_ifval([$2], [$2], [:])
@@ -1420,20 +1311,3 @@
   AC_SUBST(JT_HOME)
   AC_SUBST(JTREGEXE)
 ])
-
-AC_DEFUN_ONCE([TOOLCHAIN_SETUP_GCC6_COMPILER_FLAGS],
-[
-  # These flags are required for GCC 6 builds as undefined behaviour in OpenJDK code
-  # runs afoul of the more aggressive versions of these optimisations.
-  # Notably, value range propagation now assumes that the this pointer of C++
-  # member functions is non-null.
-  NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks"
-  TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([$NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror],
-  				     [], [NO_DELETE_NULL_POINTER_CHECKS_CFLAG=""])
-  AC_SUBST([NO_DELETE_NULL_POINTER_CHECKS_CFLAG])
-  NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
-  TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([$NO_LIFETIME_DSE_CFLAG -Werror],
-  				     [], [NO_LIFETIME_DSE_CFLAG=""])
-  CFLAGS_JDK="${CFLAGS_JDK} ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
-  AC_SUBST([NO_LIFETIME_DSE_CFLAG])
-])
diff --git a/corba/ASSEMBLY_EXCEPTION b/corba/ASSEMBLY_EXCEPTION
index 065b8d9..8b7ac1d 100644
--- a/corba/ASSEMBLY_EXCEPTION
+++ b/corba/ASSEMBLY_EXCEPTION
@@ -1,27 +1,27 @@
 
 OPENJDK ASSEMBLY EXCEPTION
 
-The OpenJDK source code made available by Oracle America, Inc. (Oracle) at
-openjdk.java.net ("OpenJDK Code") is distributed under the terms of the GNU
-General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
+The OpenJDK source code made available by Sun at openjdk.java.net and
+openjdk.dev.java.net ("OpenJDK Code") is distributed under the terms of the
+GNU General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
 only ("GPL2"), with the following clarification and special exception.
 
     Linking this OpenJDK Code statically or dynamically with other code
     is making a combined work based on this library.  Thus, the terms
     and conditions of GPL2 cover the whole combination.
 
-    As a special exception, Oracle gives you permission to link this
-    OpenJDK Code with certain code licensed by Oracle as indicated at
+    As a special exception, Sun gives you permission to link this
+    OpenJDK Code with certain code licensed by Sun as indicated at
     http://openjdk.java.net/legal/exception-modules-2007-05-08.html
     ("Designated Exception Modules") to produce an executable,
     regardless of the license terms of the Designated Exception Modules,
     and to copy and distribute the resulting executable under GPL2,
     provided that the Designated Exception Modules continue to be
-    governed by the licenses under which they were offered by Oracle.
+    governed by the licenses under which they were offered by Sun.
 
-As such, it allows licensees and sublicensees of Oracle's GPL2 OpenJDK Code
-to build an executable that includes those portions of necessary code that
-Oracle could not provide under GPL2 (or that Oracle has provided under GPL2
-with the Classpath exception).  If you modify or add to the OpenJDK code,
-that new GPL2 code may still be combined with Designated Exception Modules
-if the new code is made subject to this exception by its copyright holder.
+As such, it allows licensees and sublicensees of Sun's GPL2 OpenJDK Code to
+build an executable that includes those portions of necessary code that Sun
+could not provide under GPL2 (or that Sun has provided under GPL2 with the
+Classpath exception).  If you modify or add to the OpenJDK code, that new
+GPL2 code may still be combined with Designated Exception Modules if the
+new code is made subject to this exception by its copyright holder.
diff --git a/corba/LICENSE b/corba/LICENSE
index 8b400c7..b40a0f4 100644
--- a/corba/LICENSE
+++ b/corba/LICENSE
@@ -3,7 +3,7 @@
 Version 2, June 1991
 
 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
 Everyone is permitted to copy and distribute verbatim copies of this license
 document, but changing it is not allowed.
@@ -287,8 +287,8 @@
     more details.
 
     You should have received a copy of the GNU General Public License along
-    with this program; if not, write to the Free Software Foundation, Inc.,
-    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+    with this program; if not, write to the Free Software Foundation, Inc., 59
+    Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
 Also add information on how to contact you by electronic and paper mail.
 
diff --git a/corba/src/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java b/corba/src/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java
index 7eff7c3..c9d6320 100644
--- a/corba/src/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java
+++ b/corba/src/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java
@@ -2230,7 +2230,7 @@
      * REVISIT -- This code doesn't do what the comment says to when
      * getField() is null!
      */
-    private void inputClassFields(Object o, final Class<?> cl,
+    private void inputClassFields(Object o, Class cl,
                                   ObjectStreamField[] fields,
                                   com.sun.org.omg.SendingContext.CodeBase sender)
         throws InvalidClassException, StreamCorruptedException,
@@ -2264,31 +2264,21 @@
                 }
 
                 try {
-                    Class<?> fieldCl = fields[i].getClazz();
+                    Class fieldCl = fields[i].getClazz();
                     if ((objectValue != null)
                             && (!fieldCl.isAssignableFrom(
                                     objectValue.getClass()))) {
                         throw new IllegalArgumentException("Field mismatch");
                     }
-                    Field declaredClassField = null;
-                    final String inputStreamFieldName = fields[i].getName();
+                   Field classField = null;
                     try {
-                        declaredClassField = getDeclaredField( cl, inputStreamFieldName);
-                    } catch (PrivilegedActionException paEx) {
-                        throw new IllegalArgumentException(
-                            (NoSuchFieldException) paEx.getException());
+                        classField = cl.getDeclaredField(fields[i].getName());
+                    } catch (NoSuchFieldException nsfEx) {
+                        throw new IllegalArgumentException(nsfEx);
                     } catch (SecurityException secEx) {
-                        throw new IllegalArgumentException(secEx);
-                    }  catch (NullPointerException npEx) {
-                        continue;
-                    } catch (NoSuchFieldException e) {
-                        continue;
+                        throw new IllegalArgumentException(secEx.getCause());
                     }
-
-                    if (declaredClassField == null) {
-                        continue;
-                    }
-                    Class<?> declaredFieldClass = declaredClassField.getType();
+                    Class<?> declaredFieldClass = classField.getType();
 
                     // check input field type is a declared field type
                     // input field is a subclass of the declared field
@@ -2301,24 +2291,15 @@
                     }
                     bridge.putObject( o, fields[i].getFieldID(), objectValue ) ;
                     // reflective code: fields[i].getField().set( o, objectValue ) ;
-                } catch (IllegalArgumentException iaEx) {
-                    String objectValueClassName = "null";
-                    String currentClassDescClassName = "null";
-                    String fieldName = "null";
-                    if (objectValue != null) {
-                        objectValueClassName = objectValue.getClass().getName();
-                    }
-                    if (currentClassDesc != null) {
-                        currentClassDescClassName = currentClassDesc.getName();
-                    }
-                    if (fields[i] != null && fields[i].getField() != null) {
-                        fieldName = fields[i].getField().getName();
-                    }
-                    ClassCastException ccEx = new ClassCastException(
-                            "Assigning instance of class " + objectValueClassName
-                                    + " to field " + currentClassDescClassName + '#' + fieldName);
-                    ccEx.initCause( iaEx ) ;
-                    throw ccEx ;
+                } catch (IllegalArgumentException e) {
+                    ClassCastException exc = new ClassCastException("Assigning instance of class " +
+                                                 objectValue.getClass().getName() +
+                                                 " to field " +
+                                                 currentClassDesc.getName() +
+                                                 '#' +
+                                                 fields[i].getField().getName());
+                    exc.initCause( e ) ;
+                    throw exc ;
                 }
             } // end : for loop
             }
@@ -2614,9 +2595,9 @@
 
     }
 
-    private static void setObjectField(Object o, Class<?> c, String fieldName, Object v) {
+    private static void setObjectField(Object o, Class c, String fieldName, Object v) {
         try {
-            Field fld = getDeclaredField( c, fieldName ) ;
+            Field fld = c.getDeclaredField( fieldName ) ;
             Class fieldCl = fld.getType();
             if(v != null && !fieldCl.isInstance(v)) {
                 throw new Exception();
@@ -2636,10 +2617,10 @@
         }
     }
 
-    private static void setBooleanField(Object o, Class<?> c, String fieldName, boolean v)
+    private static void setBooleanField(Object o, Class c, String fieldName, boolean v)
     {
         try {
-            Field fld = getDeclaredField( c, fieldName ) ;
+            Field fld = c.getDeclaredField( fieldName ) ;
             if ((fld != null) && (fld.getType() == Boolean.TYPE)) {
                 long key = bridge.objectFieldOffset( fld ) ;
                 bridge.putBoolean( o, key, v ) ;
@@ -2659,10 +2640,10 @@
         }
     }
 
-    private static void setByteField(Object o, Class<?> c, String fieldName, byte v)
+    private static void setByteField(Object o, Class c, String fieldName, byte v)
     {
         try {
-            Field fld = getDeclaredField( c, fieldName ) ;
+            Field fld = c.getDeclaredField( fieldName ) ;
             if ((fld != null) && (fld.getType() == Byte.TYPE)) {
                 long key = bridge.objectFieldOffset( fld ) ;
                 bridge.putByte( o, key, v ) ;
@@ -2682,10 +2663,10 @@
         }
     }
 
-    private static void setCharField(Object o, Class<?> c, String fieldName, char v)
+    private static void setCharField(Object o, Class c, String fieldName, char v)
     {
         try {
-            Field fld = getDeclaredField( c, fieldName ) ;
+            Field fld = c.getDeclaredField( fieldName ) ;
             if ((fld != null) && (fld.getType() == Character.TYPE)) {
                 long key = bridge.objectFieldOffset( fld ) ;
                 bridge.putChar( o, key, v ) ;
@@ -2705,10 +2686,10 @@
         }
     }
 
-    private static void setShortField(Object o, Class<?> c, String fieldName, short v)
+    private static void setShortField(Object o, Class c, String fieldName, short v)
     {
         try {
-            Field fld = getDeclaredField( c, fieldName ) ;
+            Field fld = c.getDeclaredField( fieldName ) ;
             if ((fld != null) && (fld.getType() == Short.TYPE)) {
                 long key = bridge.objectFieldOffset( fld ) ;
                 bridge.putShort( o, key, v ) ;
@@ -2728,10 +2709,10 @@
         }
     }
 
-    private static void setIntField(Object o, final Class<?> c, final String fieldName, int v)
+    private static void setIntField(Object o, Class c, String fieldName, int v)
     {
         try {
-            Field fld = getDeclaredField( c, fieldName ) ;
+            Field fld = c.getDeclaredField( fieldName ) ;
             if ((fld != null) && (fld.getType() == Integer.TYPE)) {
                 long key = bridge.objectFieldOffset( fld ) ;
                 bridge.putInt( o, key, v ) ;
@@ -2751,10 +2732,10 @@
         }
     }
 
-    private static void setLongField(Object o, Class<?> c, String fieldName, long v)
+    private static void setLongField(Object o, Class c, String fieldName, long v)
     {
         try {
-            Field fld = getDeclaredField( c, fieldName ) ;
+            Field fld = c.getDeclaredField( fieldName ) ;
             if ((fld != null) && (fld.getType() == Long.TYPE)) {
                 long key = bridge.objectFieldOffset( fld ) ;
                 bridge.putLong( o, key, v ) ;
@@ -2774,10 +2755,10 @@
         }
     }
 
-    private static void setFloatField(Object o, Class<?> c, String fieldName, float v)
+    private static void setFloatField(Object o, Class c, String fieldName, float v)
     {
         try {
-            Field fld = getDeclaredField( c, fieldName ) ;
+            Field fld = c.getDeclaredField( fieldName ) ;
             if ((fld != null) && (fld.getType() == Float.TYPE)) {
                 long key = bridge.objectFieldOffset( fld ) ;
                 bridge.putFloat( o, key, v ) ;
@@ -2797,10 +2778,10 @@
         }
     }
 
-    private static void setDoubleField(Object o, Class<?> c, String fieldName, double v)
+    private static void setDoubleField(Object o, Class c, String fieldName, double v)
     {
         try {
-            Field fld = getDeclaredField(c, fieldName ) ;
+            Field fld = c.getDeclaredField( fieldName ) ;
             if ((fld != null) && (fld.getType() == Double.TYPE)) {
                 long key = bridge.objectFieldOffset( fld ) ;
                 bridge.putDouble( o, key, v ) ;
@@ -2820,23 +2801,6 @@
         }
     }
 
-
-    private static Field getDeclaredField(final Class<?> c,
-                                           final String fieldName)
-        throws PrivilegedActionException, NoSuchFieldException, SecurityException {
-        if (System.getSecurityManager() == null) {
-            return c.getDeclaredField(fieldName);
-        } else {
-            return AccessController
-                .doPrivileged(new PrivilegedExceptionAction<Field>() {
-                    public Field run()
-                            throws NoSuchFieldException {
-                        return c.getDeclaredField(fieldName);
-                    }
-                });
-        }
-    }
-
     /**
      * This class maintains a map of stream position to
      * an Object currently being deserialized.  It is used
@@ -2847,12 +2811,12 @@
      */
     static class ActiveRecursionManager
     {
-        private Map<Integer, Object> offsetToObjectMap;
+        private Map offsetToObjectMap;
 
         public ActiveRecursionManager() {
             // A hash map is unsynchronized and allows
             // null values
-            offsetToObjectMap = new HashMap<>();
+            offsetToObjectMap = new HashMap();
         }
 
         // Called right after allocating a new object.
diff --git a/get_source.sh b/get_source.sh
index 72049bd..5e874d1 100755
--- a/get_source.sh
+++ b/get_source.sh
@@ -67,7 +67,7 @@
   error "Could not locate Mercurial command"
 fi
 
-hgversion="`LANGUAGE=en hg --version 2> /dev/null | sed -n -e 's@^Mercurial Distributed SCM (version \([^+]*\).*)\$@\1@p'`"
+hgversion="`hg --version 2> /dev/null | sed -n -e 's@^Mercurial Distributed SCM (version \([^+]*\).*)\$@\1@p'`"
 if [ "x${hgversion}" = "x" ] ; then
   error "Could not determine Mercurial version of $hgwhere"
 fi
diff --git a/hotspot/ASSEMBLY_EXCEPTION b/hotspot/ASSEMBLY_EXCEPTION
index 065b8d9..3e78398 100644
--- a/hotspot/ASSEMBLY_EXCEPTION
+++ b/hotspot/ASSEMBLY_EXCEPTION
@@ -1,9 +1,9 @@
 
 OPENJDK ASSEMBLY EXCEPTION
 
-The OpenJDK source code made available by Oracle America, Inc. (Oracle) at
-openjdk.java.net ("OpenJDK Code") is distributed under the terms of the GNU
-General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
+The OpenJDK source code made available by Oracle at openjdk.java.net and
+openjdk.dev.java.net ("OpenJDK Code") is distributed under the terms of the
+GNU General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
 only ("GPL2"), with the following clarification and special exception.
 
     Linking this OpenJDK Code statically or dynamically with other code
@@ -19,9 +19,9 @@
     provided that the Designated Exception Modules continue to be
     governed by the licenses under which they were offered by Oracle.
 
-As such, it allows licensees and sublicensees of Oracle's GPL2 OpenJDK Code
-to build an executable that includes those portions of necessary code that
-Oracle could not provide under GPL2 (or that Oracle has provided under GPL2
-with the Classpath exception).  If you modify or add to the OpenJDK code,
-that new GPL2 code may still be combined with Designated Exception Modules
-if the new code is made subject to this exception by its copyright holder.
+As such, it allows licensees and sublicensees of Oracle's GPL2 OpenJDK Code to
+build an executable that includes those portions of necessary code that Oracle
+could not provide under GPL2 (or that Oracle has provided under GPL2 with the
+Classpath exception).  If you modify or add to the OpenJDK code, that new
+GPL2 code may still be combined with Designated Exception Modules if the
+new code is made subject to this exception by its copyright holder.
diff --git a/hotspot/LICENSE b/hotspot/LICENSE
index 8b400c7..b40a0f4 100644
--- a/hotspot/LICENSE
+++ b/hotspot/LICENSE
@@ -3,7 +3,7 @@
 Version 2, June 1991
 
 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
 Everyone is permitted to copy and distribute verbatim copies of this license
 document, but changing it is not allowed.
@@ -287,8 +287,8 @@
     more details.
 
     You should have received a copy of the GNU General Public License along
-    with this program; if not, write to the Free Software Foundation, Inc.,
-    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+    with this program; if not, write to the Free Software Foundation, Inc., 59
+    Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
 Also add information on how to contact you by electronic and paper mail.
 
diff --git a/hotspot/src/cpu/ppc/vm/assembler_ppc.hpp b/hotspot/src/cpu/ppc/vm/assembler_ppc.hpp
index a488d6d..7d9aecb 100644
--- a/hotspot/src/cpu/ppc/vm/assembler_ppc.hpp
+++ b/hotspot/src/cpu/ppc/vm/assembler_ppc.hpp
@@ -589,7 +589,6 @@
     VNOR_OPCODE    = (4u  << OPCODE_SHIFT | 1284u     ),
     VOR_OPCODE     = (4u  << OPCODE_SHIFT | 1156u     ),
     VXOR_OPCODE    = (4u  << OPCODE_SHIFT | 1220u     ),
-    VRLD_OPCODE    = (4u  << OPCODE_SHIFT |  196u     ),
     VRLB_OPCODE    = (4u  << OPCODE_SHIFT |    4u     ),
     VRLW_OPCODE    = (4u  << OPCODE_SHIFT |  132u     ),
     VRLH_OPCODE    = (4u  << OPCODE_SHIFT |   68u     ),
@@ -1919,7 +1918,6 @@
   inline void vnor(     VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vor(      VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vxor(     VectorRegister d, VectorRegister a, VectorRegister b);
-  inline void vrld(     VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vrlb(     VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vrlw(     VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vrlh(     VectorRegister d, VectorRegister a, VectorRegister b);
diff --git a/hotspot/src/cpu/ppc/vm/assembler_ppc.inline.hpp b/hotspot/src/cpu/ppc/vm/assembler_ppc.inline.hpp
index 0f76435..b4a7370 100644
--- a/hotspot/src/cpu/ppc/vm/assembler_ppc.inline.hpp
+++ b/hotspot/src/cpu/ppc/vm/assembler_ppc.inline.hpp
@@ -739,7 +739,6 @@
 inline void Assembler::vnor(    VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VNOR_OPCODE     | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vor(     VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VOR_OPCODE      | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vxor(    VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VXOR_OPCODE     | vrt(d) | vra(a) | vrb(b)); }
-inline void Assembler::vrld(    VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VRLD_OPCODE     | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vrlb(    VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VRLB_OPCODE     | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vrlw(    VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VRLW_OPCODE     | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vrlh(    VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VRLH_OPCODE     | vrt(d) | vra(a) | vrb(b)); }
diff --git a/hotspot/src/cpu/ppc/vm/compiledIC_ppc.cpp b/hotspot/src/cpu/ppc/vm/compiledIC_ppc.cpp
index 762a329..1b54594 100644
--- a/hotspot/src/cpu/ppc/vm/compiledIC_ppc.cpp
+++ b/hotspot/src/cpu/ppc/vm/compiledIC_ppc.cpp
@@ -94,7 +94,7 @@
 
 const int IC_pos_in_java_to_interp_stub = 8;
 #define __ _masm.
-address CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf) {
+void CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf) {
 #ifdef COMPILER2
   // Get the mark within main instrs section which is set to the address of the call.
   address call_addr = cbuf.insts_mark();
@@ -106,7 +106,8 @@
   // Start the stub.
   address stub = __ start_a_stub(CompiledStaticCall::to_interp_stub_size());
   if (stub == NULL) {
-    return NULL; // CodeCache is full
+    Compile::current()->env()->record_out_of_memory_failure();
+    return;
   }
 
   // For java_to_interp stubs we use R11_scratch1 as scratch register
@@ -148,7 +149,6 @@
 
  // End the stub.
   __ end_a_stub();
-  return stub;
 #else
   ShouldNotReachHere();
 #endif
diff --git a/hotspot/src/cpu/ppc/vm/ppc.ad b/hotspot/src/cpu/ppc/vm/ppc.ad
index 54c2361..9fd4d73 100644
--- a/hotspot/src/cpu/ppc/vm/ppc.ad
+++ b/hotspot/src/cpu/ppc/vm/ppc.ad
@@ -1171,7 +1171,7 @@
   // Start the stub.
   address stub = __ start_a_stub(Compile::MAX_stubs_size/2);
   if (stub == NULL) {
-    ciEnv::current()->record_failure("CodeCache is full");
+    Compile::current()->env()->record_out_of_memory_failure();
     return;
   }
 
@@ -1249,7 +1249,7 @@
 
     // Emit the trampoline stub which will be related to the branch-and-link below.
     CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, offsets.insts_call_instruction_offset);
-    if (ciEnv::current()->failing()) { return offsets; } // Code cache may be full.
+    if (Compile::current()->env()->failing()) { return offsets; } // Code cache may be full.
     __ relocate(rtype);
   }
 
@@ -3488,7 +3488,7 @@
 
         // Emit the trampoline stub which will be related to the branch-and-link below.
         CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, start_offset);
-        if (ciEnv::current()->failing()) { return; } // Code cache may be full.
+        if (Compile::current()->env()->failing()) { return; } // Code cache may be full.
         __ relocate(_optimized_virtual ?
                     relocInfo::opt_virtual_call_type : relocInfo::static_call_type);
       }
@@ -3501,11 +3501,7 @@
       __ bl(__ pc());  // Emits a relocation.
 
       // The stub for call to interpreter.
-      address stub = CompiledStaticCall::emit_to_interp_stub(cbuf);
-      if (stub == NULL) {
-        ciEnv::current()->record_failure("CodeCache is full"); 
-        return;
-      }
+      CompiledStaticCall::emit_to_interp_stub(cbuf);
     }
   %}
 
@@ -3550,11 +3546,7 @@
 
     assert(_method, "execute next statement conditionally");
     // The stub for call to interpreter.
-    address stub = CompiledStaticCall::emit_to_interp_stub(cbuf);
-    if (stub == NULL) {
-      ciEnv::current()->record_failure("CodeCache is full"); 
-      return;
-    }
+    CompiledStaticCall::emit_to_interp_stub(cbuf);
 
     // Restore original sp.
     __ ld(R11_scratch1, 0, R1_SP); // Load caller sp.
@@ -5469,7 +5461,7 @@
 %}
 
 // Match loading integer and casting it to long.
-instruct loadI2L(iRegLdst dst, memoryAlg4 mem) %{
+instruct loadI2L(iRegLdst dst, memory mem) %{
   match(Set dst (ConvI2L (LoadI mem)));
   predicate(_kids[0]->_leaf->as_Load()->is_unordered());
   ins_cost(MEMORY_REF_COST);
@@ -5485,7 +5477,7 @@
 %}
 
 // Match loading integer and casting it to long - acquire.
-instruct loadI2L_ac(iRegLdst dst, memoryAlg4 mem) %{
+instruct loadI2L_ac(iRegLdst dst, memory mem) %{
   match(Set dst (ConvI2L (LoadI mem)));
   ins_cost(3*MEMORY_REF_COST);
 
diff --git a/hotspot/src/cpu/ppc/vm/relocInfo_ppc.cpp b/hotspot/src/cpu/ppc/vm/relocInfo_ppc.cpp
index b48cba0..4f365a4 100644
--- a/hotspot/src/cpu/ppc/vm/relocInfo_ppc.cpp
+++ b/hotspot/src/cpu/ppc/vm/relocInfo_ppc.cpp
@@ -62,7 +62,7 @@
       nativeMovConstReg_at(addr())->set_narrow_oop(no, code());
     }
   } else {
-    guarantee((address) (nativeMovConstReg_at(addr())->data()) == x, "data must match");
+    assert((address) (nativeMovConstReg_at(addr())->data()) == x, "data must match");
   }
 }
 
diff --git a/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp b/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp
index 325b527..ed292cb 100644
--- a/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp
+++ b/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp
@@ -1961,434 +1961,6 @@
     return start;
   }
 
-  // Arguments for generated stub (little endian only):
-  //   R3_ARG1   - source byte array address
-  //   R4_ARG2   - destination byte array address
-  //   R5_ARG3   - round key array
-  address generate_aescrypt_encryptBlock() {
-    assert(UseAES, "need AES instructions and misaligned SSE support");
-    StubCodeMark mark(this, "StubRoutines", "aescrypt_encryptBlock");
-
-    address start = __ function_entry();
-
-    Label L_doLast;
-
-    Register from           = R3_ARG1;  // source array address
-    Register to             = R4_ARG2;  // destination array address
-    Register key            = R5_ARG3;  // round key array
-
-    Register keylen         = R8;
-    Register temp           = R9;
-    Register keypos         = R10;
-    Register hex            = R11;
-    Register fifteen        = R12;
-
-    VectorRegister vRet     = VR0;
-
-    VectorRegister vKey1    = VR1;
-    VectorRegister vKey2    = VR2;
-    VectorRegister vKey3    = VR3;
-    VectorRegister vKey4    = VR4;
-
-    VectorRegister fromPerm = VR5;
-    VectorRegister keyPerm  = VR6;
-    VectorRegister toPerm   = VR7;
-    VectorRegister fSplt    = VR8;
-
-    VectorRegister vTmp1    = VR9;
-    VectorRegister vTmp2    = VR10;
-    VectorRegister vTmp3    = VR11;
-    VectorRegister vTmp4    = VR12;
-
-    VectorRegister vLow     = VR13;
-    VectorRegister vHigh    = VR14;
-
-    __ li              (hex, 16);
-    __ li              (fifteen, 15);
-    __ vspltisb        (fSplt, 0x0f);
-
-    // load unaligned from[0-15] to vsRet
-    __ lvx             (vRet, from);
-    __ lvx             (vTmp1, fifteen, from);
-    __ lvsl            (fromPerm, from);
-    __ vxor            (fromPerm, fromPerm, fSplt);
-    __ vperm           (vRet, vRet, vTmp1, fromPerm);
-
-    // load keylen (44 or 52 or 60)
-    __ lwz             (keylen, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT), key);
-
-    // to load keys
-    __ lvsr            (keyPerm, key);
-    __ vxor            (vTmp2, vTmp2, vTmp2);
-    __ vspltisb        (vTmp2, -16);
-    __ vrld            (keyPerm, keyPerm, vTmp2);
-    __ vrld            (keyPerm, keyPerm, vTmp2);
-    __ vsldoi          (keyPerm, keyPerm, keyPerm, -8);
-
-    // load the 1st round key to vKey1
-    __ li              (keypos, 0);
-    __ lvx             (vKey1, keypos, key);
-    __ addi            (keypos, keypos, 16);
-    __ lvx             (vTmp1, keypos, key);
-    __ vperm           (vKey1, vTmp1, vKey1, keyPerm);
-
-    // 1st round
-    __ vxor (vRet, vRet, vKey1);
-
-    // load the 2nd round key to vKey1
-    __ addi            (keypos, keypos, 16);
-    __ lvx             (vTmp2, keypos, key);
-    __ vperm           (vKey1, vTmp2, vTmp1, keyPerm);
-
-    // load the 3rd round key to vKey2
-    __ addi            (keypos, keypos, 16);
-    __ lvx             (vTmp1, keypos, key);
-    __ vperm           (vKey2, vTmp1, vTmp2, keyPerm);
-
-    // load the 4th round key to vKey3
-    __ addi            (keypos, keypos, 16);
-    __ lvx             (vTmp2, keypos, key);
-    __ vperm           (vKey3, vTmp2, vTmp1, keyPerm);
-
-    // load the 5th round key to vKey4
-    __ addi            (keypos, keypos, 16);
-    __ lvx             (vTmp1, keypos, key);
-    __ vperm           (vKey4, vTmp1, vTmp2, keyPerm);
-
-    // 2nd - 5th rounds
-    __ vcipher (vRet, vRet, vKey1);
-    __ vcipher (vRet, vRet, vKey2);
-    __ vcipher (vRet, vRet, vKey3);
-    __ vcipher (vRet, vRet, vKey4);
-
-    // load the 6th round key to vKey1
-    __ addi            (keypos, keypos, 16);
-    __ lvx             (vTmp2, keypos, key);
-    __ vperm           (vKey1, vTmp2, vTmp1, keyPerm);
-
-    // load the 7th round key to vKey2
-    __ addi            (keypos, keypos, 16);
-    __ lvx             (vTmp1, keypos, key);
-    __ vperm           (vKey2, vTmp1, vTmp2, keyPerm);
-
-    // load the 8th round key to vKey3
-    __ addi            (keypos, keypos, 16);
-    __ lvx             (vTmp2, keypos, key);
-    __ vperm           (vKey3, vTmp2, vTmp1, keyPerm);
-
-    // load the 9th round key to vKey4
-    __ addi            (keypos, keypos, 16);
-    __ lvx             (vTmp1, keypos, key);
-    __ vperm           (vKey4, vTmp1, vTmp2, keyPerm);
-
-    // 6th - 9th rounds
-    __ vcipher (vRet, vRet, vKey1);
-    __ vcipher (vRet, vRet, vKey2);
-    __ vcipher (vRet, vRet, vKey3);
-    __ vcipher (vRet, vRet, vKey4);
-
-    // load the 10th round key to vKey1
-    __ addi            (keypos, keypos, 16);
-    __ lvx             (vTmp2, keypos, key);
-    __ vperm           (vKey1, vTmp2, vTmp1, keyPerm);
-
-    // load the 11th round key to vKey2
-    __ addi            (keypos, keypos, 16);
-    __ lvx             (vTmp1, keypos, key);
-    __ vperm           (vKey2, vTmp1, vTmp2, keyPerm);
-
-    // if all round keys are loaded, skip next 4 rounds
-    __ cmpwi           (CCR0, keylen, 44);
-    __ beq             (CCR0, L_doLast);
-
-    // 10th - 11th rounds
-    __ vcipher (vRet, vRet, vKey1);
-    __ vcipher (vRet, vRet, vKey2);
-
-    // load the 12th round key to vKey1
-    __ addi            (keypos, keypos, 16);
-    __ lvx             (vTmp2, keypos, key);
-    __ vperm           (vKey1, vTmp2, vTmp1, keyPerm);
-
-    // load the 13th round key to vKey2
-    __ addi            (keypos, keypos, 16);
-    __ lvx             (vTmp1, keypos, key);
-    __ vperm           (vKey2, vTmp1, vTmp2, keyPerm);
-
-    // if all round keys are loaded, skip next 2 rounds
-    __ cmpwi           (CCR0, keylen, 52);
-    __ beq             (CCR0, L_doLast);
-
-    // 12th - 13th rounds
-    __ vcipher (vRet, vRet, vKey1);
-    __ vcipher (vRet, vRet, vKey2);
-
-    // load the 14th round key to vKey1
-    __ addi            (keypos, keypos, 16);
-    __ lvx             (vTmp2, keypos, key);
-    __ vperm           (vKey1, vTmp2, vTmp1, keyPerm);
-
-    // load the 15th round key to vKey2
-    __ addi            (keypos, keypos, 16);
-    __ lvx             (vTmp1, keypos, key);
-    __ vperm           (vKey2, vTmp1, vTmp2, keyPerm);
-
-    __ bind(L_doLast);
-
-    // last two rounds
-    __ vcipher (vRet, vRet, vKey1);
-    __ vcipherlast (vRet, vRet, vKey2);
-
-    __ neg             (temp, to);
-    __ lvsr            (toPerm, temp);
-    __ vspltisb        (vTmp2, -1);
-    __ vxor            (vTmp1, vTmp1, vTmp1);
-    __ vperm           (vTmp2, vTmp2, vTmp1, toPerm);
-    __ vxor            (toPerm, toPerm, fSplt);
-    __ lvx             (vTmp1, to);
-    __ vperm           (vRet, vRet, vRet, toPerm);
-    __ vsel            (vTmp1, vTmp1, vRet, vTmp2);
-    __ lvx             (vTmp4, fifteen, to);
-    __ stvx            (vTmp1, to);
-    __ vsel            (vRet, vRet, vTmp4, vTmp2);
-    __ stvx            (vRet, fifteen, to);
-
-    __ blr();
-     return start;
-  }
-
-  // Arguments for generated stub (little endian only):
-  //   R3_ARG1   - source byte array address
-  //   R4_ARG2   - destination byte array address
-  //   R5_ARG3   - K (key) in little endian int array
-  address generate_aescrypt_decryptBlock() {
-    assert(UseAES, "need AES instructions and misaligned SSE support");
-    StubCodeMark mark(this, "StubRoutines", "aescrypt_decryptBlock");
-
-    address start = __ function_entry();
-
-    Label L_doLast;
-    Label L_do44;
-    Label L_do52;
-    Label L_do60;
-
-    Register from           = R3_ARG1;  // source array address
-    Register to             = R4_ARG2;  // destination array address
-    Register key            = R5_ARG3;  // round key array
-
-    Register keylen         = R8;
-    Register temp           = R9;
-    Register keypos         = R10;
-    Register hex            = R11;
-    Register fifteen        = R12;
-
-    VectorRegister vRet     = VR0;
-
-    VectorRegister vKey1    = VR1;
-    VectorRegister vKey2    = VR2;
-    VectorRegister vKey3    = VR3;
-    VectorRegister vKey4    = VR4;
-    VectorRegister vKey5    = VR5;
-
-    VectorRegister fromPerm = VR6;
-    VectorRegister keyPerm  = VR7;
-    VectorRegister toPerm   = VR8;
-    VectorRegister fSplt    = VR9;
-
-    VectorRegister vTmp1    = VR10;
-    VectorRegister vTmp2    = VR11;
-    VectorRegister vTmp3    = VR12;
-    VectorRegister vTmp4    = VR13;
-
-    VectorRegister vLow     = VR14;
-    VectorRegister vHigh    = VR15;
-
-    __ li              (hex, 16);
-    __ li              (fifteen, 15);
-    __ vspltisb        (fSplt, 0x0f);
-
-    // load unaligned from[0-15] to vsRet
-    __ lvx             (vRet, from);
-    __ lvx             (vTmp1, fifteen, from);
-    __ lvsl            (fromPerm, from);
-    __ vxor            (fromPerm, fromPerm, fSplt);
-    __ vperm           (vRet, vRet, vTmp1, fromPerm); // align [and byte swap in LE]
-
-    // load keylen (44 or 52 or 60)
-    __ lwz             (keylen, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT), key);
-
-    // to load keys
-    __ lvsr            (keyPerm, key);
-    __ vxor            (vTmp2, vTmp2, vTmp2);
-    __ vspltisb        (vTmp2, -16);
-    __ vrld            (keyPerm, keyPerm, vTmp2);
-    __ vrld            (keyPerm, keyPerm, vTmp2);
-    __ vsldoi          (keyPerm, keyPerm, keyPerm, -8);
-
-    __ cmpwi           (CCR0, keylen, 44);
-    __ beq             (CCR0, L_do44);
-
-    __ cmpwi           (CCR0, keylen, 52);
-    __ beq             (CCR0, L_do52);
-
-    // load the 15th round key to vKey11
-    __ li              (keypos, 240);
-    __ lvx             (vTmp1, keypos, key);
-    __ addi            (keypos, keypos, -16);
-    __ lvx             (vTmp2, keypos, key);
-    __ vperm           (vKey1, vTmp1, vTmp2, keyPerm);
-
-    // load the 14th round key to vKey10
-    __ addi            (keypos, keypos, -16);
-    __ lvx             (vTmp1, keypos, key);
-    __ vperm           (vKey2, vTmp2, vTmp1, keyPerm);
-
-    // load the 13th round key to vKey10
-    __ addi            (keypos, keypos, -16);
-    __ lvx             (vTmp2, keypos, key);
-    __ vperm           (vKey3, vTmp1, vTmp2, keyPerm);
-
-    // load the 12th round key to vKey10
-    __ addi            (keypos, keypos, -16);
-    __ lvx             (vTmp1, keypos, key);
-    __ vperm           (vKey4, vTmp2, vTmp1, keyPerm);
-
-    // load the 11th round key to vKey10
-    __ addi            (keypos, keypos, -16);
-    __ lvx             (vTmp2, keypos, key);
-    __ vperm           (vKey5, vTmp1, vTmp2, keyPerm);
-
-    // 1st - 5th rounds
-    __ vxor            (vRet, vRet, vKey1);
-    __ vncipher        (vRet, vRet, vKey2);
-    __ vncipher        (vRet, vRet, vKey3);
-    __ vncipher        (vRet, vRet, vKey4);
-    __ vncipher        (vRet, vRet, vKey5);
-
-    __ b               (L_doLast);
-
-    __ bind            (L_do52);
-
-    // load the 13th round key to vKey11
-    __ li              (keypos, 208);
-    __ lvx             (vTmp1, keypos, key);
-    __ addi            (keypos, keypos, -16);
-    __ lvx             (vTmp2, keypos, key);
-    __ vperm           (vKey1, vTmp1, vTmp2, keyPerm);
-
-    // load the 12th round key to vKey10
-    __ addi            (keypos, keypos, -16);
-    __ lvx             (vTmp1, keypos, key);
-    __ vperm           (vKey2, vTmp2, vTmp1, keyPerm);
-
-    // load the 11th round key to vKey10
-    __ addi            (keypos, keypos, -16);
-    __ lvx             (vTmp2, keypos, key);
-    __ vperm           (vKey3, vTmp1, vTmp2, keyPerm);
-
-    // 1st - 3rd rounds
-    __ vxor            (vRet, vRet, vKey1);
-    __ vncipher        (vRet, vRet, vKey2);
-    __ vncipher        (vRet, vRet, vKey3);
-
-    __ b               (L_doLast);
-
-    __ bind            (L_do44);
-
-    // load the 11th round key to vKey11
-    __ li              (keypos, 176);
-    __ lvx             (vTmp1, keypos, key);
-    __ addi            (keypos, keypos, -16);
-    __ lvx             (vTmp2, keypos, key);
-    __ vperm           (vKey1, vTmp1, vTmp2, keyPerm);
-
-    // 1st round
-    __ vxor            (vRet, vRet, vKey1);
-
-    __ bind            (L_doLast);
-
-    // load the 10th round key to vKey10
-    __ addi            (keypos, keypos, -16);
-    __ lvx             (vTmp1, keypos, key);
-    __ vperm           (vKey1, vTmp2, vTmp1, keyPerm);
-
-    // load the 9th round key to vKey10
-    __ addi            (keypos, keypos, -16);
-    __ lvx             (vTmp2, keypos, key);
-    __ vperm           (vKey2, vTmp1, vTmp2, keyPerm);
-
-    // load the 8th round key to vKey10
-    __ addi            (keypos, keypos, -16);
-    __ lvx             (vTmp1, keypos, key);
-    __ vperm           (vKey3, vTmp2, vTmp1, keyPerm);
-
-    // load the 7th round key to vKey10
-    __ addi            (keypos, keypos, -16);
-    __ lvx             (vTmp2, keypos, key);
-    __ vperm           (vKey4, vTmp1, vTmp2, keyPerm);
-
-    // load the 6th round key to vKey10
-    __ addi            (keypos, keypos, -16);
-    __ lvx             (vTmp1, keypos, key);
-    __ vperm           (vKey5, vTmp2, vTmp1, keyPerm);
-
-    // last 10th - 6th rounds
-    __ vncipher        (vRet, vRet, vKey1);
-    __ vncipher        (vRet, vRet, vKey2);
-    __ vncipher        (vRet, vRet, vKey3);
-    __ vncipher        (vRet, vRet, vKey4);
-    __ vncipher        (vRet, vRet, vKey5);
-
-    // load the 5th round key to vKey10
-    __ addi            (keypos, keypos, -16);
-    __ lvx             (vTmp2, keypos, key);
-    __ vperm           (vKey1, vTmp1, vTmp2, keyPerm);
-
-    // load the 4th round key to vKey10
-    __ addi            (keypos, keypos, -16);
-    __ lvx             (vTmp1, keypos, key);
-    __ vperm           (vKey2, vTmp2, vTmp1, keyPerm);
-
-    // load the 3rd round key to vKey10
-    __ addi            (keypos, keypos, -16);
-    __ lvx             (vTmp2, keypos, key);
-    __ vperm           (vKey3, vTmp1, vTmp2, keyPerm);
-
-    // load the 2nd round key to vKey10
-    __ addi            (keypos, keypos, -16);
-    __ lvx             (vTmp1, keypos, key);
-    __ vperm           (vKey4, vTmp2, vTmp1, keyPerm);
-
-    // load the 1st round key to vKey10
-    __ addi            (keypos, keypos, -16);
-    __ lvx             (vTmp2, keypos, key);
-    __ vperm           (vKey5, vTmp1, vTmp2, keyPerm);
-
-    // last 5th - 1th rounds
-    __ vncipher        (vRet, vRet, vKey1);
-    __ vncipher        (vRet, vRet, vKey2);
-    __ vncipher        (vRet, vRet, vKey3);
-    __ vncipher        (vRet, vRet, vKey4);
-    __ vncipherlast    (vRet, vRet, vKey5);
-
-    __ neg             (temp, to);
-    __ lvsr            (toPerm, temp);
-    __ vspltisb        (vTmp2, -1);
-    __ vxor            (vTmp1, vTmp1, vTmp1);
-    __ vperm           (vTmp2, vTmp2, vTmp1, toPerm);
-    __ vxor            (toPerm, toPerm, fSplt);
-    __ lvx             (vTmp1, to);
-    __ vperm           (vRet, vRet, vRet, toPerm);
-    __ vsel            (vTmp1, vTmp1, vRet, vTmp2);
-    __ lvx             (vTmp4, fifteen, to);
-    __ stvx            (vTmp1, to);
-    __ vsel            (vRet, vRet, vTmp4, vTmp2);
-    __ stvx            (vRet, fifteen, to);
-
-    __ blr();
-     return start;
-  }
-
   void generate_arraycopy_stubs() {
     // Note: the disjoint stubs must be generated first, some of
     // the conjoint stubs use them.
@@ -2511,6 +2083,10 @@
     // arraycopy stubs used by compilers
     generate_arraycopy_stubs();
 
+    if (UseAESIntrinsics) {
+      guarantee(!UseAESIntrinsics, "not yet implemented.");
+    }
+
     // Safefetch stubs.
     generate_safefetch("SafeFetch32", sizeof(int),     &StubRoutines::_safefetch32_entry,
                                                        &StubRoutines::_safefetch32_fault_pc,
@@ -2518,12 +2094,6 @@
     generate_safefetch("SafeFetchN", sizeof(intptr_t), &StubRoutines::_safefetchN_entry,
                                                        &StubRoutines::_safefetchN_fault_pc,
                                                        &StubRoutines::_safefetchN_continuation_pc);
-
-    if (UseAESIntrinsics) {
-      StubRoutines::_aescrypt_encryptBlock = generate_aescrypt_encryptBlock();
-      StubRoutines::_aescrypt_decryptBlock = generate_aescrypt_decryptBlock();
-    }
-
   }
 
  public:
diff --git a/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp b/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp
index d8214a8..1f8375f 100644
--- a/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp
+++ b/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp
@@ -102,7 +102,7 @@
   // Create and print feature-string.
   char buf[(num_features+1) * 16]; // Max 16 chars per feature.
   jio_snprintf(buf, sizeof(buf),
-               "ppc64%s%s%s%s%s%s%s%s%s",
+               "ppc64%s%s%s%s%s%s%s%s",
                (has_fsqrt()   ? " fsqrt"   : ""),
                (has_isel()    ? " isel"    : ""),
                (has_lxarxeh() ? " lxarxeh" : ""),
@@ -111,8 +111,7 @@
                (has_popcntb() ? " popcntb" : ""),
                (has_popcntw() ? " popcntw" : ""),
                (has_fcfids()  ? " fcfids"  : ""),
-               (has_vand()    ? " vand"    : ""),
-               (has_vcipher() ? " aes"     : "")
+               (has_vand()    ? " vand"    : "")
                // Make sure number of %s matches num_features!
               );
   _features_str = strdup(buf);
@@ -157,28 +156,6 @@
   }
 
   // The AES intrinsic stubs require AES instruction support.
-#if defined(VM_LITTLE_ENDIAN)
-  if (has_vcipher()) {
-    if (FLAG_IS_DEFAULT(UseAES)) {
-      UseAES = true;
-    }
-  } else if (UseAES) {
-    if (!FLAG_IS_DEFAULT(UseAES))
-      warning("AES instructions are not available on this CPU");
-    FLAG_SET_DEFAULT(UseAES, false);
-  }
-
-  if (UseAES && has_vcipher()) {
-    if (FLAG_IS_DEFAULT(UseAESIntrinsics)) {
-      UseAESIntrinsics = true;
-    }
-  } else if (UseAESIntrinsics) {
-    if (!FLAG_IS_DEFAULT(UseAESIntrinsics))
-      warning("AES intrinsics are not available on this CPU");
-    FLAG_SET_DEFAULT(UseAESIntrinsics, false);
-  }
-
-#else
   if (UseAES) {
     warning("AES instructions are not available on this CPU");
     FLAG_SET_DEFAULT(UseAES, false);
@@ -188,7 +165,6 @@
       warning("AES intrinsics are not available on this CPU");
     FLAG_SET_DEFAULT(UseAESIntrinsics, false);
   }
-#endif
 
   if (UseSHA) {
     warning("SHA instructions are not available on this CPU");
@@ -476,7 +452,6 @@
   a->popcntw(R7, R5);                          // code[7] -> popcntw
   a->fcfids(F3, F4);                           // code[8] -> fcfids
   a->vand(VR0, VR0, VR0);                      // code[9] -> vand
-  a->vcipher(VR0, VR1, VR2);                   // code[10] -> vcipher
   a->blr();
 
   // Emit function to set one cache line to zero. Emit function descriptor and get pointer to it.
@@ -520,7 +495,6 @@
   if (code[feature_cntr++]) features |= popcntw_m;
   if (code[feature_cntr++]) features |= fcfids_m;
   if (code[feature_cntr++]) features |= vand_m;
-  if (code[feature_cntr++]) features |= vcipher_m;
 
   // Print the detection code.
   if (PrintAssembly) {
diff --git a/hotspot/src/cpu/ppc/vm/vm_version_ppc.hpp b/hotspot/src/cpu/ppc/vm/vm_version_ppc.hpp
index d7839b4..2bbfddd 100644
--- a/hotspot/src/cpu/ppc/vm/vm_version_ppc.hpp
+++ b/hotspot/src/cpu/ppc/vm/vm_version_ppc.hpp
@@ -42,7 +42,6 @@
     fcfids,
     vand,
     dcba,
-    vcipher,
     num_features // last entry to count features
   };
   enum Feature_Flag_Set {
@@ -57,7 +56,6 @@
     fcfids_m              = (1 << fcfids ),
     vand_m                = (1 << vand   ),
     dcba_m                = (1 << dcba   ),
-    vcipher_m             = (1 << vcipher),
     all_features_m        = -1
   };
   static int  _features;
@@ -85,7 +83,6 @@
   static bool has_fcfids()  { return (_features & fcfids_m) != 0; }
   static bool has_vand()    { return (_features & vand_m) != 0; }
   static bool has_dcba()    { return (_features & dcba_m) != 0; }
-  static bool has_vcipher() { return (_features & vcipher_m) != 0; }
 
   static const char* cpu_features() { return _features_str; }
 
diff --git a/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp
index 7c6a1d7..8584037 100644
--- a/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp
@@ -431,9 +431,6 @@
   __ mov(length()->as_register(),  O4);
 
   ce->emit_static_call_stub();
-  if (ce->compilation()->bailed_out()) {
-    return; // CodeCache is full
-  }
 
   __ call(SharedRuntime::get_resolve_static_call_stub(), relocInfo::static_call_type);
   __ delayed()->nop();
diff --git a/hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp b/hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp
index 5429e33..dee64df 100644
--- a/hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp
@@ -53,7 +53,7 @@
 // ----------------------------------------------------------------------------
 
 #define __ _masm.
-address CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf) {
+void CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf) {
 #ifdef COMPILER2
   // Stub is fixed up when the corresponding call is converted from calling
   // compiled code to calling interpreted code.
@@ -64,10 +64,9 @@
 
   MacroAssembler _masm(&cbuf);
 
-  address base = __ start_a_stub(to_interp_stub_size());
-  if (base == NULL) {
-    return NULL;  // CodeBuffer::expand failed.
-  }
+  address base =
+  __ start_a_stub(to_interp_stub_size()*2);
+  if (base == NULL) return;  // CodeBuffer::expand failed.
 
   // Static stub relocation stores the instruction address of the call.
   __ relocate(static_stub_Relocation::spec(mark));
@@ -82,7 +81,6 @@
 
   // Update current stubs pointer and restore code_end.
   __ end_a_stub();
-  return base;
 #else
   ShouldNotReachHere();
 #endif
diff --git a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp
index 4dfc1db..d7396f6 100644
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp
@@ -4261,7 +4261,6 @@
   assert(UseBlockZeroing && VM_Version::has_block_zeroing(), "only works with BIS zeroing");
   Register end = count;
   int cache_line_size = VM_Version::prefetch_data_size();
-  assert(cache_line_size > 0, "cache line size should be known for this code");
   // Minimum count when BIS zeroing can be used since
   // it needs membar which is expensive.
   int block_zero_size  = MAX2(cache_line_size*3, (int)BlockZeroingLowLimit);
diff --git a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp
index 413cfe2..f5ac37c 100644
--- a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp
@@ -64,7 +64,7 @@
   masm.patchable_sethi(x, destreg);
   int len = buffer - masm.pc();
   for (int i = 0; i < len; i++) {
-    guarantee(instaddr[i] == buffer[i], "instructions must match");
+    assert(instaddr[i] == buffer[i], "instructions must match");
   }
 }
 
diff --git a/hotspot/src/cpu/sparc/vm/relocInfo_sparc.cpp b/hotspot/src/cpu/sparc/vm/relocInfo_sparc.cpp
index 4900e14..e132c42 100644
--- a/hotspot/src/cpu/sparc/vm/relocInfo_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/relocInfo_sparc.cpp
@@ -83,7 +83,7 @@
     inst &= ~Assembler::simm(    -1, 13);
     inst |=  Assembler::simm(simm13, 13);
     if (verify_only) {
-      guarantee(ip->long_at(0) == inst, "instructions must match");
+      assert(ip->long_at(0) == inst, "instructions must match");
     } else {
       ip->set_long_at(0, inst);
     }
@@ -101,15 +101,15 @@
       inst &= ~Assembler::hi22(-1);
       inst |=  Assembler::hi22((intptr_t)np);
       if (verify_only) {
-        guarantee(ip->long_at(0) == inst, "instructions must match");
+        assert(ip->long_at(0) == inst, "instructions must match");
       } else {
         ip->set_long_at(0, inst);
       }
       inst2 = ip->long_at( NativeInstruction::nop_instruction_size );
       guarantee(Assembler::inv_op(inst2)==Assembler::arith_op, "arith op");
       if (verify_only) {
-        guarantee(ip->long_at(NativeInstruction::nop_instruction_size) == NativeInstruction::set_data32_simm13( inst2, (intptr_t)np),
-                  "instructions must match");
+        assert(ip->long_at(NativeInstruction::nop_instruction_size) == NativeInstruction::set_data32_simm13( inst2, (intptr_t)np),
+               "instructions must match");
       } else {
         ip->set_long_at(NativeInstruction::nop_instruction_size, NativeInstruction::set_data32_simm13( inst2, (intptr_t)np));
       }
@@ -126,7 +126,7 @@
     inst |=  Assembler::hi22((intptr_t)x);
     // (ignore offset; it doesn't play into the sethi)
     if (verify_only) {
-      guarantee(ip->long_at(0) == inst, "instructions must match");
+      assert(ip->long_at(0) == inst, "instructions must match");
     } else {
       ip->set_long_at(0, inst);
     }
diff --git a/hotspot/src/cpu/sparc/vm/sparc.ad b/hotspot/src/cpu/sparc/vm/sparc.ad
index 0b46f32..3d43f6b 100644
--- a/hotspot/src/cpu/sparc/vm/sparc.ad
+++ b/hotspot/src/cpu/sparc/vm/sparc.ad
@@ -1775,11 +1775,9 @@
   AddressLiteral exception_blob(OptoRuntime::exception_blob()->entry_point());
   MacroAssembler _masm(&cbuf);
 
-  address base = __ start_a_stub(size_exception_handler());
-  if (base == NULL) {
-    ciEnv::current()->record_failure("CodeCache is full");
-    return 0;  // CodeBuffer::expand failed
-  }
+  address base =
+  __ start_a_stub(size_exception_handler());
+  if (base == NULL)  return 0;  // CodeBuffer::expand failed
 
   int offset = __ offset();
 
@@ -1800,11 +1798,9 @@
   AddressLiteral deopt_blob(SharedRuntime::deopt_blob()->unpack());
   MacroAssembler _masm(&cbuf);
 
-  address base = __ start_a_stub(size_deopt_handler());
-  if (base == NULL) {
-    ciEnv::current()->record_failure("CodeCache is full");
-    return 0;  // CodeBuffer::expand failed
-  }
+  address base =
+  __ start_a_stub(size_deopt_handler());
+  if (base == NULL)  return 0;  // CodeBuffer::expand failed
 
   int offset = __ offset();
   __ save_frame(0);
@@ -2605,12 +2601,7 @@
       emit_call_reloc(cbuf, $meth$$method, relocInfo::static_call_type);
     }
     if (_method) {  // Emit stub for static call.
-      address stub = CompiledStaticCall::emit_to_interp_stub(cbuf);
-      // Stub does not fit into scratch buffer if TraceJumps is enabled
-      if (stub == NULL && !(TraceJumps && Compile::current()->in_scratch_emit_size())) {
-        ciEnv::current()->record_failure("CodeCache is full");
-        return;
-      } 
+      CompiledStaticCall::emit_to_interp_stub(cbuf);
     }
   %}
 
diff --git a/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp b/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp
index b14a6e9..72e98c6 100644
--- a/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp
@@ -74,7 +74,7 @@
     AllocatePrefetchDistance = AllocatePrefetchStepSize;
   }
 
-  if (AllocatePrefetchStyle == 3 && (!has_blk_init() || cache_line_size <= 0)) {
+  if (AllocatePrefetchStyle == 3 && !has_blk_init()) {
     warning("BIS instructions are not available on this CPU");
     FLAG_SET_DEFAULT(AllocatePrefetchStyle, 1);
   }
@@ -138,7 +138,7 @@
       FLAG_SET_DEFAULT(InteriorEntryAlignment, 4);
     }
     if (is_niagara_plus()) {
-      if (has_blk_init() && (cache_line_size > 0) && UseTLAB &&
+      if (has_blk_init() && UseTLAB &&
           FLAG_IS_DEFAULT(AllocatePrefetchInstr)) {
         // Use BIS instruction for TLAB allocation prefetch.
         FLAG_SET_ERGO(intx, AllocatePrefetchInstr, 1);
diff --git a/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp b/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp
index b96cb13..a6e7731 100644
--- a/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp
@@ -502,9 +502,6 @@
   ce->align_call(lir_static_call);
 
   ce->emit_static_call_stub();
-  if (ce->compilation()->bailed_out()) {
-    return; // CodeCache is full
-  }
   AddressLiteral resolve(SharedRuntime::get_resolve_static_call_stub(),
                          relocInfo::static_call_type);
   __ call(resolve);
diff --git a/hotspot/src/cpu/x86/vm/compiledIC_x86.cpp b/hotspot/src/cpu/x86/vm/compiledIC_x86.cpp
index 29eba2f..9537ef9 100644
--- a/hotspot/src/cpu/x86/vm/compiledIC_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/compiledIC_x86.cpp
@@ -50,7 +50,7 @@
 // ----------------------------------------------------------------------------
 
 #define __ _masm.
-address CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf) {
+void CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf) {
   // Stub is fixed up when the corresponding call is converted from
   // calling compiled code to calling interpreted code.
   // movq rbx, 0
@@ -62,10 +62,9 @@
   // That's why we must use the macroassembler to generate a stub.
   MacroAssembler _masm(&cbuf);
 
-  address base = __ start_a_stub(to_interp_stub_size());
-  if (base == NULL) {
-    return NULL;  // CodeBuffer::expand failed.
-  }
+  address base =
+  __ start_a_stub(to_interp_stub_size()*2);
+  if (base == NULL) return;  // CodeBuffer::expand failed.
   // Static stub relocation stores the instruction address of the call.
   __ relocate(static_stub_Relocation::spec(mark), Assembler::imm_operand);
   // Static stub relocation also tags the Method* in the code-stream.
@@ -75,7 +74,6 @@
 
   // Update current stubs pointer and restore insts_end.
   __ end_a_stub();
-  return base;
 }
 #undef __
 
diff --git a/hotspot/src/cpu/x86/vm/relocInfo_x86.cpp b/hotspot/src/cpu/x86/vm/relocInfo_x86.cpp
index 918b6f2..14868cb 100644
--- a/hotspot/src/cpu/x86/vm/relocInfo_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/relocInfo_x86.cpp
@@ -40,7 +40,7 @@
          which == Assembler::imm_operand, "format unpacks ok");
   if (which == Assembler::imm_operand) {
     if (verify_only) {
-      guarantee(*pd_address_in_code() == x, "instructions must match");
+      assert(*pd_address_in_code() == x, "instructions must match");
     } else {
       *pd_address_in_code() = x;
     }
@@ -49,13 +49,13 @@
     // both compressed oops and compressed classes look the same
     if (Universe::heap()->is_in_reserved((oop)x)) {
     if (verify_only) {
-      guarantee(*(uint32_t*) disp == oopDesc::encode_heap_oop((oop)x), "instructions must match");
+      assert(*(uint32_t*) disp == oopDesc::encode_heap_oop((oop)x), "instructions must match");
     } else {
       *(int32_t*) disp = oopDesc::encode_heap_oop((oop)x);
     }
   } else {
       if (verify_only) {
-        guarantee(*(uint32_t*) disp == Klass::encode_klass((Klass*)x), "instructions must match");
+        assert(*(uint32_t*) disp == Klass::encode_klass((Klass*)x), "instructions must match");
       } else {
         *(int32_t*) disp = Klass::encode_klass((Klass*)x);
       }
@@ -66,14 +66,14 @@
     address disp = Assembler::locate_operand(ip, which);
     address next_ip = Assembler::locate_next_instruction(ip);
     if (verify_only) {
-      guarantee(*(int32_t*) disp == (x - next_ip), "instructions must match");
+      assert(*(int32_t*) disp == (x - next_ip), "instructions must match");
     } else {
       *(int32_t*) disp = x - next_ip;
     }
   }
 #else
   if (verify_only) {
-    guarantee(*pd_address_in_code() == (x + o), "instructions must match");
+    assert(*pd_address_in_code() == (x + o), "instructions must match");
   } else {
     *pd_address_in_code() = x + o;
   }
diff --git a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp
index 134fa24..28aa48e 100644
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp
@@ -704,16 +704,16 @@
     UseMultiplyToLenIntrinsic = true;
   }
   if (FLAG_IS_DEFAULT(UseSquareToLenIntrinsic)) {
-    UseSquareToLenIntrinsic = true;
+    UseSquareToLenIntrinsic = false;
   }
   if (FLAG_IS_DEFAULT(UseMulAddIntrinsic)) {
-    UseMulAddIntrinsic = true;
+    UseMulAddIntrinsic = false;
   }
   if (FLAG_IS_DEFAULT(UseMontgomeryMultiplyIntrinsic)) {
-    UseMontgomeryMultiplyIntrinsic = true;
+    UseMontgomeryMultiplyIntrinsic = false;
   }
   if (FLAG_IS_DEFAULT(UseMontgomerySquareIntrinsic)) {
-    UseMontgomerySquareIntrinsic = true;
+    UseMontgomerySquareIntrinsic = false;
   }
 #else
   if (UseMultiplyToLenIntrinsic) {
diff --git a/hotspot/src/cpu/x86/vm/x86.ad b/hotspot/src/cpu/x86/vm/x86.ad
index 4e2499a..8d402c1 100644
--- a/hotspot/src/cpu/x86/vm/x86.ad
+++ b/hotspot/src/cpu/x86/vm/x86.ad
@@ -550,10 +550,7 @@
   // That's why we must use the macroassembler to generate a handler.
   MacroAssembler _masm(&cbuf);
   address base = __ start_a_stub(size_exception_handler());
-  if (base == NULL) {
-    ciEnv::current()->record_failure("CodeCache is full");
-    return 0;  // CodeBuffer::expand failed
-  }
+  if (base == NULL)  return 0;  // CodeBuffer::expand failed
   int offset = __ offset();
   __ jump(RuntimeAddress(OptoRuntime::exception_blob()->entry_point()));
   assert(__ offset() - offset <= (int) size_exception_handler(), "overflow");
@@ -568,10 +565,7 @@
   // That's why we must use the macroassembler to generate a handler.
   MacroAssembler _masm(&cbuf);
   address base = __ start_a_stub(size_deopt_handler());
-  if (base == NULL) {
-    ciEnv::current()->record_failure("CodeCache is full");
-    return 0;  // CodeBuffer::expand failed
-  }
+  if (base == NULL)  return 0;  // CodeBuffer::expand failed
   int offset = __ offset();
 
 #ifdef _LP64
diff --git a/hotspot/src/cpu/x86/vm/x86_32.ad b/hotspot/src/cpu/x86/vm/x86_32.ad
index 512ec20..42aba5b 100644
--- a/hotspot/src/cpu/x86/vm/x86_32.ad
+++ b/hotspot/src/cpu/x86/vm/x86_32.ad
@@ -1870,11 +1870,7 @@
                      static_call_Relocation::spec(), RELOC_IMM32 );
     }
     if (_method) {  // Emit stub for static call.
-      address stub = CompiledStaticCall::emit_to_interp_stub(cbuf);
-      if (stub == NULL) {
-        ciEnv::current()->record_failure("CodeCache is full");
-        return;
-      } 
+      CompiledStaticCall::emit_to_interp_stub(cbuf);
     }
   %}
 
diff --git a/hotspot/src/cpu/x86/vm/x86_64.ad b/hotspot/src/cpu/x86/vm/x86_64.ad
index ed304df..52bc635 100644
--- a/hotspot/src/cpu/x86/vm/x86_64.ad
+++ b/hotspot/src/cpu/x86/vm/x86_64.ad
@@ -2125,11 +2125,7 @@
     }
     if (_method) {
       // Emit stub for static call.
-      address stub = CompiledStaticCall::emit_to_interp_stub(cbuf);
-      if (stub == NULL) {
-        ciEnv::current()->record_failure("CodeCache is full");
-        return;
-      } 
+      CompiledStaticCall::emit_to_interp_stub(cbuf);
     }
   %}
 
diff --git a/hotspot/src/cpu/zero/vm/compiledIC_zero.cpp b/hotspot/src/cpu/zero/vm/compiledIC_zero.cpp
index 185a8b1..143dc31 100644
--- a/hotspot/src/cpu/zero/vm/compiledIC_zero.cpp
+++ b/hotspot/src/cpu/zero/vm/compiledIC_zero.cpp
@@ -60,9 +60,8 @@
 
 // ----------------------------------------------------------------------------
 
-address CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf) {
+void CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf) {
   ShouldNotReachHere(); // Only needed for COMPILER2.
-  return NULL;
 }
 
 int CompiledStaticCall::to_interp_stub_size() {
diff --git a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp
index 242ce1c..15cfc86 100644
--- a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp
+++ b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp
@@ -220,16 +220,9 @@
   // Push our result
   for (int i = 0; i < result_slots; i++) {
     // Adjust result to smaller
-    union {
-      intptr_t res;
-      jint res_jint;
-    };
-    res = result[-i];
+    intptr_t res = result[-i];
     if (result_slots == 1) {
-      BasicType t = method->result_type();
-      if (is_subword_type(t)) {
-        res_jint = (jint)narrow(t, res_jint);
-      }
+      res = narrow(method->result_type(), res);
     }
     stack->push(res);
   }
diff --git a/hotspot/src/os/linux/vm/globals_linux.hpp b/hotspot/src/os/linux/vm/globals_linux.hpp
index 32d4619..83424f2 100644
--- a/hotspot/src/os/linux/vm/globals_linux.hpp
+++ b/hotspot/src/os/linux/vm/globals_linux.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2016, 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
@@ -47,10 +47,7 @@
           "Load DLLs with executable-stack attribute in the VM Thread") \
                                                                         \
   product(bool, UseSHM, false,                                          \
-          "Use SYSV shared memory for large pages")                     \
-                                                                        \
-  diagnostic(bool, PrintActiveCpus, false,                              \
-          "Print the number of CPUs detected in os::active_processor_count")
+          "Use SYSV shared memory for large pages")
 
 //
 // Defines Linux-specific default values. The flags are available on all
diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
index 292d478..c59b702 100644
--- a/hotspot/src/os/linux/vm/os_linux.cpp
+++ b/hotspot/src/os/linux/vm/os_linux.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -104,14 +104,6 @@
 
 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
-#ifndef _GNU_SOURCE
-  #define _GNU_SOURCE
-  #include <sched.h>
-  #undef _GNU_SOURCE
-#else
-  #include <sched.h>
-#endif
-
 // if RUSAGE_THREAD for getrusage() has not been defined, do it here. The code calling
 // getrusage() is prepared to handle the associated failure.
 #ifndef RUSAGE_THREAD
@@ -2854,7 +2846,7 @@
                               // in the library.
   const size_t BitsPerCLong = sizeof(long) * CHAR_BIT;
 
-  size_t cpu_num = processor_count();
+  size_t cpu_num = os::active_processor_count();
   size_t cpu_map_size = NCPUS / BitsPerCLong;
   size_t cpu_map_valid_size =
     MIN2((cpu_num + BitsPerCLong - 1) / BitsPerCLong, cpu_map_size);
@@ -3055,48 +3047,6 @@
   return addr == MAP_FAILED ? NULL : addr;
 }
 
-// Allocate (using mmap, NO_RESERVE, with small pages) at either a given request address
-//   (req_addr != NULL) or with a given alignment.
-//  - bytes shall be a multiple of alignment.
-//  - req_addr can be NULL. If not NULL, it must be a multiple of alignment.
-//  - alignment sets the alignment at which memory shall be allocated.
-//     It must be a multiple of allocation granularity.
-// Returns address of memory or NULL. If req_addr was not NULL, will only return
-//  req_addr or NULL.
-static char* anon_mmap_aligned(size_t bytes, size_t alignment, char* req_addr) {
-
-  size_t extra_size = bytes;
-  if (req_addr == NULL && alignment > 0) {
-    extra_size += alignment;
-  }
-
-  char* start = (char*) ::mmap(req_addr, extra_size, PROT_NONE,
-    MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE,
-    -1, 0);
-  if (start == MAP_FAILED) {
-    start = NULL;
-  } else {
-    if (req_addr != NULL) {
-      if (start != req_addr) {
-        ::munmap(start, extra_size);
-        start = NULL;
-      }
-    } else {
-      char* const start_aligned = (char*) align_ptr_up(start, alignment);
-      char* const end_aligned = start_aligned + bytes;
-      char* const end = start + extra_size;
-      if (start_aligned > start) {
-        ::munmap(start, start_aligned - start);
-      }
-      if (end_aligned < end) {
-        ::munmap(end_aligned, end - end_aligned);
-      }
-      start = start_aligned;
-    }
-  }
-  return start;
-}
-
 // Don't update _highest_vm_reserved_address, because there might be memory
 // regions above addr + size. If so, releasing a memory region only creates
 // a hole in the address space, it doesn't help prevent heap-stack collision.
@@ -3381,133 +3331,54 @@
 #define SHM_HUGETLB 04000
 #endif
 
-#define shm_warning_format(format, ...)              \
-  do {                                               \
-    if (UseLargePages &&                             \
-        (!FLAG_IS_DEFAULT(UseLargePages) ||          \
-         !FLAG_IS_DEFAULT(UseSHM) ||                 \
-         !FLAG_IS_DEFAULT(LargePageSizeInBytes))) {  \
-      warning(format, __VA_ARGS__);                  \
-    }                                                \
-  } while (0)
-
-#define shm_warning(str) shm_warning_format("%s", str)
-
-#define shm_warning_with_errno(str)                \
-  do {                                             \
-    int err = errno;                               \
-    shm_warning_format(str " (error = %d)", err);  \
-  } while (0)
-
-static char* shmat_with_alignment(int shmid, size_t bytes, size_t alignment) {
-  assert(is_size_aligned(bytes, alignment), "Must be divisible by the alignment");
-
-  if (!is_size_aligned(alignment, SHMLBA)) {
-    assert(false, "Code below assumes that alignment is at least SHMLBA aligned");
-    return NULL;
-  }
-
-  // To ensure that we get 'alignment' aligned memory from shmat,
-  // we pre-reserve aligned virtual memory and then attach to that.
-
-  char* pre_reserved_addr = anon_mmap_aligned(bytes, alignment, NULL);
-  if (pre_reserved_addr == NULL) {
-    // Couldn't pre-reserve aligned memory.
-    shm_warning("Failed to pre-reserve aligned memory for shmat.");
-    return NULL;
-  }
-
-  // SHM_REMAP is needed to allow shmat to map over an existing mapping.
-  char* addr = (char*)shmat(shmid, pre_reserved_addr, SHM_REMAP);
-
-  if ((intptr_t)addr == -1) {
-    int err = errno;
-    shm_warning_with_errno("Failed to attach shared memory.");
-
-    assert(err != EACCES, "Unexpected error");
-    assert(err != EIDRM,  "Unexpected error");
-    assert(err != EINVAL, "Unexpected error");
-
-    // Since we don't know if the kernel unmapped the pre-reserved memory area
-    // we can't unmap it, since that would potentially unmap memory that was
-    // mapped from other threads.
-    return NULL;
-  }
-
-  return addr;
-}
-
-static char* shmat_at_address(int shmid, char* req_addr) {
-  if (!is_ptr_aligned(req_addr, SHMLBA)) {
-    assert(false, "Requested address needs to be SHMLBA aligned");
-    return NULL;
-  }
-
-  char* addr = (char*)shmat(shmid, req_addr, 0);
-
-  if ((intptr_t)addr == -1) {
-    shm_warning_with_errno("Failed to attach shared memory.");
-    return NULL;
-  }
-
-  return addr;
-}
-
-static char* shmat_large_pages(int shmid, size_t bytes, size_t alignment, char* req_addr) {
-  // If a req_addr has been provided, we assume that the caller has already aligned the address.
-  if (req_addr != NULL) {
-    assert(is_ptr_aligned(req_addr, os::large_page_size()), "Must be divisible by the large page size");
-    assert(is_ptr_aligned(req_addr, alignment), "Must be divisible by given alignment");
-    return shmat_at_address(shmid, req_addr);
-  }
-
-  // Since shmid has been setup with SHM_HUGETLB, shmat will automatically
-  // return large page size aligned memory addresses when req_addr == NULL.
-  // However, if the alignment is larger than the large page size, we have
-  // to manually ensure that the memory returned is 'alignment' aligned.
-  if (alignment > os::large_page_size()) {
-    assert(is_size_aligned(alignment, os::large_page_size()), "Must be divisible by the large page size");
-    return shmat_with_alignment(shmid, bytes, alignment);
-  } else {
-    return shmat_at_address(shmid, NULL);
-  }
-}
-
 char* os::Linux::reserve_memory_special_shm(size_t bytes, size_t alignment, char* req_addr, bool exec) {
   // "exec" is passed in but not used.  Creating the shared image for
   // the code cache doesn't have an SHM_X executable permission to check.
   assert(UseLargePages && UseSHM, "only for SHM large pages");
   assert(is_ptr_aligned(req_addr, os::large_page_size()), "Unaligned address");
-  assert(is_ptr_aligned(req_addr, alignment), "Unaligned address");
 
-  if (!is_size_aligned(bytes, os::large_page_size())) {
+  if (!is_size_aligned(bytes, os::large_page_size()) || alignment > os::large_page_size()) {
     return NULL; // Fallback to small pages.
   }
 
+  key_t key = IPC_PRIVATE;
+  char *addr;
+
+  bool warn_on_failure = UseLargePages &&
+                        (!FLAG_IS_DEFAULT(UseLargePages) ||
+                         !FLAG_IS_DEFAULT(UseSHM) ||
+                         !FLAG_IS_DEFAULT(LargePageSizeInBytes)
+                        );
+  char msg[128];
+
   // Create a large shared memory region to attach to based on size.
-  // Currently, size is the total size of the heap.
-  int shmid = shmget(IPC_PRIVATE, bytes, SHM_HUGETLB|IPC_CREAT|SHM_R|SHM_W);
+  // Currently, size is the total size of the heap
+  int shmid = shmget(key, bytes, SHM_HUGETLB|IPC_CREAT|SHM_R|SHM_W);
   if (shmid == -1) {
-    // Possible reasons for shmget failure:
-    // 1. shmmax is too small for Java heap.
-    //    > check shmmax value: cat /proc/sys/kernel/shmmax
-    //    > increase shmmax value: echo "0xffffffff" > /proc/sys/kernel/shmmax
-    // 2. not enough large page memory.
-    //    > check available large pages: cat /proc/meminfo
-    //    > increase amount of large pages:
-    //          echo new_value > /proc/sys/vm/nr_hugepages
-    //      Note 1: different Linux may use different name for this property,
-    //            e.g. on Redhat AS-3 it is "hugetlb_pool".
-    //      Note 2: it's possible there's enough physical memory available but
-    //            they are so fragmented after a long run that they can't
-    //            coalesce into large pages. Try to reserve large pages when
-    //            the system is still "fresh".
-    shm_warning_with_errno("Failed to reserve shared memory.");
-    return NULL;
+     // Possible reasons for shmget failure:
+     // 1. shmmax is too small for Java heap.
+     //    > check shmmax value: cat /proc/sys/kernel/shmmax
+     //    > increase shmmax value: echo "0xffffffff" > /proc/sys/kernel/shmmax
+     // 2. not enough large page memory.
+     //    > check available large pages: cat /proc/meminfo
+     //    > increase amount of large pages:
+     //          echo new_value > /proc/sys/vm/nr_hugepages
+     //      Note 1: different Linux may use different name for this property,
+     //            e.g. on Redhat AS-3 it is "hugetlb_pool".
+     //      Note 2: it's possible there's enough physical memory available but
+     //            they are so fragmented after a long run that they can't
+     //            coalesce into large pages. Try to reserve large pages when
+     //            the system is still "fresh".
+     if (warn_on_failure) {
+       jio_snprintf(msg, sizeof(msg), "Failed to reserve shared memory (errno = %d).", errno);
+       warning("%s", msg);
+     }
+     return NULL;
   }
 
-  // Attach to the region.
-  char* addr = shmat_large_pages(shmid, bytes, alignment, req_addr);
+  // attach to the region
+  addr = (char*)shmat(shmid, req_addr, 0);
+  int err = errno;
 
   // Remove shmid. If shmat() is successful, the actual shared memory segment
   // will be deleted when it's detached by shmdt() or when the process
@@ -3515,6 +3386,14 @@
   // segment immediately.
   shmctl(shmid, IPC_RMID, NULL);
 
+  if ((intptr_t)addr == -1) {
+     if (warn_on_failure) {
+       jio_snprintf(msg, sizeof(msg), "Failed to attach shared memory (errno = %d).", err);
+       warning("%s", msg);
+     }
+     return NULL;
+  }
+
   return addr;
 }
 
@@ -3554,22 +3433,22 @@
   return addr;
 }
 
-// Reserve memory using mmap(MAP_HUGETLB).
-//  - bytes shall be a multiple of alignment.
-//  - req_addr can be NULL. If not NULL, it must be a multiple of alignment.
-//  - alignment sets the alignment at which memory shall be allocated.
-//     It must be a multiple of allocation granularity.
-// Returns address of memory or NULL. If req_addr was not NULL, will only return
-//  req_addr or NULL.
 char* os::Linux::reserve_memory_special_huge_tlbfs_mixed(size_t bytes, size_t alignment, char* req_addr, bool exec) {
   size_t large_page_size = os::large_page_size();
+
   assert(bytes >= large_page_size, "Shouldn't allocate large pages for small sizes");
 
-  assert(is_ptr_aligned(req_addr, alignment), "Must be");
-  assert(is_size_aligned(bytes, alignment), "Must be");
+  // Allocate small pages.
 
-  // First reserve - but not commit - the address range in small pages.
-  char* const start = anon_mmap_aligned(bytes, alignment, req_addr);
+  char* start;
+  if (req_addr != NULL) {
+    assert(is_ptr_aligned(req_addr, alignment), "Must be");
+    assert(is_size_aligned(bytes, alignment), "Must be");
+    start = os::reserve_memory(bytes, req_addr);
+    assert(start == NULL || start == req_addr, "Must be");
+  } else {
+    start = os::reserve_memory_aligned(bytes, alignment);
+  }
 
   if (start == NULL) {
     return NULL;
@@ -3577,6 +3456,13 @@
 
   assert(is_ptr_aligned(start, alignment), "Must be");
 
+  if (MemTracker::tracking_level() > NMT_minimal) {
+    // os::reserve_memory_special will record this memory area.
+    // Need to release it here to prevent overlapping reservations.
+    Tracker tkr = MemTracker::get_virtual_memory_release_tracker();
+    tkr.record((address)start, bytes);
+  }
+
   char* end = start + bytes;
 
   // Find the regions of the allocated chunk that can be promoted to large pages.
@@ -3596,9 +3482,9 @@
 
   int prot = exec ? PROT_READ|PROT_WRITE|PROT_EXEC : PROT_READ|PROT_WRITE;
 
+
   void* result;
 
-  // Commit small-paged leading area.
   if (start != lp_start) {
     result = ::mmap(start, lp_start - start, prot,
                     MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,
@@ -3609,12 +3495,11 @@
     }
   }
 
-  // Commit large-paged area.
   result = ::mmap(lp_start, lp_bytes, prot,
                   MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED|MAP_HUGETLB,
                   -1, 0);
   if (result == MAP_FAILED) {
-    warn_on_large_pages_failure(lp_start, lp_bytes, errno);
+    warn_on_large_pages_failure(req_addr, bytes, errno);
     // If the mmap above fails, the large pages region will be unmapped and we
     // have regions before and after with small pages. Release these regions.
     //
@@ -3627,7 +3512,6 @@
     return NULL;
   }
 
-  // Commit small-paged trailing area.
   if (lp_end != end) {
       result = ::mmap(lp_end, end - lp_end, prot,
                       MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,
@@ -3644,7 +3528,7 @@
 char* os::Linux::reserve_memory_special_huge_tlbfs(size_t bytes, size_t alignment, char* req_addr, bool exec) {
   assert(UseLargePages && UseHugeTLBFS, "only for Huge TLBFS large pages");
   assert(is_ptr_aligned(req_addr, alignment), "Must be");
-  assert(is_size_aligned(alignment, os::vm_allocation_granularity()), "Must be");
+  assert(is_power_of_2(alignment), "Must be");
   assert(is_power_of_2(os::large_page_size()), "Must be");
   assert(bytes >= os::large_page_size(), "Shouldn't allocate large pages for small sizes");
 
@@ -5024,42 +4908,12 @@
   }
 };
 
-static int os_cpu_count(const cpu_set_t* cpus) {
-  int count = 0;
-  // only look up to the number of configured processors
-  for (int i = 0; i < os::processor_count(); i++) {
-    if (CPU_ISSET(i, cpus)) {
-      count++;
-    }
-  }
-  return count;
-}
-
-// Get the current number of available processors for this process.
-// This value can change at any time during a process's lifetime.
-// sched_getaffinity gives an accurate answer as it accounts for cpusets.
-// If anything goes wrong we fallback to returning the number of online
-// processors - which can be greater than the number available to the process.
 int os::active_processor_count() {
-  cpu_set_t cpus;  // can represent at most 1024 (CPU_SETSIZE) processors
-  int cpus_size = sizeof(cpu_set_t);
-  int cpu_count = 0;
-
-  // pid 0 means the current thread - which we have to assume represents the process
-  if (sched_getaffinity(0, cpus_size, &cpus) == 0) {
-    cpu_count = os_cpu_count(&cpus);
-    if (PrintActiveCpus) {
-      tty->print_cr("active_processor_count: sched_getaffinity processor count: %d", cpu_count);
-    }
-  }
-  else {
-    cpu_count = ::sysconf(_SC_NPROCESSORS_ONLN);
-    warning("sched_getaffinity failed (%s)- using online processor count (%d) "
-            "which may exceed available processors", strerror(errno), cpu_count);
-  }
-
-  assert(cpu_count > 0 && cpu_count <= processor_count(), "sanity check");
-  return cpu_count;
+  // Linux doesn't yet have a (official) notion of processor sets,
+  // so just return the number of online processors.
+  int online_cpus = ::sysconf(_SC_NPROCESSORS_ONLN);
+  assert(online_cpus > 0 && online_cpus <= processor_count(), "sanity check");
+  return online_cpus;
 }
 
 void os::set_native_thread_name(const char *name) {
@@ -6248,100 +6102,47 @@
     }
   }
 
+  static void test_reserve_memory_special_huge_tlbfs_mixed(size_t size, size_t alignment) {
+    if (!UseHugeTLBFS) {
+        return;
+    }
+
+    test_log("test_reserve_memory_special_huge_tlbfs_mixed(" SIZE_FORMAT ", " SIZE_FORMAT ")",
+        size, alignment);
+
+    assert(size >= os::large_page_size(), "Incorrect input to test");
+
+    char* addr = os::Linux::reserve_memory_special_huge_tlbfs_mixed(size, alignment, NULL, false);
+
+    if (addr != NULL) {
+      small_page_write(addr, size);
+
+      os::Linux::release_memory_special_huge_tlbfs(addr, size);
+    }
+  }
+
+  static void test_reserve_memory_special_huge_tlbfs_mixed_all_alignments(size_t size) {
+    size_t lp = os::large_page_size();
+    size_t ag = os::vm_allocation_granularity();
+
+    for (size_t alignment = ag; is_size_aligned(size, alignment); alignment *= 2) {
+      test_reserve_memory_special_huge_tlbfs_mixed(size, alignment);
+    }
+  }
+
   static void test_reserve_memory_special_huge_tlbfs_mixed() {
     size_t lp = os::large_page_size();
     size_t ag = os::vm_allocation_granularity();
 
-    // sizes to test
-    const size_t sizes[] = {
-      lp, lp + ag, lp + lp / 2, lp * 2,
-      lp * 2 + ag, lp * 2 - ag, lp * 2 + lp / 2,
-      lp * 10, lp * 10 + lp / 2
-    };
-    const int num_sizes = sizeof(sizes) / sizeof(size_t);
-
-    // For each size/alignment combination, we test three scenarios:
-    // 1) with req_addr == NULL
-    // 2) with a non-null req_addr at which we expect to successfully allocate
-    // 3) with a non-null req_addr which contains a pre-existing mapping, at which we
-    //    expect the allocation to either fail or to ignore req_addr
-
-    // Pre-allocate two areas; they shall be as large as the largest allocation
-    //  and aligned to the largest alignment we will be testing.
-    const size_t mapping_size = sizes[num_sizes - 1] * 2;
-    char* const mapping1 = (char*) ::mmap(NULL, mapping_size,
-      PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE,
-      -1, 0);
-    assert(mapping1 != MAP_FAILED, "should work");
-
-    char* const mapping2 = (char*) ::mmap(NULL, mapping_size,
-      PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE,
-      -1, 0);
-    assert(mapping2 != MAP_FAILED, "should work");
-
-    // Unmap the first mapping, but leave the second mapping intact: the first
-    // mapping will serve as a value for a "good" req_addr (case 2). The second
-    // mapping, still intact, as "bad" req_addr (case 3).
-    ::munmap(mapping1, mapping_size);
-
-    // Case 1
-    test_log("%s, req_addr NULL:", __FUNCTION__);
-    test_log("size            align           result");
-
-    for (int i = 0; i < num_sizes; i++) {
-      const size_t size = sizes[i];
-      for (size_t alignment = ag; is_size_aligned(size, alignment); alignment *= 2) {
-        char* p = os::Linux::reserve_memory_special_huge_tlbfs_mixed(size, alignment, NULL, false);
-        test_log(SIZE_FORMAT_HEX " " SIZE_FORMAT_HEX " ->  " PTR_FORMAT " %s",
-            size, alignment, p, (p != NULL ? "" : "(failed)"));
-        if (p != NULL) {
-          assert(is_ptr_aligned(p, alignment), "must be");
-          small_page_write(p, size);
-          os::Linux::release_memory_special_huge_tlbfs(p, size);
-        }
-      }
-    }
-
-    // Case 2
-    test_log("%s, req_addr non-NULL:", __FUNCTION__);
-    test_log("size            align           req_addr         result");
-
-    for (int i = 0; i < num_sizes; i++) {
-      const size_t size = sizes[i];
-      for (size_t alignment = ag; is_size_aligned(size, alignment); alignment *= 2) {
-        char* const req_addr = (char*) align_ptr_up(mapping1, alignment);
-        char* p = os::Linux::reserve_memory_special_huge_tlbfs_mixed(size, alignment, req_addr, false);
-        test_log(SIZE_FORMAT_HEX " " SIZE_FORMAT_HEX " " PTR_FORMAT " ->  " PTR_FORMAT " %s",
-            size, alignment, req_addr, p,
-            ((p != NULL ? (p == req_addr ? "(exact match)" : "") : "(failed)")));
-        if (p != NULL) {
-          assert(p == req_addr, "must be");
-          small_page_write(p, size);
-          os::Linux::release_memory_special_huge_tlbfs(p, size);
-        }
-      }
-    }
-
-    // Case 3
-    test_log("%s, req_addr non-NULL with preexisting mapping:", __FUNCTION__);
-    test_log("size            align           req_addr         result");
-
-    for (int i = 0; i < num_sizes; i++) {
-      const size_t size = sizes[i];
-      for (size_t alignment = ag; is_size_aligned(size, alignment); alignment *= 2) {
-        char* const req_addr = (char*) align_ptr_up(mapping2, alignment);
-        char* p = os::Linux::reserve_memory_special_huge_tlbfs_mixed(size, alignment, req_addr, false);
-        test_log(SIZE_FORMAT_HEX " " SIZE_FORMAT_HEX " " PTR_FORMAT " ->  " PTR_FORMAT " %s",
-            size, alignment, req_addr, p,
-            ((p != NULL ? "" : "(failed)")));
-        // as the area around req_addr contains already existing mappings, the API should always
-        // return NULL (as per contract, it cannot return another address)
-        assert(p == NULL, "must be");
-      }
-    }
-
-    ::munmap(mapping2, mapping_size);
-
+    test_reserve_memory_special_huge_tlbfs_mixed_all_alignments(lp);
+    test_reserve_memory_special_huge_tlbfs_mixed_all_alignments(lp + ag);
+    test_reserve_memory_special_huge_tlbfs_mixed_all_alignments(lp + lp / 2);
+    test_reserve_memory_special_huge_tlbfs_mixed_all_alignments(lp * 2);
+    test_reserve_memory_special_huge_tlbfs_mixed_all_alignments(lp * 2 + ag);
+    test_reserve_memory_special_huge_tlbfs_mixed_all_alignments(lp * 2 - ag);
+    test_reserve_memory_special_huge_tlbfs_mixed_all_alignments(lp * 2 + lp / 2);
+    test_reserve_memory_special_huge_tlbfs_mixed_all_alignments(lp * 10);
+    test_reserve_memory_special_huge_tlbfs_mixed_all_alignments(lp * 10 + lp / 2);
   }
 
   static void test_reserve_memory_special_huge_tlbfs() {
diff --git a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp
index 3447e07..ef2b106 100644
--- a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp
+++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp
@@ -464,7 +464,6 @@
 
   // emit the static call stub stuff out of line
   emit_static_call_stub();
-  CHECK_BAILOUT();
 
   switch (op->code()) {
   case lir_static_call:
diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp
index 9678287..23a0cec 100644
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp
@@ -537,9 +537,6 @@
           int name_index = cp->name_ref_index_at(index);
           Symbol*  name = cp->symbol_at(name_index);
           Symbol*  sig = cp->symbol_at(sig_index);
-          guarantee_property(sig->utf8_length() != 0,
-            "Illegal zero length constant pool entry at %d in class %s",
-            sig_index, CHECK_(nullHandle));
           if (sig->byte_at(0) == JVM_SIGNATURE_FUNC) {
             verify_legal_method_signature(name, sig, CHECK_(nullHandle));
           } else {
@@ -563,9 +560,8 @@
           verify_legal_field_name(name, CHECK_(nullHandle));
           if (_need_verify && _major_version >= JAVA_7_VERSION) {
             // Signature is verified above, when iterating NameAndType_info.
-            // Need only to be sure it's non-zero length and the right type.
-            if (signature->utf8_length() == 0 ||
-                signature->byte_at(0) == JVM_SIGNATURE_FUNC) {
+            // Need only to be sure it's the right type.
+            if (signature->byte_at(0) == JVM_SIGNATURE_FUNC) {
               throwIllegalSignature(
                   "Field", name, signature, CHECK_(nullHandle));
             }
@@ -576,9 +572,8 @@
           verify_legal_method_name(name, CHECK_(nullHandle));
           if (_need_verify && _major_version >= JAVA_7_VERSION) {
             // Signature is verified above, when iterating NameAndType_info.
-            // Need only to be sure it's non-zero length and the right type.
-            if (signature->utf8_length() == 0 ||
-                signature->byte_at(0) != JVM_SIGNATURE_FUNC) {
+            // Need only to be sure it's the right type.
+            if (signature->byte_at(0) != JVM_SIGNATURE_FUNC) {
               throwIllegalSignature(
                   "Method", name, signature, CHECK_(nullHandle));
             }
@@ -589,7 +584,8 @@
             // 4509014: If a class method name begins with '<', it must be "<init>".
             assert(name != NULL, "method name in constant pool is null");
             unsigned int name_len = name->utf8_length();
-            if (name_len != 0 && name->byte_at(0) == '<') {
+            assert(name_len > 0, "bad method name");  // already verified as legal name
+            if (name->byte_at(0) == '<') {
               if (name != vmSymbols::object_initializer_name()) {
                 classfile_parse_error(
                   "Bad method name at constant pool index %u in class file %s",
diff --git a/hotspot/src/share/vm/classfile/classLoaderData.cpp b/hotspot/src/share/vm/classfile/classLoaderData.cpp
index 1f25e15..2e852f3 100644
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp
@@ -813,12 +813,6 @@
     // called on all alive classes. See the comment in ClassLoaderDataGraph::clean_metaspaces.
     cld->free_deallocate_list();
   }
-
-  // In some rare cases items added to the unloading list will not be freed elsewhere.
-  // To keep it simple, walk the _unloading list also.
-  for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) {
-    cld->free_deallocate_list();
-  }
 }
 
 // CDS support
diff --git a/hotspot/src/share/vm/classfile/classLoaderData.inline.hpp b/hotspot/src/share/vm/classfile/classLoaderData.inline.hpp
index 755ac54..11014f2 100644
--- a/hotspot/src/share/vm/classfile/classLoaderData.inline.hpp
+++ b/hotspot/src/share/vm/classfile/classLoaderData.inline.hpp
@@ -40,7 +40,7 @@
 
 
 inline ClassLoaderData *ClassLoaderDataGraph::find_or_create(Handle loader, TRAPS) {
-  guarantee(loader() != NULL && loader()->is_oop(), "Loader must be oop");
+  assert(loader() != NULL,"Must be a class loader");
   // Gets the class loader data out of the java/lang/ClassLoader object, if non-null
   // it's already in the loader_data, so no need to add
   ClassLoaderData* loader_data= java_lang_ClassLoader::loader_data(loader());
diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp
index 1dfe3b6..31be14b 100644
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp
@@ -1084,18 +1084,15 @@
                                                              THREAD);
 
   const char* pkg = "java/";
-  size_t pkglen = strlen(pkg);
   if (!HAS_PENDING_EXCEPTION &&
       !class_loader.is_null() &&
       parsed_name != NULL &&
-      parsed_name->utf8_length() >= (int)pkglen &&
-      !strncmp((const char*)parsed_name->bytes(), pkg, pkglen)) {
+      !strncmp((const char*)parsed_name->bytes(), pkg, strlen(pkg))) {
     // It is illegal to define classes in the "java." package from
     // JVM_DefineClass or jni_DefineClass unless you're the bootclassloader
     ResourceMark rm(THREAD);
     char* name = parsed_name->as_C_string();
     char* index = strrchr(name, '/');
-    assert(index != NULL, "must be");
     *index = '\0'; // chop to just the package name
     while ((index = strchr(name, '/')) != NULL) {
       *index = '.'; // replace '/' with '.' in package name
diff --git a/hotspot/src/share/vm/classfile/vmSymbols.hpp b/hotspot/src/share/vm/classfile/vmSymbols.hpp
index 5281758..b857cb3 100644
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -517,7 +517,6 @@
   template(int_StringBuffer_signature,                "(I)Ljava/lang/StringBuffer;")                              \
   template(char_StringBuffer_signature,               "(C)Ljava/lang/StringBuffer;")                              \
   template(int_String_signature,                      "(I)Ljava/lang/String;")                                    \
-  template(codesource_permissioncollection_signature, "(Ljava/security/CodeSource;Ljava/security/PermissionCollection;)V") \
   /* signature symbols needed by intrinsics */                                                                    \
   VM_INTRINSICS_DO(VM_INTRINSIC_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, template, VM_ALIAS_IGNORE)            \
                                                                                                                   \
diff --git a/hotspot/src/share/vm/code/compiledIC.hpp b/hotspot/src/share/vm/code/compiledIC.hpp
index de72423..b797329 100644
--- a/hotspot/src/share/vm/code/compiledIC.hpp
+++ b/hotspot/src/share/vm/code/compiledIC.hpp
@@ -320,7 +320,7 @@
   friend CompiledStaticCall* compiledStaticCall_at(Relocation* call_site);
 
   // Code
-  static address emit_to_interp_stub(CodeBuffer &cbuf);
+  static void emit_to_interp_stub(CodeBuffer &cbuf);
   static int to_interp_stub_size();
   static int reloc_to_interp_stub();
 
diff --git a/hotspot/src/share/vm/code/nmethod.cpp b/hotspot/src/share/vm/code/nmethod.cpp
index e20f507..6ea39ae 100644
--- a/hotspot/src/share/vm/code/nmethod.cpp
+++ b/hotspot/src/share/vm/code/nmethod.cpp
@@ -2290,7 +2290,7 @@
     assert(cur != NULL, "not NULL-terminated");
     nmethod* next = cur->_oops_do_mark_link;
     cur->_oops_do_mark_link = NULL;
-    DEBUG_ONLY(cur->verify_oop_relocations());
+    cur->verify_oop_relocations();
     NOT_PRODUCT(if (TraceScavenge)  cur->print_on(tty, "oops_do, unmark"));
     cur = next;
   }
diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp
index 32a753c..dad99ec 100644
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp
@@ -1851,10 +1851,6 @@
           tty->print_cr("Opening compilation log %s", file_name);
         }
         CompileLog* log = new(ResourceObj::C_HEAP, mtCompiler) CompileLog(file_name, fp, thread_id);
-        if (log == NULL) {
-          fclose(fp);
-          return;
-        }
         thread->init_log(log);
 
         if (xtty != NULL) {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp
index fc86a50..406ac73 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -148,9 +148,7 @@
   do {
     // Drain the overflow stack first, so other threads can steal.
     while (_refs->pop_overflow(ref)) {
-      if (!_refs->try_push_to_taskqueue(ref)) {
-        dispatch_reference(ref);
-      }
+      dispatch_reference(ref);
     }
 
     while (_refs->pop_local(ref)) {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.cpp
index 45bc364..c55165b 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -133,6 +133,10 @@
   }
 }
 
+static size_t round_to_K(size_t value) {
+  return value / K;
+}
+
 class RegionTypeCounter VALUE_OBJ_CLASS_SPEC {
 private:
   const char* _name;
@@ -183,10 +187,8 @@
   size_t code_root_elems() const { return _code_root_elems; }
 
   void print_rs_mem_info_on(outputStream * out, size_t total) {
-    out->print_cr("    "SIZE_FORMAT_W(8) "%s (%5.1f%%) by "SIZE_FORMAT" %s regions",
-        byte_size_in_proper_unit(rs_mem_size()),
-        proper_unit_for_byte_size(rs_mem_size()),
-        rs_mem_size_percent_of(total), amount(), _name);
+    out->print_cr("    "SIZE_FORMAT_W(8)"K (%5.1f%%) by "SIZE_FORMAT" %s regions",
+        round_to_K(rs_mem_size()), rs_mem_size_percent_of(total), amount(), _name);
   }
 
   void print_cards_occupied_info_on(outputStream * out, size_t total) {
@@ -195,10 +197,8 @@
   }
 
   void print_code_root_mem_info_on(outputStream * out, size_t total) {
-    out->print_cr("    "SIZE_FORMAT_W(8) "%s (%5.1f%%) by "SIZE_FORMAT" %s regions",
-        byte_size_in_proper_unit(code_root_mem_size()),
-        proper_unit_for_byte_size(code_root_mem_size()),
-        code_root_mem_size_percent_of(total), amount(), _name);
+    out->print_cr("    "SIZE_FORMAT_W(8)"K (%5.1f%%) by "SIZE_FORMAT" %s regions",
+        round_to_K(code_root_mem_size()), code_root_mem_size_percent_of(total), amount(), _name);
   }
 
   void print_code_root_elems_info_on(outputStream * out, size_t total) {
@@ -280,23 +280,17 @@
     RegionTypeCounter* counters[] = { &_young, &_humonguous, &_free, &_old, NULL };
 
     out->print_cr("\n Current rem set statistics");
-    out->print_cr("  Total per region rem sets sizes = " SIZE_FORMAT "%s."
-                  " Max = " SIZE_FORMAT "%s.",
-                  byte_size_in_proper_unit(total_rs_mem_sz()),
-                  proper_unit_for_byte_size(total_rs_mem_sz()),
-                  byte_size_in_proper_unit(max_rs_mem_sz()),
-                  proper_unit_for_byte_size(max_rs_mem_sz()));
-
+    out->print_cr("  Total per region rem sets sizes = "SIZE_FORMAT"K."
+                  " Max = "SIZE_FORMAT"K.",
+                  round_to_K(total_rs_mem_sz()), round_to_K(max_rs_mem_sz()));
     for (RegionTypeCounter** current = &counters[0]; *current != NULL; current++) {
       (*current)->print_rs_mem_info_on(out, total_rs_mem_sz());
     }
 
-    out->print_cr("   Static structures = " SIZE_FORMAT "%s,"
-                  " free_lists = " SIZE_FORMAT "%s.",
-                  byte_size_in_proper_unit(HeapRegionRemSet::static_mem_size()),
-                  proper_unit_for_byte_size(HeapRegionRemSet::static_mem_size()),
-                  byte_size_in_proper_unit(HeapRegionRemSet::fl_mem_size()),
-                  proper_unit_for_byte_size(HeapRegionRemSet::fl_mem_size()));
+    out->print_cr("   Static structures = "SIZE_FORMAT"K,"
+                  " free_lists = "SIZE_FORMAT"K.",
+                  round_to_K(HeapRegionRemSet::static_mem_size()),
+                  round_to_K(HeapRegionRemSet::fl_mem_size()));
 
     out->print_cr("    "SIZE_FORMAT" occupied cards represented.",
                   total_cards_occupied());
@@ -307,21 +301,17 @@
     // Largest sized rem set region statistics
     HeapRegionRemSet* rem_set = max_rs_mem_sz_region()->rem_set();
     out->print_cr("    Region with largest rem set = "HR_FORMAT", "
-                  "size = "SIZE_FORMAT "%s, occupied = "SIZE_FORMAT "%s.",
+                  "size = "SIZE_FORMAT "K, occupied = "SIZE_FORMAT"K.",
                   HR_FORMAT_PARAMS(max_rs_mem_sz_region()),
-                  byte_size_in_proper_unit(rem_set->mem_size()),
-                  proper_unit_for_byte_size(rem_set->mem_size()),
-                  byte_size_in_proper_unit(rem_set->occupied()),
-                  proper_unit_for_byte_size(rem_set->occupied()));
+                  round_to_K(rem_set->mem_size()),
+                  round_to_K(rem_set->occupied()));
+
     // Strong code root statistics
     HeapRegionRemSet* max_code_root_rem_set = max_code_root_mem_sz_region()->rem_set();
-    out->print_cr("  Total heap region code root sets sizes = " SIZE_FORMAT "%s."
-                  "  Max = " SIZE_FORMAT "%s.",
-                  byte_size_in_proper_unit(total_code_root_mem_sz()),
-                  proper_unit_for_byte_size(total_code_root_mem_sz()),
-                  byte_size_in_proper_unit(max_code_root_rem_set->strong_code_roots_mem_size()),
-                  proper_unit_for_byte_size(max_code_root_rem_set->strong_code_roots_mem_size()));
-
+    out->print_cr("  Total heap region code root sets sizes = "SIZE_FORMAT"K."
+                  "  Max = "SIZE_FORMAT"K.",
+                  round_to_K(total_code_root_mem_sz()),
+                  round_to_K(max_code_root_rem_set->strong_code_roots_mem_size()));
     for (RegionTypeCounter** current = &counters[0]; *current != NULL; current++) {
       (*current)->print_code_root_mem_info_on(out, total_code_root_mem_sz());
     }
@@ -333,12 +323,10 @@
     }
 
     out->print_cr("    Region with largest amount of code roots = "HR_FORMAT", "
-                  "size = "SIZE_FORMAT "%s, num_elems = "SIZE_FORMAT".",
+                  "size = "SIZE_FORMAT "K, num_elems = "SIZE_FORMAT".",
                   HR_FORMAT_PARAMS(max_code_root_mem_sz_region()),
-                  byte_size_in_proper_unit(max_code_root_rem_set->strong_code_roots_mem_size()),
-                  proper_unit_for_byte_size(max_code_root_rem_set->strong_code_roots_mem_size()),
-                  max_code_root_rem_set->strong_code_roots_list_length());
-
+                  round_to_K(max_code_root_rem_set->strong_code_roots_mem_size()),
+                  round_to_K(max_code_root_rem_set->strong_code_roots_list_length()));
   }
 };
 
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp
index 71e7e53..2b41688 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,23 +28,22 @@
 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
 #include "gc_implementation/g1/g1StringDedupTable.hpp"
-#include "gc_implementation/shared/concurrentGCThread.hpp"
 #include "memory/gcLocker.hpp"
 #include "memory/padded.inline.hpp"
 #include "oops/typeArrayOop.hpp"
 #include "runtime/mutexLocker.hpp"
 
 //
-// List of deduplication table entries. Links table
+// Freelist in the deduplication table entry cache. Links table
 // entries together using their _next fields.
 //
-class G1StringDedupEntryList : public CHeapObj<mtGC> {
+class G1StringDedupEntryFreeList : public CHeapObj<mtGC> {
 private:
   G1StringDedupEntry* _list;
   size_t              _length;
 
 public:
-  G1StringDedupEntryList() :
+  G1StringDedupEntryFreeList() :
     _list(NULL),
     _length(0) {
   }
@@ -64,12 +63,6 @@
     return entry;
   }
 
-  G1StringDedupEntry* remove_all() {
-    G1StringDedupEntry* list = _list;
-    _list = NULL;
-    return list;
-  }
-
   size_t length() {
     return _length;
   }
@@ -91,53 +84,43 @@
 //
 class G1StringDedupEntryCache : public CHeapObj<mtGC> {
 private:
-  // One cache/overflow list per GC worker to allow lock less freeing of
-  // entries while doing a parallel scan of the table. Using PaddedEnd to
-  // avoid false sharing.
-  size_t                             _nlists;
-  size_t                             _max_list_length;
-  PaddedEnd<G1StringDedupEntryList>* _cached;
-  PaddedEnd<G1StringDedupEntryList>* _overflowed;
+  // One freelist per GC worker to allow lock less freeing of
+  // entries while doing a parallel scan of the table. Using
+  // PaddedEnd to avoid false sharing.
+  PaddedEnd<G1StringDedupEntryFreeList>* _lists;
+  size_t                                 _nlists;
 
 public:
-  G1StringDedupEntryCache(size_t max_size);
+  G1StringDedupEntryCache();
   ~G1StringDedupEntryCache();
 
-  // Set max number of table entries to cache.
-  void set_max_size(size_t max_size);
-
-  // Get a table entry from the cache, or allocate a new entry if the cache is empty.
+  // Get a table entry from the cache freelist, or allocate a new
+  // entry if the cache is empty.
   G1StringDedupEntry* alloc();
 
-  // Insert a table entry into the cache.
+  // Insert a table entry into the cache freelist.
   void free(G1StringDedupEntry* entry, uint worker_id);
 
   // Returns current number of entries in the cache.
   size_t size();
 
-  // Deletes overflowed entries.
-  void delete_overflowed();
+  // If the cache has grown above the given max size, trim it down
+  // and deallocate the memory occupied by trimmed of entries.
+  void trim(size_t max_size);
 };
 
-G1StringDedupEntryCache::G1StringDedupEntryCache(size_t max_size) :
-  _nlists(MAX2(ParallelGCThreads, (size_t)1)),
-  _max_list_length(0),
-  _cached(PaddedArray<G1StringDedupEntryList, mtGC>::create_unfreeable((uint)_nlists)),
-  _overflowed(PaddedArray<G1StringDedupEntryList, mtGC>::create_unfreeable((uint)_nlists)) {
-  set_max_size(max_size);
+G1StringDedupEntryCache::G1StringDedupEntryCache() {
+  _nlists = MAX2(ParallelGCThreads, (size_t)1);
+  _lists = PaddedArray<G1StringDedupEntryFreeList, mtGC>::create_unfreeable((uint)_nlists);
 }
 
 G1StringDedupEntryCache::~G1StringDedupEntryCache() {
   ShouldNotReachHere();
 }
 
-void G1StringDedupEntryCache::set_max_size(size_t size) {
-  _max_list_length = size / _nlists;
-}
-
 G1StringDedupEntry* G1StringDedupEntryCache::alloc() {
   for (size_t i = 0; i < _nlists; i++) {
-    G1StringDedupEntry* entry = _cached[i].remove();
+    G1StringDedupEntry* entry = _lists[i].remove();
     if (entry != NULL) {
       return entry;
     }
@@ -148,55 +131,31 @@
 void G1StringDedupEntryCache::free(G1StringDedupEntry* entry, uint worker_id) {
   assert(entry->obj() != NULL, "Double free");
   assert(worker_id < _nlists, "Invalid worker id");
-
   entry->set_obj(NULL);
   entry->set_hash(0);
-
-  if (_cached[worker_id].length() < _max_list_length) {
-    // Cache is not full
-    _cached[worker_id].add(entry);
-  } else {
-    // Cache is full, add to overflow list for later deletion
-    _overflowed[worker_id].add(entry);
-  }
+  _lists[worker_id].add(entry);
 }
 
 size_t G1StringDedupEntryCache::size() {
   size_t size = 0;
   for (size_t i = 0; i < _nlists; i++) {
-    size += _cached[i].length();
+    size += _lists[i].length();
   }
   return size;
 }
 
-void G1StringDedupEntryCache::delete_overflowed() {
-  double start = os::elapsedTime();
-  uintx count = 0;
-
+void G1StringDedupEntryCache::trim(size_t max_size) {
+  size_t cache_size = 0;
   for (size_t i = 0; i < _nlists; i++) {
-    G1StringDedupEntry* entry;
-
-    {
-      // The overflow list can be modified during safepoints, therefore
-      // we temporarily join the suspendible thread set while removing
-      // all entries from the list.
-      SuspendibleThreadSetJoiner sts_join;
-      entry = _overflowed[i].remove_all();
-    }
-
-    // Delete all entries
-    while (entry != NULL) {
-      G1StringDedupEntry* next = entry->next();
+    G1StringDedupEntryFreeList* list = &_lists[i];
+    cache_size += list->length();
+    while (cache_size > max_size) {
+      G1StringDedupEntry* entry = list->remove();
+      assert(entry != NULL, "Should not be null");
+      cache_size--;
       delete entry;
-      entry = next;
-      count++;
     }
   }
-
-  double end = os::elapsedTime();
-  if (PrintStringDeduplicationStatistics) {
-    gclog_or_tty->print_cr("[GC concurrent-string-deduplication, deleted " UINTX_FORMAT " entries, " G1_STRDEDUP_TIME_FORMAT "]", count, end - start);
-  }
 }
 
 G1StringDedupTable*      G1StringDedupTable::_table = NULL;
@@ -233,7 +192,7 @@
 
 void G1StringDedupTable::create() {
   assert(_table == NULL, "One string deduplication table allowed");
-  _entry_cache = new G1StringDedupEntryCache((size_t)(_min_size * _max_cache_factor));
+  _entry_cache = new G1StringDedupEntryCache();
   _table = new G1StringDedupTable(_min_size);
 }
 
@@ -416,9 +375,6 @@
   // Update statistics
   _resize_count++;
 
-  // Update max cache size
-  _entry_cache->set_max_size((size_t)(size * _max_cache_factor));
-
   // Allocate the new table. The new table will be populated by workers
   // calling unlink_or_oops_do() and finally installed by finish_resize().
   return new G1StringDedupTable(size, _table->_hash_seed);
@@ -471,7 +427,7 @@
     removed += unlink_or_oops_do(cl, table_half + partition_begin, table_half + partition_end, worker_id);
   }
 
-  // Delayed update to avoid contention on the table lock
+  // Delayed update avoid contention on the table lock
   if (removed > 0) {
     MutexLockerEx ml(StringDedupTable_lock, Mutex::_no_safepoint_check_flag);
     _table->_entries -= removed;
@@ -589,8 +545,10 @@
   }
 }
 
-void G1StringDedupTable::clean_entry_cache() {
-  _entry_cache->delete_overflowed();
+void G1StringDedupTable::trim_entry_cache() {
+  MutexLockerEx ml(StringDedupTable_lock, Mutex::_no_safepoint_check_flag);
+  size_t max_cache_size = (size_t)(_table->_size * _max_cache_factor);
+  _entry_cache->trim(max_cache_size);
 }
 
 void G1StringDedupTable::print_statistics(outputStream* st) {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.hpp
index d771219..f357523 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -218,8 +218,8 @@
   // and deletes the previously active table.
   static void finish_rehash(G1StringDedupTable* rehashed_table);
 
-  // If the table entry cache has grown too large, delete overflowed entries.
-  static void clean_entry_cache();
+  // If the table entry cache has grown too large, trim it down according to policy
+  static void trim_entry_cache();
 
   static void unlink_or_oops_do(G1StringDedupUnlinkOrOopsDoClosure* cl, uint worker_id);
 
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupThread.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupThread.cpp
index 09c567e..e59efa7 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupThread.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupThread.cpp
@@ -100,14 +100,14 @@
         }
       }
 
+      G1StringDedupTable::trim_entry_cache();
+
       stat.mark_done();
 
       // Print statistics
       total_stat.add(stat);
       print(gclog_or_tty, stat, total_stat);
     }
-
-    G1StringDedupTable::clean_entry_cache();
   }
 
   terminate();
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp
index 7d85c34..260dc72 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp
@@ -171,7 +171,7 @@
   ParallelScavengeHeap* heap = PSParallelCompact::gc_heap();
   uint parallel_gc_threads = heap->gc_task_manager()->workers();
   uint active_gc_threads = heap->gc_task_manager()->active_workers();
-  OopTaskQueueSet* qset = ParCompactionManager::stack_array();
+  RegionTaskQueueSet* qset = ParCompactionManager::region_array();
   ParallelTaskTerminator terminator(active_gc_threads, qset);
   GCTaskQueue* q = GCTaskQueue::create();
   for(uint i=0; i<parallel_gc_threads; i++) {
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
index b2c3b06..8175ded 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
@@ -2355,7 +2355,7 @@
   ParallelScavengeHeap* heap = gc_heap();
   uint parallel_gc_threads = heap->gc_task_manager()->workers();
   uint active_gc_threads = heap->gc_task_manager()->active_workers();
-  TaskQueueSetSuper* qset = ParCompactionManager::stack_array();
+  TaskQueueSetSuper* qset = ParCompactionManager::region_array();
   ParallelTaskTerminator terminator(active_gc_threads, qset);
 
   PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm);
diff --git a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp
index 59e1fb9..eed4a35 100644
--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp
+++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp
@@ -593,9 +593,8 @@
 /* 0xDC */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,
 
 /* 0xE0 */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,
-/* 0xE4 */ &&opc_default,     &&opc_default,        &&opc_fast_aldc,    &&opc_fast_aldc_w,
-/* 0xE8 */ &&opc_return_register_finalizer,
-                              &&opc_invokehandle,   &&opc_default,      &&opc_default,
+/* 0xE4 */ &&opc_default,     &&opc_fast_aldc,      &&opc_fast_aldc_w,  &&opc_return_register_finalizer,
+/* 0xE8 */ &&opc_invokehandle,&&opc_default,        &&opc_default,      &&opc_default,
 /* 0xEC */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,
 
 /* 0xF0 */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,
diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp
index 4ecc87e..481742d 100644
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp
@@ -616,11 +616,7 @@
 
 bool InstanceKlass::link_class_impl(
     instanceKlassHandle this_oop, bool throw_verifyerror, TRAPS) {
-  // check for error state.
-  // This is checking for the wrong state.  If the state is initialization_error,
-  // then this class *was* linked.  The CDS code does a try_link_class and uses
-  // initialization_error to mark classes to not include in the archive during
-  // DumpSharedSpaces.  This should be removed when the CDS bug is fixed.
+  // check for error state
   if (this_oop->is_in_error_state()) {
     ResourceMark rm(THREAD);
     THROW_MSG_(vmSymbols::java_lang_NoClassDefFoundError(),
@@ -805,22 +801,37 @@
 }
 
 // Eagerly initialize superinterfaces that declare default methods (concrete instance: any access)
-void InstanceKlass::initialize_super_interfaces(instanceKlassHandle this_k, TRAPS) {
-  assert (this_k->has_default_methods(), "caller should have checked this");
-  for (int i = 0; i < this_k->local_interfaces()->length(); ++i) {
-    Klass* iface = this_k->local_interfaces()->at(i);
-    InstanceKlass* ik = InstanceKlass::cast(iface);
+void InstanceKlass::initialize_super_interfaces(instanceKlassHandle this_oop, TRAPS) {
+  if (this_oop->has_default_methods()) {
+    for (int i = 0; i < this_oop->local_interfaces()->length(); ++i) {
+      Klass* iface = this_oop->local_interfaces()->at(i);
+      InstanceKlass* ik = InstanceKlass::cast(iface);
+      if (ik->should_be_initialized()) {
+        if (ik->has_default_methods()) {
+          ik->initialize_super_interfaces(ik, THREAD);
+        }
+        // Only initialize() interfaces that "declare" concrete methods.
+        // has_default_methods drives searching superinterfaces since it
+        // means has_default_methods in its superinterface hierarchy
+        if (!HAS_PENDING_EXCEPTION && ik->declares_default_methods()) {
+          ik->initialize(THREAD);
+        }
+        if (HAS_PENDING_EXCEPTION) {
+          Handle e(THREAD, PENDING_EXCEPTION);
+          CLEAR_PENDING_EXCEPTION;
+          {
+            EXCEPTION_MARK;
+            // Locks object, set state, and notify all waiting threads
+            this_oop->set_initialization_state_and_notify(
+                initialization_error, THREAD);
 
-    // Initialization is depth first search ie. we start with top of the inheritance tree
-    // has_default_methods drives searching superinterfaces since it
-    // means has_default_methods in its superinterface hierarchy
-    if (ik->has_default_methods()) {
-      ik->initialize_super_interfaces(ik, CHECK);
-    }
-
-    // Only initialize() interfaces that "declare" concrete methods.
-    if (ik->should_be_initialized() && ik->declares_default_methods()) {
-      ik->initialize(CHECK);
+            // ignore any exception thrown, superclass initialization error is
+            // thrown below
+            CLEAR_PENDING_EXCEPTION;
+          }
+          THROW_OOP(e());
+        }
+      }
     }
   }
 }
@@ -886,36 +897,30 @@
   }
 
   // Step 7
-  // Next, if C is a class rather than an interface, initialize its super class and super
-  // interfaces.
-  if (!this_oop->is_interface()) {
-    Klass* super_klass = this_oop->super();
-    if (super_klass != NULL && super_klass->should_be_initialized()) {
-      super_klass->initialize(THREAD);
-    }
-    // If C implements any interfaces that declares a non-abstract, non-static method,
-    // the initialization of C triggers initialization of its super interfaces.
-    // Only need to recurse if has_default_methods which includes declaring and
-    // inheriting default methods
-    if (!HAS_PENDING_EXCEPTION && this_oop->has_default_methods()) {
-      this_oop->initialize_super_interfaces(this_oop, THREAD);
-    }
+  Klass* super_klass = this_oop->super();
+  if (super_klass != NULL && !this_oop->is_interface() && super_klass->should_be_initialized()) {
+    super_klass->initialize(THREAD);
 
-    // If any exceptions, complete abruptly, throwing the same exception as above.
     if (HAS_PENDING_EXCEPTION) {
       Handle e(THREAD, PENDING_EXCEPTION);
       CLEAR_PENDING_EXCEPTION;
       {
         EXCEPTION_MARK;
-        // Locks object, set state, and notify all waiting threads
-        this_oop->set_initialization_state_and_notify(initialization_error, THREAD);
-        CLEAR_PENDING_EXCEPTION;
+        this_oop->set_initialization_state_and_notify(initialization_error, THREAD); // Locks object, set state, and notify all waiting threads
+        CLEAR_PENDING_EXCEPTION;   // ignore any exception thrown, superclass initialization error is thrown below
       }
       DTRACE_CLASSINIT_PROBE_WAIT(super__failed, InstanceKlass::cast(this_oop()), -1,wait);
       THROW_OOP(e());
     }
   }
 
+  // Recursively initialize any superinterfaces that declare default methods
+  // Only need to recurse if has_default_methods which includes declaring and
+  // inheriting default methods
+  if (this_oop->has_default_methods()) {
+    this_oop->initialize_super_interfaces(this_oop, CHECK);
+  }
+
   // Step 8
   {
     assert(THREAD->is_Java_thread(), "non-JavaThread in initialize_impl");
@@ -976,15 +981,10 @@
 
 void InstanceKlass::set_initialization_state_and_notify_impl(instanceKlassHandle this_oop, ClassState state, TRAPS) {
   oop init_lock = this_oop->init_lock();
-  if (init_lock != NULL) {
-    ObjectLocker ol(init_lock, THREAD);
-    this_oop->set_init_state(state);
-    this_oop->fence_and_clear_init_lock();
-    ol.notify_all(CHECK);
-  } else {
-    assert(init_lock != NULL, "The initialization state should never be set twice");
-    this_oop->set_init_state(state);
-  }
+  ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
+  this_oop->set_init_state(state);
+  this_oop->fence_and_clear_init_lock();
+  ol.notify_all(CHECK);
 }
 
 // The embedded _implementor field can only record one implementor.
diff --git a/hotspot/src/share/vm/oops/method.cpp b/hotspot/src/share/vm/oops/method.cpp
index b1db4dc..172c612 100644
--- a/hotspot/src/share/vm/oops/method.cpp
+++ b/hotspot/src/share/vm/oops/method.cpp
@@ -111,7 +111,6 @@
 // Release Method*.  The nmethod will be gone when we get here because
 // we've walked the code cache.
 void Method::deallocate_contents(ClassLoaderData* loader_data) {
-  clear_jmethod_id(loader_data);
   MetadataFactory::free_metadata(loader_data, constMethod());
   set_constMethod(NULL);
   MetadataFactory::free_metadata(loader_data, method_data());
@@ -1801,24 +1800,13 @@
 #endif // ASSERT
     *m = _free_method;
   }
-  void clear_method(Method* m) {
-    for (JNIMethodBlock* b = this; b != NULL; b = b->_next) {
-      for (int i = 0; i < number_of_methods; i++) {
-        if (b->_methods[i] == m) {
-          b->_methods[i] = NULL;
-          return;
-        }
-      }
-    }
-    // not found
-  }
 
   // During class unloading the methods are cleared, which is different
   // than freed.
   void clear_all_methods() {
     for (JNIMethodBlock* b = this; b != NULL; b = b->_next) {
       for (int i = 0; i< number_of_methods; i++) {
-        b->_methods[i] = NULL;
+        _methods[i] = NULL;
       }
     }
   }
@@ -1828,7 +1816,7 @@
     int count = 0;
     for (JNIMethodBlock* b = this; b != NULL; b = b->_next) {
       for (int i = 0; i< number_of_methods; i++) {
-        if (b->_methods[i] != _free_method) count++;
+        if (_methods[i] != _free_method) count++;
       }
     }
     return count;
@@ -1884,13 +1872,8 @@
 
 bool Method::is_method_id(jmethodID mid) {
   Method* m = resolve_jmethod_id(mid);
-  if (m == NULL) {
-    return false;
-  }
+  assert(m != NULL, "should be called with non-null method");
   InstanceKlass* ik = m->method_holder();
-  if (ik == NULL) {
-    return false;
-  }
   ClassLoaderData* cld = ik->class_loader_data();
   if (cld->jmethod_ids() == NULL) return false;
   return (cld->jmethod_ids()->contains((Method**)mid));
@@ -1898,9 +1881,6 @@
 
 Method* Method::checked_resolve_jmethod_id(jmethodID mid) {
   if (mid == NULL) return NULL;
-  if (!Method::is_method_id(mid)) {
-    return NULL;
-  }
   Method* o = resolve_jmethod_id(mid);
   if (o == NULL || o == JNIMethodBlock::_free_method || !((Metadata*)o)->is_method()) {
     return NULL;
@@ -1919,10 +1899,6 @@
   }
 }
 
-void Method::clear_jmethod_id(ClassLoaderData* loader_data) {
-  loader_data->jmethod_ids()->clear_method(this);
-}
-
 // Called when the class loader is unloaded to make all methods weak.
 void Method::clear_jmethod_ids(ClassLoaderData* loader_data) {
   loader_data->jmethod_ids()->clear_all_methods();
diff --git a/hotspot/src/share/vm/oops/method.hpp b/hotspot/src/share/vm/oops/method.hpp
index 974bced..2126033 100644
--- a/hotspot/src/share/vm/oops/method.hpp
+++ b/hotspot/src/share/vm/oops/method.hpp
@@ -768,8 +768,6 @@
 
   // Helper routines for intrinsic_id() and vmIntrinsics::method().
   void init_intrinsic_id();     // updates from _none if a match
-  void clear_jmethod_id(ClassLoaderData* loader_data);
-
   static vmSymbols::SID klass_id_for_intrinsics(Klass* holder);
 
   bool     jfr_towrite()                { return _jfr_towrite;              }
diff --git a/hotspot/src/share/vm/opto/block.cpp b/hotspot/src/share/vm/opto/block.cpp
index 245ce42..f0599a1 100644
--- a/hotspot/src/share/vm/opto/block.cpp
+++ b/hotspot/src/share/vm/opto/block.cpp
@@ -1208,9 +1208,6 @@
       if (j >= 1 && n->is_Mach() && n->as_Mach()->ideal_Opcode() == Op_CreateEx) {
         assert(j == 1 || block->get_node(j-1)->is_Phi(), "CreateEx must be first instruction in block");
       }
-      if (n->needs_anti_dependence_check()) {
-        verify_anti_dependences(block, n);
-      }
       for (uint k = 0; k < n->req(); k++) {
         Node *def = n->in(k);
         if (def && def != n) {
diff --git a/hotspot/src/share/vm/opto/block.hpp b/hotspot/src/share/vm/opto/block.hpp
index 0c7363e..d085b29 100644
--- a/hotspot/src/share/vm/opto/block.hpp
+++ b/hotspot/src/share/vm/opto/block.hpp
@@ -185,13 +185,14 @@
   Block* lone_fall_through();   // Return lone fall-through Block or null
 
   Block* dom_lca(Block* that);  // Compute LCA in dominator tree.
-
+#ifdef ASSERT
   bool dominates(Block* that) {
     int dom_diff = this->_dom_depth - that->_dom_depth;
     if (dom_diff > 0)  return false;
     for (; dom_diff < 0; dom_diff++)  that = that->_idom;
     return this == that;
   }
+#endif
 
   // Report the alignment required by this block.  Must be a power of 2.
   // The previous block will insert nops to get this alignment.
@@ -472,9 +473,9 @@
   MachNode* _goto;
 
   Block* insert_anti_dependences(Block* LCA, Node* load, bool verify = false);
-  void verify_anti_dependences(Block* LCA, Node* load) const {
+  void verify_anti_dependences(Block* LCA, Node* load) {
     assert(LCA == get_block_for_node(load), "should already be scheduled");
-    const_cast<PhaseCFG*>(this)->insert_anti_dependences(LCA, load, true);
+    insert_anti_dependences(LCA, load, true);
   }
 
   bool move_to_next(Block* bx, uint b_index);
diff --git a/hotspot/src/share/vm/opto/cfgnode.hpp b/hotspot/src/share/vm/opto/cfgnode.hpp
index 74461aa..e795483 100644
--- a/hotspot/src/share/vm/opto/cfgnode.hpp
+++ b/hotspot/src/share/vm/opto/cfgnode.hpp
@@ -119,9 +119,6 @@
 // input in slot 0.
 class PhiNode : public TypeNode {
   const TypePtr* const _adr_type; // non-null only for Type::MEMORY nodes.
-  // The following fields are only used for data PhiNodes to indicate
-  // that the PhiNode represents the value of a known instance field.
-        int _inst_mem_id; // Instance memory id (node index of the memory Phi)
   const int _inst_id;     // Instance id of the memory slice.
   const int _inst_index;  // Alias index of the instance memory slice.
   // Array elements references have the same alias_idx but different offset.
@@ -141,13 +138,11 @@
   };
 
   PhiNode( Node *r, const Type *t, const TypePtr* at = NULL,
-           const int imid = -1,
            const int iid = TypeOopPtr::InstanceTop,
            const int iidx = Compile::AliasIdxTop,
            const int ioffs = Type::OffsetTop )
     : TypeNode(t,r->req()),
       _adr_type(at),
-      _inst_mem_id(imid),
       _inst_id(iid),
       _inst_index(iidx),
       _inst_offset(ioffs)
@@ -192,14 +187,11 @@
   virtual bool pinned() const { return in(0) != 0; }
   virtual const TypePtr *adr_type() const { verify_adr_type(true); return _adr_type; }
 
-  void  set_inst_mem_id(int inst_mem_id) { _inst_mem_id = inst_mem_id; }
-  const int inst_mem_id() const { return _inst_mem_id; }
   const int inst_id()     const { return _inst_id; }
   const int inst_index()  const { return _inst_index; }
   const int inst_offset() const { return _inst_offset; }
-  bool is_same_inst_field(const Type* tp, int mem_id, int id, int index, int offset) {
+  bool is_same_inst_field(const Type* tp, int id, int index, int offset) {
     return type()->basic_type() == tp->basic_type() &&
-           inst_mem_id() == mem_id &&
            inst_id()     == id     &&
            inst_index()  == index  &&
            inst_offset() == offset &&
diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp
index e021924..dc88381 100644
--- a/hotspot/src/share/vm/opto/compile.cpp
+++ b/hotspot/src/share/vm/opto/compile.cpp
@@ -608,10 +608,6 @@
     n->as_MachBranch()->label_set(&fakeL, 0);
   }
   n->emit(buf, this->regalloc());
-
-  // Emitting into the scratch buffer should not fail
-  assert (!failing(), err_msg_res("Must not have pending failure. Reason is: %s", failure_reason()));
-
   if (is_branch) // Restore label.
     n->as_MachBranch()->label_set(saveL, save_bnum);
 
diff --git a/hotspot/src/share/vm/opto/connode.cpp b/hotspot/src/share/vm/opto/connode.cpp
index 3d99249..00aee51 100644
--- a/hotspot/src/share/vm/opto/connode.cpp
+++ b/hotspot/src/share/vm/opto/connode.cpp
@@ -446,9 +446,7 @@
 }
 
 uint CastIINode::cmp(const Node &n) const {
-  return TypeNode::cmp(n) &&
-         ((CastIINode&)n)._carry_dependency == _carry_dependency &&
-         ((CastIINode&)n)._range_check_dependency == _range_check_dependency;
+  return TypeNode::cmp(n) && ((CastIINode&)n)._carry_dependency == _carry_dependency;
 }
 
 Node *CastIINode::Identity(PhaseTransform *phase) {
@@ -525,7 +523,7 @@
 }
 
 Node *CastIINode::Ideal_DU_postCCP(PhaseCCP *ccp) {
-  if (_carry_dependency || _range_check_dependency) {
+  if (_carry_dependency) {
     return NULL;
   }
   return ConstraintCastNode::Ideal_DU_postCCP(ccp);
diff --git a/hotspot/src/share/vm/opto/doCall.cpp b/hotspot/src/share/vm/opto/doCall.cpp
index fee6eb7..f4ed1ae 100644
--- a/hotspot/src/share/vm/opto/doCall.cpp
+++ b/hotspot/src/share/vm/opto/doCall.cpp
@@ -205,22 +205,16 @@
 
       int morphism = profile.morphism();
       if (speculative_receiver_type != NULL) {
-        if (!too_many_traps(caller, bci, Deoptimization::Reason_speculate_class_check)) {
-          // We have a speculative type, we should be able to resolve
-          // the call. We do that before looking at the profiling at
-          // this invoke because it may lead to bimorphic inlining which
-          // a speculative type should help us avoid.
-          receiver_method = callee->resolve_invoke(jvms->method()->holder(),
-                                                   speculative_receiver_type);
-          if (receiver_method == NULL) {
-            speculative_receiver_type = NULL;
-          } else {
-            morphism = 1;
-          }
-        } else {
-          // speculation failed before. Use profiling at the call
-          // (could allow bimorphic inlining for instance).
+        // We have a speculative type, we should be able to resolve
+        // the call. We do that before looking at the profiling at
+        // this invoke because it may lead to bimorphic inlining which
+        // a speculative type should help us avoid.
+        receiver_method = callee->resolve_invoke(jvms->method()->holder(),
+                                                 speculative_receiver_type);
+        if (receiver_method == NULL) {
           speculative_receiver_type = NULL;
+        } else {
+          morphism = 1;
         }
       }
       if (receiver_method == NULL &&
@@ -258,7 +252,7 @@
                                     Deoptimization::Reason_bimorphic :
                                     (speculative_receiver_type == NULL ? Deoptimization::Reason_class_check : Deoptimization::Reason_speculate_class_check);
           if ((morphism == 1 || (morphism == 2 && next_hit_cg != NULL)) &&
-              !too_many_traps(caller, bci, reason)
+              !too_many_traps(jvms->method(), jvms->bci(), reason)
              ) {
             // Generate uncommon trap for class check failure path
             // in case of monomorphic or bimorphic virtual call site.
diff --git a/hotspot/src/share/vm/opto/graphKit.cpp b/hotspot/src/share/vm/opto/graphKit.cpp
index bfba3e9..38e0ce2 100644
--- a/hotspot/src/share/vm/opto/graphKit.cpp
+++ b/hotspot/src/share/vm/opto/graphKit.cpp
@@ -1683,9 +1683,6 @@
   const Type* elemtype = arytype->elem();
   BasicType elembt = elemtype->array_element_basic_type();
   Node* adr = array_element_address(ary, idx, elembt, arytype->size());
-  if (elembt == T_NARROWOOP) {
-    elembt = T_OBJECT; // To satisfy switch in LoadNode::make()
-  }
   Node* ld = make_load(ctl, adr, elemtype, elembt, arytype, MemNode::unordered);
   return ld;
 }
diff --git a/hotspot/src/share/vm/opto/lcm.cpp b/hotspot/src/share/vm/opto/lcm.cpp
index dd93b0f..8f6844f 100644
--- a/hotspot/src/share/vm/opto/lcm.cpp
+++ b/hotspot/src/share/vm/opto/lcm.cpp
@@ -246,14 +246,6 @@
       continue;
     }
 
-    // Check that node's control edge is not-null block's head or dominates it,
-    // otherwise we can't hoist it because there are other control dependencies.
-    Node* ctrl = mach->in(0);
-    if (ctrl != NULL && !(ctrl == not_null_block->head() ||
-        get_block_for_node(ctrl)->dominates(not_null_block))) {
-      continue;
-    }
-
     // check if the offset is not too high for implicit exception
     {
       intptr_t offset = 0;
@@ -391,12 +383,9 @@
   block->add_inst(best);
   map_node_to_block(best, block);
 
-  // Move the control dependence if it is pinned to not-null block.
-  // Don't change it in other cases: NULL or dominating control.
-  if (best->in(0) == not_null_block->head()) {
-    // Set it to control edge of null check.
-    best->set_req(0, proj->in(0)->in(0));
-  }
+  // Move the control dependence
+  if (best->in(0) && best->in(0) == old_block->head())
+    best->set_req(0, block->head());
 
   // Check for flag-killing projections that also need to be hoisted
   // Should be DU safe because no edge updates.
@@ -452,18 +441,6 @@
 
   latency_from_uses(nul_chk);
   latency_from_uses(best);
-
-  // insert anti-dependences to defs in this block
-  if (! best->needs_anti_dependence_check()) {
-    for (uint k = 1; k < block->number_of_nodes(); k++) {
-      Node *n = block->get_node(k);
-      if (n->needs_anti_dependence_check() &&
-          n->in(LoadNode::Memory) == best->in(StoreNode::Memory)) {
-        // Found anti-dependent load
-        insert_anti_dependences(block, n);
-      }
-    }
-  }
 }
 
 
@@ -1111,12 +1088,11 @@
     Block *sb = block->_succs[i];
     // Clone the entire area; ignoring the edge fixup for now.
     for( uint j = end; j > beg; j-- ) {
+      // It is safe here to clone a node with anti_dependence
+      // since clones dominate on each path.
       Node *clone = block->get_node(j-1)->clone();
       sb->insert_node(clone, 1);
       map_node_to_block(clone, sb);
-      if (clone->needs_anti_dependence_check()) {
-        insert_anti_dependences(sb, clone);
-      }
     }
   }
 
diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp
index eb99517..f2a2937 100644
--- a/hotspot/src/share/vm/opto/library_call.cpp
+++ b/hotspot/src/share/vm/opto/library_call.cpp
@@ -6459,20 +6459,7 @@
 
 //------------------------------get_key_start_from_aescrypt_object-----------------------
 Node * LibraryCallKit::get_key_start_from_aescrypt_object(Node *aescrypt_object) {
-#ifdef PPC64
-  // MixColumns for decryption can be reduced by preprocessing MixColumns with round keys.
-  // Intel's extention is based on this optimization and AESCrypt generates round keys by preprocessing MixColumns.
-  // However, ppc64 vncipher processes MixColumns and requires the same round keys with encryption.
-  // The ppc64 stubs of encryption and decryption use the same round keys (sessionK[0]).
-  Node* objSessionK = load_field_from_object(aescrypt_object, "sessionK", "[[I", /*is_exact*/ false);
-  assert (objSessionK != NULL, "wrong version of com.sun.crypto.provider.AESCrypt");
-  if (objSessionK == NULL) {
-    return (Node *) NULL;
-  }
-  Node* objAESCryptKey = load_array_element(control(), objSessionK, intcon(0), TypeAryPtr::OOPS);
-#else
   Node* objAESCryptKey = load_field_from_object(aescrypt_object, "K", "[I", /*is_exact*/ false);
-#endif // PPC64
   assert (objAESCryptKey != NULL, "wrong version of com.sun.crypto.provider.AESCrypt");
   if (objAESCryptKey == NULL) return (Node *) NULL;
 
diff --git a/hotspot/src/share/vm/opto/loopnode.cpp b/hotspot/src/share/vm/opto/loopnode.cpp
index 8f2f228..e653557 100644
--- a/hotspot/src/share/vm/opto/loopnode.cpp
+++ b/hotspot/src/share/vm/opto/loopnode.cpp
@@ -278,16 +278,8 @@
     return false;
 
   // Allow funny placement of Safepoint
-  if (back_control->Opcode() == Op_SafePoint) {
-    if (UseCountedLoopSafepoints) {
-      // Leaving the safepoint on the backedge and creating a
-      // CountedLoop will confuse optimizations. We can't move the
-      // safepoint around because its jvm state wouldn't match a new
-      // location. Give up on that loop.
-      return false;
-    }
+  if (back_control->Opcode() == Op_SafePoint)
     back_control = back_control->in(TypeFunc::Control);
-  }
 
   // Controlling test for loop
   Node *iftrue = back_control;
diff --git a/hotspot/src/share/vm/opto/macro.cpp b/hotspot/src/share/vm/opto/macro.cpp
index d1e1f32..01b329c 100644
--- a/hotspot/src/share/vm/opto/macro.cpp
+++ b/hotspot/src/share/vm/opto/macro.cpp
@@ -401,7 +401,7 @@
   for (DUIterator_Fast kmax, k = region->fast_outs(kmax); k < kmax; k++) {
     Node* phi = region->fast_out(k);
     if (phi->is_Phi() && phi != mem &&
-        phi->as_Phi()->is_same_inst_field(phi_type, (int)mem->_idx, instance_id, alias_idx, offset)) {
+        phi->as_Phi()->is_same_inst_field(phi_type, instance_id, alias_idx, offset)) {
       return phi;
     }
   }
@@ -420,7 +420,7 @@
   GrowableArray <Node *> values(length, length, NULL, false);
 
   // create a new Phi for the value
-  PhiNode *phi = new (C) PhiNode(mem->in(0), phi_type, NULL, mem->_idx, instance_id, alias_idx, offset);
+  PhiNode *phi = new (C) PhiNode(mem->in(0), phi_type, NULL, instance_id, alias_idx, offset);
   transform_later(phi);
   value_phis->push(phi, mem->_idx);
 
diff --git a/hotspot/src/share/vm/opto/memnode.cpp b/hotspot/src/share/vm/opto/memnode.cpp
index a922a4e..80e25c9 100644
--- a/hotspot/src/share/vm/opto/memnode.cpp
+++ b/hotspot/src/share/vm/opto/memnode.cpp
@@ -1155,7 +1155,7 @@
     for (DUIterator_Fast imax, i = region->fast_outs(imax); i < imax; i++) {
       Node* phi = region->fast_out(i);
       if (phi->is_Phi() && phi != mem &&
-          phi->as_Phi()->is_same_inst_field(this_type, (int)mem->_idx, this_iid, this_index, this_offset)) {
+          phi->as_Phi()->is_same_inst_field(this_type, this_iid, this_index, this_offset)) {
         return phi;
       }
     }
@@ -1400,7 +1400,7 @@
     this_iid = base->_idx;
   }
   PhaseIterGVN* igvn = phase->is_IterGVN();
-  Node* phi = new (C) PhiNode(region, this_type, NULL, mem->_idx, this_iid, this_index, this_offset);
+  Node* phi = new (C) PhiNode(region, this_type, NULL, this_iid, this_index, this_offset);
   for (uint i = 1; i < region->req(); i++) {
     Node* x;
     Node* the_clone = NULL;
diff --git a/hotspot/src/share/vm/opto/output.cpp b/hotspot/src/share/vm/opto/output.cpp
index 95de2d6..0563ebb 100644
--- a/hotspot/src/share/vm/opto/output.cpp
+++ b/hotspot/src/share/vm/opto/output.cpp
@@ -1502,13 +1502,6 @@
       n->emit(*cb, _regalloc);
       current_offset  = cb->insts_size();
 
-      // Above we only verified that there is enough space in the instruction section.
-      // However, the instruction may emit stubs that cause code buffer expansion.
-      // Bail out here if expansion failed due to a lack of code cache space.
-      if (failing()) {
-        return;
-      }
-
 #ifdef ASSERT
       if (n->size(_regalloc) < (current_offset-instr_offset)) {
         n->dump();
@@ -1637,14 +1630,11 @@
   if (_method) {
     // Emit the exception handler code.
     _code_offsets.set_value(CodeOffsets::Exceptions, HandlerImpl::emit_exception_handler(*cb));
-    if (failing()) {
-      return; // CodeBuffer::expand failed
-    }
     // Emit the deopt handler code.
     _code_offsets.set_value(CodeOffsets::Deopt, HandlerImpl::emit_deopt_handler(*cb));
 
     // Emit the MethodHandle deopt handler code (if required).
-    if (has_method_handle_invokes() && !failing()) {
+    if (has_method_handle_invokes()) {
       // We can use the same code as for the normal deopt handler, we
       // just need a different entry point address.
       _code_offsets.set_value(CodeOffsets::DeoptMH, HandlerImpl::emit_deopt_handler(*cb));
diff --git a/hotspot/src/share/vm/opto/phaseX.cpp b/hotspot/src/share/vm/opto/phaseX.cpp
index 1782cb9..f090fcc 100644
--- a/hotspot/src/share/vm/opto/phaseX.cpp
+++ b/hotspot/src/share/vm/opto/phaseX.cpp
@@ -481,8 +481,6 @@
   uint current_idx = 0; // The current new node ID. Incremented after every assignment.
   for (uint i = 0; i < _useful.size(); i++) {
     Node* n = _useful.at(i);
-    // Sanity check that fails if we ever decide to execute this phase after EA
-    assert(!n->is_Phi() || n->as_Phi()->inst_mem_id() == -1, "should not be linked to data Phi");
     const Type* type = gvn->type_or_null(n);
     new_type_array.map(current_idx, type);
 
@@ -1380,18 +1378,6 @@
     i -= num_edges;    // we deleted 1 or more copies of this edge
   }
 
-  // Search for instance field data PhiNodes in the same region pointing to the old
-  // memory PhiNode and update their instance memory ids to point to the new node.
-  if (old->is_Phi() && old->as_Phi()->type()->has_memory() && old->in(0) != NULL) {
-    Node* region = old->in(0);
-    for (DUIterator_Fast imax, i = region->fast_outs(imax); i < imax; i++) {
-      PhiNode* phi = region->fast_out(i)->isa_Phi();
-      if (phi != NULL && phi->inst_mem_id() == (int)old->_idx) {
-        phi->set_inst_mem_id((int)nn->_idx);
-      }
-    }
-  }
-
   // Smash all inputs to 'old', isolating him completely
   Node *temp = new (C) Node(1);
   temp->init_req(0,nn);     // Add a use to nn to prevent him from dying
diff --git a/hotspot/src/share/vm/opto/stringopts.cpp b/hotspot/src/share/vm/opto/stringopts.cpp
index 70962e3..0f8e671 100644
--- a/hotspot/src/share/vm/opto/stringopts.cpp
+++ b/hotspot/src/share/vm/opto/stringopts.cpp
@@ -1641,11 +1641,16 @@
     }
     kit.store_String_value(kit.control(), result, char_array);
 
-    // The value field is final. Emit a barrier here to ensure that the effect
-    // of the initialization is committed to memory before any code publishes
-    // a reference to the newly constructed object (see Parse::do_exits()).
-    assert(AllocateNode::Ideal_allocation(result, _gvn) != NULL, "should be newly allocated");
-    kit.insert_mem_bar(Op_MemBarRelease, result);
+    // Do not let stores that initialize this object be reordered with
+    // a subsequent store that would make this object accessible by
+    // other threads.
+    // Record what AllocateNode this StoreStore protects so that
+    // escape analysis can go from the MemBarStoreStoreNode to the
+    // AllocateNode and eliminate the MemBarStoreStoreNode if possible
+    // based on the escape status of the AllocateNode.
+    AllocateNode* alloc = AllocateNode::Ideal_allocation(result, _gvn);
+    assert(alloc != NULL, "should be newly allocated");
+    kit.insert_mem_bar(Op_MemBarStoreStore, alloc->proj_out(AllocateNode::RawAddress));
   } else {
     result = C->top();
   }
diff --git a/hotspot/src/share/vm/opto/subnode.cpp b/hotspot/src/share/vm/opto/subnode.cpp
index 303d333..1e6c061 100644
--- a/hotspot/src/share/vm/opto/subnode.cpp
+++ b/hotspot/src/share/vm/opto/subnode.cpp
@@ -547,12 +547,8 @@
     // All unsigned values are LE -1 and GE 0.
     if (lo0 == 0 && hi0 == 0) {
       return TypeInt::CC_LE;            //   0 <= bot
-    } else if ((jint)lo0 == -1 && (jint)hi0 == -1) {
-      return TypeInt::CC_GE;            // -1 >= bot
     } else if (lo1 == 0 && hi1 == 0) {
       return TypeInt::CC_GE;            // bot >= 0
-    } else if ((jint)lo1 == -1 && (jint)hi1 == -1) {
-      return TypeInt::CC_LE;            // bot <= -1
     }
   } else {
     // We can use ranges of the form [lo..hi] if signs are the same.
diff --git a/hotspot/src/share/vm/opto/type.hpp b/hotspot/src/share/vm/opto/type.hpp
index 3c69445..4506c3a 100644
--- a/hotspot/src/share/vm/opto/type.hpp
+++ b/hotspot/src/share/vm/opto/type.hpp
@@ -882,7 +882,7 @@
 
   // If not InstanceTop or InstanceBot, indicates that this is
   // a particular instance of this type which is distinct.
-  // This is the node index of the allocation node creating this instance.
+  // This is the the node index of the allocation node creating this instance.
   int           _instance_id;
 
   // Extra type information profiling gave us. We propagate it the
diff --git a/hotspot/src/share/vm/prims/jniCheck.cpp b/hotspot/src/share/vm/prims/jniCheck.cpp
index 07e40ae..e95937a 100644
--- a/hotspot/src/share/vm/prims/jniCheck.cpp
+++ b/hotspot/src/share/vm/prims/jniCheck.cpp
@@ -461,11 +461,16 @@
 
 Method* jniCheck::validate_jmethod_id(JavaThread* thr, jmethodID method_id) {
   ASSERT_OOPS_ALLOWED;
-  // Do the jmethodID check
+  // do the fast jmethodID check first
   Method* moop = Method::checked_resolve_jmethod_id(method_id);
   if (moop == NULL) {
     ReportJNIFatalError(thr, fatal_wrong_class_or_method);
   }
+  // jmethodIDs are supposed to be weak handles in the class loader data,
+  // but that can be expensive so check it last
+  else if (!Method::is_method_id(method_id)) {
+    ReportJNIFatalError(thr, fatal_non_weak_method);
+  }
   return moop;
 }
 
diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp
index f1b13f2..e6f5e88 100644
--- a/hotspot/src/share/vm/prims/jvm.cpp
+++ b/hotspot/src/share/vm/prims/jvm.cpp
@@ -1290,22 +1290,18 @@
 // and null permissions - which gives no permissions.
 oop create_dummy_access_control_context(TRAPS) {
   InstanceKlass* pd_klass = InstanceKlass::cast(SystemDictionary::ProtectionDomain_klass());
-  Handle obj = pd_klass->allocate_instance_handle(CHECK_NULL);
-  // Call constructor ProtectionDomain(null, null);
-  JavaValue result(T_VOID);
-  JavaCalls::call_special(&result, obj, KlassHandle(THREAD, pd_klass),
-                          vmSymbols::object_initializer_name(),
-                          vmSymbols::codesource_permissioncollection_signature(),
-                          Handle(), Handle(), CHECK_NULL);
+  // new ProtectionDomain(null,null);
+  oop null_protection_domain = pd_klass->allocate_instance(CHECK_NULL);
+  Handle null_pd(THREAD, null_protection_domain);
 
   // new ProtectionDomain[] {pd};
   objArrayOop context = oopFactory::new_objArray(pd_klass, 1, CHECK_NULL);
-  context->obj_at_put(0, obj());
+  context->obj_at_put(0, null_pd());
 
   // new AccessControlContext(new ProtectionDomain[] {pd})
   objArrayHandle h_context(THREAD, context);
-  oop acc = java_security_AccessControlContext::create(h_context, false, Handle(), CHECK_NULL);
-  return acc;
+  oop result = java_security_AccessControlContext::create(h_context, false, Handle(), CHECK_NULL);
+  return result;
 }
 
 JVM_ENTRY(jobject, JVM_DoPrivileged(JNIEnv *env, jclass cls, jobject action, jobject context, jboolean wrapException))
diff --git a/hotspot/src/share/vm/prims/unsafe.cpp b/hotspot/src/share/vm/prims/unsafe.cpp
index 5e39b38..0846b20 100644
--- a/hotspot/src/share/vm/prims/unsafe.cpp
+++ b/hotspot/src/share/vm/prims/unsafe.cpp
@@ -985,6 +985,14 @@
   }
 UNSAFE_END
 
+static jobject get_class_loader(JNIEnv* env, jclass cls) {
+  if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(cls))) {
+    return NULL;
+  }
+  Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
+  oop loader = k->class_loader();
+  return JNIHandles::make_local(env, loader);
+}
 
 UNSAFE_ENTRY(jclass, Unsafe_DefineClass0(JNIEnv *env, jobject unsafe, jstring name, jbyteArray data, int offset, int length))
   UnsafeWrapper("Unsafe_DefineClass");
@@ -993,7 +1001,7 @@
 
     int depthFromDefineClass0 = 1;
     jclass  caller = JVM_GetCallerClass(env, depthFromDefineClass0);
-    jobject loader = (caller == NULL) ? NULL : JVM_GetClassLoader(env, caller);
+    jobject loader = (caller == NULL) ? NULL : get_class_loader(env, caller);
     jobject pd     = (caller == NULL) ? NULL : JVM_GetProtectionDomain(env, caller);
 
     return Unsafe_DefineClass_impl(env, name, data, offset, length, loader, pd);
diff --git a/hotspot/src/share/vm/utilities/taskqueue.hpp b/hotspot/src/share/vm/utilities/taskqueue.hpp
index 8bdb38d..fb9ea61 100644
--- a/hotspot/src/share/vm/utilities/taskqueue.hpp
+++ b/hotspot/src/share/vm/utilities/taskqueue.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, 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
@@ -453,9 +453,6 @@
   // Push task t onto the queue or onto the overflow stack.  Return true.
   inline bool push(E t);
 
-  // Try to push task t onto the queue only. Returns true if successful, false otherwise.
-  inline bool try_push_to_taskqueue(E t);
-
   // Attempt to pop from the overflow stack; return true if anything was popped.
   inline bool pop_overflow(E& t);
 
@@ -489,10 +486,6 @@
   return true;
 }
 
-template <class E, MEMFLAGS F, unsigned int N>
-bool OverflowTaskQueue<E, F, N>::try_push_to_taskqueue(E t) {
-  return taskqueue_t::push(t);
-}
 class TaskQueueSetSuper {
 protected:
   static int randomParkAndMiller(int* seed0);
diff --git a/hotspot/test/compiler/jsr292/VMAnonymousClasses.java b/hotspot/test/compiler/jsr292/VMAnonymousClasses.java
index 3b0a0c1..dc8b577 100644
--- a/hotspot/test/compiler/jsr292/VMAnonymousClasses.java
+++ b/hotspot/test/compiler/jsr292/VMAnonymousClasses.java
@@ -24,7 +24,7 @@
 /**
  * @test
  * @bug 8058828
- * @run main/bootclasspath/othervm -Xbatch VMAnonymousClasses
+ * @run main/bootclasspath -Xbatch VMAnonymousClasses
  */
 
 import jdk.internal.org.objectweb.asm.ClassWriter;
diff --git a/hotspot/test/compiler/loopopts/TestCountedLoopSafepointBackedge.java b/hotspot/test/compiler/loopopts/TestCountedLoopSafepointBackedge.java
deleted file mode 100644
index 31c32f2..0000000
--- a/hotspot/test/compiler/loopopts/TestCountedLoopSafepointBackedge.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2016, Red Hat, Inc. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * @test
- * @bug 8161147
- * @requires vm.flavor == "server"
- * @summary Safepoint on backedge breaks UseCountedLoopSafepoints
- * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:+UseCountedLoopSafepoints TestCountedLoopSafepointBackedge
- *
- */
-
-public class TestCountedLoopSafepointBackedge {
-    static void test(int[] arr, int inc) {
-        int i = 0;
-        for (;;) {
-            for (int j = 0; j < 10; j++);
-            arr[i] = i;
-            i++;
-            if (i >= 100) {
-                break;
-            }
-            for (int j = 0; j < 10; j++);
-        }
-    }
-
-    static public void main(String[] args) {
-        int[] arr = new int[100];
-        for (int i = 0; i < 20000; i++) {
-             test(arr, 1);
-        }
-    }
-}
diff --git a/hotspot/test/compiler/native/TestDirtyInt.sh b/hotspot/test/compiler/native/TestDirtyInt.sh
index 31f253f..79749b4 100644
--- a/hotspot/test/compiler/native/TestDirtyInt.sh
+++ b/hotspot/test/compiler/native/TestDirtyInt.sh
@@ -30,19 +30,20 @@
 ## @run shell/timeout=30 TestDirtyInt.sh
 ##
 
-if [ -z "${TESTSRC}" ]; then
-    TESTSRC="${PWD}"
-    echo "TESTSRC not set.  Using "${TESTSRC}" as default"
+if [ "${TESTSRC}" = "" ]
+then
+  TESTSRC=${PWD}
+  echo "TESTSRC not set.  Using "${TESTSRC}" as default"
 fi
 echo "TESTSRC=${TESTSRC}"
 ## Adding common setup Variables for running shell tests.
 . ${TESTSRC}/../../test_env.sh
 
 # set platform-dependent variables
-if [ "$VM_OS" = "linux" -a "$VM_CPU" = "sparcv9" ]; then
+if [ $VM_OS == "linux" -a $VM_CPU == "sparcv9" ]; then
     echo "Testing on linux-sparc"
     gcc_cmd=`which gcc`
-    if [ -z "$gcc_cmd" ]; then
+    if [ "x$gcc_cmd" == "x" ]; then
         echo "WARNING: gcc not found. Cannot execute test." 2>&1
         exit 0;
     fi
@@ -67,9 +68,10 @@
     -Djava.library.path=${TESTSRC}${FS} TestDirtyInt"
 
 echo "$cmd"
-eval $cmd
+eval $cmd 
 
-if [ $? = 0 ]; then
+if [ $? = 0 ]
+then
     echo "Test Passed"
     exit 0
 fi
diff --git a/hotspot/test/compiler/stringopts/TestStringObjectInitialization.java b/hotspot/test/compiler/stringopts/TestStringObjectInitialization.java
index 2d09be1..6c6fa7e 100644
--- a/hotspot/test/compiler/stringopts/TestStringObjectInitialization.java
+++ b/hotspot/test/compiler/stringopts/TestStringObjectInitialization.java
@@ -27,7 +27,6 @@
 /*
  * @test
  * @bug 8159244
- * @requires vm.gc == "Parallel" | vm.gc == "null"
  * @summary Verifies that no partially initialized String object escapes from
  *          C2's String concat optimization in a highly concurrent setting.
  *          This test triggers the bug in about 1 out of 10 runs.
diff --git a/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java b/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java
index 87e5616..55fa598 100644
--- a/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java
+++ b/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/hotspot/test/runtime/classFileParserBug/BadNameAndType.java b/hotspot/test/runtime/classFileParserBug/BadNameAndType.java
deleted file mode 100644
index a8135cb..0000000
--- a/hotspot/test/runtime/classFileParserBug/BadNameAndType.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/*
- * @test
- * @bug 8042660
- * @summary Constant pool NameAndType entries must point to non-zero length Utf8 strings
- * @compile emptySigUtf8.jcod
- * @compile emptyNameUtf8.jcod
- * @run main/othervm -Xverify:all BadNameAndType
- */
-
-// Test that a constant pool NameAndType descriptor_index and/or name_index
-// that points to a zero length Utf8 string causes a ClassFormatError.
-public class BadNameAndType {
-    public static void main(String args[]) throws Throwable {
-
-        System.out.println("Regression test for bug 8042660");
-
-        // Test descriptor_index pointing to zero-length string.
-        try {
-            Class newClass = Class.forName("emptySigUtf8");
-            throw new RuntimeException("Expected ClassFormatError exception not thrown");
-        } catch (java.lang.ClassFormatError e) {
-            System.out.println("Test BadNameAndType passed test case emptySigUtf8");
-        }
-
-        // Test name_index pointing to zero-length string.
-        try {
-            Class newClass = Class.forName("emptyNameUtf8");
-            throw new RuntimeException("Expected ClassFormatError exception not thrown");
-        } catch (java.lang.ClassFormatError e) {
-            System.out.println("Test BadNameAndType passed test case emptyNameUtf8");
-        }
-    }
-}
diff --git a/hotspot/test/runtime/classFileParserBug/emptyNameUtf8.jcod b/hotspot/test/runtime/classFileParserBug/emptyNameUtf8.jcod
deleted file mode 100644
index 1e96aac..0000000
--- a/hotspot/test/runtime/classFileParserBug/emptyNameUtf8.jcod
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-// This class has an illegal NameAndType at constant pool #4.  It's illegal because
-// the Utf8 that it points to at #27 is a zero length string which is not a valid
-// name.  Loading this class should cause a ClassFormatError exception.
-class emptyNameUtf8 {
-  0xCAFEBABE;
-  0; // minor version
-  52; // version
-  [29] { // Constant Pool
-    ; // first element is empty
-    Method #6 #15; // #1     at 0x0A
-    Field #16 #17; // #2     at 0x0F
-    String #18; // #3     at 0x14
-    NameAndType #27 #28; // #4     at 0x9F
-    class #21; // #5     at 0x1C
-    class #22; // #6     at 0x1F
-    Utf8 "<init>"; // #7     at 0x22
-    Utf8 "()V"; // #8     at 0x2B
-    Utf8 "Code"; // #9     at 0x2E
-    Utf8 "LineNumberTable"; // #10     at 0x35
-    Utf8 "main"; // #11     at 0x47
-    Utf8 "([Ljava/lang/String;)V"; // #12     at 0x4E
-    Utf8 "SourceFile"; // #13     at 0x67
-    Utf8 "emptyNameUtf8.java"; // #14     at 0x74
-    NameAndType #7 #8; // #15     at 0x81
-    class #23; // #16     at 0x86
-    NameAndType #24 #25; // #17     at 0x89
-    Utf8 "Hello World"; // #18     at 0x8E
-    class #26; // #19     at 0x9C
-    Method #19 #4; // #20     at 0x17
-    Utf8 "emptyNameUtf8"; // #21     at 0xA4
-    Utf8 "java/lang/Object"; // #22     at 0xAC
-    Utf8 "java/lang/System"; // #23     at 0xBF
-    Utf8 "out"; // #24     at 0xD2
-    Utf8 "Ljava/io/PrintStream;"; // #25     at 0xD8
-    Utf8 "java/io/PrintStream"; // #26     at 0xF0
-    Utf8 ""; // #27     at 0x0106
-    Utf8 "()V"; // #28     at 0x0110
-  } // Constant Pool
-
-  0x0021; // access
-  #5;// this_cpx
-  #6;// super_cpx
-
-  [0] { // Interfaces
-  } // Interfaces
-
-  [0] { // fields
-  } // fields
-
-  [2] { // methods
-    { // Member at 0x0134
-      0x0001; // access
-      #7; // name_cpx
-      #8; // sig_cpx
-      [1] { // Attributes
-        Attr(#9, 29) { // Code at 0x013C
-          1; // max_stack
-          1; // max_locals
-          Bytes[5]{
-            0x2AB70001B1;
-          };
-          [0] { // Traps
-          } // end Traps
-          [1] { // Attributes
-            Attr(#10, 6) { // LineNumberTable at 0x0153
-              [1] { // LineNumberTable
-                0  2; //  at 0x015F
-              }
-            } // end LineNumberTable
-          } // Attributes
-        } // end Code
-      } // Attributes
-    } // Member
-    ;
-    { // Member at 0x015F
-      0x0009; // access
-      #11; // name_cpx
-      #12; // sig_cpx
-      [1] { // Attributes
-        Attr(#9, 37) { // Code at 0x0167
-          2; // max_stack
-          1; // max_locals
-          Bytes[9]{
-            0xB200021203B60004;
-            0xB1;
-          };
-          [0] { // Traps
-          } // end Traps
-          [1] { // Attributes
-            Attr(#10, 10) { // LineNumberTable at 0x0182
-              [2] { // LineNumberTable
-                0  4; //  at 0x018E
-                8  5; //  at 0x0192
-              }
-            } // end LineNumberTable
-          } // Attributes
-        } // end Code
-      } // Attributes
-    } // Member
-  } // methods
-
-  [1] { // Attributes
-    Attr(#13, 2) { // SourceFile at 0x0194
-      #14;
-    } // end SourceFile
-  } // Attributes
-} // end class emptyNameUtf8
diff --git a/hotspot/test/runtime/classFileParserBug/emptySigUtf8.jcod b/hotspot/test/runtime/classFileParserBug/emptySigUtf8.jcod
deleted file mode 100644
index 0b1957f..0000000
--- a/hotspot/test/runtime/classFileParserBug/emptySigUtf8.jcod
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-// This class has an illegal NameAndType at constant pool #4.  It's illegal because
-// the type that it points to at #28 is a zero length Utf8 string which is not a
-// valid signature.  Loading this class should cause a ClassFormatError exception.
-class emptySigUtf8 {
-  0xCAFEBABE;
-  0; // minor version
-  52; // version
-  [29] { // Constant Pool
-    ; // first element is empty
-    Method #6 #15; // #1     at 0x0A
-    Field #16 #17; // #2     at 0x0F
-    String #18; // #3     at 0x14
-    NameAndType #27 #28; // #4     at 0x9F
-    class #21; // #5     at 0x1C
-    class #22; // #6     at 0x1F
-    Utf8 "<init>"; // #7     at 0x22
-    Utf8 "()V"; // #8     at 0x2B
-    Utf8 "Code"; // #9     at 0x2E
-    Utf8 "LineNumberTable"; // #10     at 0x35
-    Utf8 "main"; // #11     at 0x47
-    Utf8 "([Ljava/lang/String;)V"; // #12     at 0x4E
-    Utf8 "SourceFile"; // #13     at 0x67
-    Utf8 "emptySigUtf8.java"; // #14     at 0x74
-    NameAndType #7 #8; // #15     at 0x81
-    class #23; // #16     at 0x86
-    NameAndType #24 #25; // #17     at 0x89
-    Utf8 "Hello World"; // #18     at 0x8E
-    class #26; // #19     at 0x9C
-    Method #19 #4; // #20     at 0x17
-    Utf8 "emptySigUtf8"; // #21     at 0xA4
-    Utf8 "java/lang/Object"; // #22     at 0xAC
-    Utf8 "java/lang/System"; // #23     at 0xBF
-    Utf8 "out"; // #24     at 0xD2
-    Utf8 "Ljava/io/PrintStream;"; // #25     at 0xD8
-    Utf8 "java/io/PrintStream"; // #26     at 0xF0
-    Utf8 "hi"; // #27     at 0x0106
-    Utf8 ""; // #28     at 0x0110
-  } // Constant Pool
-
-  0x0021; // access
-  #5;// this_cpx
-  #6;// super_cpx
-
-  [0] { // Interfaces
-  } // Interfaces
-
-  [0] { // fields
-  } // fields
-
-  [2] { // methods
-    { // Member at 0x0134
-      0x0001; // access
-      #7; // name_cpx
-      #8; // sig_cpx
-      [1] { // Attributes
-        Attr(#9, 29) { // Code at 0x013C
-          1; // max_stack
-          1; // max_locals
-          Bytes[5]{
-            0x2AB70001B1;
-          };
-          [0] { // Traps
-          } // end Traps
-          [1] { // Attributes
-            Attr(#10, 6) { // LineNumberTable at 0x0153
-              [1] { // LineNumberTable
-                0  2; //  at 0x015F
-              }
-            } // end LineNumberTable
-          } // Attributes
-        } // end Code
-      } // Attributes
-    } // Member
-    ;
-    { // Member at 0x015F
-      0x0009; // access
-      #11; // name_cpx
-      #12; // sig_cpx
-      [1] { // Attributes
-        Attr(#9, 37) { // Code at 0x0167
-          2; // max_stack
-          1; // max_locals
-          Bytes[9]{
-            0xB200021203B60004;
-            0xB1;
-          };
-          [0] { // Traps
-          } // end Traps
-          [1] { // Attributes
-            Attr(#10, 10) { // LineNumberTable at 0x0182
-              [2] { // LineNumberTable
-                0  4; //  at 0x018E
-                8  5; //  at 0x0192
-              }
-            } // end LineNumberTable
-          } // Attributes
-        } // end Code
-      } // Attributes
-    } // Member
-  } // methods
-
-  [1] { // Attributes
-    Attr(#13, 2) { // SourceFile at 0x0194
-      #14;
-    } // end SourceFile
-  } // Attributes
-} // end class emptySigUtf8
diff --git a/hotspot/test/runtime/lambda-features/TestInterfaceInit.java b/hotspot/test/runtime/lambda-features/TestInterfaceInit.java
index a6f057c..0493a60 100644
--- a/hotspot/test/runtime/lambda-features/TestInterfaceInit.java
+++ b/hotspot/test/runtime/lambda-features/TestInterfaceInit.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,7 @@
 /*
  * @test
  * @bug 8034275
- * @bug 8163969
- * @summary [JDK 8u40] Test interface init: only for interfaces declaring default methods, when subclass inits
+ * @summary [JDK 8u40] Test interface initialization: only for interfaces declaring default methods
  * @run main TestInterfaceInit
  */
 import java.util.List;
@@ -40,59 +39,43 @@
    // Declares a default method and initializes
    interface I {
        boolean v = TestInterfaceInit.out(I.class);
-        default void ix() {}
+        default void x() {}
    }
 
    // Declares a default method and initializes
    interface J extends I {
        boolean v = TestInterfaceInit.out(J.class);
-       default void jx() {}
+       default void x() {}
    }
-   // No default method, has an abstract method, does not initialize
+   // No default method, does not initialize
    interface JN extends J {
        boolean v = TestInterfaceInit.out(JN.class);
-       public abstract void jnx();
    }
 
    // Declares a default method and initializes
    interface K extends I {
        boolean v = TestInterfaceInit.out(K.class);
-        default void kx() {}
+        default void x() {}
    }
 
-   // No default method, has a static method, does not initialize
+   // No default method, does not initialize
    interface KN extends K {
        boolean v = TestInterfaceInit.out(KN.class);
-       static void knx() {}
    }
 
    interface L extends JN, KN {
        boolean v = TestInterfaceInit.out(L.class);
-        default void lx() {}
-   }
-
-   static class ChildClass implements JN, KN {
-       boolean v = TestInterfaceInit.out(ChildClass.class);
-       public void jnx() {}
+        default void x() {}
    }
 
    public static void main(String[] args) {
        // Trigger initialization
        boolean v = L.v;
 
-       List<Class<?>> expectedCInitOrder = Arrays.asList(L.class);
+       List<Class<?>> expectedCInitOrder = Arrays.asList(I.class,J.class,K.class,L.class);
        if (!cInitOrder.equals(expectedCInitOrder)) {
          throw new RuntimeException(String.format("Class initialization array %s not equal to expected array %s", cInitOrder, expectedCInitOrder));
        }
-
-       ChildClass myC = new ChildClass();
-       boolean w = myC.v;
-
-       expectedCInitOrder = Arrays.asList(L.class,I.class,J.class,K.class,ChildClass.class);
-       if (!cInitOrder.equals(expectedCInitOrder)) {
-         throw new RuntimeException(String.format("Class initialization array %s not equal to expected array %s", cInitOrder, expectedCInitOrder));
-       }
-
    }
 
    static boolean out(Class c) {
diff --git a/hotspot/test/runtime/os/AvailableProcessors.java b/hotspot/test/runtime/os/AvailableProcessors.java
deleted file mode 100644
index 482d762..0000000
--- a/hotspot/test/runtime/os/AvailableProcessors.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-import java.io.File;
-import com.oracle.java.testlibrary.ProcessTools;
-import com.oracle.java.testlibrary.OutputAnalyzer;
-import java.util.ArrayList;
-
-/*
- * @test
- * @bug 6515172
- * @summary Check that availableProcessors reports the correct value when running in a cpuset on linux
- * @requires os.family == "linux"
- * @library /testlibrary
- * @build com.oracle.java.testlibrary.*
- * @run driver AvailableProcessors
- */
-public class AvailableProcessors {
-
-    static final String SUCCESS_STRING = "Found expected processors: ";
-
-    public static void main(String[] args) throws Throwable {
-        if (args.length > 0)
-            checkProcessors(Integer.parseInt(args[0]));
-        else {
-            // run ourselves under different cpu configurations
-            // using the taskset command
-            String taskset;
-            final String taskset1 = "/bin/taskset";
-            final String taskset2 = "/usr/bin/taskset";
-            if (new File(taskset1).exists())
-                taskset = taskset1;
-            else if (new File(taskset2).exists())
-                taskset = taskset2;
-            else {
-                System.out.println("Skipping test: could not find taskset command");
-                return;
-            }
-
-            int available = Runtime.getRuntime().availableProcessors();
-
-            if (available == 1) {
-                System.out.println("Skipping test: only one processor available");
-                return;
-            }
-
-            // Get the java command we want to execute
-            // Enable logging for easier failure diagnosis
-            ProcessBuilder master =
-                    ProcessTools.createJavaProcessBuilder(false,
-                                                          "-XX:+UnlockDiagnosticVMOptions",
-                                                          "-XX:+PrintActiveCpus",
-                                                          "AvailableProcessors");
-
-            int[] expected = new int[] { 1, available/2, available-1, available };
-
-            for (int i : expected) {
-                System.out.println("Testing for " + i + " processors ...");
-                int max = i - 1;
-                ArrayList<String> cmdline = new ArrayList<>(master.command());
-                // prepend taskset command
-                cmdline.add(0, "0-" + max);
-                cmdline.add(0, "-c");
-                cmdline.add(0, taskset);
-                // append expected processor count
-                cmdline.add(String.valueOf(i));
-                ProcessBuilder pb = new ProcessBuilder(cmdline);
-                System.out.println("Final command line: " +
-                                   ProcessTools.getCommandLine(pb));
-                OutputAnalyzer output = ProcessTools.executeProcess(pb);
-                output.shouldContain(SUCCESS_STRING);
-            }
-        }
-    }
-
-    static void checkProcessors(int expected) {
-        int available = Runtime.getRuntime().availableProcessors();
-        if (available != expected)
-            throw new Error("Expected " + expected + " processors, but found "
-                            + available);
-        else
-            System.out.println(SUCCESS_STRING + available);
-    }
-}
diff --git a/hotspot/test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java b/hotspot/test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java
index 191a75c..b81f21a 100644
--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java
@@ -24,8 +24,6 @@
 package com.oracle.java.testlibrary;
 
 import java.io.IOException;
-import java.util.Arrays;
-import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -71,58 +69,6 @@
   }
 
   /**
-   * Verify that the stdout contents of output buffer is empty
-   *
-   * @throws RuntimeException
-   *             If stdout was not empty
-   */
-  public void stdoutShouldBeEmpty() {
-    if (!getStdout().isEmpty()) {
-      reportDiagnosticSummary();
-      throw new RuntimeException("stdout was not empty");
-    }
-  }
-
-  /**
-   * Verify that the stderr contents of output buffer is empty
-   *
-   * @throws RuntimeException
-   *             If stderr was not empty
-   */
-  public void stderrShouldBeEmpty() {
-    if (!getStderr().isEmpty()) {
-      reportDiagnosticSummary();
-      throw new RuntimeException("stderr was not empty");
-    }
-  }
-
-  /**
-   * Verify that the stdout contents of output buffer is not empty
-   *
-   * @throws RuntimeException
-   *             If stdout was empty
-   */
-  public void stdoutShouldNotBeEmpty() {
-    if (getStdout().isEmpty()) {
-      reportDiagnosticSummary();
-      throw new RuntimeException("stdout was empty");
-    }
-  }
-
-  /**
-   * Verify that the stderr contents of output buffer is not empty
-   *
-   * @throws RuntimeException
-   *             If stderr was empty
-   */
-  public void stderrShouldNotBeEmpty() {
-    if (getStderr().isEmpty()) {
-      reportDiagnosticSummary();
-      throw new RuntimeException("stderr was empty");
-    }
-  }
-
-    /**
    * Verify that the stdout and stderr contents of output buffer contains the string
    *
    * @param expectedString String that buffer should contain
@@ -419,18 +365,4 @@
   public int getExitValue() {
     return exitValue;
   }
-
-  /**
-   * Get the contents of the output buffer (stdout and stderr) as list of strings.
-   * Output will be split by newlines.
-   *
-   * @return Contents of the output buffer as list of strings
-   */
-  public List<String> asLines() {
-    return asLines(getOutput());
-  }
-
-  private List<String> asLines(String buffer) {
-    return Arrays.asList(buffer.split("(\\r\\n|\\n|\\r)"));
-  }
 }
diff --git a/hotspot/test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java b/hotspot/test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java
index 1953d18..649b7a1 100644
--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java
@@ -187,36 +187,23 @@
     return executeProcess(pb);
   }
 
-    /**
-     * Executes a process, waits for it to finish and returns the process output.
-     * The process will have exited before this method returns.
-     * @param pb The ProcessBuilder to execute.
-     * @return The {@linkplain OutputAnalyzer} instance wrapping the process.
-     */
-    public static OutputAnalyzer executeProcess(ProcessBuilder pb) throws Exception {
-        OutputAnalyzer output = null;
-        Process p = null;
-        boolean failed = false;
-        try {
-            p = pb.start();
-            output = new OutputAnalyzer(p);
-            p.waitFor();
-
-            return output;
-        } catch (Throwable t) {
-            if (p != null) {
-                p.destroyForcibly().waitFor();
-            }
-
-            failed = true;
-            System.out.println("executeProcess() failed: " + t);
-            throw t;
-        } finally {
-            if (failed) {
-                System.err.println(getProcessLog(pb, output));
-            }
-        }
+  /**
+   * Executes a process, waits for it to finish and returns the process output.
+   * @param pb The ProcessBuilder to execute.
+   * @return The output from the process.
+   */
+  public static OutputAnalyzer executeProcess(ProcessBuilder pb) throws Throwable {
+    OutputAnalyzer output = null;
+    try {
+      output = new OutputAnalyzer(pb.start());
+      return output;
+    } catch (Throwable t) {
+      System.out.println("executeProcess() failed: " + t);
+      throw t;
+    } finally {
+      System.out.println(getProcessLog(pb, output));
     }
+  }
 
   /**
    * Executes a process, waits for it to finish and returns the process output.
diff --git a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Utils.java b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Utils.java
index b332c1e..8421519 100644
--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Utils.java
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Utils.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -260,8 +260,8 @@
             output = ProcessTools.executeProcess(jcmdLauncher.getCommand());
             output.shouldHaveExitValue(0);
 
-            // Search for a line starting with numbers (pid), followed by the key.
-            Pattern pattern = Pattern.compile("^([0-9]+)\\s.*(" + key + ")", Pattern.MULTILINE);
+            // Search for a line starting with numbers (pid), follwed by the key.
+            Pattern pattern = Pattern.compile("([0-9]+)\\s.*(" + key + ").*\\r?\\n");
             Matcher matcher = pattern.matcher(output.getStdout());
 
             int pid = -1;
diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/UintxTest.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/UintxTest.java
index 7141221..688962f 100644
--- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/UintxTest.java
+++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/UintxTest.java
@@ -34,7 +34,7 @@
 import com.oracle.java.testlibrary.Platform;
 
 public class UintxTest {
-    private static final String FLAG_NAME = "VerifyGCStartAt";
+    private static final String FLAG_NAME = "TypeProfileLevel";
     private static final Long[] TESTS = {0L, 100L, (long) Integer.MAX_VALUE,
         (1L << 32L) - 1L, 1L << 32L};
     private static final Long[] EXPECTED_64 = TESTS;
diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/VmFlagTest.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/VmFlagTest.java
index 0818f21..fa8915f 100644
--- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/VmFlagTest.java
+++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/VmFlagTest.java
@@ -55,7 +55,9 @@
     }
 
     private T getValue() {
-        return get.apply(flagName);
+        T t = get.apply(flagName);
+        System.out.println("T = " + t);
+        return t;
     }
 
     protected static <T> void runTest(String existentFlag, T[] tests,
diff --git a/jaxp/ASSEMBLY_EXCEPTION b/jaxp/ASSEMBLY_EXCEPTION
index 065b8d9..8b7ac1d 100644
--- a/jaxp/ASSEMBLY_EXCEPTION
+++ b/jaxp/ASSEMBLY_EXCEPTION
@@ -1,27 +1,27 @@
 
 OPENJDK ASSEMBLY EXCEPTION
 
-The OpenJDK source code made available by Oracle America, Inc. (Oracle) at
-openjdk.java.net ("OpenJDK Code") is distributed under the terms of the GNU
-General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
+The OpenJDK source code made available by Sun at openjdk.java.net and
+openjdk.dev.java.net ("OpenJDK Code") is distributed under the terms of the
+GNU General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
 only ("GPL2"), with the following clarification and special exception.
 
     Linking this OpenJDK Code statically or dynamically with other code
     is making a combined work based on this library.  Thus, the terms
     and conditions of GPL2 cover the whole combination.
 
-    As a special exception, Oracle gives you permission to link this
-    OpenJDK Code with certain code licensed by Oracle as indicated at
+    As a special exception, Sun gives you permission to link this
+    OpenJDK Code with certain code licensed by Sun as indicated at
     http://openjdk.java.net/legal/exception-modules-2007-05-08.html
     ("Designated Exception Modules") to produce an executable,
     regardless of the license terms of the Designated Exception Modules,
     and to copy and distribute the resulting executable under GPL2,
     provided that the Designated Exception Modules continue to be
-    governed by the licenses under which they were offered by Oracle.
+    governed by the licenses under which they were offered by Sun.
 
-As such, it allows licensees and sublicensees of Oracle's GPL2 OpenJDK Code
-to build an executable that includes those portions of necessary code that
-Oracle could not provide under GPL2 (or that Oracle has provided under GPL2
-with the Classpath exception).  If you modify or add to the OpenJDK code,
-that new GPL2 code may still be combined with Designated Exception Modules
-if the new code is made subject to this exception by its copyright holder.
+As such, it allows licensees and sublicensees of Sun's GPL2 OpenJDK Code to
+build an executable that includes those portions of necessary code that Sun
+could not provide under GPL2 (or that Sun has provided under GPL2 with the
+Classpath exception).  If you modify or add to the OpenJDK code, that new
+GPL2 code may still be combined with Designated Exception Modules if the
+new code is made subject to this exception by its copyright holder.
diff --git a/jaxp/LICENSE b/jaxp/LICENSE
index 8b400c7..b40a0f4 100644
--- a/jaxp/LICENSE
+++ b/jaxp/LICENSE
@@ -3,7 +3,7 @@
 Version 2, June 1991
 
 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
 Everyone is permitted to copy and distribute verbatim copies of this license
 document, but changing it is not allowed.
@@ -287,8 +287,8 @@
     more details.
 
     You should have received a copy of the GNU General Public License along
-    with this program; if not, write to the Free Software Foundation, Inc.,
-    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+    with this program; if not, write to the Free Software Foundation, Inc., 59
+    Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
 Also add information on how to contact you by electronic and paper mail.
 
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/LiteralElement.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/LiteralElement.java
index c392cbe..e136357 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/LiteralElement.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/LiteralElement.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -9,7 +9,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,6 +17,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+/*
+ * $Id: LiteralElement.java,v 1.2.4.1 2005/09/13 12:38:33 pvedula Exp $
+ */
 
 package com.sun.org.apache.xalan.internal.xsltc.compiler;
 
@@ -55,6 +58,8 @@
     // names are not known at compile time.
     private boolean _allAttributesUnique = false;
 
+    private final static String XMLNS_STRING = "xmlns";
+
     /**
      * Returns the QName for this literal element
      */
@@ -135,8 +140,8 @@
         // Treat default namespace as "" and not null
         if (prefix == null)
             prefix = Constants.EMPTYSTRING;
-        else if (prefix.equals(XMLNS_PREFIX))
-            return(XMLNS_PREFIX);
+        else if (prefix.equals(XMLNS_STRING))
+            return(XMLNS_STRING);
 
         // Check if we must translate the prefix
         final String alternative = stable.lookupPrefixAlias(prefix);
@@ -261,7 +266,7 @@
                 // Ignore special attributes (e.g. xmlns:prefix and xmlns)
                 final String prefix = qname.getPrefix();
                 if (prefix != null && prefix.equals(XMLNS_PREFIX) ||
-                    prefix == null && qname.getLocalPart().equals(XMLNS_PREFIX) ||
+                    prefix == null && qname.getLocalPart().equals("xmlns") ||
                     uri != null && uri.equals(XSLT_URI))
                 {
                     continue;
@@ -334,9 +339,9 @@
         il.append(methodGen.startElement());
 
         // The value of an attribute may depend on a (sibling) variable
-        int j = 0;
+        int j=0;
         while (j < elementCount())  {
-            final SyntaxTreeNode item = elementAt(j);
+            final SyntaxTreeNode item = (SyntaxTreeNode) elementAt(j);
             if (item instanceof Variable) {
                 item.translate(classGen, methodGen);
             }
@@ -345,12 +350,35 @@
 
         // Compile code to emit namespace attributes
         if (_accessedPrefixes != null) {
+            boolean declaresDefaultNS = false;
+
             for (Map.Entry<String, String> entry : _accessedPrefixes.entrySet()) {
                 final String prefix = entry.getKey();
                 final String uri = entry.getValue();
+
+                if (uri != Constants.EMPTYSTRING ||
+                        prefix != Constants.EMPTYSTRING)
+                {
+                    if (prefix == Constants.EMPTYSTRING) {
+                        declaresDefaultNS = true;
+                    }
+                    il.append(methodGen.loadHandler());
+                    il.append(new PUSH(cpg,prefix));
+                    il.append(new PUSH(cpg,uri));
+                    il.append(methodGen.namespace());
+                }
+            }
+
+            /*
+             * If our XslElement parent redeclares the default NS, and this
+             * element doesn't, it must be redeclared one more time.
+             */
+            if (!declaresDefaultNS && (_parent instanceof XslElement)
+                    && ((XslElement) _parent).declaresDefaultNS())
+            {
                 il.append(methodGen.loadHandler());
-                il.append(new PUSH(cpg, prefix));
-                il.append(new PUSH(cpg, uri));
+                il.append(new PUSH(cpg, Constants.EMPTYSTRING));
+                il.append(new PUSH(cpg, Constants.EMPTYSTRING));
                 il.append(methodGen.namespace());
             }
         }
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java
index 7088850..d15d90e 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -17,6 +17,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+/*
+ * $Id: Parser.java,v 1.2.4.1 2005/09/13 12:14:32 pvedula Exp $
+ */
 
 package com.sun.org.apache.xalan.internal.xsltc.compiler;
 
@@ -34,7 +37,6 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.StringReader;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -42,6 +44,7 @@
 import java.util.Properties;
 import java.util.Stack;
 import java.util.StringTokenizer;
+import java.util.Vector;
 import javax.xml.XMLConstants;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
@@ -65,20 +68,20 @@
  */
 public class Parser implements Constants, ContentHandler {
 
-    private static final String XSL = "xsl";           // standard prefix
+    private static final String XSL = "xsl";            // standard prefix
     private static final String TRANSLET = "translet"; // extension prefix
 
     private Locator _locator = null;
 
-    private XSLTC _xsltc;                  // Reference to the compiler object.
-    private XPathParser _xpathParser;      // Reference to the XPath parser.
-    private ArrayList<ErrorMsg> _errors;   // Contains all compilation errors
-    private ArrayList<ErrorMsg> _warnings; // Contains all compilation warnings
+    private XSLTC _xsltc;             // Reference to the compiler object.
+    private XPathParser _xpathParser; // Reference to the XPath parser.
+    private Vector _errors;           // Contains all compilation errors
+    private Vector _warnings;         // Contains all compilation errors
 
     private Map<String, String>   _instructionClasses; // Maps instructions to classes
     private Map<String, String[]> _instructionAttrs;  // reqd and opt attrs
-    private Map<String, QName>    _qNames;
-    private Map<String, Map<String, QName>> _namespaces;
+    private Map<String, QName>   _qNames;
+    private Map<String, Map>     _namespaces;
     private QName       _useAttributeSets;
     private QName       _excludeResultPrefixes;
     private QName       _extensionElementPrefixes;
@@ -110,8 +113,8 @@
         _instructionAttrs    = new HashMap<>();
         _variableScope       = new HashMap<>();
         _template            = null;
-        _errors              = new ArrayList<>();
-        _warnings            = new ArrayList<>();
+        _errors              = new Vector();
+        _warnings            = new Vector();
         _symbolTable         = new SymbolTable();
         _xpathParser         = new XPathParser(this);
         _currentStylesheet   = null;
@@ -136,6 +139,7 @@
     public void setOutput(Output output) {
         if (_output != null) {
             if (_output.getImportPrecedence() <= output.getImportPrecedence()) {
+                String cdata = _output.getCdata();
                 output.mergeOutput(_output);
                 _output.disable();
                 _output = output;
@@ -169,13 +173,12 @@
         Object existing = _variableScope.get(var.getName().getStringRep());
         if (existing != null) {
             if (existing instanceof Stack) {
-                @SuppressWarnings("unchecked")
-                Stack<VariableBase> stack = (Stack<VariableBase>)existing;
+                Stack stack = (Stack)existing;
                 stack.push(var);
             }
             else if (existing instanceof VariableBase) {
-                Stack<VariableBase> stack = new Stack<>();
-                stack.push((VariableBase)existing);
+                Stack stack = new Stack();
+                stack.push(existing);
                 stack.push(var);
                 _variableScope.put(var.getName().getStringRep(), stack);
             }
@@ -188,8 +191,7 @@
     public void removeVariable(QName name) {
         Object existing = _variableScope.get(name.getStringRep());
         if (existing instanceof Stack) {
-            @SuppressWarnings("unchecked")
-            Stack<VariableBase> stack = (Stack<VariableBase>)existing;
+            Stack stack = (Stack)existing;
             if (!stack.isEmpty()) stack.pop();
             if (!stack.isEmpty()) return;
         }
@@ -199,14 +201,13 @@
     public VariableBase lookupVariable(QName name) {
         Object existing = _variableScope.get(name.getStringRep());
         if (existing instanceof VariableBase) {
-            return (VariableBase)existing;
+            return((VariableBase)existing);
         }
         else if (existing instanceof Stack) {
-            @SuppressWarnings("unchecked")
-            Stack<VariableBase> stack = (Stack<VariableBase>)existing;
-            return stack.peek();
+            Stack stack = (Stack)existing;
+            return((VariableBase)stack.peek());
         }
-        return null;
+        return(null);
     }
 
     public void setXSLTC(XSLTC xsltc) {
@@ -396,6 +397,7 @@
         try {
             if (stylesheet != null) {
                 stylesheet.parseContents(this);
+                final int precedence = stylesheet.getImportPrecedence();
                 final Iterator<SyntaxTreeNode> elements = stylesheet.elements();
                 while (elements.hasNext()) {
                     SyntaxTreeNode child = elements.next();
@@ -702,6 +704,8 @@
            new String[] {"stylesheet-prefix", "result-prefix"});
     }
 
+
+
     /**
      * Initialize the _instructionClasses map, which maps XSL element
      * names to Java classes in this package.
@@ -775,7 +779,6 @@
     /**
      * Add primops and base functions to the symbol table.
      */
-    @SuppressWarnings("unused")
     private void initSymbolTable() {
         MethodType I_V  = new MethodType(Type.Int, Type.Void);
         MethodType I_R  = new MethodType(Type.Int, Type.Real);
@@ -968,12 +971,12 @@
         String local, Attributes attributes)
     {
         SyntaxTreeNode node = null;
-        QName qname = getQName(uri, prefix, local);
+        QName  qname = getQName(uri, prefix, local);
         String className = _instructionClasses.get(qname.getStringRep());
 
         if (className != null) {
             try {
-                final Class<?> clazz = ObjectFactory.findProviderClass(className, true);
+                final Class clazz = ObjectFactory.findProviderClass(className, true);
                 node = (SyntaxTreeNode)clazz.newInstance();
                 node.setQName(qname);
                 node.setParser(this);
@@ -1020,7 +1023,7 @@
                 else {
                     Stylesheet sheet = _xsltc.getStylesheet();
                     if ((sheet != null) && (sheet.isExtension(uri))) {
-                        if (sheet != _parentStack.peek()) {
+                        if (sheet != (SyntaxTreeNode)_parentStack.peek()) {
                             node = new UnsupportedElement(uri, prefix, local, true);
                             UnsupportedElement elem = (UnsupportedElement)node;
                             ErrorMsg msg =
@@ -1153,6 +1156,7 @@
                     node.setParser(this);
                     node.setParent(parent);
                     node.setLineNumber(line);
+// System.out.println("e = " + text + " " + node);
                     return node;
                 }
             }
@@ -1187,7 +1191,7 @@
         if (size > 0) {
             System.err.println(new ErrorMsg(ErrorMsg.COMPILER_ERROR_KEY));
             for (int i = 0; i < size; i++) {
-                System.err.println("  " + _errors.get(i));
+                System.err.println("  " + _errors.elementAt(i));
             }
         }
     }
@@ -1200,7 +1204,7 @@
         if (size > 0) {
             System.err.println(new ErrorMsg(ErrorMsg.COMPILER_WARNING_KEY));
             for (int i = 0; i < size; i++) {
-                System.err.println("  " + _warnings.get(i));
+                System.err.println("  " + _warnings.elementAt(i));
             }
         }
     }
@@ -1213,42 +1217,42 @@
         case Constants.INTERNAL:
             // Unexpected internal errors, such as null-ptr exceptions, etc.
             // Immediately terminates compilation, no translet produced
-            _errors.add(error);
+            _errors.addElement(error);
             break;
         case Constants.UNSUPPORTED:
             // XSLT elements that are not implemented and unsupported ext.
             // Immediately terminates compilation, no translet produced
-            _errors.add(error);
+            _errors.addElement(error);
             break;
         case Constants.FATAL:
             // Fatal error in the stylesheet input (parsing or content)
             // Immediately terminates compilation, no translet produced
-            _errors.add(error);
+            _errors.addElement(error);
             break;
         case Constants.ERROR:
             // Other error in the stylesheet input (parsing or content)
             // Does not terminate compilation, no translet produced
-            _errors.add(error);
+            _errors.addElement(error);
             break;
         case Constants.WARNING:
             // Other error in the stylesheet input (content errors only)
             // Does not terminate compilation, a translet is produced
-            _warnings.add(error);
+            _warnings.addElement(error);
             break;
         }
     }
 
-    public ArrayList<ErrorMsg> getErrors() {
+    public Vector getErrors() {
         return _errors;
     }
 
-    public ArrayList<ErrorMsg> getWarnings() {
+    public Vector getWarnings() {
         return _warnings;
     }
 
     /************************ SAX2 ContentHandler INTERFACE *****************/
 
-    private Stack<SyntaxTreeNode> _parentStack = null;
+    private Stack _parentStack = null;
     private Map<String, String> _prefixMapping = null;
 
     /**
@@ -1258,7 +1262,7 @@
         _root = null;
         _target = null;
         _prefixMapping = null;
-        _parentStack = new Stack<>();
+        _parentStack = new Stack();
     }
 
     /**
@@ -1314,7 +1318,7 @@
             _root = element;
         }
         else {
-            SyntaxTreeNode parent = _parentStack.peek();
+            SyntaxTreeNode parent = (SyntaxTreeNode)_parentStack.peek();
             parent.addElement(element);
             element.setParent(parent);
         }
@@ -1345,7 +1349,7 @@
      */
     public void characters(char[] ch, int start, int length) {
         String string = new String(ch, start, length);
-        SyntaxTreeNode parent = _parentStack.peek();
+        SyntaxTreeNode parent = (SyntaxTreeNode)_parentStack.peek();
 
         if (string.length() == 0) return;
 
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Stylesheet.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Stylesheet.java
index 09061ea..5894996 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Stylesheet.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Stylesheet.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -31,7 +31,6 @@
 import com.sun.org.apache.bcel.internal.generic.GETSTATIC;
 import com.sun.org.apache.bcel.internal.generic.INVOKEINTERFACE;
 import com.sun.org.apache.bcel.internal.generic.INVOKESPECIAL;
-import com.sun.org.apache.bcel.internal.generic.INVOKESTATIC;
 import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL;
 import com.sun.org.apache.bcel.internal.generic.ISTORE;
 import com.sun.org.apache.bcel.internal.generic.InstructionHandle;
@@ -1253,10 +1252,6 @@
                                 classGen.getConstantPool());
         transf.addException("com.sun.org.apache.xalan.internal.xsltc.TransletException");
 
-        // call resetPrefixIndex at the beginning of transform
-        final int check = cpg.addMethodref(BASIS_LIBRARY_CLASS, "resetPrefixIndex", "()V");
-        il.append(new INVOKESTATIC(check));
-
         // Define and initialize current with the root node
         final LocalVariableGen current =
             transf.addLocalVariable("current",
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/SyntaxTreeNode.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/SyntaxTreeNode.java
index 01ef38b..1e8ad86 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/SyntaxTreeNode.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/SyntaxTreeNode.java
@@ -73,7 +73,7 @@
     protected QName _qname;                    // The element QName
     private int _line;                         // Source file line number
     protected AttributesImpl _attributes = null;   // Attributes of this element
-    private Map<String, String> _prefixMapping = null; // Namespace declarations
+    private   Map<String, String> _prefixMapping = null; // Namespace declarations
 
     // Sentinel - used to denote unrecognised syntaxt tree nodes.
     protected static final SyntaxTreeNode Dummy = new AbsolutePathPattern(null);
@@ -829,7 +829,7 @@
      * @param pos The child node's position.
      * @return The child node.
      */
-    protected final SyntaxTreeNode elementAt(int pos) {
+    protected final Object elementAt(int pos) {
         return _contents.get(pos);
     }
 
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java
index 631edbd..3218181 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -17,6 +17,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+/*
+ * $Id: XSLTC.java,v 1.2.4.1 2005/09/05 09:51:38 pvedula Exp $
+ */
 
 package com.sun.org.apache.xalan.internal.xsltc.compiler;
 
@@ -36,7 +39,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Date;
 import java.util.Enumeration;
@@ -281,7 +283,7 @@
     }
 
     /*
-     * Function loads an external extension function.
+     * Function loads an external extension functions.
      * The filtering of function types (external,internal) takes place in FunctionCall class
      *
      */
@@ -596,18 +598,18 @@
     }
 
     /**
-     * Get a list of all compile error messages
-     * @return A List containing all compile error messages
+     * Get a Vector containing all compile error messages
+     * @return A Vector containing all compile error messages
      */
-    public ArrayList<ErrorMsg> getErrors() {
+    public Vector getErrors() {
         return _parser.getErrors();
     }
 
     /**
-     * Get a list of all compile warning messages
-     * @return A List containing all compile error messages
+     * Get a Vector containing all compile warning messages
+     * @return A Vector containing all compile error messages
      */
-    public ArrayList<ErrorMsg> getWarnings() {
+    public Vector getWarnings() {
         return _parser.getWarnings();
     }
 
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XslElement.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XslElement.java
index e94ebb1..e04bab7 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XslElement.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XslElement.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -17,6 +17,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+/*
+ * $Id: XslElement.java,v 1.2.4.1 2005/09/12 11:39:55 pvedula Exp $
+ */
 
 package com.sun.org.apache.xalan.internal.xsltc.compiler;
 
@@ -57,6 +60,14 @@
         displayContents(indent + IndentIncrement);
     }
 
+    /**
+     * This method is now deprecated. The new implemation of this class
+     * never declares the default NS.
+     */
+    public boolean declaresDefaultNS() {
+        return false;
+    }
+
     public void parseContents(Parser parser) {
         final SymbolTable stable = parser.getSymbolTable();
 
@@ -199,6 +210,7 @@
      * on the handler (vii) evaluates the contents (viii) calls endElement().
      */
     public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
+        LocalVariableGen local = null;
         final ConstantPoolGen cpg = classGen.getConstantPool();
         final InstructionList il = methodGen.getInstructionList();
 
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java
index 804b154..dc3a3ce 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -48,7 +48,6 @@
 import java.text.NumberFormat;
 import java.util.Locale;
 import java.util.ResourceBundle;
-import java.util.concurrent.atomic.AtomicInteger;
 import javax.xml.transform.dom.DOMSource;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
@@ -1531,25 +1530,16 @@
     }
 
     /**
-     * These functions are used in the execution of xsl:element to generate
-     * and reset namespace prefix index local to current transformation process
+     * This function is used in the execution of xsl:element
      */
+    private static int prefixIndex = 0;
+
     public static String generatePrefix() {
-        return ("ns" + threadLocalPrefixIndex.get().getAndIncrement());
+        synchronized (BasisLibrary.class) {
+            return ("ns" + prefixIndex++);
+        }
     }
 
-    public static void resetPrefixIndex() {
-        threadLocalPrefixIndex.get().set(0);
-    }
-
-    private static final ThreadLocal<AtomicInteger> threadLocalPrefixIndex =
-        new ThreadLocal<AtomicInteger>() {
-            @Override
-            protected AtomicInteger initialValue() {
-                return new AtomicInteger();
-            }
-        };
-
     public static final String RUN_TIME_INTERNAL_ERR =
                                            "RUN_TIME_INTERNAL_ERR";
     public static final String RUN_TIME_COPY_ERR =
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java
index bce2c3a..8bbc541 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java
@@ -1,13 +1,13 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * reserved comment block
+ * DO NOT REMOVE OR ALTER!
  */
 /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
  *     http://www.apache.org/licenses/LICENSE-2.0
  *
@@ -17,9 +17,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+/*
+ * $Id: TemplatesHandlerImpl.java,v 1.2.4.1 2005/09/06 12:09:03 pvedula Exp $
+ */
 
 package com.sun.org.apache.xalan.internal.xsltc.trax;
 
+import javax.xml.XMLConstants;
+import javax.xml.transform.Source;
+import javax.xml.transform.Templates;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.sax.TemplatesHandler;
 import com.sun.org.apache.xalan.internal.XalanConstants;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.CompilerException;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.Parser;
@@ -28,19 +37,15 @@
 import com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
-import java.util.ArrayList;
-import javax.xml.XMLConstants;
-import javax.xml.transform.Source;
-import javax.xml.transform.Templates;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.URIResolver;
-import javax.xml.transform.sax.TemplatesHandler;
+
 import org.xml.sax.ContentHandler;
 import org.xml.sax.InputSource;
 import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
 import org.xml.sax.Attributes;
 
+import java.util.Vector;
+
 /**
  * Implementation of a JAXP1.1 TemplatesHandler
  * @author Morten Jorgensen
@@ -263,13 +268,13 @@
                 }
             }
             else {
-                StringBuilder errorMessage = new StringBuilder();
-                ArrayList<ErrorMsg> errors = _parser.getErrors();
+                StringBuffer errorMessage = new StringBuffer();
+                Vector errors = _parser.getErrors();
                 final int count = errors.size();
                 for (int i = 0; i < count; i++) {
                     if (errorMessage.length() > 0)
                         errorMessage.append('\n');
-                    errorMessage.append(errors.get(i).toString());
+                    errorMessage.append(errors.elementAt(i).toString());
                 }
                 throw new SAXException(ErrorMsg.JAXP_COMPILE_ERR, new TransformerException(errorMessage.toString()));
             }
diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java
index e30fffd..b37c8f4 100644
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -17,6 +17,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+/*
+ * $Id: TransformerFactoryImpl.java,v 1.8 2007/04/09 21:30:41 joehw Exp $
+ */
 
 package com.sun.org.apache.xalan.internal.xsltc.trax;
 
@@ -45,7 +48,6 @@
 import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.Map;
 import java.util.Properties;
@@ -590,7 +592,7 @@
         }
 
         // Inefficient, but array is small
-        for (int i = 0; i < features.length; i++) {
+        for (int i =0; i < features.length; i++) {
             if (name.equals(features[i])) {
                 return true;
             }
@@ -797,7 +799,7 @@
     /**
      * Pass warning messages from the compiler to the error listener
      */
-    private void passWarningsToListener(ArrayList<ErrorMsg> messages)
+    private void passWarningsToListener(Vector messages)
         throws TransformerException
     {
         if (_errorListener == null || messages == null) {
@@ -806,7 +808,7 @@
         // Pass messages to listener, one by one
         final int count = messages.size();
         for (int pos = 0; pos < count; pos++) {
-            ErrorMsg msg = messages.get(pos);
+            ErrorMsg msg = (ErrorMsg)messages.elementAt(pos);
             // Workaround for the TCK failure ErrorListener.errorTests.error001.
             if (msg.isWarningError())
                 _errorListener.error(
@@ -820,7 +822,7 @@
     /**
      * Pass error messages from the compiler to the error listener
      */
-    private void passErrorsToListener(ArrayList<ErrorMsg> messages) {
+    private void passErrorsToListener(Vector messages) {
         try {
             if (_errorListener == null || messages == null) {
                 return;
@@ -828,7 +830,7 @@
             // Pass messages to listener, one by one
             final int count = messages.size();
             for (int pos = 0; pos < count; pos++) {
-                String message = messages.get(pos).toString();
+                String message = messages.elementAt(pos).toString();
                 _errorListener.error(new TransformerException(message));
             }
         }
@@ -1002,39 +1004,40 @@
         }
 
         // Check that the transformation went well before returning
-        if (bytecodes == null) {
-            ArrayList<ErrorMsg> errs = xsltc.getErrors();
-            ErrorMsg err;
-            if (errs != null) {
-                err = errs.get(errs.size() - 1);
-            } else {
-                err = new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR);
-            }
-            Throwable cause = err.getCause();
-            TransformerConfigurationException exc;
-            if (cause != null) {
-                exc =  new TransformerConfigurationException(cause.getMessage(), cause);
-            } else {
-                exc =  new TransformerConfigurationException(err.toString());
-            }
-
-            // Pass compiler errors to the error listener
-            if (_errorListener != null) {
-                passErrorsToListener(xsltc.getErrors());
-
-                // As required by TCK 1.2, send a fatalError to the
-                // error listener because compilation of the stylesheet
-                // failed and no further processing will be possible.
-                try {
-                    _errorListener.fatalError(exc);
-                } catch (TransformerException te) {
-                    // well, we tried.
-                }
-            } else {
-                xsltc.printErrors();
-            }
-            throw exc;
+    if (bytecodes == null) {
+        Vector errs = xsltc.getErrors();
+        ErrorMsg err;
+        if (errs != null) {
+            err = (ErrorMsg)errs.elementAt(errs.size()-1);
+        } else {
+            err = new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR);
         }
+        Throwable cause = err.getCause();
+        TransformerConfigurationException exc;
+        if (cause != null) {
+            exc =  new TransformerConfigurationException(cause.getMessage(), cause);
+        } else {
+            exc =  new TransformerConfigurationException(err.toString());
+        }
+
+        // Pass compiler errors to the error listener
+        if (_errorListener != null) {
+            passErrorsToListener(xsltc.getErrors());
+
+            // As required by TCK 1.2, send a fatalError to the
+            // error listener because compilation of the stylesheet
+            // failed and no further processing will be possible.
+            try {
+                _errorListener.fatalError(exc);
+            } catch (TransformerException te) {
+                // well, we tried.
+            }
+        }
+        else {
+            xsltc.printErrors();
+        }
+        throw exc;
+    }
 
         return new TemplatesImpl(bytecodes, transletName,
             xsltc.getOutputProperties(), _indentNumber, this);
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/dom/AbortException.java b/jaxp/src/com/sun/org/apache/xerces/internal/dom/AbortException.java
deleted file mode 100644
index 3e178dd..0000000
--- a/jaxp/src/com/sun/org/apache/xerces/internal/dom/AbortException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.org.apache.xerces.internal.dom;
-
-public class AbortException extends RuntimeException {
-
-        private static final long serialVersionUID = 2608302175475740417L;
-
-        /**
-         * Constructor AbortException
-         */
-        public AbortException() { super(null, null, false, false); }
-}
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/dom/DOMNormalizer.java b/jaxp/src/com/sun/org/apache/xerces/internal/dom/DOMNormalizer.java
index c4268dc..3758f39 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/dom/DOMNormalizer.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/dom/DOMNormalizer.java
@@ -26,7 +26,6 @@
 import java.io.StringReader;
 import java.util.Vector;
 
-import com.sun.org.apache.xerces.internal.dom.AbortException;
 import com.sun.org.apache.xerces.internal.impl.Constants;
 import com.sun.org.apache.xerces.internal.impl.RevalidationHandler;
 import com.sun.org.apache.xerces.internal.impl.dtd.DTDGrammar;
@@ -159,6 +158,11 @@
     // attribute value normalization
     final XMLString fNormalizedValue = new XMLString(new char[16], 0, 0);
 
+    /**
+     * If the user stops the process, this exception will be thrown.
+     */
+    public static final RuntimeException abort = new RuntimeException();
+
     //DTD validator
     private XMLDTDValidator fDTDValidator;
 
@@ -239,10 +243,11 @@
                                         XMLGrammarDescription.XML_SCHEMA, fValidationHandler);
                                 fValidationHandler = null;
                         }
-                } catch (AbortException e) {
-                    return;
-                } catch (RuntimeException e) {
-                    throw e;    // otherwise re-throw.
+                }
+                catch (RuntimeException e) {
+            if( e==abort )
+                return; // processing aborted by the user
+            throw e;    // otherwise re-throw.
                 }
 
         }
@@ -1367,10 +1372,10 @@
             error.fRelatedData = locator.fRelatedNode;
 
             if(!errorHandler.handleError(error))
-                throw new AbortException();
+                throw abort;
         }
         if( severity==DOMError.SEVERITY_FATAL_ERROR )
-            throw new AbortException();
+            throw abort;
     }
 
     protected final void updateQName (Node node, QName qname){
@@ -2039,4 +2044,5 @@
         return null;
     }
 
+
 }  // DOMNormalizer class
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java
index e29d296..ac26f80 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java
@@ -752,7 +752,7 @@
             load(0, true, true);
         }
         else if (fCurrentEntity.position == fCurrentEntity.count - 1) {
-            invokeListeners(1);
+            invokeListeners(0);
             fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1];
             load(1, false, false);
             fCurrentEntity.position = 0;
@@ -904,7 +904,7 @@
             load(0, true, true);
         }
         else if (fCurrentEntity.position == fCurrentEntity.count - 1) {
-            invokeListeners(1);
+            invokeListeners(0);
             fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1];
             load(1, false, false);
             fCurrentEntity.startPosition = 0;
@@ -1352,7 +1352,7 @@
                         fCurrentEntity.lineNumber++;
                         fCurrentEntity.columnNumber = 1;
                         if (fCurrentEntity.position == fCurrentEntity.count - 1) {
-                            invokeListeners(1);
+                            invokeListeners(0);
                             fCurrentEntity.ch[0] = (char)c;
                             entityChanged = load(1, true, false);
                             if (!entityChanged) {
@@ -1406,9 +1406,8 @@
                     fCurrentEntity.lineNumber++;
                     fCurrentEntity.columnNumber = 1;
                     if (fCurrentEntity.position == fCurrentEntity.count - 1) {
-                        invokeListeners(1);
                         fCurrentEntity.ch[0] = (char)c;
-                        entityChanged = load(1, true, false);
+                        entityChanged = load(1, true, true);
                         if (!entityChanged) {
                             // the load change the position to be 1,
                             // need to restore it when entity not changed
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java
index d63df64..135eb5e 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java
@@ -3,13 +3,11 @@
  */
 
 /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
-
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
@@ -21,19 +19,17 @@
  */
 
 package com.sun.org.apache.xerces.internal.impl;
+import com.sun.xml.internal.stream.dtd.nonvalidating.DTDGrammar;
+import java.io.EOFException;
+import java.io.IOException;
 
-import com.sun.org.apache.xerces.internal.impl.Constants;
 import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
 
-import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter;
-import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler;
 import com.sun.org.apache.xerces.internal.util.SymbolTable;
 import com.sun.org.apache.xerces.internal.util.XMLAttributesImpl;
 import com.sun.org.apache.xerces.internal.util.XMLChar;
 import com.sun.org.apache.xerces.internal.util.XMLStringBuffer;
 
-import com.sun.org.apache.xerces.internal.utils.XMLLimitAnalyzer;
-import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
 import com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler;
 import com.sun.org.apache.xerces.internal.xni.XMLDTDHandler;
 import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
@@ -45,9 +41,8 @@
 import com.sun.org.apache.xerces.internal.xni.parser.XMLDTDScanner;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
 import com.sun.org.apache.xerces.internal.xni.Augmentations;
-import com.sun.xml.internal.stream.dtd.nonvalidating.DTDGrammar;
-import java.io.EOFException;
-import java.io.IOException;
+import com.sun.org.apache.xerces.internal.utils.XMLLimitAnalyzer;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
 
 /**
  * This class is responsible for scanning the declarations found
@@ -391,25 +386,15 @@
      */
     @Override
     public boolean skipDTD(boolean supportDTD) throws IOException {
-        if (supportDTD)
-            return false;
-
-        fStringBuffer.clear();
-        while (fEntityScanner.scanData("]", fStringBuffer)) {
-            int c = fEntityScanner.peekChar();
-            if (c != -1) {
-                if (XMLChar.isHighSurrogate(c)) {
-                    scanSurrogates(fStringBuffer);
-                }
-                if (isInvalidLiteral(c)) {
-                    reportFatalError("InvalidCharInDTD",
-                        new Object[] { Integer.toHexString(c) });
-                    fEntityScanner.scanChar(null);
-                }
+        if (!supportDTD) {
+            fStringBuffer.clear();
+            if (!fEntityScanner.scanData("]", fStringBuffer)) {
+                fEntityScanner.fCurrentEntity.position--;
             }
+
+            return true;
         }
-        fEntityScanner.fCurrentEntity.position--;
-        return true;
+        return false;
     }
 
     //
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java
index 6d197c5..ef118f0 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java
@@ -3,14 +3,13 @@
  */
 
 /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
+ * Copyright 2005 The Apache Software Foundation.
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -19,6 +18,7 @@
  * limitations under the License.
  */
 
+
 package com.sun.org.apache.xerces.internal.impl;
 
 import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java
index 6c62345..4330492 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java
@@ -3,14 +3,13 @@
  */
 
 /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
+ * Copyright 2005 The Apache Software Foundation.
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -21,6 +20,7 @@
 
 package com.sun.org.apache.xerces.internal.impl;
 
+
 import com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDDescription;
 import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
 import com.sun.org.apache.xerces.internal.util.NamespaceSupport;
@@ -1107,7 +1107,8 @@
                             if (!moreToScan) {
                                 // end doctype declaration
                                 if (!fEntityScanner.skipChar(']', null)) {
-                                    reportFatalError("DoctypedeclNotClosed", new Object[]{fDoctypeName});
+                                    reportFatalError("EXPECTED_SQUARE_BRACKET_TO_CLOSE_INTERNAL_SUBSET",
+                                            null);
                                 }
                                 fEntityScanner.skipSpaces();
                                 if (!fEntityScanner.skipChar('>', null)) {
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java
index ff02bba..8b02b2e 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java
@@ -44,8 +44,8 @@
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
-import java.util.ArrayList;
 import java.util.Locale;
+import java.util.Vector;
 
 /**
  * Implements the entity scanner methods.
@@ -58,10 +58,11 @@
  */
 public class XMLEntityScanner implements XMLLocator  {
 
-    protected Entity.ScannedEntity fCurrentEntity = null;
+
+    protected Entity.ScannedEntity fCurrentEntity = null ;
     protected int fBufferSize = XMLEntityManager.DEFAULT_BUFFER_SIZE;
 
-    protected XMLEntityManager fEntityManager;
+    protected XMLEntityManager fEntityManager ;
 
     /** Security manager. */
     protected XMLSecurityManager fSecurityManager = null;
@@ -71,9 +72,8 @@
 
     /** Debug switching readers for encodings. */
     private static final boolean DEBUG_ENCODINGS = false;
-
     /** Listeners which should know when load is being called */
-    private ArrayList<XMLBufferListener> listeners = new ArrayList<>();
+    private Vector listeners = new Vector();
 
     private static final boolean [] VALID_NAMES = new boolean[127];
 
@@ -140,10 +140,9 @@
         VALID_NAMES[58]=true;
         VALID_NAMES[95]=true;
     }
-
-    // Remember, that the XML version has explicitly been set,
+    // SAPJVM: Remember, that the XML version has explicitly been set,
     // so that XMLStreamReader.getVersion() can find that out.
-    protected boolean xmlVersionSetExplicitly = false;
+    boolean xmlVersionSetExplicitly = false;
 
     // indicates that the operation is for detecting XML version
     boolean detectingVersion = false;
@@ -262,7 +261,7 @@
      * @param xmlVersion the XML version of the current entity
      */
     public final void setXMLVersion(String xmlVersion) {
-        xmlVersionSetExplicitly = true;
+        xmlVersionSetExplicitly = true; // SAPJVM
         fCurrentEntity.xmlVersion = xmlVersion;
     } // setXMLVersion(String)
 
@@ -554,7 +553,8 @@
         // scan character
         int offset = fCurrentEntity.position;
         int c = fCurrentEntity.ch[fCurrentEntity.position++];
-        if (c == '\n' || (c == '\r' && isExternal)) {
+        if (c == '\n' ||
+                (c == '\r' && isExternal)) {
             fCurrentEntity.lineNumber++;
             fCurrentEntity.columnNumber = 1;
             if (fCurrentEntity.position == fCurrentEntity.count) {
@@ -1027,7 +1027,7 @@
         if (fCurrentEntity.position == fCurrentEntity.count) {
             load(0, true, true);
         } else if (fCurrentEntity.position == fCurrentEntity.count - 1) {
-            invokeListeners(1);
+            invokeListeners(0);
             fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1];
             load(1, false, false);
             fCurrentEntity.position = 0;
@@ -1186,7 +1186,7 @@
         if (fCurrentEntity.position == fCurrentEntity.count) {
             load(0, true, true);
         } else if (fCurrentEntity.position == fCurrentEntity.count - 1) {
-            invokeListeners(1);
+            invokeListeners(0);
             fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1];
             load(1, false, false);
             fCurrentEntity.position = 0;
@@ -1339,8 +1339,8 @@
      * <p>
      * <strong>Note:</strong> The characters are consumed.
      * <p>
-     * <strong>Note:</strong> This assumes that the delimiter contains at
-     * least one character.
+     * <strong>Note:</strong> This assumes that the length of the delimiter
+     * and that the delimiter contains at least one character.
      * <p>
      * <strong>Note:</strong> This method does not guarantee to return
      * the longest run of character data. This method may return before
@@ -1523,7 +1523,7 @@
         } while (!done);
         return !done;
 
-    } // scanData(String, XMLStringBuffer)
+    } // scanData(String,XMLString)
 
     /**
      * Skips a character appearing immediately on the input.
@@ -1650,7 +1650,7 @@
                     fCurrentEntity.lineNumber++;
                     fCurrentEntity.columnNumber = 1;
                     if (fCurrentEntity.position == fCurrentEntity.count - 1) {
-                        invokeListeners(1);
+                        invokeListeners(0);
                         fCurrentEntity.ch[0] = (char)c;
                         entityChanged = load(1, true, false);
                         if (!entityChanged){
@@ -1827,7 +1827,8 @@
         final int length = s.length;
         //first make sure that required capacity is avaible
         if(arrangeCapacity(length, false)){
-            int beforeSkip = fCurrentEntity.position;
+            int beforeSkip = fCurrentEntity.position ;
+            int afterSkip = fCurrentEntity.position + length  ;
 
             if(DEBUG_SKIP_STRING){
                 System.out.println("skipString,length = " + new String(s) + "," + length);
@@ -2209,9 +2210,8 @@
      * is being changed.
      */
     public void registerListener(XMLBufferListener listener) {
-        if (!listeners.contains(listener)) {
+        if(!listeners.contains(listener))
             listeners.add(listener);
-        }
     }
 
     /**
@@ -2219,8 +2219,9 @@
      * @param loadPos Starting position from which new data is being loaded into scanner buffer.
      */
     public void invokeListeners(int loadPos){
-        for (int i=0; i<listeners.size(); i++) {
-            listeners.get(i).refresh(loadPos);
+        for(int i=0;i<listeners.size();i++){
+            XMLBufferListener listener =(XMLBufferListener) listeners.get(i);
+            listener.refresh(loadPos);
         }
     }
 
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java
index fb12b42..7645cce 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java
@@ -3,14 +3,13 @@
  */
 
 /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
+ * Copyright 2005 The Apache Software Foundation.
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -21,6 +20,7 @@
 
 package com.sun.org.apache.xerces.internal.impl;
 
+
 import com.sun.org.apache.xerces.internal.util.Status;
 import com.sun.xml.internal.stream.XMLEntityStorage;
 import java.io.IOException;
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties
index 01531f7..c7a23c2 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties
@@ -145,7 +145,6 @@
         MSG_SPACE_REQUIRED_BEFORE_ROOT_ELEMENT_TYPE_IN_DOCTYPEDECL = White space is required after \"<!DOCTYPE\" in the document type declaration.
         MSG_ROOT_ELEMENT_TYPE_REQUIRED = The root element type must appear after \"<!DOCTYPE\" in the document type declaration.
         DoctypedeclUnterminated = The document type declaration for root element type \"{0}\" must end with ''>''.
-        DoctypedeclNotClosed = The document type declaration for root element type \"{0}\" must be closed with '']''.
         PEReferenceWithinMarkup = The parameter entity reference \"%{0};\" cannot occur within markup in the internal subset of the DTD.
         MSG_MARKUP_NOT_RECOGNIZED_IN_DTD = The markup declarations contained or pointed to by the document type declaration must be well-formed.
 # 2.10 White Space Handling
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_de.properties b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_de.properties
index 0848270..91ff0dc 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_de.properties
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_de.properties
@@ -145,7 +145,6 @@
         MSG_SPACE_REQUIRED_BEFORE_ROOT_ELEMENT_TYPE_IN_DOCTYPEDECL = Leerstelle nach "<!DOCTYPE" in der Dokumenttypdeklaration erforderlich.
         MSG_ROOT_ELEMENT_TYPE_REQUIRED = Root-Elementtyp muss nach "<!DOCTYPE" in der Dokumenttypdeklaration enthalten sein.
         DoctypedeclUnterminated = Dokumenttypdeklaration f\u00FCr Root-Elementtyp "{0}" muss mit ">" enden.
-        DoctypedeclNotClosed = Dokumenttypdeklaration f\u00FCr Root-Elementtyp "{0}" muss mit '']'' enden.
         PEReferenceWithinMarkup = Parameterentityreferenz "%{0};" darf nicht in Markup in der internen Teilmenge der DTD vorkommen.
         MSG_MARKUP_NOT_RECOGNIZED_IN_DTD = Die Markup-Deklarationen, die in der Dokumenttypdeklaration enthalten sind bzw. auf die von der Dokumenttypdeklaration verwiesen wird, m\u00FCssen ordnungsgem\u00E4\u00DF formatiert sein.
 # 2.10 White Space Handling
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_es.properties b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_es.properties
index 108eeeb..9c4d5b0 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_es.properties
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_es.properties
@@ -145,7 +145,6 @@
         MSG_SPACE_REQUIRED_BEFORE_ROOT_ELEMENT_TYPE_IN_DOCTYPEDECL = Es necesario un espacio en blanco despu\u00E9s de "<!DOCTYPE" en la declaraci\u00F3n de tipo de documento.
         MSG_ROOT_ELEMENT_TYPE_REQUIRED = El tipo de elemento ra\u00EDz debe aparecer despu\u00E9s de "<!DOCTYPE" en la declaraci\u00F3n de tipo de documento.
         DoctypedeclUnterminated = La declaraci\u00F3n de tipo de documento para el tipo de elemento ra\u00EDz "{0}" debe finalizar en ''>''.
-        DoctypedeclNotClosed = La declaraci\u00F3n de tipo de documento para el tipo de elemento ra\u00EDz "{0}" debe finalizar en '']''.
         PEReferenceWithinMarkup = La referencia de entidad del par\u00E1metro "%{0};" no puede producirse en el marcador en el subconjunto interno del DTD.
         MSG_MARKUP_NOT_RECOGNIZED_IN_DTD = Las declaraciones de marcador que se incluyen o a las que apunta la declaraci\u00F3n de tipo de documento deben tener el formato correcto.
 # 2.10 White Space Handling
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_fr.properties b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_fr.properties
index c9c31bb..300ff03 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_fr.properties
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_fr.properties
@@ -145,7 +145,6 @@
         MSG_SPACE_REQUIRED_BEFORE_ROOT_ELEMENT_TYPE_IN_DOCTYPEDECL = Un espace est obligatoire apr\u00E8s "<!DOCTYPE" dans la d\u00E9claration de type de document.
         MSG_ROOT_ELEMENT_TYPE_REQUIRED = Le type d'\u00E9l\u00E9ment racine doit figurer apr\u00E8s "<!DOCTYPE" dans la d\u00E9claration de type de document.
         DoctypedeclUnterminated = La d\u00E9claration de type de document pour le type d''\u00E9l\u00E9ment racine "{0}" doit se terminer par ''>''.
-        DoctypedeclNotClosed = La d\u00E9claration de type de document pour le type d''\u00E9l\u00E9ment racine "{0}" doit se terminer par '']''.
         PEReferenceWithinMarkup = La r\u00E9f\u00E9rence d''entit\u00E9 de param\u00E8tre "%{0};" ne peut pas survenir dans le balisage du sous-ensemble interne de la DTD.
         MSG_MARKUP_NOT_RECOGNIZED_IN_DTD = Les d\u00E9clarations de balisage contenues dans la d\u00E9claration de type de document ou sur lesquelles pointe cette derni\u00E8re doivent avoir un format correct.
 # 2.10 White Space Handling
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_it.properties b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_it.properties
index 1cca604..fbb95d3 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_it.properties
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_it.properties
@@ -145,7 +145,6 @@
         MSG_SPACE_REQUIRED_BEFORE_ROOT_ELEMENT_TYPE_IN_DOCTYPEDECL = \u00C8 richiesto uno spazio dopo "<!DOCTYPE" nella dichiarazione del tipo di documento.
         MSG_ROOT_ELEMENT_TYPE_REQUIRED = Il tipo di elemento radice deve comparire dopo "<!DOCTYPE" nella dichiarazione del tipo di documento.
         DoctypedeclUnterminated = La dichiarazione del tipo di documento per il tipo di elemento radice "{0}" deve terminare con ''>''.
-        DoctypedeclNotClosed = La dichiarazione del tipo di documento per il tipo di elemento radice "{0}" deve terminare con '']''.
         PEReferenceWithinMarkup = Il riferimento di entit\u00E0 di parametro "%{0};" non pu\u00F2 essere presente nel markup del set secondario interno del DTD.
         MSG_MARKUP_NOT_RECOGNIZED_IN_DTD = Le dichiarazioni di markup contenute o indicate dalla dichiarazione del tipo di documento devono avere un formato corretto.
 # 2.10 White Space Handling
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_ja.properties b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_ja.properties
index 74e0594..e656dd8 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_ja.properties
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_ja.properties
@@ -145,7 +145,6 @@
         MSG_SPACE_REQUIRED_BEFORE_ROOT_ELEMENT_TYPE_IN_DOCTYPEDECL = \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u30FB\u30BF\u30A4\u30D7\u5BA3\u8A00\u3067\u306F\u3001"<!DOCTYPE"\u306E\u5F8C\u306B\u7A7A\u767D\u304C\u5FC5\u8981\u3067\u3059\u3002
         MSG_ROOT_ELEMENT_TYPE_REQUIRED = \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u30FB\u30BF\u30A4\u30D7\u5BA3\u8A00\u3067\u306F\u3001"<!DOCTYPE"\u306E\u5F8C\u306B\u30EB\u30FC\u30C8\u8981\u7D20\u30BF\u30A4\u30D7\u304C\u5FC5\u8981\u3067\u3059\u3002
         DoctypedeclUnterminated = \u30EB\u30FC\u30C8\u8981\u7D20\u30BF\u30A4\u30D7"{0}"\u306E\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u30FB\u30BF\u30A4\u30D7\u5BA3\u8A00\u306F''>''\u3067\u7D42\u4E86\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
-        DoctypedeclNotClosed = \u30EB\u30FC\u30C8\u8981\u7D20\u30BF\u30A4\u30D7"{0}"\u306E\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u30FB\u30BF\u30A4\u30D7\u5BA3\u8A00\u306F'']''\u3067\u9589\u3058\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
         PEReferenceWithinMarkup = \u30D1\u30E9\u30E1\u30FC\u30BF\u30FB\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u53C2\u7167"%{0};"\u306F\u3001DTD\u306E\u5185\u90E8\u30B5\u30D6\u30BB\u30C3\u30C8\u306E\u30DE\u30FC\u30AF\u30A2\u30C3\u30D7\u5185\u306B\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093\u3002
         MSG_MARKUP_NOT_RECOGNIZED_IN_DTD = \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u30FB\u30BF\u30A4\u30D7\u5BA3\u8A00\u306B\u542B\u307E\u308C\u308B\u304B\u3001\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u30FB\u30BF\u30A4\u30D7\u5BA3\u8A00\u304C\u6307\u3057\u3066\u3044\u308B\u30DE\u30FC\u30AF\u30A2\u30C3\u30D7\u5BA3\u8A00\u306F\u6574\u5F62\u5F0F\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
 # 2.10 White Space Handling
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_ko.properties b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_ko.properties
index e90be33..099855e 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_ko.properties
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_ko.properties
@@ -145,7 +145,6 @@
         MSG_SPACE_REQUIRED_BEFORE_ROOT_ELEMENT_TYPE_IN_DOCTYPEDECL = \uBB38\uC11C \uC720\uD615 \uC120\uC5B8\uC5D0\uC11C\uB294 "<!DOCTYPE" \uB2E4\uC74C\uC5D0 \uACF5\uBC31\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.
         MSG_ROOT_ELEMENT_TYPE_REQUIRED = \uBB38\uC11C \uC720\uD615 \uC120\uC5B8\uC5D0\uC11C\uB294 "<!DOCTYPE" \uB2E4\uC74C\uC5D0 \uB8E8\uD2B8 \uC694\uC18C \uC720\uD615\uC774 \uB098\uD0C0\uB098\uC57C \uD569\uB2C8\uB2E4.
         DoctypedeclUnterminated = \uB8E8\uD2B8 \uC694\uC18C \uC720\uD615 "{0}"\uC5D0 \uB300\uD55C \uBB38\uC11C \uC720\uD615 \uC120\uC5B8\uC740 ''>''\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4.
-        DoctypedeclNotClosed = \uB8E8\uD2B8 \uC694\uC18C \uC720\uD615 "{0}"\uC5D0 \uB300\uD55C \uBB38\uC11C \uC720\uD615 \uC120\uC5B8\uC740 '']''\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4.
         PEReferenceWithinMarkup = \uB9E4\uAC1C\uBCC0\uC218 \uC5D4\uD2F0\uD2F0 \uCC38\uC870 "%{0};"\uC740 DTD\uC758 \uB0B4\uBD80 \uBD80\uBD84 \uC9D1\uD569\uC5D0 \uC788\uB294 \uB9C8\uD06C\uC5C5 \uC548\uC5D0 \uD45C\uC2DC\uB420 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
         MSG_MARKUP_NOT_RECOGNIZED_IN_DTD = \uBB38\uC11C \uC720\uD615 \uC120\uC5B8\uC744 \uD3EC\uD568\uD558\uAC70\uB098 \uBB38\uC11C \uC720\uD615 \uC120\uC5B8\uC774 \uAC00\uB9AC\uD0A4\uB294 \uB9C8\uD06C\uC5C5 \uC120\uC5B8\uC740 \uC62C\uBC14\uB978 \uD615\uC2DD\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.
 # 2.10 White Space Handling
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_pt_BR.properties b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_pt_BR.properties
index 93ae48e..1e00587 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_pt_BR.properties
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_pt_BR.properties
@@ -145,7 +145,6 @@
         MSG_SPACE_REQUIRED_BEFORE_ROOT_ELEMENT_TYPE_IN_DOCTYPEDECL = O espa\u00E7o em branco \u00E9 necess\u00E1rio ap\u00F3s "<!DOCTYPE" na declara\u00E7\u00E3o do tipo de documento.
         MSG_ROOT_ELEMENT_TYPE_REQUIRED = O tipo de elemento-raiz deve aparecer ap\u00F3s "<!DOCTYPE" na declara\u00E7\u00E3o do tipo de documento.
         DoctypedeclUnterminated = A declara\u00E7\u00E3o do tipo de documento do tipo de elemento "{0}" deve terminar com ''>''.
-        DoctypedeclNotClosed = A declara\u00E7\u00E3o do tipo de documento do tipo de elemento "{0}" deve terminar com '']''.
         PEReferenceWithinMarkup = A refer\u00EAncia da entidade do par\u00E2metro "%{0};" n\u00E3o pode ocorrer na marca\u00E7\u00E3o no subconjunto interno do DTD.
         MSG_MARKUP_NOT_RECOGNIZED_IN_DTD = As declara\u00E7\u00F5es de marca\u00E7\u00E3o contidas ou apontadas pela declara\u00E7\u00E3o do tipo de documento devem estar corretas.
 # 2.10 White Space Handling
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_sv.properties b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_sv.properties
index 4f54e5f..add473e 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_sv.properties
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_sv.properties
@@ -145,7 +145,6 @@
         MSG_SPACE_REQUIRED_BEFORE_ROOT_ELEMENT_TYPE_IN_DOCTYPEDECL = Tomt utrymme kr\u00E4vs efter "<!DOCTYPE" i dokumenttypdeklarationen.
         MSG_ROOT_ELEMENT_TYPE_REQUIRED = Rotelementtyp m\u00E5ste anges efter "<!DOCTYPE" i dokumenttypdeklarationen.
         DoctypedeclUnterminated = Dokumenttypdeklarationen f\u00F6r rotelementtyp "{0}" m\u00E5ste avslutas med ''>''.
-        DoctypedeclNotClosed = Dokumenttypsdeklarationen f\u00F6r rotelementtypen "{0}" m\u00E5ste st\u00E4ngas med '']''.
         PEReferenceWithinMarkup = Parameterreferensen "%{0};" f\u00E5r inte f\u00F6rekomma i kodtexten i den interna delm\u00E4ngden i DTD.
         MSG_MARKUP_NOT_RECOGNIZED_IN_DTD = Kodtextdeklarationerna som finns med eller pekas till fr\u00E5n dokumenttypdeklarationen m\u00E5ste vara v\u00E4lformulerade.
 # 2.10 White Space Handling
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_zh_CN.properties b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_zh_CN.properties
index dc2e1d0..dc6bca0 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_zh_CN.properties
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_zh_CN.properties
@@ -145,7 +145,6 @@
         MSG_SPACE_REQUIRED_BEFORE_ROOT_ELEMENT_TYPE_IN_DOCTYPEDECL = \u5728\u6587\u6863\u7C7B\u578B\u58F0\u660E\u4E2D\u7684 "<!DOCTYPE" \u540E\u9762\u9700\u8981\u6709\u7A7A\u683C\u3002
         MSG_ROOT_ELEMENT_TYPE_REQUIRED = \u5728\u6587\u6863\u7C7B\u578B\u58F0\u660E\u4E2D, \u6839\u5143\u7D20\u7C7B\u578B\u5FC5\u987B\u51FA\u73B0\u5728 "<!DOCTYPE" \u540E\u9762\u3002
         DoctypedeclUnterminated = \u6839\u5143\u7D20\u7C7B\u578B "{0}" \u7684\u6587\u6863\u7C7B\u578B\u58F0\u660E\u5FC5\u987B\u4EE5 ''>'' \u7ED3\u5C3E\u3002
-        DoctypedeclNotClosed = \u6839\u5143\u7D20\u7C7B\u578B "{0}" \u7684\u6587\u6863\u7C7B\u578B\u58F0\u660E\u5FC5\u987B\u4EE5 '']'' \u7ED3\u5C3E\u3002
         PEReferenceWithinMarkup = \u53C2\u6570\u5B9E\u4F53\u5F15\u7528 "%{0};" \u4E0D\u80FD\u51FA\u73B0\u5728 DTD \u7684\u5185\u90E8\u5B50\u96C6\u4E2D\u7684\u6807\u8BB0\u5185\u3002
         MSG_MARKUP_NOT_RECOGNIZED_IN_DTD = \u6587\u6863\u7C7B\u578B\u58F0\u660E\u5305\u542B\u6216\u6307\u5411\u7684\u6807\u8BB0\u58F0\u660E\u5FC5\u987B\u683C\u5F0F\u6B63\u786E\u3002
 # 2.10 White Space Handling
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_zh_TW.properties b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_zh_TW.properties
index 80e01f2..9d22569 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_zh_TW.properties
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_zh_TW.properties
@@ -145,7 +145,6 @@
         MSG_SPACE_REQUIRED_BEFORE_ROOT_ELEMENT_TYPE_IN_DOCTYPEDECL = \u5728\u6587\u4EF6\u985E\u578B\u5BA3\u544A\u4E2D "<!DOCTYPE" \u4E4B\u5F8C\u9700\u8981\u7A7A\u683C\u3002
         MSG_ROOT_ELEMENT_TYPE_REQUIRED = \u5728\u6587\u4EF6\u985E\u578B\u5BA3\u544A\u4E2D\uFF0C\u6839\u5143\u7D20\u985E\u578B\u5FC5\u9808\u51FA\u73FE\u5728 "<!DOCTYPE" \u4E4B\u5F8C\u3002
         DoctypedeclUnterminated = \u6839\u5143\u7D20\u985E\u578B "{0}" \u7684\u6587\u4EF6\u985E\u578B\u5BA3\u544A\u7D50\u5C3E\u5FC5\u9808\u70BA ''>''\u3002
-        DoctypedeclNotClosed = \u6839\u5143\u7D20\u985E\u578B "{0}" \u7684\u6587\u4EF6\u985E\u578B\u5BA3\u544A\u7D50\u5C3E\u5FC5\u9808\u70BA '']''\u3002
         PEReferenceWithinMarkup = DTD \u5167\u90E8\u5B57\u96C6\u7684\u6A19\u8A18\u5167\u4E0D\u80FD\u51FA\u73FE\u53C3\u6578\u5BE6\u9AD4\u53C3\u7167 "%{0};"\u3002
         MSG_MARKUP_NOT_RECOGNIZED_IN_DTD = \u6587\u4EF6\u985E\u578B\u5BA3\u544A\u5305\u542B\u6216\u6307\u5411\u7684\u6A19\u8A18\u5BA3\u544A\u5FC5\u9808\u683C\u5F0F\u6B63\u78BA\u3002
 # 2.10 White Space Handling
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java
index 84543ec..dac7fbf 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2671,9 +2671,6 @@
             customTimezoneId.append(sign);
             customTimezoneId.append(hour);
             if (minutes != 0) {
-                if (minutes < 10) {
-                    customTimezoneId.append('0');
-                }
                 customTimezoneId.append(minutes);
             }
             result = TimeZone.getTimeZone(customTimezoneId.toString());
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/util/HTTPInputSource.java b/jaxp/src/com/sun/org/apache/xerces/internal/util/HTTPInputSource.java
index c9bbed9..bdd0750 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/util/HTTPInputSource.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/util/HTTPInputSource.java
@@ -1,16 +1,15 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * reserved comment block
+ * DO NOT REMOVE OR ALTER!
  */
-
 /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
+ * Copyright 2004,2005 The Apache Software Foundation.
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -18,17 +17,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.sun.org.apache.xerces.internal.util;
 
-import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
-import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
 import java.io.InputStream;
 import java.io.Reader;
+
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 
+import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
+import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
+
 /**
  * This class represents an input source for an XML resource
  * retrievable over HTTP. In addition to the properties
diff --git a/jaxp/src/com/sun/org/apache/xml/internal/serialize/DOMSerializerImpl.java b/jaxp/src/com/sun/org/apache/xml/internal/serialize/DOMSerializerImpl.java
index 8f14d74..d17cf33 100644
--- a/jaxp/src/com/sun/org/apache/xml/internal/serialize/DOMSerializerImpl.java
+++ b/jaxp/src/com/sun/org/apache/xml/internal/serialize/DOMSerializerImpl.java
@@ -33,7 +33,6 @@
 import java.util.StringTokenizer;
 import java.util.Vector;
 
-import com.sun.org.apache.xerces.internal.dom.AbortException;
 import com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl;
 import com.sun.org.apache.xerces.internal.dom.DOMErrorImpl;
 import com.sun.org.apache.xerces.internal.dom.DOMLocatorImpl;
@@ -118,6 +117,7 @@
     private DOMErrorHandler fErrorHandler = null;
     private final DOMErrorImpl fError = new DOMErrorImpl();
     private final DOMLocatorImpl fLocator = new DOMLocatorImpl();
+    private static final RuntimeException abort = new RuntimeException();
 
     /**
      * Constructs a new LSSerializer.
@@ -539,9 +539,11 @@
         } catch (LSException lse) {
             // Rethrow LSException.
             throw lse;
-        } catch (AbortException e) {
-            return null;
         } catch (RuntimeException e) {
+            if (e == DOMNormalizer.abort){
+                // stopped at user request
+                return null;
+            }
             throw (LSException) new LSException(LSException.SERIALIZE_ERR, e.toString()).initCause(e);
         } catch (IOException ioe) {
             // REVISIT: A generic IOException doesn't provide enough information
@@ -834,9 +836,11 @@
         } catch (LSException lse) {
             // Rethrow LSException.
             throw lse;
-        } catch (AbortException e) {
-            return false;
         } catch (RuntimeException e) {
+            if (e == DOMNormalizer.abort){
+                // stopped at user request
+                return false;
+            }
             throw (LSException) DOMUtil.createLSException(LSException.SERIALIZE_ERR, e).fillInStackTrace();
         } catch (Exception e) {
             if (ser.fDOMErrorHandler != null) {
@@ -988,9 +992,11 @@
         } catch (LSException lse) {
             // Rethrow LSException.
             throw lse;
-        } catch (AbortException e) {
-            return false;
         } catch (RuntimeException e) {
+            if (e == DOMNormalizer.abort){
+                // stopped at user request
+                return false;
+            }
             throw (LSException) DOMUtil.createLSException(LSException.SERIALIZE_ERR, e).fillInStackTrace();
         } catch (Exception e) {
             if (ser.fDOMErrorHandler != null) {
diff --git a/jaxws/ASSEMBLY_EXCEPTION b/jaxws/ASSEMBLY_EXCEPTION
index 065b8d9..8b7ac1d 100644
--- a/jaxws/ASSEMBLY_EXCEPTION
+++ b/jaxws/ASSEMBLY_EXCEPTION
@@ -1,27 +1,27 @@
 
 OPENJDK ASSEMBLY EXCEPTION
 
-The OpenJDK source code made available by Oracle America, Inc. (Oracle) at
-openjdk.java.net ("OpenJDK Code") is distributed under the terms of the GNU
-General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
+The OpenJDK source code made available by Sun at openjdk.java.net and
+openjdk.dev.java.net ("OpenJDK Code") is distributed under the terms of the
+GNU General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
 only ("GPL2"), with the following clarification and special exception.
 
     Linking this OpenJDK Code statically or dynamically with other code
     is making a combined work based on this library.  Thus, the terms
     and conditions of GPL2 cover the whole combination.
 
-    As a special exception, Oracle gives you permission to link this
-    OpenJDK Code with certain code licensed by Oracle as indicated at
+    As a special exception, Sun gives you permission to link this
+    OpenJDK Code with certain code licensed by Sun as indicated at
     http://openjdk.java.net/legal/exception-modules-2007-05-08.html
     ("Designated Exception Modules") to produce an executable,
     regardless of the license terms of the Designated Exception Modules,
     and to copy and distribute the resulting executable under GPL2,
     provided that the Designated Exception Modules continue to be
-    governed by the licenses under which they were offered by Oracle.
+    governed by the licenses under which they were offered by Sun.
 
-As such, it allows licensees and sublicensees of Oracle's GPL2 OpenJDK Code
-to build an executable that includes those portions of necessary code that
-Oracle could not provide under GPL2 (or that Oracle has provided under GPL2
-with the Classpath exception).  If you modify or add to the OpenJDK code,
-that new GPL2 code may still be combined with Designated Exception Modules
-if the new code is made subject to this exception by its copyright holder.
+As such, it allows licensees and sublicensees of Sun's GPL2 OpenJDK Code to
+build an executable that includes those portions of necessary code that Sun
+could not provide under GPL2 (or that Sun has provided under GPL2 with the
+Classpath exception).  If you modify or add to the OpenJDK code, that new
+GPL2 code may still be combined with Designated Exception Modules if the
+new code is made subject to this exception by its copyright holder.
diff --git a/jaxws/LICENSE b/jaxws/LICENSE
index 8b400c7..b40a0f4 100644
--- a/jaxws/LICENSE
+++ b/jaxws/LICENSE
@@ -3,7 +3,7 @@
 Version 2, June 1991
 
 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
 Everyone is permitted to copy and distribute verbatim copies of this license
 document, but changing it is not allowed.
@@ -287,8 +287,8 @@
     more details.
 
     You should have received a copy of the GNU General Public License along
-    with this program; if not, write to the Free Software Foundation, Inc.,
-    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+    with this program; if not, write to the Free Software Foundation, Inc., 59
+    Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
 Also add information on how to contact you by electronic and paper mail.
 
diff --git a/jdk/ASSEMBLY_EXCEPTION b/jdk/ASSEMBLY_EXCEPTION
index 065b8d9..8b7ac1d 100644
--- a/jdk/ASSEMBLY_EXCEPTION
+++ b/jdk/ASSEMBLY_EXCEPTION
@@ -1,27 +1,27 @@
 
 OPENJDK ASSEMBLY EXCEPTION
 
-The OpenJDK source code made available by Oracle America, Inc. (Oracle) at
-openjdk.java.net ("OpenJDK Code") is distributed under the terms of the GNU
-General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
+The OpenJDK source code made available by Sun at openjdk.java.net and
+openjdk.dev.java.net ("OpenJDK Code") is distributed under the terms of the
+GNU General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
 only ("GPL2"), with the following clarification and special exception.
 
     Linking this OpenJDK Code statically or dynamically with other code
     is making a combined work based on this library.  Thus, the terms
     and conditions of GPL2 cover the whole combination.
 
-    As a special exception, Oracle gives you permission to link this
-    OpenJDK Code with certain code licensed by Oracle as indicated at
+    As a special exception, Sun gives you permission to link this
+    OpenJDK Code with certain code licensed by Sun as indicated at
     http://openjdk.java.net/legal/exception-modules-2007-05-08.html
     ("Designated Exception Modules") to produce an executable,
     regardless of the license terms of the Designated Exception Modules,
     and to copy and distribute the resulting executable under GPL2,
     provided that the Designated Exception Modules continue to be
-    governed by the licenses under which they were offered by Oracle.
+    governed by the licenses under which they were offered by Sun.
 
-As such, it allows licensees and sublicensees of Oracle's GPL2 OpenJDK Code
-to build an executable that includes those portions of necessary code that
-Oracle could not provide under GPL2 (or that Oracle has provided under GPL2
-with the Classpath exception).  If you modify or add to the OpenJDK code,
-that new GPL2 code may still be combined with Designated Exception Modules
-if the new code is made subject to this exception by its copyright holder.
+As such, it allows licensees and sublicensees of Sun's GPL2 OpenJDK Code to
+build an executable that includes those portions of necessary code that Sun
+could not provide under GPL2 (or that Sun has provided under GPL2 with the
+Classpath exception).  If you modify or add to the OpenJDK code, that new
+GPL2 code may still be combined with Designated Exception Modules if the
+new code is made subject to this exception by its copyright holder.
diff --git a/jdk/LICENSE b/jdk/LICENSE
index 8b400c7..b40a0f4 100644
--- a/jdk/LICENSE
+++ b/jdk/LICENSE
@@ -3,7 +3,7 @@
 Version 2, June 1991
 
 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
 Everyone is permitted to copy and distribute verbatim copies of this license
 document, but changing it is not allowed.
@@ -287,8 +287,8 @@
     more details.
 
     You should have received a copy of the GNU General Public License along
-    with this program; if not, write to the Free Software Foundation, Inc.,
-    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+    with this program; if not, write to the Free Software Foundation, Inc., 59
+    Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
 Also add information on how to contact you by electronic and paper mail.
 
diff --git a/jdk/make/CopyFiles.gmk b/jdk/make/CopyFiles.gmk
index bc070f0..9c7e7bc 100644
--- a/jdk/make/CopyFiles.gmk
+++ b/jdk/make/CopyFiles.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -357,21 +357,18 @@
 RESTRICTED_PKGS_SRC := $(JDK_TOPDIR)/src/closed/share/lib/security/restricted.pkgs
 RESTRICTED_PKGS := $(shell $(CAT) $(RESTRICTED_PKGS_SRC) | $(TR) "\n" " ")
 
-endif
-
 $(PROPS_DST): $(PROPS_SRC)
 	$(MKDIR) -p $(@D)
-        ifndef OPENJDK
-	  $(TOOL_ADDTORESTRICTEDPKGS) $^ $@.tmp $(RESTRICTED_PKGS)
-        else
-	  $(CP) $^ $@.tmp
-        endif
-        ifeq ($(UNLIMITED_CRYPTO), true)
-	  $(TOOL_CRYPTOLEVEL) $@.tmp $@.tmp2 unlimited
-	  $(MV) $@.tmp2 $@.tmp
-        endif
+	$(TOOL_ADDTORESTRICTEDPKGS) $^ $@.tmp $(RESTRICTED_PKGS)
 	$(MV) $@.tmp $@
 
+else
+
+$(PROPS_DST): $(PROPS_SRC)
+	$(call install-file)
+
+endif
+
 COPY_FILES += $(PROPS_DST)
 
 ##########################################################################################
diff --git a/jdk/make/CreateSecurityJars.gmk b/jdk/make/CreateSecurityJars.gmk
index da9cc20..d5b3b8e 100644
--- a/jdk/make/CreateSecurityJars.gmk
+++ b/jdk/make/CreateSecurityJars.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -178,10 +178,7 @@
 
 ##########################################################################################
 
-US_EXPORT_POLICY_JAR_UNLIMITED_DST := \
-    $(JDK_OUTPUTDIR)/lib/security/policy/unlimited/US_export_policy.jar
-US_EXPORT_POLICY_JAR_LIMITED_DST := \
-    $(JDK_OUTPUTDIR)/lib/security/policy/limited/US_export_policy.jar
+US_EXPORT_POLICY_JAR_DST := $(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar
 
 ifneq ($(BUILD_CRYPTO), no)
 
@@ -223,29 +220,27 @@
 endif
 
 ifndef OPENJDK
-  $(US_EXPORT_POLICY_JAR_UNLIMITED_DST): \
-    $(JDK_TOPDIR)/make/closed/tools/crypto/jce/unlimited/US_export_policy.jar
-	$(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
-	$(install-file)
-  $(US_EXPORT_POLICY_JAR_LIMITED_DST): \
-    $(JDK_TOPDIR)/make/closed/tools/crypto/jce/limited/US_export_policy.jar
+  ifeq ($(UNLIMITED_CRYPTO), true)
+    $(error No prebuilt unlimited crypto jars available)
+  endif
+  $(US_EXPORT_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/US_export_policy.jar
 	$(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
 	$(install-file)
 else
-  $(US_EXPORT_POLICY_JAR_UNLIMITED_DST): $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED)
+  ifeq ($(UNLIMITED_CRYPTO), true)
+    $(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED)
 	$(install-file)
-  $(US_EXPORT_POLICY_JAR_LIMITED_DST): $(US_EXPORT_POLICY_JAR_LIMITED_UNSIGNED)
+  else
+    $(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_LIMITED_UNSIGNED)
 	$(install-file)
   endif
+endif
 
-TARGETS += $(US_EXPORT_POLICY_JAR_UNLIMITED_DST) $(US_EXPORT_POLICY_JAR_LIMITED_DST)
+TARGETS += $(US_EXPORT_POLICY_JAR_DST)
 
 ##########################################################################################
 
-LOCAL_POLICY_JAR_LIMITED_DST := \
-    $(JDK_OUTPUTDIR)/lib/security/policy/limited/local_policy.jar
-LOCAL_POLICY_JAR_UNLIMITED_DST := \
-    $(JDK_OUTPUTDIR)/lib/security/policy/unlimited/local_policy.jar
+LOCAL_POLICY_JAR_DST := $(JDK_OUTPUTDIR)/lib/security/local_policy.jar
 
 ifneq ($(BUILD_CRYPTO), no)
 
@@ -298,20 +293,20 @@
 endif
 
 ifndef OPENJDK
-  $(LOCAL_POLICY_JAR_UNLIMITED_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/unlimited/local_policy.jar
-	$(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
-	$(install-file)
-  $(LOCAL_POLICY_JAR_LIMITED_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/limited/local_policy.jar
+  $(LOCAL_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/local_policy.jar
 	$(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
 	$(install-file)
 else
-  $(LOCAL_POLICY_JAR_UNLIMITED_DST): $(LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED)
+  ifeq ($(UNLIMITED_CRYPTO), true)
+    $(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED)
 	$(install-file)
-  $(LOCAL_POLICY_JAR_LIMITED_DST): $(LOCAL_POLICY_JAR_LIMITED_UNSIGNED)
+  else
+    $(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_LIMITED_UNSIGNED)
 	$(install-file)
   endif
+endif
 
-TARGETS += $(LOCAL_POLICY_JAR_UNLIMITED_DST) $(LOCAL_POLICY_JAR_LIMITED_DST)
+TARGETS += $(LOCAL_POLICY_JAR_DST)
 
 ##########################################################################################
 
diff --git a/jdk/make/Tools.gmk b/jdk/make/Tools.gmk
index afb9f86..b45d5dc 100644
--- a/jdk/make/Tools.gmk
+++ b/jdk/make/Tools.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -132,10 +132,7 @@
     build.tools.deps.CheckDeps
 
 TOOL_ADDTORESTRICTEDPKGS=$(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
-    build.tools.customizesecurityfile.AddToRestrictedPkgs
-
-TOOL_CRYPTOLEVEL=$(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
-    build.tools.customizesecurityfile.CryptoLevel
+    build.tools.addtorestrictedpkgs.AddToRestrictedPkgs
 
 ##########################################################################################
 
diff --git a/jdk/make/data/tzdata/VERSION b/jdk/make/data/tzdata/VERSION
index f587cb7..6bf3661 100644
--- a/jdk/make/data/tzdata/VERSION
+++ b/jdk/make/data/tzdata/VERSION
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2016g
+tzdata2016f
diff --git a/jdk/make/data/tzdata/africa b/jdk/make/data/tzdata/africa
index cbde238..b523dc3 100644
--- a/jdk/make/data/tzdata/africa
+++ b/jdk/make/data/tzdata/africa
@@ -487,7 +487,7 @@
 # http://www.libyaherald.com/2013/10/24/correction-no-time-change-tomorrow/
 #
 # From Paul Eggert (2013-10-25):
-# For now, assume they're reverting to the pre-2012 rules of permanent UT +02.
+# For now, assume they're reverting to the pre-2012 rules of permanent UTC+2.
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Libya	1951	only	-	Oct	14	2:00	1:00	S
diff --git a/jdk/make/data/tzdata/antarctica b/jdk/make/data/tzdata/antarctica
index f96947a..e12c764 100644
--- a/jdk/make/data/tzdata/antarctica
+++ b/jdk/make/data/tzdata/antarctica
@@ -33,7 +33,9 @@
 # http://www.spri.cam.ac.uk/bob/periant.htm
 # for information.
 # Unless otherwise specified, we have no time zone information.
-
+#
+# Except for the French entries,
+# I made up all time zone abbreviations mentioned here; corrections welcome!
 # FORMAT is '-00' and GMTOFF is 0 for locations while uninhabited.
 
 # Argentina - year-round bases
@@ -50,7 +52,7 @@
 #	previously sealers and scientific personnel wintered
 #	Margaret Turner reports
 #	http://web.archive.org/web/20021204222245/http://www.dstc.qut.edu.au/DST/marg/daylight.html
-#	(1999-09-30) that they're UT +05, with no DST;
+#	(1999-09-30) that they're UTC+5, with no DST;
 #	presumably this is when they have visitors.
 #
 # year-round bases
@@ -89,22 +91,23 @@
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Antarctica/Casey	0	-	-00	1969
-			8:00	-	+08	2009 Oct 18  2:00
-			11:00	-	+11	2010 Mar  5  2:00
-			8:00	-	+08	2011 Oct 28  2:00
-			11:00	-	+11	2012 Feb 21 17:00u
-			8:00	-	+08
+			8:00	-	AWST	2009 Oct 18  2:00
+						# Australian Western Std Time
+			11:00	-	CAST	2010 Mar  5  2:00  # Casey Time
+			8:00	-	AWST	2011 Oct 28  2:00
+			11:00	-	CAST	2012 Feb 21 17:00u
+			8:00	-	AWST
 Zone Antarctica/Davis	0	-	-00	1957 Jan 13
-			7:00	-	+07	1964 Nov
+			7:00	-	DAVT	1964 Nov    # Davis Time
 			0	-	-00	1969 Feb
-			7:00	-	+07	2009 Oct 18  2:00
-			5:00	-	+05	2010 Mar 10 20:00u
-			7:00	-	+07	2011 Oct 28  2:00
-			5:00	-	+05	2012 Feb 21 20:00u
-			7:00	-	+07
+			7:00	-	DAVT	2009 Oct 18  2:00
+			5:00	-	DAVT	2010 Mar 10 20:00u
+			7:00	-	DAVT	2011 Oct 28  2:00
+			5:00	-	DAVT	2012 Feb 21 20:00u
+			7:00	-	DAVT
 Zone Antarctica/Mawson	0	-	-00	1954 Feb 13
-			6:00	-	+06	2009 Oct 18  2:00
-			5:00	-	+05
+			6:00	-	MAWT	2009 Oct 18  2:00 # Mawson Time
+			5:00	-	MAWT
 # References:
 # Casey Weather (1998-02-26)
 # http://www.antdiv.gov.au/aad/exop/sfo/casey/casey_aws.html
@@ -158,7 +161,7 @@
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Indian/Kerguelen	0	-	-00	1950 # Port-aux-Français
-			5:00	-	+05
+			5:00	-	TFT	# ISO code TF Time
 #
 # year-round base in the main continent
 # Dumont d'Urville, Île des Pétrels, -6640+14001, since 1956-11
@@ -169,9 +172,9 @@
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Antarctica/DumontDUrville 0 -	-00	1947
-			10:00	-	+10	1952 Jan 14
+			10:00	-	PMT	1952 Jan 14 # Port-Martin Time
 			0	-	-00	1956 Nov
-			10:00	-	+10
+			10:00	-	DDUT	# Dumont-d'Urville Time
 
 # France & Italy - year-round base
 # Concordia, -750600+1232000, since 2005
@@ -197,7 +200,7 @@
 # station of Japan, it's appropriate for the principal location.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Antarctica/Syowa	0	-	-00	1957 Jan 29
-			3:00	-	+03
+			3:00	-	SYOT	# Syowa Time
 # See:
 # NIPR Antarctic Research Activities (1999-08-17)
 # http://www.nipr.ac.jp/english/ara01.html
@@ -234,17 +237,17 @@
 # correct, but they should be quite close to the actual dates.
 #
 # From Paul Eggert (2014-03-21):
-# The CET-switching Troll rules require zic from tz 2014b or later, so as
+# The CET-switching Troll rules require zic from tzcode 2014b or later, so as
 # suggested by Bengt-Inge Larsson comment them out for now, and approximate
 # with only UTC and CEST.  Uncomment them when 2014b is more prevalent.
 #
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
-#Rule	Troll	2005	max	-	Mar	 1	1:00u	1:00	+01
-Rule	Troll	2005	max	-	Mar	lastSun	1:00u	2:00	+02
-#Rule	Troll	2005	max	-	Oct	lastSun	1:00u	1:00	+01
-#Rule	Troll	2004	max	-	Nov	 7	1:00u	0:00	+00
+#Rule	Troll	2005	max	-	Mar	 1	1:00u	1:00	CET
+Rule	Troll	2005	max	-	Mar	lastSun	1:00u	2:00	CEST
+#Rule	Troll	2005	max	-	Oct	lastSun	1:00u	1:00	CET
+#Rule	Troll	2004	max	-	Nov	 7	1:00u	0:00	UTC
 # Remove the following line when uncommenting the above '#Rule' lines.
-Rule	Troll	2004	max	-	Oct	lastSun	1:00u	0:00	+00
+Rule	Troll	2004	max	-	Oct	lastSun	1:00u	0:00	UTC
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Antarctica/Troll	0	-	-00	2005 Feb 12
 			0:00	Troll	%s
@@ -285,10 +288,10 @@
 # changes during the year and does not necessarily correspond to mean
 # solar noon.  So the Vostok time might have been whatever the clocks
 # happened to be during their visit.  So we still don't really know what time
-# it is at Vostok.  But we'll guess +06.
+# it is at Vostok.  But we'll guess UTC+6.
 #
 Zone Antarctica/Vostok	0	-	-00	1957 Dec 16
-			6:00	-	+06
+			6:00	-	VOST	# Vostok time
 
 # S Africa - year-round bases
 # Marion Island, -4653+03752
@@ -321,7 +324,7 @@
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Antarctica/Rothera	0	-	-00	1976 Dec  1
-			-3:00	-	-03
+			-3:00	-	ROTT	# Rothera time
 
 # Uruguay - year round base
 # Artigas, King George Island, -621104-0585107
diff --git a/jdk/make/data/tzdata/asia b/jdk/make/data/tzdata/asia
index 65e5f94..35ac37c 100644
--- a/jdk/make/data/tzdata/asia
+++ b/jdk/make/data/tzdata/asia
@@ -139,11 +139,13 @@
 # http://www.worldtimezone.com/dst_news/dst_news_armenia03.html
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Yerevan	2:58:00 -	LMT	1924 May  2
-			3:00	-	+03	1957 Mar
-			4:00 RussiaAsia +04/+05	1991 Mar 31  2:00s
-			3:00 RussiaAsia	+03/+04	1995 Sep 24  2:00s
-			4:00	-	+04	1997
-			4:00 RussiaAsia	+04/+05
+			3:00	-	YERT	1957 Mar    # Yerevan Time
+			4:00 RussiaAsia YER%sT	1991 Mar 31  2:00s
+			3:00	1:00	YERST	1991 Sep 23 # independence
+			3:00 RussiaAsia	AM%sT	1995 Sep 24  2:00s
+			4:00	-	AMT	1997
+			4:00 RussiaAsia	AM%sT	2012 Feb  9
+			4:00	-	AMT
 
 # Azerbaijan
 
@@ -164,12 +166,13 @@
 Rule	Azer	1997	2015	-	Oct	lastSun	 5:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Baku	3:19:24 -	LMT	1924 May  2
-			3:00	-	+03	1957 Mar
-			4:00 RussiaAsia +04/+05	1991 Mar 31  2:00s
-			3:00 RussiaAsia	+03/+04	1992 Sep lastSun  2:00s
-			4:00	-	+04	1996
-			4:00	EUAsia	+04/+05	1997
-			4:00	Azer	+04/+05
+			3:00	-	BAKT	1957 Mar    # Baku Time
+			4:00 RussiaAsia BAK%sT	1991 Mar 31  2:00s
+			3:00	1:00	BAKST	1991 Aug 30 # independence
+			3:00 RussiaAsia	AZ%sT	1992 Sep lastSun  2:00s
+			4:00	-	AZT	1996     # Azerbaijan Time
+			4:00	EUAsia	AZ%sT	1997
+			4:00	Azer	AZ%sT
 
 # Bahrain
 # See Asia/Qatar.
@@ -288,7 +291,7 @@
 # Milne says 6:24:40 was the meridian of the time ball observatory at Rangoon.
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Yangon	6:24:40 -	LMT	1880        # or Rangoon
+Zone	Asia/Rangoon	6:24:40 -	LMT	1880        # or Yangon
 			6:24:40	-	RMT	1920        # Rangoon Mean Time?
 			6:30	-	BURT	1942 May    # Burma Time
 			9:00	-	JST	1945 May  3
@@ -403,7 +406,7 @@
 # Lewiston (ME) Daily Sun (1939-05-29), p 17, said "Even the time is
 # different - the occupied districts going by Tokyo time, an hour
 # ahead of that prevailing in the rest of Shanghai."  Guess that the
-# Xujiahui Observatory was under French control and stuck with UT +08.
+# Xujiahui Observatory was under French control and stuck with UT+8.
 #
 # In earlier versions of this file, China had many separate Zone entries, but
 # this was based on what were apparently incorrect data in Shanks & Pottenger.
@@ -412,26 +415,26 @@
 # Proposed in 1918 and theoretically in effect until 1949 (although in practice
 # mainly observed in coastal areas), the five zones were:
 #
-# Changbai Time ("Long-white Time", Long-white = Heilongjiang area) UT +08:30
+# Changbai Time ("Long-white Time", Long-white = Heilongjiang area) UT+8.5
 # Asia/Harbin (currently a link to Asia/Shanghai)
 # Heilongjiang (except Mohe county), Jilin
 #
-# Zhongyuan Time ("Central plain Time") UT +08
+# Zhongyuan Time ("Central plain Time") UT+8
 # Asia/Shanghai
 # most of China
 # This currently represents most other zones as well,
 # as apparently these regions have been the same since 1970.
 # Milne gives 8:05:43.2 for Xujiahui Observatory time; round to nearest.
-# Guo says Shanghai switched to UT +08 "from the end of the 19th century".
+# Guo says Shanghai switched to UT+8 "from the end of the 19th century".
 #
-# Long-shu Time (probably due to Long and Shu being two names of the area) UT +07
+# Long-shu Time (probably due to Long and Shu being two names of that area) UT+7
 # Asia/Chongqing (currently a link to Asia/Shanghai)
 # Guangxi, Guizhou, Hainan, Ningxia, Sichuan, Shaanxi, and Yunnan;
 # most of Gansu; west Inner Mongolia; west Qinghai; and the Guangdong
 # counties Deqing, Enping, Kaiping, Luoding, Taishan, Xinxing,
 # Yangchun, Yangjiang, Yu'nan, and Yunfu.
 #
-# Xin-zang Time ("Xinjiang-Tibet Time") UT +06
+# Xin-zang Time ("Xinjiang-Tibet Time") UT+6
 # Asia/Urumqi
 # This currently represents Kunlun Time as well,
 # as apparently the two regions have been the same since 1970.
@@ -444,7 +447,7 @@
 # Shihezi, Changji, Yanqi, Heshuo, Tuokexun, Tulufan, Shanshan, Hami,
 # Fukang, Kuitun, Kumukuli, Miquan, Qitai, and Turfan.
 #
-# Kunlun Time UT +05:30
+# Kunlun Time UT+5.5
 # Asia/Kashgar (currently a link to Asia/Urumqi)
 # West Tibet, including Pulan, Aheqi, Shufu, Shule;
 # West Xinjiang, including Aksu, Atushi, Yining, Hetian, Cele, Luopu, Nileke,
@@ -460,7 +463,7 @@
 #
 # On the other hand, ethnic Uyghurs, who make up about half the
 # population of Xinjiang, typically use "Xinjiang time" which is two
-# hours behind Beijing time, or UT +06. The government of the Xinjiang
+# hours behind Beijing time, or UTC +0600. The government of the Xinjiang
 # Uyghur Autonomous Region, (XAUR, or just Xinjiang for short) as well as
 # local governments such as the Ürümqi city government use both times in
 # publications, referring to what is popularly called Xinjiang time as
@@ -516,8 +519,8 @@
 # having the same time as Beijing.
 
 # From Paul Eggert (2014-06-30):
-# In the early days of the PRC, Tibet was given its own time zone (UT +06)
-# but this was withdrawn in 1959 and never reinstated; see Tubten Khétsun,
+# In the early days of the PRC, Tibet was given its own time zone (UT+6) but
+# this was withdrawn in 1959 and never reinstated; see Tubten Khétsun,
 # Memories of life in Lhasa under Chinese Rule, Columbia U Press, ISBN
 # 978-0231142861 (2008), translator's introduction by Matthew Akester, p x.
 # As this is before our 1970 cutoff, Tibet doesn't need a separate zone.
@@ -531,12 +534,12 @@
 # Republics, the Soviet Union, the Kuomintang, and the People's Republic of
 # China, and tracking down all these organizations' timekeeping rules would be
 # quite a trick.  Approximate this lost history by a transition from LMT to
-# UT +06 at the start of 1928, the year of accession of the warlord Jin Shuren,
+# XJT at the start of 1928, the year of accession of the warlord Jin Shuren,
 # which happens to be the date given by Shanks & Pottenger (no doubt as a
-# guess) as the transition from LMT.  Ignore the usage of +08 before
-# 1986-02-01 under the theory that the transition date to +08 is unknown and
+# guess) as the transition from LMT.  Ignore the usage of UT+8 before
+# 1986-02-01 under the theory that the transition date to UT+8 is unknown and
 # that the sort of users who prefer Asia/Urumqi now typically ignored the
-# +08 mandate back then.
+# UT+8 mandate back then.
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 # Beijing time, used throughout China; represented by Shanghai.
@@ -741,7 +744,7 @@
 # be found from historical government announcement database.
 
 # From Paul Eggert (2014-07-03):
-# As per Yu-Cheng Chuang, say that Taiwan was at UT +09 from 1937-10-01
+# As per Yu-Cheng Chuang, say that Taiwan was at UT+9 from 1937-10-01
 # until 1945-09-21 at 01:00, overriding Shanks & Pottenger.
 # Likewise, use Yu-Cheng Chuang's data for DST in Taiwan.
 
@@ -855,15 +858,16 @@
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Tbilisi	2:59:11 -	LMT	1880
 			2:59:11	-	TBMT	1924 May  2 # Tbilisi Mean Time
-			3:00	-	+03	1957 Mar
-			4:00 RussiaAsia +04/+05	1991 Mar 31  2:00s
-			3:00 RussiaAsia +03/+04	1992
-			3:00 E-EurAsia	+03/+04	1994 Sep lastSun
-			4:00 E-EurAsia	+04/+05	1996 Oct lastSun
-			4:00	1:00	+05	1997 Mar lastSun
-			4:00 E-EurAsia	+04/+05	2004 Jun 27
-			3:00 RussiaAsia	+03/+04	2005 Mar lastSun  2:00
-			4:00	-	+04
+			3:00	-	TBIT	1957 Mar    # Tbilisi Time
+			4:00 RussiaAsia TBI%sT	1991 Mar 31  2:00s
+			3:00	1:00	TBIST	1991 Apr  9 # independence
+			3:00 RussiaAsia GE%sT	1992        # Georgia Time
+			3:00 E-EurAsia	GE%sT	1994 Sep lastSun
+			4:00 E-EurAsia	GE%sT	1996 Oct lastSun
+			4:00	1:00	GEST	1997 Mar lastSun
+			4:00 E-EurAsia	GE%sT	2004 Jun 27
+			3:00 RussiaAsia	GE%sT	2005 Mar lastSun  2:00
+			4:00	-	GET
 
 # East Timor
 
@@ -940,7 +944,7 @@
 # These would be the earliest possible times for a change.
 # Régimes horaires pour le monde entier, by Henri Le Corre, (Éditions
 # Traditionnelles, 1987, Paris) says that Java and Madura switched
-# from UT +09 to +07:30 on 1945-09-23, and gives 1944-09-01 for Jayapura
+# from JST to UTC+07:30 on 1945-09-23, and gives 1944-09-01 for Jayapura
 # (Hollandia).  For now, assume all Indonesian locations other than Jayapura
 # switched on 1945-09-23.
 #
@@ -951,11 +955,11 @@
 # summary published by the Time and Frequency Laboratory of the
 # Research Center for Calibration, Instrumentation and Metrology,
 # Indonesia, <http://time.kim.lipi.go.id/time-eng.php> (2006-09-29).
-# The time zone abbreviations and UT offsets are:
+# The abbreviations are:
 #
-# WIB  - +07 - Waktu Indonesia Barat (Indonesia western time)
-# WITA - +08 - Waktu Indonesia Tengah (Indonesia central time)
-# WIT  - +09 - Waktu Indonesia Timur (Indonesia eastern time)
+# WIB  - UTC+7 - Waktu Indonesia Barat (Indonesia western time)
+# WITA - UTC+8 - Waktu Indonesia Tengah (Indonesia central time)
+# WIT  - UTC+9 - Waktu Indonesia Timur (Indonesia eastern time)
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 # Java, Sumatra
@@ -1844,11 +1848,11 @@
 Rule	Kyrgyz	1997	2004	-	Oct	lastSun	2:30	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Bishkek	4:58:24 -	LMT	1924 May  2
-			5:00	-	+05	1930 Jun 21
-			6:00 RussiaAsia +06/+07	1991 Mar 31  2:00s
-			5:00 RussiaAsia	+05/+06	1991 Aug 31  2:00
-			5:00	Kyrgyz	+05/+06	2005 Aug 12
-			6:00	-	+06
+			5:00	-	FRUT	1930 Jun 21 # Frunze Time
+			6:00 RussiaAsia FRU%sT	1991 Mar 31  2:00s
+			5:00	1:00	FRUST	1991 Aug 31  2:00 # independence
+			5:00	Kyrgyz	KG%sT	2005 Aug 12 # Kyrgyzstan Time
+			6:00	-	KGT
 
 ###############################################################################
 
@@ -1887,24 +1891,25 @@
 Rule	ROK	1987	1988	-	May	Sun>=8	2:00	1:00	D
 Rule	ROK	1987	1988	-	Oct	Sun>=8	3:00	0	S
 
-# From Paul Eggert (2016-08-23):
+# From Paul Eggert (2014-10-30):
 # The Korean Wikipedia entry gives the following sources for UT offsets:
 #
-# 1908: Official Journal Article No. 3994 (decree No. 5)
+# 1908: Official Journal Article No. 3994 (Edict No. 5)
 # 1912: Governor-General of Korea Official Gazette Issue No. 367
 #       (Announcement No. 338)
 # 1954: Presidential Decree No. 876 (1954-03-17)
 # 1961: Law No. 676 (1961-08-07)
+# 1987: Law No. 3919 (1986-12-31)
 #
-# (Another source "1987: Law No. 3919 (1986-12-31)" was in the 2014-10-30
-# edition of the Korean Wikipedia entry.)
+# The Wikipedia entry also has confusing information about a change
+# to UT+9 in April 1910, but then what would be the point of the later change
+# to UT+9 on 1912-01-01?  Omit the 1910 change for now.
 #
 # I guessed that time zone abbreviations through 1945 followed the same
 # rules as discussed under Taiwan, with nominal switches from JST to KST
 # when the respective cities were taken over by the Allies after WWII.
 #
-# For Pyongyang, guess no changes from World War II until 2015, as we
-# have no information otherwise.
+# For Pyongyang we have no information; guess no changes since World War II.
 
 # From Steffen Thorsen (2015-08-07):
 # According to many news sources, North Korea is going to change to
@@ -2064,7 +2069,7 @@
 # Bill Bonnet (2005-05-19) reports that the US Embassy in Ulaanbaatar says
 # there is only one time zone and that DST is observed, citing Microsoft
 # Windows XP as the source.  Risto Nykänen (2005-05-16) reports that
-# travelmongolia.org says there are two time zones (UT +07, +08) with no DST.
+# travelmongolia.org says there are two time zones (UTC+7, UTC+8) with no DST.
 # Oscar van Vlijmen (2005-05-20) reports that the Mongolian Embassy in
 # Washington, DC says there are two time zones, with DST observed.
 # He also found
@@ -2700,7 +2705,7 @@
 # earlier date.
 #
 # Shanks & Pottenger also state that until 1968-05-01 Saudi Arabia had two
-# time zones; the other zone, at UT +04, was in the far eastern part of
+# time zones; the other zone, at UTC+4, was in the far eastern part of
 # the country.  Ignore this, as it's before our 1970 cutoff.
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -2969,10 +2974,10 @@
 # From Shanks & Pottenger.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Dushanbe	4:35:12 -	LMT	1924 May  2
-			5:00	-	+05	1930 Jun 21
-			6:00 RussiaAsia +06/+07	1991 Mar 31  2:00s
-			5:00	1:00	+05/+06	1991 Sep  9  2:00s
-			5:00	-	+05
+			5:00	-	DUST	1930 Jun 21 # Dushanbe Time
+			6:00 RussiaAsia DUS%sT	1991 Mar 31  2:00s
+			5:00	1:00	DUSST	1991 Sep  9  2:00s
+			5:00	-	TJT	# Tajikistan Time
 
 # Thailand
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -2986,10 +2991,11 @@
 # From Shanks & Pottenger.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Ashgabat	3:53:32 -	LMT	1924 May  2 # or Ashkhabad
-			4:00	-	+04	1930 Jun 21
-			5:00 RussiaAsia	+05/+06	1991 Mar 31  2:00
-			4:00 RussiaAsia	+04/+05	1992 Jan 19  2:00
-			5:00	-	+05
+			4:00	-	ASHT	1930 Jun 21 # Ashkhabad Time
+			5:00 RussiaAsia	ASH%sT	1991 Mar 31  2:00
+			4:00 RussiaAsia	ASH%sT	1991 Oct 27 # independence
+			4:00 RussiaAsia	TM%sT	1992 Jan 19  2:00
+			5:00	-	TMT
 
 # United Arab Emirates
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -3001,18 +3007,20 @@
 # Byalokoz 1919 says Uzbekistan was 4:27:53.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Samarkand	4:27:53 -	LMT	1924 May  2
-			4:00	-	+04	1930 Jun 21
-			5:00	-	+05	1981 Apr  1
-			5:00	1:00	+06	1981 Oct  1
-			6:00	-	+06	1982 Apr  1
-			5:00 RussiaAsia	+05/+06	1992
-			5:00	-	+05
+			4:00	-	SAMT	1930 Jun 21 # Samarkand Time
+			5:00	-	SAMT	1981 Apr  1
+			5:00	1:00	SAMST	1981 Oct  1
+			6:00	-	TAST	1982 Apr  1 # Tashkent Time
+			5:00 RussiaAsia	SAM%sT	1991 Sep  1 # independence
+			5:00 RussiaAsia	UZ%sT	1992
+			5:00	-	UZT
 # Milne says Tashkent was 4:37:10.8; round to nearest.
 Zone	Asia/Tashkent	4:37:11 -	LMT	1924 May  2
-			5:00	-	+05	1930 Jun 21
-			6:00 RussiaAsia	+06/+07	1991 Mar 31  2:00
-			5:00 RussiaAsia	+05/+06	1992
-			5:00	-	+05
+			5:00	-	TAST	1930 Jun 21 # Tashkent Time
+			6:00 RussiaAsia	TAS%sT	1991 Mar 31  2:00
+			5:00 RussiaAsia	TAS%sT	1991 Sep  1 # independence
+			5:00 RussiaAsia	UZ%sT	1992
+			5:00	-	UZT
 
 # Vietnam
 
diff --git a/jdk/make/data/tzdata/australasia b/jdk/make/data/tzdata/australasia
index 20a4020..134a01e 100644
--- a/jdk/make/data/tzdata/australasia
+++ b/jdk/make/data/tzdata/australasia
@@ -568,7 +568,7 @@
 # Base the Bougainville entry on the Arawa-Kieta region, which appears to have
 # the most people even though it was devastated in the Bougainville Civil War.
 #
-# Although Shanks gives 1942-03-15 / 1943-11-01 for UT +09, these dates
+# Although Shanks gives 1942-03-15 / 1943-11-01 for JST, these dates
 # are apparently rough guesswork from the starts of military campaigns.
 # The World War II entries below are instead based on Arawa-Kieta.
 # The Japanese occupied Kieta in July 1942,
@@ -576,8 +576,8 @@
 # http://pwencycl.kgbudge.com/B/o/Bougainville.htm
 # and seem to have controlled it until their 1945-08-21 surrender.
 #
-# The Autonomous Region of Bougainville switched from UT +10 to +11
-# on 2014-12-28 at 02:00.  They call +11 "Bougainville Standard Time";
+# The Autonomous Region of Bougainville plans to switch from UTC+10 to UTC+11
+# on 2014-12-28 at 02:00.  They call UTC+11 "Bougainville Standard Time";
 # abbreviate this as BST.  See:
 # http://www.bougainville24.com/bougainville-issues/bougainville-gets-own-timezone/
 #
@@ -643,7 +643,7 @@
 # From Paul Eggert (2014-06-27):
 # The International Date Line Act 2011
 # http://www.parliament.gov.ws/images/ACTS/International_Date_Line_Act__2011_-_Eng.pdf
-# changed Samoa from UT -11 to +13, effective "12 o'clock midnight, on
+# changed Samoa from UTC-11 to UTC+13, effective "12 o'clock midnight, on
 # Thursday 29th December 2011".  The International Date Line was adjusted
 # accordingly.
 
@@ -738,7 +738,7 @@
 # 1886-1891; Baker was similar but exact dates are not known.
 # Inhabited by civilians 1935-1942; U.S. military bases 1943-1944;
 # uninhabited thereafter.
-# Howland observed Hawaii Standard Time (UT -10:30) in 1937;
+# Howland observed Hawaii Standard Time (UT-10:30) in 1937;
 # see page 206 of Elgen M. Long and Marie K. Long,
 # Amelia Earhart: the Mystery Solved, Simon & Schuster (2000).
 # So most likely Howland and Baker observed Hawaii Time from 1935
@@ -1496,7 +1496,7 @@
 # Zealand time.  I understand that is the time they keep locally, anyhow."
 # For now, assume this practice goes back to the introduction of standard time
 # in New Zealand, as this would make Chatham Islands time almost exactly match
-# LMT back when New Zealand was at UT +11:30; also, assume Chatham Islands did
+# LMT back when New Zealand was at UTC+11:30; also, assume Chatham Islands did
 # not observe New Zealand's prewar DST.
 
 ###############################################################################
@@ -1552,7 +1552,7 @@
 # For now, we assume the Ladrones switched at the same time as the Philippines;
 # see Asia/Manila.
 
-# US Public Law 106-564 (2000-12-23) made UT +10 the official standard time,
+# US Public Law 106-564 (2000-12-23) made UTC+10 the official standard time,
 # under the name "Chamorro Standard Time".  There is no official abbreviation,
 # but Congressman Robert A. Underwood, author of the bill that became law,
 # wrote in a press release (2000-12-27) that he will seek the use of "ChST".
@@ -1564,15 +1564,15 @@
 # "I am certain, having lived there for the past decade, that 'Truk'
 # (now properly known as Chuuk) ... is in the time zone GMT+10."
 #
-# Shanks & Pottenger write that Truk switched from UT +10 to +11
+# Shanks & Pottenger write that Truk switched from UTC+10 to UTC+11
 # on 1978-10-01; ignore this for now.
 
 # From Paul Eggert (1999-10-29):
 # The Federated States of Micronesia Visitors Board writes in
 # The Federated States of Micronesia - Visitor Information (1999-01-26)
 # http://www.fsmgov.org/info/clocks.html
-# that Truk and Yap are UT +10, and Ponape and Kosrae are +11.
-# We don't know when Kosrae switched from +12; assume January 1 for now.
+# that Truk and Yap are UTC+10, and Ponape and Kosrae are UTC+11.
+# We don't know when Kosrae switched from UTC+12; assume January 1 for now.
 
 
 # Midway
@@ -1638,11 +1638,11 @@
 # ordaining - by a masterpiece of diplomatic flattery - that
 # the Fourth of July should be celebrated twice in that year."
 
-# Although Shanks & Pottenger says they both switched to UT -11:30
-# in 1911, and to -11 in 1950. many earlier sources give -11
+# Although Shanks & Pottenger says they both switched to UTC-11:30
+# in 1911, and to UTC-11 in 1950. many earlier sources give UTC-11
 # for American Samoa, e.g., the US National Bureau of Standards
 # circular "Standard Time Throughout the World", 1932.
-# Assume American Samoa switched to -11 in 1911, not 1950,
+# Assume American Samoa switched to UTC-11 in 1911, not 1950,
 # and that after 1950 they agreed until (western) Samoa skipped a
 # day in 2011.  Assume also that the Samoas follow the US and New
 # Zealand's "ST"/"DT" style of daylight-saving abbreviations.
diff --git a/jdk/make/data/tzdata/backward b/jdk/make/data/tzdata/backward
index ec96c7e..8352705 100644
--- a/jdk/make/data/tzdata/backward
+++ b/jdk/make/data/tzdata/backward
@@ -59,7 +59,6 @@
 Link	Asia/Urumqi		Asia/Kashgar
 Link	Asia/Kathmandu		Asia/Katmandu
 Link	Asia/Macau		Asia/Macao
-Link	Asia/Yangon		Asia/Rangoon
 Link	Asia/Ho_Chi_Minh	Asia/Saigon
 Link	Asia/Jerusalem		Asia/Tel_Aviv
 Link	Asia/Thimphu		Asia/Thimbu
diff --git a/jdk/make/data/tzdata/etcetera b/jdk/make/data/tzdata/etcetera
index ec31f1b..d2fb91c 100644
--- a/jdk/make/data/tzdata/etcetera
+++ b/jdk/make/data/tzdata/etcetera
@@ -31,13 +31,6 @@
 # need now for the entries that are not on UTC are for ships at sea
 # that cannot use POSIX TZ settings.
 
-# Starting with POSIX 1003.1-2001, the entries below are all
-# unnecessary as settings for the TZ environment variable.  E.g.,
-# instead of TZ='Etc/GMT+4' one can use the POSIX setting TZ='<-04>+4'.
-#
-# Do not use a POSIX TZ setting like TZ='GMT+4', which is four hours
-# behind GMT but uses the completely misleading abbreviation "GMT".
-
 Zone	Etc/GMT		0	-	GMT
 Zone	Etc/UTC		0	-	UTC
 Zone	Etc/UCT		0	-	UCT
@@ -56,13 +49,23 @@
 Link	Etc/GMT				Etc/GMT+0
 Link	Etc/GMT				Etc/GMT0
 
-# Be consistent with POSIX TZ settings in the Zone names,
+# We use POSIX-style signs in the Zone names and the output abbreviations,
 # even though this is the opposite of what many people expect.
 # POSIX has positive signs west of Greenwich, but many people expect
 # positive signs east of Greenwich.  For example, TZ='Etc/GMT+4' uses
-# the abbreviation "-04" and corresponds to 4 hours behind UT
+# the abbreviation "GMT+4" and corresponds to 4 hours behind UT
 # (i.e. west of Greenwich) even though many people would expect it to
 # mean 4 hours ahead of UT (i.e. east of Greenwich).
+#
+# In the draft 5 of POSIX 1003.1-200x, the angle bracket notation allows for
+# TZ='<GMT-4>+4'; if you want time zone abbreviations conforming to
+# ISO 8601 you can use TZ='<-0400>+4'.  Thus the commonly-expected
+# offset is kept within the angle bracket (and is used for display)
+# while the POSIX sign is kept outside the angle bracket (and is used
+# for calculation).
+#
+# Do not use a TZ setting like TZ='GMT+4', which is four hours behind
+# GMT but uses the completely misleading abbreviation "GMT".
 
 # Earlier incarnations of this package were not POSIX-compliant,
 # and had lines such as
@@ -71,31 +74,30 @@
 # way does a
 #		zic -l GMT-12
 # so we moved the names into the Etc subdirectory.
-# Also, the time zone abbreviations are now compatible with %z.
 
-Zone	Etc/GMT-14	14	-	+14
-Zone	Etc/GMT-13	13	-	+13
-Zone	Etc/GMT-12	12	-	+12
-Zone	Etc/GMT-11	11	-	+11
-Zone	Etc/GMT-10	10	-	+10
-Zone	Etc/GMT-9	9	-	+09
-Zone	Etc/GMT-8	8	-	+08
-Zone	Etc/GMT-7	7	-	+07
-Zone	Etc/GMT-6	6	-	+06
-Zone	Etc/GMT-5	5	-	+05
-Zone	Etc/GMT-4	4	-	+04
-Zone	Etc/GMT-3	3	-	+03
-Zone	Etc/GMT-2	2	-	+02
-Zone	Etc/GMT-1	1	-	+01
-Zone	Etc/GMT+1	-1	-	-01
-Zone	Etc/GMT+2	-2	-	-02
-Zone	Etc/GMT+3	-3	-	-03
-Zone	Etc/GMT+4	-4	-	-04
-Zone	Etc/GMT+5	-5	-	-05
-Zone	Etc/GMT+6	-6	-	-06
-Zone	Etc/GMT+7	-7	-	-07
-Zone	Etc/GMT+8	-8	-	-08
-Zone	Etc/GMT+9	-9	-	-09
-Zone	Etc/GMT+10	-10	-	-10
-Zone	Etc/GMT+11	-11	-	-11
-Zone	Etc/GMT+12	-12	-	-12
+Zone	Etc/GMT-14	14	-	GMT-14	# 14 hours ahead of GMT
+Zone	Etc/GMT-13	13	-	GMT-13
+Zone	Etc/GMT-12	12	-	GMT-12
+Zone	Etc/GMT-11	11	-	GMT-11
+Zone	Etc/GMT-10	10	-	GMT-10
+Zone	Etc/GMT-9	9	-	GMT-9
+Zone	Etc/GMT-8	8	-	GMT-8
+Zone	Etc/GMT-7	7	-	GMT-7
+Zone	Etc/GMT-6	6	-	GMT-6
+Zone	Etc/GMT-5	5	-	GMT-5
+Zone	Etc/GMT-4	4	-	GMT-4
+Zone	Etc/GMT-3	3	-	GMT-3
+Zone	Etc/GMT-2	2	-	GMT-2
+Zone	Etc/GMT-1	1	-	GMT-1
+Zone	Etc/GMT+1	-1	-	GMT+1
+Zone	Etc/GMT+2	-2	-	GMT+2
+Zone	Etc/GMT+3	-3	-	GMT+3
+Zone	Etc/GMT+4	-4	-	GMT+4
+Zone	Etc/GMT+5	-5	-	GMT+5
+Zone	Etc/GMT+6	-6	-	GMT+6
+Zone	Etc/GMT+7	-7	-	GMT+7
+Zone	Etc/GMT+8	-8	-	GMT+8
+Zone	Etc/GMT+9	-9	-	GMT+9
+Zone	Etc/GMT+10	-10	-	GMT+10
+Zone	Etc/GMT+11	-11	-	GMT+11
+Zone	Etc/GMT+12	-12	-	GMT+12
diff --git a/jdk/make/data/tzdata/europe b/jdk/make/data/tzdata/europe
index aededb1..8ed7d4b 100644
--- a/jdk/make/data/tzdata/europe
+++ b/jdk/make/data/tzdata/europe
@@ -98,7 +98,8 @@
 #        1:00       CET CEST CEMT Central Europe
 #        1:00:14    SET           Swedish (1879-1899)*
 #        2:00       EET EEST      Eastern Europe
-#        3:00       MSK MSD       Moscow
+#        3:00       FET           Further-eastern Europe (2011-2014)*
+#        3:00       MSK MSD  MSM* Minsk, Moscow
 
 # From Peter Ilieve (1994-12-04),
 # The original six [EU members]: Belgium, France, (West) Germany, Italy,
@@ -605,33 +606,16 @@
 Rule	E-Eur	1981	max	-	Mar	lastSun	 0:00	1:00	S
 Rule	E-Eur	1996	max	-	Oct	lastSun	 0:00	0	-
 
-
-# Daylight saving time for Russia and the Soviet Union
-#
-# The 1917-1921 decree URLs are from Alexander Belopolsky (2016-08-23).
-
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Russia	1917	only	-	Jul	 1	23:00	1:00	MST  # Moscow Summer Time
-#
-# Decree No. 142 (1917-12-22) http://istmat.info/node/28137
 Rule	Russia	1917	only	-	Dec	28	 0:00	0	MMT  # Moscow Mean Time
-#
-# Decree No. 497 (1918-05-30) http://istmat.info/node/30001
 Rule	Russia	1918	only	-	May	31	22:00	2:00	MDST # Moscow Double Summer Time
 Rule	Russia	1918	only	-	Sep	16	 1:00	1:00	MST
-#
-# Decree No. 258 (1919-05-29) http://istmat.info/node/37949
 Rule	Russia	1919	only	-	May	31	23:00	2:00	MDST
-#
-Rule	Russia	1919	only	-	Jul	 1	 0:00u	1:00	MSD
+Rule	Russia	1919	only	-	Jul	 1	 2:00	1:00	MSD
 Rule	Russia	1919	only	-	Aug	16	 0:00	0	MSK
-#
-# Decree No. 63 (1921-02-03) http://istmat.info/node/45840
 Rule	Russia	1921	only	-	Feb	14	23:00	1:00	MSD
-#
-# Decree No. 121 (1921-03-07) http://istmat.info/node/45949
-Rule	Russia	1921	only	-	Mar	20	23:00	2:00	+05
-#
+Rule	Russia	1921	only	-	Mar	20	23:00	2:00	MSM  # Midsummer
 Rule	Russia	1921	only	-	Sep	 1	 0:00	1:00	MSD
 Rule	Russia	1921	only	-	Oct	 1	 0:00	0	-
 # Act No. 925 of the Council of Ministers of the USSR (1980-10-24):
@@ -814,6 +798,8 @@
 # From Alexander Bokovoy (2014-10-09):
 # Belarussian government decided against changing to winter time....
 # http://eng.belta.by/all_news/society/Belarus-decides-against-adjusting-time-in-Russias-wake_i_76335.html
+# From Paul Eggert (2014-10-08):
+# Hence Belarus can share time zone abbreviations with Moscow again.
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Europe/Minsk	1:50:16 -	LMT	1880
@@ -824,7 +810,8 @@
 			3:00	Russia	MSK/MSD	1990
 			3:00	-	MSK	1991 Mar 31  2:00s
 			2:00	Russia	EE%sT	2011 Mar 27  2:00s
-			3:00	-	+03
+			3:00	-	FET	2014 Oct 26  1:00s
+			3:00	-	MSK
 
 # Belgium
 #
@@ -1332,7 +1319,7 @@
 # http://www.parlament-berlin.de/pds-fraktion.nsf/727459127c8b66ee8525662300459099/defc77cb784f180ac1256c2b0030274b/$FILE/bersarint.pdf
 # says that Bersarin issued an order to use Moscow time on May 20.
 # However, Moscow did not observe daylight saving in 1945, so
-# this was equivalent to UT +03, not +04.
+# this was equivalent to CEMT (GMT+3), not GMT+4.
 
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
@@ -2296,6 +2283,7 @@
 # http://www.worldtimezone.com/dst_news/dst_news_russia-map-2014-07.html
 
 # From Paul Eggert (2006-03-22):
+# Except for Moscow after 1919-07-01, I invented the time zone abbreviations.
 # Moscow time zone abbreviations after 1919-07-01, and Moscow rules after 1991,
 # are from Andrey A. Chernov.  The rest is from Shanks & Pottenger,
 # except we follow Chernov's report that 1992 DST transitions were Sat
@@ -2371,7 +2359,7 @@
 			 2:00	Poland	CE%sT	1946
 			 3:00	Russia	MSK/MSD	1989 Mar 26  2:00s
 			 2:00	Russia	EE%sT	2011 Mar 27  2:00s
-			 3:00	-	+03	2014 Oct 26  2:00s
+			 3:00	-	FET	2014 Oct 26  2:00s
 			 2:00	-	EET
 
 
@@ -2424,16 +2412,6 @@
 # 78	RU-SPE	Saint Petersburg
 # 83	RU-NEN	Nenets Autonomous Okrug
 
-# From Paul Eggert (2016-08-23):
-# The Soviets switched to UT-based time in 1919.  Decree No. 59
-# (1919-02-08) http://istmat.info/node/35567 established UT-based time
-# zones, and Decree No. 147 (1919-03-29) http://istmat.info/node/35854
-# specified a transition date of 1919-07-01, apparently at 00:00 UT.
-# No doubt only the Soviet-controlled regions switched on that date;
-# later transitions to UT-based time in other parts of Russia are
-# taken from what appear to be guesses by Shanks.
-# (Thanks to Alexander Belopolsky for pointers to the decrees.)
-
 # From Stepan Golosunov (2016-03-07):
 # 11. Regions-violators, 1981-1982.
 # Wikipedia refers to
@@ -2475,7 +2453,7 @@
 # attributes the 1982 changes to the Act of the Council of Ministers
 # of the USSR No. 126 from 18.02.1982.  1980-925.txt also adds
 # Udmurtia to the list of affected territories and lists Khatangsky
-# district separately from Taymyr Autonomous Okrug.  Probably erroneously.
+# district separately from Taymyr Autonomous Okurg.  Probably erroneously.
 #
 # The affected territories are currently listed under Europe/Moscow,
 # Asia/Yekaterinburg and Asia/Krasnoyarsk.
@@ -2535,7 +2513,7 @@
 
 Zone Europe/Moscow	 2:30:17 -	LMT	1880
 			 2:30:17 -	MMT	1916 Jul  3 # Moscow Mean Time
-			 2:31:19 Russia	%s	1919 Jul  1  0:00u
+			 2:31:19 Russia	%s	1919 Jul  1  2:00
 			 3:00	Russia	%s	1921 Oct
 			 3:00	Russia	MSK/MSD	1922 Oct
 			 2:00	-	EET	1930 Jun 21
@@ -2618,21 +2596,22 @@
 # The 1988 transition is from USSR act No. 5 (1988-01-04).
 
 Zone Europe/Volgograd	 2:57:40 -	LMT	1920 Jan  3
-			 3:00	-	+03	1930 Jun 21
-			 4:00	-	+04	1961 Nov 11
-			 4:00	Russia	+04/+05	1988 Mar 27  2:00s
-			 3:00	Russia	+03/+04	1991 Mar 31  2:00s
-			 4:00	-	+04	1992 Mar 29  2:00s
-			 3:00	Russia	+03/+04	2011 Mar 27  2:00s
-			 4:00	-	+04	2014 Oct 26  2:00s
-			 3:00	-	+03
+			 3:00	-	TSAT	1925 Apr  6 # Tsaritsyn Time
+			 3:00	-	STAT	1930 Jun 21 # Stalingrad Time
+			 4:00	-	STAT	1961 Nov 11
+			 4:00	Russia	VOL%sT	1988 Mar 27  2:00s # Volgograd T
+			 3:00	Russia	VOL%sT	1991 Mar 31  2:00s
+			 4:00	-	VOLT	1992 Mar 29  2:00s
+			 3:00	Russia	MSK/MSD	2011 Mar 27  2:00s
+			 4:00	-	MSK	2014 Oct 26  2:00s
+			 3:00	-	MSK
 
 # From Paul Eggert (2016-03-18):
 # Europe/Kirov covers:
 # 43	RU-KIR	Kirov Oblast
 # The 1989 transition is from USSR act No. 227 (1989-03-14).
 #
-Zone Europe/Kirov	 3:18:48 -	LMT	1919 Jul  1  0:00u
+Zone Europe/Kirov	 3:18:48 -	LMT	1919 Jul  1  2:00
 			 3:00	-	+03	1930 Jun 21
 			 4:00	Russia	+04/+05	1989 Mar 26  2:00s
 			 3:00	Russia	+03/+04	1991 Mar 31  2:00s
@@ -2650,16 +2629,16 @@
 # Byalokoz 1919 says Samara was 3:20:20.
 # The 1989 transition is from USSR act No. 227 (1989-03-14).
 
-Zone Europe/Samara	 3:20:20 -	LMT	1919 Jul  1  0:00u
-			 3:00	-	+03	1930 Jun 21
-			 4:00	-	+04	1935 Jan 27
-			 4:00	Russia	+04/+05	1989 Mar 26  2:00s
-			 3:00	Russia	+03/+04	1991 Mar 31  2:00s
-			 2:00	Russia	+02/+03	1991 Sep 29  2:00s
-			 3:00	-	+03	1991 Oct 20  3:00
-			 4:00	Russia	+04/+05	2010 Mar 28  2:00s
-			 3:00	Russia	+03/+04	2011 Mar 27  2:00s
-			 4:00	-	+04
+Zone Europe/Samara	 3:20:20 -	LMT	1919 Jul  1  2:00
+			 3:00	-	SAMT	1930 Jun 21 # Samara Time
+			 4:00	-	SAMT	1935 Jan 27
+			 4:00	Russia	KUY%sT	1989 Mar 26  2:00s # Kuybyshev
+			 3:00	Russia	MSK/MSD	1991 Mar 31  2:00s
+			 2:00	Russia	EE%sT	1991 Sep 29  2:00s
+			 3:00	-	SAMT	1991 Oct 20  3:00
+			 4:00	Russia	SAM%sT	2010 Mar 28  2:00s
+			 3:00	Russia	SAM%sT	2011 Mar 27  2:00s
+			 4:00	-	SAMT
 
 # From Paul Eggert (2016-03-18):
 # Europe/Ulyanovsk covers:
@@ -2674,7 +2653,7 @@
 # From Matt Johnson (2016-03-09):
 # http://publication.pravo.gov.ru/Document/View/0001201603090051
 
-Zone Europe/Ulyanovsk	 3:13:36 -	LMT	1919 Jul  1  0:00u
+Zone Europe/Ulyanovsk	 3:13:36 -	LMT	1919 Jul  1  2:00
 			 3:00	-	+03	1930 Jun 21
 			 4:00	Russia	+04/+05	1989 Mar 26  2:00s
 			 3:00	Russia	+03/+04	1991 Mar 31  2:00s
@@ -2706,12 +2685,12 @@
 
 Zone Asia/Yekaterinburg	 4:02:33 -	LMT	1916 Jul  3
 			 3:45:05 -	PMT	1919 Jul 15  4:00
-			 4:00	-	+04	1930 Jun 21
-			 5:00	Russia	+05/+06	1991 Mar 31  2:00s
-			 4:00	Russia	+04/+05	1992 Jan 19  2:00s
-			 5:00	Russia	+05/+06	2011 Mar 27  2:00s
-			 6:00	-	+06	2014 Oct 26  2:00s
-			 5:00	-	+05
+			 4:00	-	SVET	1930 Jun 21 # Sverdlovsk Time
+			 5:00	Russia	SVE%sT	1991 Mar 31  2:00s
+			 4:00	Russia	SVE%sT	1992 Jan 19  2:00s
+			 5:00	Russia	YEK%sT	2011 Mar 27  2:00s
+			 6:00	-	YEKT	2014 Oct 26  2:00s
+			 5:00	-	YEKT
 
 
 # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2001-08-25):
@@ -2721,12 +2700,12 @@
 # Byalokoz 1919 says Omsk was 4:53:30.
 
 Zone Asia/Omsk		 4:53:30 -	LMT	1919 Nov 14
-			 5:00	-	+05	1930 Jun 21
-			 6:00	Russia	+06/+07	1991 Mar 31  2:00s
-			 5:00	Russia	+05/+06	1992 Jan 19  2:00s
-			 6:00	Russia	+06/+07	2011 Mar 27  2:00s
-			 7:00	-	+07	2014 Oct 26  2:00s
-			 6:00	-	+06
+			 5:00	-	OMST	1930 Jun 21 # Omsk Time
+			 6:00	Russia	OMS%sT	1991 Mar 31  2:00s
+			 5:00	Russia	OMS%sT	1992 Jan 19  2:00s
+			 6:00	Russia	OMS%sT	2011 Mar 27  2:00s
+			 7:00	-	OMST	2014 Oct 26  2:00s
+			 6:00	-	OMST
 
 # From Paul Eggert (2016-02-22):
 # Asia/Barnaul covers:
@@ -2806,7 +2785,7 @@
 # Note that time belts (numbered from 2 (Moscow) to 12 according to their
 # GMT/UTC offset and having too many exceptions like regions formally
 # belonging to one belt but using time from another) were replaced
-# with time zones in 2011 with different numbering (there was a
+# with time zones in 2011 with different numberings (there was a
 # 2-hour gap between second and third zones in 2011-2014).
 
 # From Stepan Golosunov (2016-04-12):
@@ -2889,12 +2868,12 @@
 # Byalokoz 1919 says Krasnoyarsk was 6:11:26.
 
 Zone Asia/Krasnoyarsk	 6:11:26 -	LMT	1920 Jan  6
-			 6:00	-	+06	1930 Jun 21
-			 7:00	Russia	+07/+08	1991 Mar 31  2:00s
-			 6:00	Russia	+06/+07	1992 Jan 19  2:00s
-			 7:00	Russia	+07/+08	2011 Mar 27  2:00s
-			 8:00	-	+08	2014 Oct 26  2:00s
-			 7:00	-	+07
+			 6:00	-	KRAT	1930 Jun 21 # Krasnoyarsk Time
+			 7:00	Russia	KRA%sT	1991 Mar 31  2:00s
+			 6:00	Russia	KRA%sT	1992 Jan 19  2:00s
+			 7:00	Russia	KRA%sT	2011 Mar 27  2:00s
+			 8:00	-	KRAT	2014 Oct 26  2:00s
+			 7:00	-	KRAT
 
 
 # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2001-08-25):
@@ -2911,12 +2890,12 @@
 
 Zone Asia/Irkutsk	 6:57:05 -	LMT	1880
 			 6:57:05 -	IMT	1920 Jan 25 # Irkutsk Mean Time
-			 7:00	-	+07	1930 Jun 21
-			 8:00	Russia	+08/+09	1991 Mar 31  2:00s
-			 7:00	Russia	+07/+08	1992 Jan 19  2:00s
-			 8:00	Russia	+08/+09	2011 Mar 27  2:00s
-			 9:00	-	+09	2014 Oct 26  2:00s
-			 8:00	-	+08
+			 7:00	-	IRKT	1930 Jun 21 # Irkutsk Time
+			 8:00	Russia	IRK%sT	1991 Mar 31  2:00s
+			 7:00	Russia	IRK%sT	1992 Jan 19  2:00s
+			 8:00	Russia	IRK%sT	2011 Mar 27  2:00s
+			 9:00	-	IRKT	2014 Oct 26  2:00s
+			 8:00	-	IRKT
 
 
 # From Tim Parenti (2014-07-06):
@@ -2933,13 +2912,13 @@
 # http://publication.pravo.gov.ru/Document/View/0001201512300107
 
 Zone Asia/Chita	 7:33:52 -	LMT	1919 Dec 15
-			 8:00	-	+08	1930 Jun 21
-			 9:00	Russia	+09/+10	1991 Mar 31  2:00s
-			 8:00	Russia	+08/+09	1992 Jan 19  2:00s
-			 9:00	Russia	+09/+10	2011 Mar 27  2:00s
-			10:00	-	+10	2014 Oct 26  2:00s
-			 8:00	-	+08	2016 Mar 27  2:00
-			 9:00	-	+09
+			 8:00	-	YAKT	1930 Jun 21 # Yakutsk Time
+			 9:00	Russia	YAK%sT	1991 Mar 31  2:00s
+			 8:00	Russia	YAK%sT	1992 Jan 19  2:00s
+			 9:00	Russia	YAK%sT	2011 Mar 27  2:00s
+			10:00	-	YAKT	2014 Oct 26  2:00s
+			 8:00	-	IRKT	2016 Mar 27  2:00
+			 9:00	-	YAKT
 
 
 # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2009-11-29):
@@ -2979,12 +2958,12 @@
 # Byalokoz 1919 says Yakutsk was 8:38:58.
 
 Zone Asia/Yakutsk	 8:38:58 -	LMT	1919 Dec 15
-			 8:00	-	+08	1930 Jun 21
-			 9:00	Russia	+09/+10	1991 Mar 31  2:00s
-			 8:00	Russia	+08/+09	1992 Jan 19  2:00s
-			 9:00	Russia	+09/+10	2011 Mar 27  2:00s
-			10:00	-	+10	2014 Oct 26  2:00s
-			 9:00	-	+09
+			 8:00	-	YAKT	1930 Jun 21 # Yakutsk Time
+			 9:00	Russia	YAK%sT	1991 Mar 31  2:00s
+			 8:00	Russia	YAK%sT	1992 Jan 19  2:00s
+			 9:00	Russia	YAK%sT	2011 Mar 27  2:00s
+			10:00	-	YAKT	2014 Oct 26  2:00s
+			 9:00	-	YAKT
 
 
 # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2009-11-29):
@@ -3002,12 +2981,12 @@
 # Go with Byalokoz.
 
 Zone Asia/Vladivostok	 8:47:31 -	LMT	1922 Nov 15
-			 9:00	-	+09	1930 Jun 21
-			10:00	Russia	+10/+11	1991 Mar 31  2:00s
-			 9:00	Russia	+09/+10	1992 Jan 19  2:00s
-			10:00	Russia	+10/+11	2011 Mar 27  2:00s
-			11:00	-	+11	2014 Oct 26  2:00s
-			10:00	-	+10
+			 9:00	-	VLAT	1930 Jun 21 # Vladivostok Time
+			10:00	Russia	VLA%sT	1991 Mar 31  2:00s
+			 9:00	Russia	VLA%sT	1992 Jan 19  2:00s
+			10:00	Russia	VLA%sT	2011 Mar 27  2:00s
+			11:00	-	VLAT	2014 Oct 26  2:00s
+			10:00	-	VLAT
 
 
 # From Tim Parenti (2014-07-03):
@@ -3025,14 +3004,14 @@
 # This transition is no doubt wrong, but we have no better info.
 
 Zone Asia/Khandyga	 9:02:13 -	LMT	1919 Dec 15
-			 8:00	-	+08	1930 Jun 21
-			 9:00	Russia	+09/+10	1991 Mar 31  2:00s
-			 8:00	Russia	+08/+09	1992 Jan 19  2:00s
-			 9:00	Russia	+09/+10	2004
-			10:00	Russia	+10/+11	2011 Mar 27  2:00s
-			11:00	-	+11	2011 Sep 13  0:00s # Decree 725?
-			10:00	-	+10	2014 Oct 26  2:00s
-			 9:00	-	+09
+			 8:00	-	YAKT	1930 Jun 21 # Yakutsk Time
+			 9:00	Russia	YAK%sT	1991 Mar 31  2:00s
+			 8:00	Russia	YAK%sT	1992 Jan 19  2:00s
+			 9:00	Russia	YAK%sT	2004
+			10:00	Russia	VLA%sT	2011 Mar 27  2:00s
+			11:00	-	VLAT	2011 Sep 13  0:00s # Decree 725?
+			10:00	-	YAKT	2014 Oct 26  2:00s
+			 9:00	-	YAKT
 
 
 # From Tim Parenti (2014-07-03):
@@ -3048,14 +3027,15 @@
 
 # The Zone name should be Asia/Yuzhno-Sakhalinsk, but that's too long.
 Zone Asia/Sakhalin	 9:30:48 -	LMT	1905 Aug 23
-			 9:00	-	+09	1945 Aug 25
-			11:00	Russia	+11/+12	1991 Mar 31  2:00s # Sakhalin T
-			10:00	Russia	+10/+11	1992 Jan 19  2:00s
-			11:00	Russia	+11/+12	1997 Mar lastSun  2:00s
-			10:00	Russia	+10/+11	2011 Mar 27  2:00s
-			11:00	-	+11	2014 Oct 26  2:00s
-			10:00	-	+10	2016 Mar 27  2:00s
-			11:00	-	+11
+			 9:00	-	JCST	1937 Oct  1
+			 9:00	-	JST	1945 Aug 25
+			11:00	Russia	SAK%sT	1991 Mar 31  2:00s # Sakhalin T
+			10:00	Russia	SAK%sT	1992 Jan 19  2:00s
+			11:00	Russia	SAK%sT	1997 Mar lastSun  2:00s
+			10:00	Russia	SAK%sT	2011 Mar 27  2:00s
+			11:00	-	SAKT	2014 Oct 26  2:00s
+			10:00	-	SAKT	2016 Mar 27  2:00s
+			11:00	-	SAKT
 
 
 # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2009-11-29):
@@ -3078,13 +3058,13 @@
 # http://publication.pravo.gov.ru/Document/View/0001201604050038
 
 Zone Asia/Magadan	10:03:12 -	LMT	1924 May  2
-			10:00	-	+10	1930 Jun 21 # Magadan Time
-			11:00	Russia	+11/+12	1991 Mar 31  2:00s
-			10:00	Russia	+10/+11	1992 Jan 19  2:00s
-			11:00	Russia	+11/+12	2011 Mar 27  2:00s
-			12:00	-	+12	2014 Oct 26  2:00s
-			10:00	-	+10	2016 Apr 24  2:00s
-			11:00	-	+11
+			10:00	-	MAGT	1930 Jun 21 # Magadan Time
+			11:00	Russia	MAG%sT	1991 Mar 31  2:00s
+			10:00	Russia	MAG%sT	1992 Jan 19  2:00s
+			11:00	Russia	MAG%sT	2011 Mar 27  2:00s
+			12:00	-	MAGT	2014 Oct 26  2:00s
+			10:00	-	MAGT	2016 Apr 24  2:00s
+			11:00	-	MAGT
 
 
 # From Tim Parenti (2014-07-06):
@@ -3127,14 +3107,17 @@
 # in Russian.)  In addition, Srednekolymsk appears to be a much older
 # settlement and the population of Zyryanka seems to be declining.
 # Go with Srednekolymsk.
+#
+# Since Magadan Oblast moves to UTC+10 on 2014-10-26, we cannot keep using MAGT
+# as the abbreviation.  Use SRET instead.
 
 Zone Asia/Srednekolymsk	10:14:52 -	LMT	1924 May  2
-			10:00	-	+10	1930 Jun 21
-			11:00	Russia	+11/+12	1991 Mar 31  2:00s
-			10:00	Russia	+10/+11	1992 Jan 19  2:00s
-			11:00	Russia	+11/+12	2011 Mar 27  2:00s
-			12:00	-	+12	2014 Oct 26  2:00s
-			11:00	-	+11
+			10:00	-	MAGT	1930 Jun 21 # Magadan Time
+			11:00	Russia	MAG%sT	1991 Mar 31  2:00s
+			10:00	Russia	MAG%sT	1992 Jan 19  2:00s
+			11:00	Russia	MAG%sT	2011 Mar 27  2:00s
+			12:00	-	MAGT	2014 Oct 26  2:00s
+			11:00	-	SRET	# Srednekolymsk Time
 
 
 # From Tim Parenti (2014-07-03):
@@ -3152,14 +3135,14 @@
 # UTC+12 since at least then, too.
 
 Zone Asia/Ust-Nera	 9:32:54 -	LMT	1919 Dec 15
-			 8:00	-	+08	1930 Jun 21
-			 9:00	Russia	+09/+10	1981 Apr  1
-			11:00	Russia	+11/+12	1991 Mar 31  2:00s
-			10:00	Russia	+10/+11	1992 Jan 19  2:00s
-			11:00	Russia	+11/+12	2011 Mar 27  2:00s
-			12:00	-	+12	2011 Sep 13  0:00s # Decree 725?
-			11:00	-	+11	2014 Oct 26  2:00s
-			10:00	-	+10
+			 8:00	-	YAKT	1930 Jun 21 # Yakutsk Time
+			 9:00	Russia	YAKT	1981 Apr  1
+			11:00	Russia	MAG%sT	1991 Mar 31  2:00s
+			10:00	Russia	MAG%sT	1992 Jan 19  2:00s
+			11:00	Russia	MAG%sT	2011 Mar 27  2:00s
+			12:00	-	MAGT	2011 Sep 13  0:00s # Decree 725?
+			11:00	-	VLAT	2014 Oct 26  2:00s
+			10:00	-	VLAT
 
 
 # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2001-08-25):
@@ -3172,12 +3155,12 @@
 # The Zone name should be Asia/Petropavlovsk-Kamchatski or perhaps
 # Asia/Petropavlovsk-Kamchatsky, but these are too long.
 Zone Asia/Kamchatka	10:34:36 -	LMT	1922 Nov 10
-			11:00	-	+11	1930 Jun 21
-			12:00	Russia	+12/+13	1991 Mar 31  2:00s
-			11:00	Russia	+11/+12	1992 Jan 19  2:00s
-			12:00	Russia	+12/+13	2010 Mar 28  2:00s
-			11:00	Russia	+11/+12	2011 Mar 27  2:00s
-			12:00	-	+12
+			11:00	-	PETT	1930 Jun 21 # P-K Time
+			12:00	Russia	PET%sT	1991 Mar 31  2:00s
+			11:00	Russia	PET%sT	1992 Jan 19  2:00s
+			12:00	Russia	PET%sT	2010 Mar 28  2:00s
+			11:00	Russia	PET%sT	2011 Mar 27  2:00s
+			12:00	-	PETT
 
 
 # From Tim Parenti (2014-07-03):
@@ -3185,13 +3168,13 @@
 # 87	RU-CHU	Chukotka Autonomous Okrug
 
 Zone Asia/Anadyr	11:49:56 -	LMT	1924 May  2
-			12:00	-	+12	1930 Jun 21
-			13:00	Russia	+13/+14	1982 Apr  1  0:00s
-			12:00	Russia	+12/+13	1991 Mar 31  2:00s
-			11:00	Russia	+11/+12	1992 Jan 19  2:00s
-			12:00	Russia	+12/+13	2010 Mar 28  2:00s
-			11:00	Russia	+11/+12	2011 Mar 27  2:00s
-			12:00	-	+12
+			12:00	-	ANAT	1930 Jun 21 # Anadyr Time
+			13:00	Russia	ANA%sT	1982 Apr  1  0:00s
+			12:00	Russia	ANA%sT	1991 Mar 31  2:00s
+			11:00	Russia	ANA%sT	1992 Jan 19  2:00s
+			12:00	Russia	ANA%sT	2010 Mar 28  2:00s
+			11:00	Russia	ANA%sT	2011 Mar 27  2:00s
+			12:00	-	ANAT
 
 
 # San Marino
@@ -3512,14 +3495,6 @@
 # Engineered Standard Time," said Twitter user @aysekarahasan.
 # http://www.bbc.com/news/world-europe-34631326
 
-# From Burak AYDIN (2016-09-08):
-# Turkey will stay in Daylight Saving Time even in winter....
-# http://www.resmigazete.gov.tr/eskiler/2016/09/20160908-2.pdf
-#
-# From Paul Eggert (2016-09-07):
-# The change is permanent, so this is the new standard time in Turkey.
-# It takes effect today, which is not much notice.
-
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Turkey	1916	only	-	May	 1	0:00	1:00	S
 Rule	Turkey	1916	only	-	Oct	 1	0:00	0	-
@@ -3583,7 +3558,7 @@
 Zone	Europe/Istanbul	1:55:52 -	LMT	1880
 			1:56:56	-	IMT	1910 Oct # Istanbul Mean Time?
 			2:00	Turkey	EE%sT	1978 Oct 15
-			3:00	Turkey	+03/+04	1985 Apr 20
+			3:00	Turkey	TR%sT	1985 Apr 20 # Turkey Time
 			2:00	Turkey	EE%sT	2007
 			2:00	EU	EE%sT	2011 Mar 27  1:00u
 			2:00	-	EET	2011 Mar 28  1:00u
@@ -3591,8 +3566,7 @@
 			2:00	-	EET	2014 Mar 31  1:00u
 			2:00	EU	EE%sT	2015 Oct 25  1:00u
 			2:00	1:00	EEST	2015 Nov  8  1:00u
-			2:00	EU	EE%sT	2016 Sep  7
-			3:00	-	+03
+			2:00	EU	EE%sT
 Link	Europe/Istanbul	Asia/Istanbul	# Istanbul is in both continents.
 
 # Ukraine
diff --git a/jdk/make/data/tzdata/factory b/jdk/make/data/tzdata/factory
index 7d79693..0a6041d 100644
--- a/jdk/make/data/tzdata/factory
+++ b/jdk/make/data/tzdata/factory
@@ -24,10 +24,9 @@
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
-# For distributors who don't want to put time zone specification in
-# their installation procedures.  Users that run 'date' will get the
-# time zone abbreviation "-00", indicating that the actual time zone
-# is unknown.
+# For companies who don't want to put time zone specification in
+# their installation procedures.  When users run date, they'll get the message.
+# Also useful for the "comp.sources" version.
 
 # Zone	NAME	GMTOFF	RULES	FORMAT
-Zone	Factory	0	-	-00
+Zone	Factory	0	- "Local time zone must be set--see zic manual page"
diff --git a/jdk/make/data/tzdata/leapseconds b/jdk/make/data/tzdata/leapseconds
index 71d774d..a08fbc7 100644
--- a/jdk/make/data/tzdata/leapseconds
+++ b/jdk/make/data/tzdata/leapseconds
@@ -79,7 +79,6 @@
 Leap	2008	Dec	31	23:59:60	+	S
 Leap	2012	Jun	30	23:59:60	+	S
 Leap	2015	Jun	30	23:59:60	+	S
-Leap	2016	Dec	31	23:59:60	+	S
 
-#	Updated through IERS Bulletin C52
-#	File expires on:  28 June 2017
+#	Updated through IERS Bulletin C51
+#	File expires on:  28 December 2016
diff --git a/jdk/make/data/tzdata/northamerica b/jdk/make/data/tzdata/northamerica
index 8ab635d..ec59510 100644
--- a/jdk/make/data/tzdata/northamerica
+++ b/jdk/make/data/tzdata/northamerica
@@ -436,42 +436,11 @@
 # north of the Salmon River, and the towns of Burgdorf and Warren),
 # Nevada (except West Wendover), Oregon (except the northern 3/4 of
 # Malheur county), and Washington
-
-# From Paul Eggert (2016-08-20):
-# In early February 1948, in response to California's electricity shortage,
-# PG&E changed power frequency from 60 to 59.5 Hz during daylight hours,
-# causing electric clocks to lose six minutes per day.  (This did not change
-# legal time, and is not part of the data here.)  See:
-# Ross SA. An energy crisis from the past: Northern California in 1948.
-# Working Paper No. 8, Institute of Governmental Studies, UC Berkeley,
-# 1973-11.  http://escholarship.org/uc/item/8x22k30c
-#
-# In another measure to save electricity, DST was instituted from 1948-03-14
-# at 02:01 to 1949-01-16 at 02:00, with the governor having the option to move
-# the fallback transition earlier.  See pages 3-4 of:
-# http://clerk.assembly.ca.gov/sites/clerk.assembly.ca.gov/files/archive/Statutes/1948/48Vol1_Chapters.pdf
-#
-# In response:
-#
-#   Governor Warren received a torrent of objecting mail, and it is not too much
-#   to speculate that the objections to Daylight Saving Time were one important
-#   factor in the defeat of the Dewey-Warren Presidential ticket in California.
-#     -- Ross, p 25
-#
-# On December 8 the governor exercised the option, setting the date to January 1
-# (LA Times 1948-12-09).  The transition time was 02:00 (LA Times 1949-01-01).
-#
-# Despite the controversy, in 1949 California voters approved Proposition 12,
-# which established DST from April's last Sunday at 01:00 until September's
-# last Sunday at 02:00. This was amended by 1962's Proposition 6, which changed
-# the fall-back date to October's last Sunday. See:
-# http://repository.uchastings.edu/cgi/viewcontent.cgi?article=1501&context=ca_ballot_props
-# http://repository.uchastings.edu/cgi/viewcontent.cgi?article=1636&context=ca_ballot_props
 #
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
-Rule	CA	1948	only	-	Mar	14	2:01	1:00	D
+Rule	CA	1948	only	-	Mar	14	2:00	1:00	D
 Rule	CA	1949	only	-	Jan	 1	2:00	0	S
-Rule	CA	1950	1966	-	Apr	lastSun	1:00	1:00	D
+Rule	CA	1950	1966	-	Apr	lastSun	2:00	1:00	D
 Rule	CA	1950	1961	-	Sep	lastSun	2:00	0	S
 Rule	CA	1962	1966	-	Oct	lastSun	2:00	0	S
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -3335,7 +3304,7 @@
 # indicating that the normal ET rules are followed.
 #
 # From Paul Eggert (2014-08-19):
-# The 2014-08-13 Cabinet meeting decided to stay on UT -04 year-round.  See:
+# The 2014-08-13 Cabinet meeting decided to stay on UTC-4 year-round.  See:
 # http://tcweeklynews.com/daylight-savings-time-to-be-maintained-p5353-127.htm
 # Model this as a switch from EST/EDT to AST ...
 # From Chris Walton (2014-11-04):
diff --git a/jdk/make/data/tzdata/southamerica b/jdk/make/data/tzdata/southamerica
index bbc0a95..08c89ca 100644
--- a/jdk/make/data/tzdata/southamerica
+++ b/jdk/make/data/tzdata/southamerica
@@ -433,9 +433,9 @@
 # stuck on Summer daylight savings time even though the summer is over.
 
 # From Paul Eggert (2013-09-05):
-# Perhaps San Luis operates on the legal fiction that it is at -04
+# Perhaps San Luis operates on the legal fiction that it is at UTC-4
 # with perpetual summer time, but ordinary usage typically seems to
-# just say it's at -03; see, for example,
+# just say it's at UTC-3; see, for example,
 # http://es.wikipedia.org/wiki/Hora_oficial_argentina
 # We've documented similar situations as being plain changes to
 # standard time, so let's do that here too.  This does not change UTC
diff --git a/jdk/make/data/tzdata/zone.tab b/jdk/make/data/tzdata/zone.tab
index db05060..5649691 100644
--- a/jdk/make/data/tzdata/zone.tab
+++ b/jdk/make/data/tzdata/zone.tab
@@ -284,7 +284,7 @@
 MH	+0905+16720	Pacific/Kwajalein	Kwajalein
 MK	+4159+02126	Europe/Skopje
 ML	+1239-00800	Africa/Bamako
-MM	+1647+09610	Asia/Yangon
+MM	+1647+09610	Asia/Rangoon
 MN	+4755+10653	Asia/Ulaanbaatar	Mongolia (most areas)
 MN	+4801+09139	Asia/Hovd	Bayan-Olgiy, Govi-Altai, Hovd, Uvs, Zavkhan
 MN	+4804+11430	Asia/Choibalsan	Dornod, Sukhbaatar
diff --git a/jdk/make/mapfiles/libnet/mapfile-vers b/jdk/make/mapfiles/libnet/mapfile-vers
index a37668a..0e432d3 100644
--- a/jdk/make/mapfiles/libnet/mapfile-vers
+++ b/jdk/make/mapfiles/libnet/mapfile-vers
@@ -112,7 +112,6 @@
 		NET_EnableFastTcpLoopback;
 		NET_ThrowNew;
                 ipv6_available;
-                initInetAddressIDs;
 
 	local:
 		*;
diff --git a/jdk/make/profile-includes.txt b/jdk/make/profile-includes.txt
index e6de98e..3014a71 100644
--- a/jdk/make/profile-includes.txt
+++ b/jdk/make/profile-includes.txt
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -183,15 +183,13 @@
     net.properties \
     resources.jar \
     rt.jar \
-    security/policy/limited/US_export_policy.jar \
-    security/policy/unlimited/US_export_policy.jar \
+    security/US_export_policy.jar \
     security/blacklist \
     security/blacklisted.certs \
     security/cacerts \
     security/java.policy \
     security/java.security \
-    security/policy/limited/local_policy.jar \
-    security/policy/unlimited/local_policy.jar \
+    security/local_policy.jar \
     security/trusted.libraries \
     tzdb.dat
 
@@ -220,10 +218,8 @@
     jsse.jar \
     resources.jar \
     rt.jar \
-    security/policy/limited/US_export_policy.jar \
-    security/policy/unlimited/US_export_policy.jar \
-    security/policy/limited/local_policy.jar \
-    security/policy/unlimited/local_policy.jar
+    security/US_export_policy.jar \
+    security/local_policy.jar
 
 
 PROFILE_2_JRE_BIN_FILES := \
diff --git a/jdk/make/profile-rtjar-includes.txt b/jdk/make/profile-rtjar-includes.txt
index 84c6a0f..bda322f 100644
--- a/jdk/make/profile-rtjar-includes.txt
+++ b/jdk/make/profile-rtjar-includes.txt
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -119,7 +119,6 @@
     com/sun/tracing \
     jdk/management \
     jdk/internal/cmm \
-    jdk/internal/instrumentation \
     java/lang/instrument \
     java/lang/management \
     java/security/acl \
@@ -208,6 +207,7 @@
     javax/xml/bind \
     javax/xml/soap \
     javax/xml/ws \
+    jdk/internal/instrumentation \
     jdk/management/resource \
     org/omg \
     sun/applet \
diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaProgressBarUI.java b/jdk/src/macosx/classes/com/apple/laf/AquaProgressBarUI.java
index 80a5e36..1ac16c3 100644
--- a/jdk/src/macosx/classes/com/apple/laf/AquaProgressBarUI.java
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaProgressBarUI.java
@@ -124,9 +124,7 @@
             if (!progressBar.isIndeterminate()) return;
             stopAnimationTimer();
             // start the animation thread
-            if (progressBar.isDisplayable()) {
-              startAnimationTimer();
-            }
+            startAnimationTimer();
         }
 
         if ("JProgressBar.style".equals(prop)) {
@@ -143,9 +141,7 @@
 
     public void ancestorAdded(final AncestorEvent e) {
         if (!progressBar.isIndeterminate()) return;
-        if (progressBar.isDisplayable()) {
-          startAnimationTimer();
-        }
+        startAnimationTimer();
     }
 
     public void ancestorMoved(final AncestorEvent e) { }
diff --git a/jdk/src/macosx/classes/com/apple/laf/ScreenMenu.java b/jdk/src/macosx/classes/com/apple/laf/ScreenMenu.java
index bc8c0cc..8739340 100644
--- a/jdk/src/macosx/classes/com/apple/laf/ScreenMenu.java
+++ b/jdk/src/macosx/classes/com/apple/laf/ScreenMenu.java
@@ -109,7 +109,6 @@
         final Component[] items = fInvoker.getMenuComponents();
         if (needsUpdate(items, childHashArray)) {
             removeAll();
-            fItems.clear();
             if (count <= 0) return;
 
             childHashArray = new int[count];
@@ -233,7 +232,7 @@
         synchronized (getTreeLock()) {
             super.addNotify();
             if (fModelPtr == 0) {
-                fInvoker.getPopupMenu().addContainerListener(this);
+                fInvoker.addContainerListener(this);
                 fInvoker.addComponentListener(this);
                 fPropertyListener = new ScreenMenuPropertyListener(this);
                 fInvoker.addPropertyChangeListener(fPropertyListener);
@@ -267,7 +266,7 @@
             if (fModelPtr != 0) {
                 removeMenuListeners(fModelPtr);
                 fModelPtr = 0;
-                fInvoker.getPopupMenu().removeContainerListener(this);
+                fInvoker.removeContainerListener(this);
                 fInvoker.removeComponentListener(this);
                 fInvoker.removePropertyChangeListener(fPropertyListener);
             }
@@ -288,10 +287,11 @@
     @Override
     public void componentRemoved(final ContainerEvent e) {
         final Component child = e.getChild();
-        final MenuItem sm = fItems.remove(child);
+        final MenuItem sm = fItems.get(child);
         if (sm == null) return;
 
         remove(sm);
+        fItems.remove(sm);
     }
 
     /**
diff --git a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java
index 6488051..b1bf878 100644
--- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java
+++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java
@@ -183,7 +183,6 @@
 
         updateAlwaysOnTopState();
         updateMinimumSize();
-        updateFocusableWindowState();
 
         final Shape shape = getTarget().getShape();
         if (shape != null) {
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CAccessibility.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CAccessibility.java
index 7bc98e7..d3ab6a6 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CAccessibility.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CAccessibility.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,6 @@
 
 package sun.lwawt.macosx;
 
-import sun.lwawt.LWWindowPeer;
-
 import java.awt.*;
 import java.beans.*;
 import java.lang.reflect.Field;
@@ -84,15 +82,6 @@
         return null;
     }
 
-    static <T> T invokeAndWait(final Callable<T> callable, final Component c, final T defValue) {
-        T value = null;
-        try {
-            value = LWCToolkit.invokeAndWait(callable, c);
-        } catch (final Exception e) { e.printStackTrace(); }
-
-        return value != null ? value : defValue;
-    }
-
     static void invokeLater(final Runnable runnable, final Component c) {
         try {
             LWCToolkit.invokeLater(runnable, c);
@@ -188,7 +177,7 @@
 
                 return new Boolean(as.isAccessibleChildSelected(index));
             }
-        }, c, false);
+        }, c);
     }
 
     public static AccessibleStateSet getAccessibleStateSet(final AccessibleContext ac, final Component c) {
@@ -210,7 +199,7 @@
                 if (ass == null) return null;
                 return ass.contains(as);
             }
-        }, c, false);
+        }, c);
     }
 
     static Field getAccessibleBundleKeyFieldWithReflection() {
@@ -276,7 +265,7 @@
             public Integer call() throws Exception {
                 return at.getCharCount();
             }
-        }, c, 0);
+        }, c);
     }
 
     // Accessibility Threadsafety for JavaComponentAccessibility.m
@@ -301,7 +290,7 @@
                 if (ac == null) return null;
                 return ac.getAccessibleIndexInParent();
             }
-        }, c, -1);
+        }, c);
     }
 
     public static AccessibleComponent getAccessibleComponent(final Accessible a, final Component c) {
@@ -397,7 +386,7 @@
 
                 return aComp.isFocusTraversable();
             }
-        }, c, false);
+        }, c);
     }
 
     public static Accessible accessibilityHitTest(final Container parent, final float hitPointX, final float hitPointY) {
@@ -432,8 +421,6 @@
     }
 
     public static AccessibleAction getAccessibleAction(final Accessible a, final Component c) {
-        if (a == null) return null;
-
         return invokeAndWait(new Callable<AccessibleAction>() {
             public AccessibleAction call() throws Exception {
                 final AccessibleContext ac = a.getAccessibleContext();
@@ -456,7 +443,7 @@
 
                 return aComp.isEnabled();
             }
-        }, c, false);
+        }, c);
     }
 
     // KCH - can we make this a postEvent instead?
@@ -680,28 +667,4 @@
             }
         }, c);
     }
-
-    /**
-     * @return AWTView ptr, a peer of the CPlatformView associated with the toplevel container of the Accessible, if any
-     */
-    private static long getAWTView(Accessible a) {
-        Accessible ax = CAccessible.getSwingAccessible(a);
-        if (!(ax instanceof Component)) return 0;
-
-        return invokeAndWait(new Callable<Long>() {
-            public Long call() throws Exception {
-                Component cont = (Component) ax;
-                while (cont != null && !(cont instanceof Window)) {
-                    cont = cont.getParent();
-                }
-                if (cont != null) {
-                    LWWindowPeer peer = (LWWindowPeer) cont.getPeer();
-                    if (peer != null) {
-                        return ((CPlatformWindow) peer.getPlatformWindow()).getContentView().getAWTView();
-                    }
-                }
-                return 0L;
-            }
-        }, (Component)ax);
-    }
 }
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CAccessibleText.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CAccessibleText.java
index 6abf06e..0237ef9 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CAccessibleText.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CAccessibleText.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -264,8 +264,6 @@
                 final double localY = boundsUnion.getY();
 
                 final Point componentLocation = ac.getAccessibleComponent().getLocationOnScreen();
-                if (componentLocation == null) return ret;
-
                 final double screenX = componentLocation.getX() + localX;
                 final double screenY = componentLocation.getY() + localY;
 
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java
index 73a8875..429a395 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java
@@ -147,7 +147,8 @@
             String separator = System.getProperty("line.separator");
             StringBuilder sb = new StringBuilder();
             if(strings.length > 0) {
-                for(int i = 0; i < strings.length; i++) {
+                sb.append(strings[0]);
+                for(int i = 1; i < strings.length; i++) {
                     sb.append(strings[i]);
                     sb.append(separator);
                 }
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
index 11f05b5..f218c90 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
@@ -91,7 +91,7 @@
         int x = (int)pluginX;
         int y = (int)pluginY;
 
-        responder.handleScrollEvent(x, y, modifierFlags, deltaX, deltaY, NSEvent.SCROLL_PHASE_UNSUPPORTED);
+        responder.handleScrollEvent(x, y, modifierFlags, deltaX, deltaY);
     }
 
     public void handleKeyEvent(int eventType, int modifierFlags, String characters,
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
index 15c377f..591c16d 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
@@ -34,7 +34,6 @@
 import java.awt.event.InputEvent;
 import java.awt.event.MouseWheelEvent;
 import java.awt.event.KeyEvent;
-import java.util.Locale;
 
 /**
  * Translates NSEvents/NPCocoaEvents into AWT events.
@@ -44,8 +43,6 @@
     private final PlatformEventNotifier eventNotifier;
     private final boolean isNpapiCallback;
     private int lastKeyPressCode = KeyEvent.VK_UNDEFINED;
-    private final DeltaAccumulator deltaAccumulatorX = new DeltaAccumulator();
-    private final DeltaAccumulator deltaAccumulatorY = new DeltaAccumulator();
 
     CPlatformResponder(final PlatformEventNotifier eventNotifier,
                        final boolean isNpapiCallback) {
@@ -92,38 +89,37 @@
      * Handles scroll events.
      */
     void handleScrollEvent(final int x, final int y, final int modifierFlags,
-                           final double deltaX, final double deltaY,
-                           final int scrollPhase) {
+                           final double deltaX, final double deltaY) {
         final int buttonNumber = CocoaConstants.kCGMouseButtonCenter;
         int jmodifiers = NSEvent.nsToJavaMouseModifiers(buttonNumber,
                                                         modifierFlags);
         final boolean isShift = (jmodifiers & InputEvent.SHIFT_DOWN_MASK) != 0;
 
-        int roundDeltaX = deltaAccumulatorX.getRoundedDelta(deltaX, scrollPhase);
-        int roundDeltaY = deltaAccumulatorY.getRoundedDelta(deltaY, scrollPhase);
-
         // Vertical scroll.
-        if (!isShift && (deltaY != 0.0 || roundDeltaY != 0)) {
-            dispatchScrollEvent(x, y, jmodifiers, roundDeltaY, deltaY);
+        if (!isShift && deltaY != 0.0) {
+            dispatchScrollEvent(x, y, jmodifiers, deltaY);
         }
         // Horizontal scroll or shirt+vertical scroll.
         final double delta = isShift && deltaY != 0.0 ? deltaY : deltaX;
-        final int roundDelta = isShift && roundDeltaY != 0 ? roundDeltaY : roundDeltaX;
-        if (delta != 0.0 || roundDelta != 0) {
+        if (delta != 0.0) {
             jmodifiers |= InputEvent.SHIFT_DOWN_MASK;
-            dispatchScrollEvent(x, y, jmodifiers, roundDelta, delta);
+            dispatchScrollEvent(x, y, jmodifiers, delta);
         }
     }
 
     private void dispatchScrollEvent(final int x, final int y,
-                                     final int modifiers,
-                                     final int roundDelta, final double delta) {
+                                     final int modifiers, final double delta) {
         final long when = System.currentTimeMillis();
         final int scrollType = MouseWheelEvent.WHEEL_UNIT_SCROLL;
         final int scrollAmount = 1;
+        int wheelRotation = (int) delta;
+        int signum = (int) Math.signum(delta);
+        if (signum * delta < 1) {
+            wheelRotation = signum;
+        }
         // invert the wheelRotation for the peer
         eventNotifier.notifyMouseWheelEvent(when, x, y, modifiers, scrollType,
-                scrollAmount, -roundDelta, -delta, null);
+                scrollAmount, -wheelRotation, -delta, null);
     }
 
     /**
@@ -175,16 +171,6 @@
                 }
             }
 
-            // If Pinyin Simplified input method is selected, CAPS_LOCK key is supposed to switch
-            // input to latin letters.
-            // It is necessary to use testCharIgnoringModifiers instead of testChar for event
-            // generation in such case to avoid uppercase letters in text components.
-            LWCToolkit lwcToolkit = (LWCToolkit)Toolkit.getDefaultToolkit();
-            if (lwcToolkit.getLockingKeyState(KeyEvent.VK_CAPS_LOCK) &&
-                    Locale.SIMPLIFIED_CHINESE.equals(lwcToolkit.getDefaultKeyboardLocale())) {
-                testChar = testCharIgnoringModifiers;
-            }
-
             jkeyCode = out[0];
             jkeyLocation = out[1];
             jeventType = isNpapiCallback ? NSEvent.npToJavaEventType(eventType) :
@@ -259,46 +245,4 @@
     void handleWindowFocusEvent(boolean gained, LWWindowPeer opposite) {
         eventNotifier.notifyActivation(gained, opposite);
     }
-
-    static class DeltaAccumulator {
-
-        static final double MIN_THRESHOLD = 0.1;
-        static final double MAX_THRESHOLD = 0.5;
-        double accumulatedDelta;
-
-        int getRoundedDelta(double delta, int scrollPhase) {
-
-            int roundDelta = (int) Math.round(delta);
-
-            if (scrollPhase == NSEvent.SCROLL_PHASE_UNSUPPORTED) { // mouse wheel
-                if (roundDelta == 0 && delta != 0) {
-                    roundDelta = delta > 0 ? 1 : -1;
-                }
-            } else { // trackpad
-                boolean begin = scrollPhase == NSEvent.SCROLL_PHASE_BEGAN;
-                boolean end = scrollPhase == NSEvent.SCROLL_MASK_PHASE_ENDED
-                        || scrollPhase == NSEvent.SCROLL_MASK_PHASE_CANCELLED;
-
-                if (begin) {
-                    accumulatedDelta = 0;
-                }
-
-                accumulatedDelta += delta;
-
-                double absAccumulatedDelta = Math.abs(accumulatedDelta);
-                if (absAccumulatedDelta > MAX_THRESHOLD) {
-                    roundDelta = (int) Math.round(accumulatedDelta);
-                    accumulatedDelta -= roundDelta;
-                }
-
-                if (end) {
-                    if (roundDelta == 0 && absAccumulatedDelta > MIN_THRESHOLD) {
-                        roundDelta = accumulatedDelta > 0 ? 1 : -1;
-                    }
-                }
-            }
-
-            return roundDelta;
-        }
-    }
 }
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java
index 9d1acaf..3c2cd23 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java
@@ -192,8 +192,7 @@
 
         if (event.getType() == CocoaConstants.NSScrollWheel) {
             responder.handleScrollEvent(x, y, event.getModifierFlags(),
-                                        event.getScrollDeltaX(), event.getScrollDeltaY(),
-                                        event.getScrollPhase());
+                                        event.getScrollDeltaX(), event.getScrollDeltaY());
         } else {
             responder.handleMouseEvent(event.getType(), event.getModifierFlags(), event.getButtonNumber(),
                                        event.getClickCount(), x, y, event.getAbsX(), event.getAbsY());
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
index a97310a..e449227 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
@@ -61,7 +61,6 @@
     private static native void nativeSetNSWindowRepresentedFilename(long nsWindowPtr, String representedFilename);
     private static native void nativeSetEnabled(long nsWindowPtr, boolean isEnabled);
     private static native void nativeSynthesizeMouseEnteredExitedEvents();
-    private static native void nativeSynthesizeMouseEnteredExitedEvents(long nsWindowPtr, int eventType);
     private static native void nativeDispose(long nsWindowPtr);
     private static native CPlatformWindow nativeGetTopmostPlatformWindowUnderMouse();
     private static native void nativeEnterFullScreenMode(long nsWindowPtr);
@@ -428,6 +427,9 @@
 
     @Override // PlatformWindow
     public void dispose() {
+        if (owner != null) {
+            CWrapper.NSWindow.removeChildWindow(owner.getNSWindowPtr(), getNSWindowPtr());
+        }
         contentView.dispose();
         nativeDispose(getNSWindowPtr());
         CPlatformWindow.super.dispose();
@@ -524,6 +526,25 @@
     public void setVisible(boolean visible) {
         final long nsWindowPtr = getNSWindowPtr();
 
+        // Process parent-child relationship when hiding
+        if (!visible) {
+            // Unparent my children
+            for (Window w : target.getOwnedWindows()) {
+                WindowPeer p = (WindowPeer)w.getPeer();
+                if (p instanceof LWWindowPeer) {
+                    CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
+                    if (pw != null && pw.isVisible()) {
+                        CWrapper.NSWindow.removeChildWindow(nsWindowPtr, pw.getNSWindowPtr());
+                    }
+                }
+            }
+
+            // Unparent myself
+            if (owner != null && owner.isVisible()) {
+                CWrapper.NSWindow.removeChildWindow(owner.getNSWindowPtr(), nsWindowPtr);
+            }
+        }
+
         // Configure stuff
         updateIconImages();
         updateFocusabilityForAutoRequestFocus(false);
@@ -597,19 +618,19 @@
 
         // Manage parent-child relationship when showing
         if (visible) {
-            // Order myself above my parent
+            // Add myself as a child
             if (owner != null && owner.isVisible()) {
-                CWrapper.NSWindow.orderWindow(nsWindowPtr, CWrapper.NSWindow.NSWindowAbove, owner.getNSWindowPtr());
+                CWrapper.NSWindow.addChildWindow(owner.getNSWindowPtr(), nsWindowPtr, CWrapper.NSWindow.NSWindowAbove);
                 applyWindowLevel(target);
             }
 
-            // Order my own children above myself
+            // Add my own children to myself
             for (Window w : target.getOwnedWindows()) {
                 WindowPeer p = (WindowPeer)w.getPeer();
                 if (p instanceof LWWindowPeer) {
                     CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
                     if (pw != null && pw.isVisible()) {
-                        CWrapper.NSWindow.orderWindow(pw.getNSWindowPtr(), CWrapper.NSWindow.NSWindowAbove, nsWindowPtr);
+                        CWrapper.NSWindow.addChildWindow(nsWindowPtr, pw.getNSWindowPtr(), CWrapper.NSWindow.NSWindowAbove);
                         pw.applyWindowLevel(w);
                     }
                 }
@@ -827,13 +848,6 @@
             return;
         }
 
-        if (blocked) {
-            // We are going to show a modal window. Previously displayed window will be
-            // blocked/disabled. So we have to send mouse exited event to it now, since
-            // all mouse events are discarded for blocked/disabled windows.
-            nativeSynthesizeMouseEnteredExitedEvents(getNSWindowPtr(), CocoaConstants.NSMouseExited);
-        }
-
         nativeSetEnabled(getNSWindowPtr(), !blocked);
         checkBlockingAndOrder();
     }
@@ -1045,8 +1059,8 @@
             // Order the window to front of the stack of child windows
             final long nsWindowSelfPtr = getNSWindowPtr();
             final long nsWindowOwnerPtr = owner.getNSWindowPtr();
-            CWrapper.NSWindow.orderFront(nsWindowOwnerPtr);
-            CWrapper.NSWindow.orderWindow(nsWindowSelfPtr, CWrapper.NSWindow.NSWindowAbove, nsWindowOwnerPtr);
+            CWrapper.NSWindow.removeChildWindow(nsWindowOwnerPtr, nsWindowSelfPtr);
+            CWrapper.NSWindow.addChildWindow(nsWindowOwnerPtr, nsWindowSelfPtr, CWrapper.NSWindow.NSWindowAbove);
         }
 
         applyWindowLevel(target);
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java
index 0a6bc23..4de4d57 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java
@@ -177,6 +177,12 @@
             return;
         }
 
+        // See if this has an NSPrintInfo in it.
+        NSPrintInfo nsPrintInfo = (NSPrintInfo)attributes.get(NSPrintInfo.class);
+        if (nsPrintInfo != null) {
+            fNSPrintInfo = nsPrintInfo.getValue();
+        }
+
         PageRanges pageRangesAttr =  (PageRanges)attributes.get(PageRanges.class);
         if (isSupportedValue(pageRangesAttr, attributes)) {
             SunPageSelection rangeSelect = (SunPageSelection)attributes.get(SunPageSelection.class);
@@ -529,11 +535,8 @@
 
     @Override
     protected void finalize() {
-        synchronized (fNSPrintInfoLock) {
-            if (fNSPrintInfo != -1) {
-                dispose(fNSPrintInfo);
-            }
-            fNSPrintInfo = -1;
+        if (fNSPrintInfo != -1) {
+            dispose(fNSPrintInfo);
         }
     }
 
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java
index 5962b7f..800d76f 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java
@@ -221,6 +221,15 @@
         synchronized (lock) {
             final long nsWindowPtr = getNSWindowPtr();
 
+            // Process parent-child relationship when hiding
+            if (!visible) {
+                // Unparent myself
+                if (owner != null && owner.isVisible()) {
+                    CWrapper.NSWindow.removeChildWindow(
+                            owner.getNSWindowPtr(), nsWindowPtr);
+                }
+            }
+
             // Actually show or hide the window
             if (visible) {
                 CWrapper.NSWindow.orderFront(nsWindowPtr);
@@ -232,10 +241,10 @@
 
             // Manage parent-child relationship when showing
             if (visible) {
-                // Order myself above my parent
+                // Add myself as a child
                 if (owner != null && owner.isVisible()) {
-                    CWrapper.NSWindow.orderWindow(nsWindowPtr,
-                            CWrapper.NSWindow.NSWindowAbove, owner.getNSWindowPtr());
+                    CWrapper.NSWindow.addChildWindow(owner.getNSWindowPtr(),
+                            nsWindowPtr, CWrapper.NSWindow.NSWindowAbove);
 
                     // do not allow security warning to be obscured by other windows
                     applyWindowLevel(ownerWindow);
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/NSEvent.java b/jdk/src/macosx/classes/sun/lwawt/macosx/NSEvent.java
index eccc257..d30a39c 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/NSEvent.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/NSEvent.java
@@ -32,13 +32,6 @@
  * JDK functionality.
  */
 final class NSEvent {
-
-    static final int SCROLL_PHASE_UNSUPPORTED = 1;
-    static final int SCROLL_PHASE_BEGAN = 2;
-    static final int SCROLL_PHASE_CONTINUED = 3;
-    static final int SCROLL_MASK_PHASE_CANCELLED = 4;
-    static final int SCROLL_MASK_PHASE_ENDED = 5;
-
     private int type;
     private int modifierFlags;
 
@@ -49,7 +42,6 @@
     private int y;
     private double scrollDeltaY;
     private double scrollDeltaX;
-    private int scrollPhase;
     private int absX;
     private int absY;
 
@@ -70,7 +62,7 @@
     // Called from native
     NSEvent(int type, int modifierFlags, int clickCount, int buttonNumber,
                    int x, int y, int absX, int absY,
-                   double scrollDeltaY, double scrollDeltaX, int scrollPhase) {
+                   double scrollDeltaY, double scrollDeltaX) {
         this.type = type;
         this.modifierFlags = modifierFlags;
         this.clickCount = clickCount;
@@ -81,7 +73,6 @@
         this.absY = absY;
         this.scrollDeltaY = scrollDeltaY;
         this.scrollDeltaX = scrollDeltaX;
-        this.scrollPhase = scrollPhase;
     }
 
     int getType() {
@@ -116,10 +107,6 @@
         return scrollDeltaX;
     }
 
-    int getScrollPhase() {
-        return scrollPhase;
-    }
-
     int getAbsX() {
         return absX;
     }
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/NSPrintInfo.java b/jdk/src/macosx/classes/sun/lwawt/macosx/NSPrintInfo.java
new file mode 100644
index 0000000..5698864
--- /dev/null
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/NSPrintInfo.java
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+package sun.lwawt.macosx;
+
+
+import java.io.*;
+import javax.print.attribute.*;
+
+public final class NSPrintInfo implements PrintJobAttribute, PrintRequestAttribute, Serializable, Cloneable {
+
+    private long fNSPrintInfo;
+
+    public NSPrintInfo(long nsPrintInfo) {
+        fNSPrintInfo = nsPrintInfo;
+    }
+
+    public long getValue() {
+        return fNSPrintInfo;
+    }
+
+    public boolean equals(Object object) {
+        return (object != null && object instanceof NSPrintInfo && fNSPrintInfo == ((NSPrintInfo)object).fNSPrintInfo);
+    }
+
+    public int hashCode() {
+        return (int)fNSPrintInfo;
+    }
+
+    public String toString() {
+        return "" + fNSPrintInfo;
+    }
+
+    public final Class<? extends Attribute> getCategory() {
+        return NSPrintInfo.class;
+    }
+
+    public final String getName() {
+        return "nsPrintInfo";
+    }
+}
diff --git a/jdk/src/macosx/native/sun/awt/AWTView.h b/jdk/src/macosx/native/sun/awt/AWTView.h
index 1ba06fe..592235b 100644
--- a/jdk/src/macosx/native/sun/awt/AWTView.h
+++ b/jdk/src/macosx/native/sun/awt/AWTView.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -63,8 +63,6 @@
 - (void) deliverJavaMouseEvent: (NSEvent *) event;
 - (jobject) awtComponent:(JNIEnv *)env;
 
-+ (AWTView *) awtView:(JNIEnv *)env ofAccessible:(jobject)jaccessible;
-
 // Input method-related events
 - (void)setInputMethod:(jobject)inputMethod;
 - (void)abandonInput;
diff --git a/jdk/src/macosx/native/sun/awt/AWTView.m b/jdk/src/macosx/native/sun/awt/AWTView.m
index 0808580..66ad514 100644
--- a/jdk/src/macosx/native/sun/awt/AWTView.m
+++ b/jdk/src/macosx/native/sun/awt/AWTView.m
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,6 @@
 #import "LWCToolkit.h"
 #import "JavaComponentAccessibility.h"
 #import "JavaTextAccessibility.h"
-#import "JavaAccessibilityUtilities.h"
 #import "GeomUtilities.h"
 #import "OSVersion.h"
 #import "CGLLayer.h"
@@ -133,7 +132,7 @@
     self.cglLayer = nil;
 
     JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
-    (*env)->DeleteWeakGlobalRef(env, m_cPlatformView);
+    (*env)->DeleteGlobalRef(env, m_cPlatformView);
     m_cPlatformView = NULL;
 
     if (fInputMethodLOCKABLE != NULL)
@@ -386,7 +385,7 @@
     }
 
     static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/NSEvent");
-    static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IIIIIIIIDDI)V");
+    static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IIIIIIIIDD)V");
     jobject jEvent = JNFNewObject(env, jctor_NSEvent,
                                   [event type],
                                   [event modifierFlags],
@@ -395,8 +394,7 @@
                                   (jint)localPoint.x, (jint)localPoint.y,
                                   (jint)absP.x, (jint)absP.y,
                                   [event deltaY],
-                                  [event deltaX],
-                                  [AWTToolkit scrollStateWithEvent: event]);
+                                  [event deltaX]);
     if (jEvent == nil) {
         // Unable to create event by some reason.
         return;
@@ -404,12 +402,7 @@
 
     static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView");
     static JNF_MEMBER_CACHE(jm_deliverMouseEvent, jc_PlatformView, "deliverMouseEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
-
-    jobject jlocal = (*env)->NewLocalRef(env, m_cPlatformView);
-    if (!(*env)->IsSameObject(env, jlocal, NULL)) {
-        JNFCallVoidMethod(env, jlocal, jm_deliverMouseEvent, jEvent);
-        (*env)->DeleteLocalRef(env, jlocal);
-    }
+    JNFCallVoidMethod(env, m_cPlatformView, jm_deliverMouseEvent, jEvent);
 }
 
 - (void) resetTrackingArea {
@@ -470,12 +463,7 @@
     static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView");
     static JNF_MEMBER_CACHE(jm_deliverKeyEvent, jc_PlatformView,
                             "deliverKeyEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
-
-    jobject jlocal = (*env)->NewLocalRef(env, m_cPlatformView);
-    if (!(*env)->IsSameObject(env, jlocal, NULL)) {
-        JNFCallVoidMethod(env, jlocal, jm_deliverKeyEvent, jevent);
-        (*env)->DeleteLocalRef(env, jlocal);
-    }
+    JNFCallVoidMethod(env, m_cPlatformView, jm_deliverKeyEvent, jevent);
 
     if (characters != NULL) {
         (*env)->DeleteLocalRef(env, characters);
@@ -490,12 +478,7 @@
     JNIEnv *env = [ThreadUtilities getJNIEnv];
     static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView");
     static JNF_MEMBER_CACHE(jm_deliverResize, jc_PlatformView, "deliverResize", "(IIII)V");
-
-    jobject jlocal = (*env)->NewLocalRef(env, m_cPlatformView);
-    if (!(*env)->IsSameObject(env, jlocal, NULL)) {
-        JNFCallVoidMethod(env, jlocal, jm_deliverResize, x,y,w,h);
-        (*env)->DeleteLocalRef(env, jlocal);
-    }
+    JNFCallVoidMethod(env, m_cPlatformView, jm_deliverResize, x,y,w,h);
 }
 
 
@@ -524,12 +507,7 @@
 */
         static JNF_CLASS_CACHE(jc_CPlatformView, "sun/lwawt/macosx/CPlatformView");
         static JNF_MEMBER_CACHE(jm_deliverWindowDidExposeEvent, jc_CPlatformView, "deliverWindowDidExposeEvent", "()V");
-
-        jobject jlocal = (*env)->NewLocalRef(env, m_cPlatformView);
-        if (!(*env)->IsSameObject(env, jlocal, NULL)) {
-            JNFCallVoidMethod(env, jlocal, jm_deliverWindowDidExposeEvent);
-            (*env)->DeleteLocalRef(env, jlocal);
-        }
+        JNFCallVoidMethod(env, m_cPlatformView, jm_deliverWindowDidExposeEvent);
 /*
         }
 */
@@ -537,10 +515,8 @@
 }
 
 -(BOOL) isCodePointInUnicodeBlockNeedingIMEvent: (unichar) codePoint {
-    if (((codePoint >= 0x3000) && (codePoint <= 0x303F)) ||
-        ((codePoint >= 0xFF00) && (codePoint <= 0xFFEF))) {
-        // Code point is in 'CJK Symbols and Punctuation' or
-        // 'Halfwidth and Fullwidth Forms' Unicode block.
+    if ((codePoint >= 0x3000) && (codePoint <= 0x303F)) {
+        // Code point is in 'CJK Symbols and Punctuation' Unicode block.
         return YES;
     }
     return NO;
@@ -559,13 +535,7 @@
         }
         return NULL;
     }
-
-    jobject peer = NULL;
-    jobject jlocal = (*env)->NewLocalRef(env, m_cPlatformView);
-    if (!(*env)->IsSameObject(env, jlocal, NULL)) {
-        peer = JNFGetObjectField(env, jlocal, jf_Peer);
-        (*env)->DeleteLocalRef(env, jlocal);
-    }
+    jobject peer = JNFGetObjectField(env, m_cPlatformView, jf_Peer);
     static JNF_CLASS_CACHE(jc_LWWindowPeer, "sun/lwawt/LWWindowPeer");
     static JNF_MEMBER_CACHE(jf_Target, jc_LWWindowPeer, "target", "Ljava/awt/Component;");
     if (peer == NULL) {
@@ -573,27 +543,12 @@
         JNFDumpJavaStack(env);
         return NULL;
     }
-    jobject comp = JNFGetObjectField(env, peer, jf_Target);
-    (*env)->DeleteLocalRef(env, peer);
-    return comp;
-}
-
-+ (AWTView *) awtView:(JNIEnv*)env ofAccessible:(jobject)jaccessible
-{
-    static JNF_STATIC_MEMBER_CACHE(jm_getAWTView, sjc_CAccessibility, "getAWTView", "(Ljavax/accessibility/Accessible;)J");
-
-    jlong jptr = JNFCallStaticLongMethod(env, jm_getAWTView, jaccessible);
-    if (jptr == 0) return nil;
-
-    return (AWTView *)jlong_to_ptr(jptr);
+    return JNFGetObjectField(env, peer, jf_Target);
 }
 
 - (id)getAxData:(JNIEnv*)env
 {
-    jobject jcomponent = [self awtComponent:env];
-    id ax = [[[JavaComponentAccessibility alloc] initWithParent:self withEnv:env withAccessible:jcomponent withIndex:-1 withView:self withJavaRole:nil] autorelease];
-    (*env)->DeleteLocalRef(env, jcomponent);
-    return ax;
+    return [[[JavaComponentAccessibility alloc] initWithParent:self withEnv:env withAccessible:[self awtComponent:env] withIndex:-1 withView:self withJavaRole:nil] autorelease];
 }
 
 - (NSArray *)accessibilityAttributeNames
@@ -1336,7 +1291,7 @@
 JNF_COCOA_ENTER(env);
 
     NSRect rect = NSMakeRect(originX, originY, width, height);
-    jobject cPlatformView = (*env)->NewWeakGlobalRef(env, obj);
+    jobject cPlatformView = (*env)->NewGlobalRef(env, obj);
 
     [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
 
diff --git a/jdk/src/macosx/native/sun/awt/AWTWindow.h b/jdk/src/macosx/native/sun/awt/AWTWindow.h
index ee01181..7f7bac7 100644
--- a/jdk/src/macosx/native/sun/awt/AWTWindow.h
+++ b/jdk/src/macosx/native/sun/awt/AWTWindow.h
@@ -46,7 +46,6 @@
     NSWindow *nsWindow;
     AWTWindow *ownerWindow;
     jint preFullScreenLevel;
-    BOOL isMinimizing;
 }
 
 // An instance of either AWTWindow_Normal or AWTWindow_Panel
@@ -60,7 +59,6 @@
 @property (nonatomic) jint styleBits;
 @property (nonatomic) BOOL isEnabled;
 @property (nonatomic) jint preFullScreenLevel;
-@property (nonatomic) BOOL isMinimizing;
 
 
 - (id) initWithPlatformWindow:(JNFWeakJObjectWrapper *)javaPlatformWindow
diff --git a/jdk/src/macosx/native/sun/awt/AWTWindow.m b/jdk/src/macosx/native/sun/awt/AWTWindow.m
index 60f465f..324f9d5 100644
--- a/jdk/src/macosx/native/sun/awt/AWTWindow.m
+++ b/jdk/src/macosx/native/sun/awt/AWTWindow.m
@@ -184,7 +184,6 @@
 @synthesize isEnabled;
 @synthesize ownerWindow;
 @synthesize preFullScreenLevel;
-@synthesize isMinimizing;
 
 - (void) updateMinMaxSize:(BOOL)resizable {
     if (resizable) {
@@ -309,7 +308,6 @@
     [self.nsWindow release]; // the property retains the object already
 
     self.isEnabled = YES;
-    self.isMinimizing = NO;
     self.javaPlatformWindow = platformWindow;
     self.styleBits = bits;
     self.ownerWindow = owner;
@@ -429,68 +427,6 @@
     [super dealloc];
 }
 
-// Tests wheather the corresponding Java paltform window is visible or not
-+ (BOOL) isJavaPlatformWindowVisible:(NSWindow *)window {
-    BOOL isVisible = NO;
-    
-    if ([AWTWindow isAWTWindow:window] && [window delegate] != nil) {
-        AWTWindow *awtWindow = (AWTWindow *)[window delegate];
-        [AWTToolkit eventCountPlusPlus];
-        
-        JNIEnv *env = [ThreadUtilities getJNIEnv];
-        jobject platformWindow = [awtWindow.javaPlatformWindow jObjectWithEnv:env];
-        if (platformWindow != NULL) {
-            static JNF_MEMBER_CACHE(jm_isVisible, jc_CPlatformWindow, "isVisible", "()Z");
-            isVisible = JNFCallBooleanMethod(env, platformWindow, jm_isVisible) == JNI_TRUE ? YES : NO;
-            (*env)->DeleteLocalRef(env, platformWindow);
-            
-        }
-    }
-    return isVisible;
-}
-
-// Orders window's childs based on the current focus state
-- (void) orderChildWindows:(BOOL)focus {
-AWT_ASSERT_APPKIT_THREAD;
-
-    if (self.isMinimizing) {
-        // Do not perform any ordering, if iconify is in progress
-        return;
-    }
-
-    NSEnumerator *windowEnumerator = [[NSApp windows]objectEnumerator];
-    NSWindow *window;
-    while ((window = [windowEnumerator nextObject]) != nil) {
-        if ([AWTWindow isJavaPlatformWindowVisible:window]) {
-            AWTWindow *awtWindow = (AWTWindow *)[window delegate];
-            AWTWindow *owner = awtWindow.ownerWindow;
-            if (IS(awtWindow.styleBits, ALWAYS_ON_TOP)) {
-                // Do not order 'always on top' windows
-                continue;
-            }
-            while (awtWindow.ownerWindow != nil) {
-                if (awtWindow.ownerWindow == self) {
-                    if (focus) {
-                        // Move the childWindow to floating level
-                        // so it will appear in front of its
-                        // parent which owns the focus
-                        [window setLevel:NSFloatingWindowLevel];
-                    } else {
-                        // Focus owner has changed, move the childWindow
-                        // back to normal window level
-                        [window setLevel:NSNormalWindowLevel];
-                    }
-                    // The childWindow should be displayed in front of
-                    // its nearest parentWindow
-                    [window orderWindow:NSWindowAbove relativeTo:[owner.nsWindow windowNumber]];
-                    break;
-                }
-                awtWindow = awtWindow.ownerWindow;
-            }
-        }
-    }
-}
-
 // NSWindow overrides
 - (BOOL) canBecomeKeyWindow {
 AWT_ASSERT_APPKIT_THREAD;
@@ -573,30 +509,6 @@
     // window exposing in _setVisible:(BOOL)
 }
 
-// Hides/shows window's childs during iconify/de-iconify operation
-- (void) iconifyChildWindows:(BOOL)iconify {
-AWT_ASSERT_APPKIT_THREAD;
-
-    NSEnumerator *windowEnumerator = [[NSApp windows]objectEnumerator];
-    NSWindow *window;
-    while ((window = [windowEnumerator nextObject]) != nil) {
-        if ([AWTWindow isJavaPlatformWindowVisible:window]) {
-            AWTWindow *awtWindow = (AWTWindow *)[window delegate];
-            while (awtWindow.ownerWindow != nil) {
-                if (awtWindow.ownerWindow == self) {
-                    if (iconify) {
-                        [window orderOut:window];
-                    } else {
-                        [window orderFront:window];
-                    }
-                    break;
-                }
-                awtWindow = awtWindow.ownerWindow;
-            }
-        }
-    }
-}
-
 - (void) _deliverIconify:(BOOL)iconify {
 AWT_ASSERT_APPKIT_THREAD;
 
@@ -610,28 +522,16 @@
     }
 }
 
-- (void)windowWillMiniaturize:(NSNotification *)notification {
-AWT_ASSERT_APPKIT_THREAD;
-
-    self.isMinimizing = YES;
-    // Excplicitly make myself a key window to avoid possible
-    // negative visual effects during iconify operation
-    [self.nsWindow makeKeyAndOrderFront:self.nsWindow];
-    [self iconifyChildWindows:YES];
-}
-
 - (void)windowDidMiniaturize:(NSNotification *)notification {
 AWT_ASSERT_APPKIT_THREAD;
 
     [self _deliverIconify:JNI_TRUE];
-    self.isMinimizing = NO;
 }
 
 - (void)windowDidDeminiaturize:(NSNotification *)notification {
 AWT_ASSERT_APPKIT_THREAD;
 
     [self _deliverIconify:JNI_FALSE];
-    [self iconifyChildWindows:NO];
 }
 
 - (void) _deliverWindowFocusEvent:(BOOL)focused oppositeWindow:(AWTWindow *)opposite {
@@ -677,7 +577,6 @@
     [AWTWindow setLastKeyWindow:nil];
 
     [self _deliverWindowFocusEvent:YES oppositeWindow: opposite];
-    [self orderChildWindows:YES];
 }
 
 - (void) windowDidResignKey: (NSNotification *) notification {
@@ -705,7 +604,6 @@
     }
 
     [self _deliverWindowFocusEvent:NO oppositeWindow: opposite];
-    [self orderChildWindows:NO];
 }
 
 - (void) windowDidBecomeMain: (NSNotification *) notification {
@@ -800,18 +698,6 @@
 
 - (void)sendEvent:(NSEvent *)event {
         if ([event type] == NSLeftMouseDown || [event type] == NSRightMouseDown || [event type] == NSOtherMouseDown) {
-            // Move parent windows to front and make sure that a child window is displayed
-            // in front of its nearest parent.
-            if (self.ownerWindow != nil) {
-                JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
-                jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
-                if (platformWindow != NULL) {
-                    static JNF_MEMBER_CACHE(jm_orderAboveSiblings, jc_CPlatformWindow, "orderAboveSiblings", "()V");
-                    JNFCallVoidMethod(env,platformWindow, jm_orderAboveSiblings);
-                    (*env)->DeleteLocalRef(env, platformWindow);
-                }
-            }
-            [self orderChildWindows:YES];
 
             NSPoint p = [NSEvent mouseLocation];
             NSRect frame = [self.nsWindow frame];
@@ -821,12 +707,9 @@
             if (p.y >= (frame.origin.y + contentRect.size.height)) {
                 JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
                 jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
-                if (platformWindow != NULL) {
-                    // Currently, no need to deliver the whole NSEvent.
-                    static JNF_MEMBER_CACHE(jm_deliverNCMouseDown, jc_CPlatformWindow, "deliverNCMouseDown", "()V");
-                    JNFCallVoidMethod(env, platformWindow, jm_deliverNCMouseDown);
-                    (*env)->DeleteLocalRef(env, platformWindow);
-                }
+                // Currently, no need to deliver the whole NSEvent.
+                static JNF_MEMBER_CACHE(jm_deliverNCMouseDown, jc_CPlatformWindow, "deliverNCMouseDown", "()V");
+                JNFCallVoidMethod(env, platformWindow, jm_deliverNCMouseDown);
             }
         }
 }
@@ -1115,16 +998,6 @@
     NSWindow *nsWindow = OBJC(windowPtr);
     [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
         [nsWindow orderBack:nil];
-        // Order parent windows
-        AWTWindow *awtWindow = (AWTWindow*)[nsWindow delegate];
-        while (awtWindow.ownerWindow != nil) {
-            awtWindow = awtWindow.ownerWindow;
-            if ([AWTWindow isJavaPlatformWindowVisible:awtWindow.nsWindow]) {
-                [awtWindow.nsWindow orderBack:nil];
-            }
-        }
-        // Order child windows
-        [(AWTWindow*)[nsWindow delegate] orderChildWindows:NO];
     }];
 
 JNF_COCOA_EXIT(env);
@@ -1276,9 +1149,9 @@
 /*
  * Class:     sun_lwawt_macosx_CPlatformWindow
  * Method:    nativeSynthesizeMouseEnteredExitedEvents
- * Signature: ()V
+ * Signature: (J)V
  */
-JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSynthesizeMouseEnteredExitedEvents__
+JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSynthesizeMouseEnteredExitedEvents
 (JNIEnv *env, jclass clazz)
 {
     JNF_COCOA_ENTER(env);
@@ -1292,29 +1165,6 @@
 
 /*
  * Class:     sun_lwawt_macosx_CPlatformWindow
- * Method:    nativeSynthesizeMouseEnteredExitedEvents
- * Signature: (JI)V
- */
-JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSynthesizeMouseEnteredExitedEvents__JI
-(JNIEnv *env, jclass clazz, jlong windowPtr, jint eventType)
-{
-JNF_COCOA_ENTER(env);
-
-    if (eventType == NSMouseEntered || eventType == NSMouseExited) {
-        NSWindow *nsWindow = OBJC(windowPtr);
-
-        [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
-            [AWTWindow synthesizeMouseEnteredExitedEvents:nsWindow withType:eventType];
-        }];
-    } else {
-        [JNFException raise:env as:kIllegalArgumentException reason:"unknown event type"];
-    }
-    
-JNF_COCOA_EXIT(env);
-}
-
-/*
- * Class:     sun_lwawt_macosx_CPlatformWindow
  * Method:    _toggleFullScreenMode
  * Signature: (J)V
  */
diff --git a/jdk/src/macosx/native/sun/awt/CGraphicsEnv.m b/jdk/src/macosx/native/sun/awt/CGraphicsEnv.m
index 23d8eee..c8044d1 100644
--- a/jdk/src/macosx/native/sun/awt/CGraphicsEnv.m
+++ b/jdk/src/macosx/native/sun/awt/CGraphicsEnv.m
@@ -146,7 +146,6 @@
                     jc_CGraphicsEnvironment, "_displayReconfiguration","(IZ)V");
             JNFCallVoidMethod(env, graphicsEnv, jm_displayReconfiguration,
                     (jint) display, (jboolean) flags & kCGDisplayRemoveFlag);
-            (*env)->DeleteLocalRef(env, graphicsEnv);
         });
     }];
 }
diff --git a/jdk/src/macosx/native/sun/awt/CTrayIcon.m b/jdk/src/macosx/native/sun/awt/CTrayIcon.m
index b3967df..79ae024 100644
--- a/jdk/src/macosx/native/sun/awt/CTrayIcon.m
+++ b/jdk/src/macosx/native/sun/awt/CTrayIcon.m
@@ -136,7 +136,7 @@
     clickCount = [event clickCount];
 
     static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/NSEvent");
-    static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IIIIIIIIDDI)V");
+    static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IIIIIIIIDD)V");
     jobject jEvent = JNFNewObject(env, jctor_NSEvent,
                                   [event type],
                                   [event modifierFlags],
@@ -145,8 +145,7 @@
                                   (jint)localPoint.x, (jint)localPoint.y,
                                   (jint)absP.x, (jint)absP.y,
                                   [event deltaY],
-                                  [event deltaX],
-                                  [AWTToolkit scrollStateWithEvent: event]);
+                                  [event deltaX]);
     if (jEvent == nil) {
         // Unable to create event by some reason.
         return;
diff --git a/jdk/src/macosx/native/sun/awt/JavaAccessibilityAction.m b/jdk/src/macosx/native/sun/awt/JavaAccessibilityAction.m
index 2078e1d..9afd1ff 100644
--- a/jdk/src/macosx/native/sun/awt/JavaAccessibilityAction.m
+++ b/jdk/src/macosx/native/sun/awt/JavaAccessibilityAction.m
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -35,9 +35,9 @@
 {
     self = [super init];
     if (self) {
-        fAccessibleAction = JNFNewWeakGlobalRef(env, accessibleAction);
+        fAccessibleAction = JNFNewGlobalRef(env, accessibleAction);
         fIndex = index;
-        fComponent = JNFNewWeakGlobalRef(env, component);
+        fComponent = JNFNewGlobalRef(env, component);
     }
     return self;
 }
@@ -46,10 +46,10 @@
 {
     JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
 
-    JNFDeleteWeakGlobalRef(env, fAccessibleAction);
+    JNFDeleteGlobalRef(env, fAccessibleAction);
     fAccessibleAction = NULL;
 
-    JNFDeleteWeakGlobalRef(env, fComponent);
+    JNFDeleteGlobalRef(env, fComponent);
     fComponent = NULL;
 
     [super dealloc];
@@ -59,10 +59,10 @@
 {
     JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
 
-    JNFDeleteWeakGlobalRef(env, fAccessibleAction);
+    JNFDeleteGlobalRef(env, fAccessibleAction);
     fAccessibleAction = NULL;
 
-    JNFDeleteWeakGlobalRef(env, fComponent);
+    JNFDeleteGlobalRef(env, fComponent);
     fComponent = NULL;
 
     [super finalize];
@@ -75,18 +75,7 @@
 
     JNIEnv* env = [ThreadUtilities getJNIEnv];
 
-    jobject fCompLocal = (*env)->NewLocalRef(env, fComponent);
-    if ((*env)->IsSameObject(env, fCompLocal, NULL)) {
-        return @"unknown";
-    }
-    NSString *str = nil;
-    jobject jstr = JNFCallStaticObjectMethod(env, jm_getAccessibleActionDescription, fAccessibleAction, fIndex, fCompLocal);
-    if (jstr != NULL) {
-        NSString *str = JNFJavaToNSString(env, jstr); // AWT_THREADING Safe (AWTRunLoopMode)
-        (*env)->DeleteLocalRef(env, jstr);
-    }
-    (*env)->DeleteLocalRef(env, fCompLocal);
-    return str == nil ? @"unknown" : str;
+    return JNFJavaToNSString(env, JNFCallStaticObjectMethod(env, jm_getAccessibleActionDescription, fAccessibleAction, fIndex, fComponent)); // AWT_THREADING Safe (AWTRunLoopMode)
 }
 
 - (void)perform
@@ -107,9 +96,9 @@
 {
     self = [super init];
     if (self) {
-        fTabGroup = JNFNewWeakGlobalRef(env, tabGroup);
+        fTabGroup = JNFNewGlobalRef(env, tabGroup);
         fIndex = index;
-        fComponent = JNFNewWeakGlobalRef(env, component);
+        fComponent = JNFNewGlobalRef(env, component);
     }
     return self;
 }
@@ -118,10 +107,10 @@
 {
     JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
 
-    JNFDeleteWeakGlobalRef(env, fTabGroup);
+    JNFDeleteGlobalRef(env, fTabGroup);
     fTabGroup = NULL;
 
-    JNFDeleteWeakGlobalRef(env, fComponent);
+    JNFDeleteGlobalRef(env, fComponent);
     fComponent = NULL;
 
     [super dealloc];
@@ -131,10 +120,10 @@
 {
     JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
 
-    JNFDeleteWeakGlobalRef(env, fTabGroup);
+    JNFDeleteGlobalRef(env, fTabGroup);
     fTabGroup = NULL;
 
-    JNFDeleteWeakGlobalRef(env, fComponent);
+    JNFDeleteGlobalRef(env, fComponent);
     fComponent = NULL;
 
     [super finalize];
diff --git a/jdk/src/macosx/native/sun/awt/JavaAccessibilityUtilities.m b/jdk/src/macosx/native/sun/awt/JavaAccessibilityUtilities.m
index 2b99936..081c7f7 100644
--- a/jdk/src/macosx/native/sun/awt/JavaAccessibilityUtilities.m
+++ b/jdk/src/macosx/native/sun/awt/JavaAccessibilityUtilities.m
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -77,9 +77,7 @@
     jobject axRole = JNFCallStaticObjectMethod(env, sjm_getAccessibleRole, axComponent, component); // AWT_THREADING Safe (AWTRunLoopMode)
     if (axRole == NULL) return @"unknown";
 
-    NSString* str = JNFJavaToNSString(env, axRole);
-    (*env)->DeleteLocalRef(env, axRole);
-    return str;
+    return JNFJavaToNSString(env, axRole);
 }
 
 jobject getAxSelection(JNIEnv *env, jobject axContext, jobject component)
@@ -128,27 +126,21 @@
 {
     static JNF_STATIC_MEMBER_CACHE(jm_VERTICAL, sjc_AccessibleState, "VERTICAL", "Ljavax/accessibility/AccessibleState;");
     jobject axVertState = JNFGetStaticObjectField(env, jm_VERTICAL);
-    BOOL vertical = containsAxState(env, axContext, axVertState, component);
-    (*env)->DeleteLocalRef(env, axVertState);
-    return vertical;
+    return containsAxState(env, axContext, axVertState, component);
 }
 
 BOOL isHorizontal(JNIEnv *env, jobject axContext, jobject component)
 {
     static JNF_STATIC_MEMBER_CACHE(jm_HORIZONTAL, sjc_AccessibleState, "HORIZONTAL", "Ljavax/accessibility/AccessibleState;");
     jobject axHorizState = JNFGetStaticObjectField(env, jm_HORIZONTAL);
-    BOOL horizontal = containsAxState(env, axContext, axHorizState, component);
-    (*env)->DeleteLocalRef(env, axHorizState);
-    return horizontal;
+    return containsAxState(env, axContext, axHorizState, component);
 }
 
 BOOL isShowing(JNIEnv *env, jobject axContext, jobject component)
 {
     static JNF_STATIC_MEMBER_CACHE(jm_SHOWING, sjc_AccessibleState, "SHOWING", "Ljavax/accessibility/AccessibleState;");
     jobject axVisibleState = JNFGetStaticObjectField(env, jm_SHOWING);
-    BOOL showing = containsAxState(env, axContext, axVisibleState, component);
-    (*env)->DeleteLocalRef(env, axVisibleState);
-    return showing;
+    return containsAxState(env, axContext, axVisibleState, component);
 }
 
 NSPoint getAxComponentLocationOnScreen(JNIEnv *env, jobject axComponent, jobject component)
diff --git a/jdk/src/macosx/native/sun/awt/JavaComponentAccessibility.m b/jdk/src/macosx/native/sun/awt/JavaComponentAccessibility.m
index fbba6a2..ffea40f 100644
--- a/jdk/src/macosx/native/sun/awt/JavaComponentAccessibility.m
+++ b/jdk/src/macosx/native/sun/awt/JavaComponentAccessibility.m
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, 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
@@ -75,6 +75,7 @@
 static NSMutableDictionary *sAttributeNamesForRoleCache = nil;
 static NSObject *sAttributeNamesLOCK = nil;
 
+
 @interface TabGroupAccessibility : JavaComponentAccessibility {
     NSInteger _numTabs;
 }
@@ -136,11 +137,8 @@
         fView = [view retain];
         fJavaRole = [javaRole retain];
 
-        fAccessible = (*env)->NewWeakGlobalRef(env, accessible);
-        
-        jobject jcomponent = [(AWTView *)fView awtComponent:env];
-        fComponent = (*env)->NewWeakGlobalRef(env, jcomponent);
-        (*env)->DeleteLocalRef(env, jcomponent);
+        fAccessible = JNFNewGlobalRef(env, accessible);
+        fComponent = JNFNewGlobalRef(env, [(AWTView *)fView awtComponent:env]);
 
         fIndex = index;
 
@@ -168,10 +166,10 @@
 
     JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
 
-    (*env)->DeleteWeakGlobalRef(env, fAccessible);
+    JNFDeleteGlobalRef(env, fAccessible);
     fAccessible = NULL;
 
-    (*env)->DeleteWeakGlobalRef(env, fComponent);
+    JNFDeleteGlobalRef(env, fComponent);
     fComponent = NULL;
 
     [fParent release];
@@ -200,10 +198,10 @@
 
     JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
 
-    (*env)->DeleteWeakGlobalRef(env, fAccessible);
+    JNFDeleteGlobalRef(env, fAccessible);
     fAccessible = NULL;
 
-    (*env)->DeleteWeakGlobalRef(env, fComponent);
+    JNFDeleteGlobalRef(env, fComponent);
     fComponent = NULL;
 
     [super finalize];
@@ -295,7 +293,7 @@
 
 + (NSArray *)childrenOfParent:(JavaComponentAccessibility *)parent withEnv:(JNIEnv *)env withChildrenCode:(NSInteger)whichChildren allowIgnored:(BOOL)allowIgnored
 {
-    jobjectArray jchildrenAndRoles = (jobjectArray)JNFCallStaticObjectMethod(env, jm_getChildrenAndRoles, parent->fAccessible, parent->fComponent, whichChildren, allowIgnored); // AWT_THREADING Safe (AWTRunLoop)
+    jobjectArray jchildrenAndRoles = JNFCallStaticObjectMethod(env, jm_getChildrenAndRoles, parent->fAccessible, parent->fComponent, whichChildren, allowIgnored); // AWT_THREADING Safe (AWTRunLoop)
     if (jchildrenAndRoles == NULL) return nil;
 
     jsize arrayLen = (*env)->GetArrayLength(env, jchildrenAndRoles);
@@ -310,35 +308,24 @@
 
         NSString *childJavaRole = nil;
         if (jchildJavaRole != NULL) {
-            jobject jkey = JNFGetObjectField(env, jchildJavaRole, sjf_key);
-            childJavaRole = JNFJavaToNSString(env, jkey);
-            (*env)->DeleteLocalRef(env, jkey);
+            childJavaRole = JNFJavaToNSString(env, JNFGetObjectField(env, jchildJavaRole, sjf_key));
         }
 
         JavaComponentAccessibility *child = [self createWithParent:parent accessible:jchild role:childJavaRole index:childIndex withEnv:env withView:parent->fView];
-        
-        (*env)->DeleteLocalRef(env, jchild);
-        (*env)->DeleteLocalRef(env, jchildJavaRole);
-        
         [children addObject:child];
         childIndex++;
     }
-    (*env)->DeleteLocalRef(env, jchildrenAndRoles);
-    
+
     return children;
 }
 
 + (JavaComponentAccessibility *)createWithAccessible:(jobject)jaccessible withEnv:(JNIEnv *)env withView:(NSView *)view
 {
-    JavaComponentAccessibility *ret = nil;
     jobject jcomponent = [(AWTView *)view awtComponent:env];
     jint index = JNFCallStaticIntMethod(env, sjm_getAccessibleIndexInParent, jaccessible, jcomponent);
-    if (index >= 0) {
-      NSString *javaRole = getJavaRole(env, jaccessible, jcomponent);
-      ret = [self createWithAccessible:jaccessible role:javaRole index:index withEnv:env withView:view];
-    }
-    (*env)->DeleteLocalRef(env, jcomponent);
-    return ret;
+    NSString *javaRole = getJavaRole(env, jaccessible, jcomponent);
+
+    return [self createWithAccessible:jaccessible role:javaRole index:index withEnv:env withView:view];
 }
 
 + (JavaComponentAccessibility *) createWithAccessible:(jobject)jaccessible role:(NSString *)javaRole index:(jint)index withEnv:(JNIEnv *)env withView:(NSView *)view
@@ -352,10 +339,7 @@
     jobject jCAX = [JavaComponentAccessibility getCAccessible:jaccessible withEnv:env];
     if (jCAX == NULL) return nil;
     JavaComponentAccessibility *value = (JavaComponentAccessibility *) jlong_to_ptr(JNFGetLongField(env, jCAX, jf_ptr));
-    if (value != nil) {
-        (*env)->DeleteLocalRef(env, jCAX);
-        return [[value retain] autorelease];
-    }
+    if (value != nil) return [[value retain] autorelease];
 
     // otherwise, create a new instance
     JavaComponentAccessibility *newChild = nil;
@@ -378,7 +362,6 @@
     // must hard CFRetain() pointer poked into Java object
     CFRetain(newChild);
     JNFSetLongField(env, jCAX, jf_ptr, ptr_to_jlong(newChild));
-    (*env)->DeleteLocalRef(env, jCAX);
 
     // return autoreleased instance
     return [newChild autorelease];
@@ -411,7 +394,7 @@
 
     // Get all the other accessibility attributes states we need in one swell foop.
     // javaRole isn't pulled in because we need protected access to AccessibleRole.key
-    jbooleanArray attributeStates = (jbooleanArray)JNFCallStaticObjectMethod(env, jm_getInitialAttributeStates, fAccessible, fComponent); // AWT_THREADING Safe (AWTRunLoop)
+    jbooleanArray attributeStates = JNFCallStaticObjectMethod(env, jm_getInitialAttributeStates, fAccessible, fComponent); // AWT_THREADING Safe (AWTRunLoop)
     if (attributeStates == NULL) return nil;
     jboolean *attributeStatesArray = (*env)->GetBooleanArrayElements(env, attributeStates, 0);
     if (attributeStatesArray == NULL) {
@@ -506,7 +489,6 @@
         JavaAxAction *action = [[JavaAxAction alloc] initWithEnv:env withAccessibleAction:axAction withIndex:0 withComponent:fComponent];
         [fActions setObject:action forKey:[self isMenu] ? NSAccessibilityPickAction : NSAccessibilityPressAction];
         [action release];
-        (*env)->DeleteLocalRef(env, axAction);
     }
 }
 
@@ -517,9 +499,7 @@
 
 - (id)parent
 {
-    static JNF_CLASS_CACHE(sjc_Window, "java/awt/Window");
     static JNF_STATIC_MEMBER_CACHE(sjm_getAccessibleParent, sjc_CAccessibility, "getAccessibleParent", "(Ljavax/accessibility/Accessible;Ljava/awt/Component;)Ljavax/accessibility/Accessible;");
-    static JNF_STATIC_MEMBER_CACHE(sjm_getSwingAccessible, sjc_CAccessible, "getSwingAccessible", "(Ljavax/accessibility/Accessible;)Ljavax/accessibility/Accessible;");
 
     if(fParent == nil) {
         JNIEnv* env = [ThreadUtilities getJNIEnv];
@@ -529,21 +509,10 @@
         if (jparent == NULL) {
             fParent = fView;
         } else {
-            AWTView *view = fView;
-            jobject jax = JNFCallStaticObjectMethod(env, sjm_getSwingAccessible, fAccessible);
-
-            if (JNFIsInstanceOf(env, jax, &sjc_Window)) {
-                // In this case jparent is an owner toplevel and we should retrieve its own view
-                view = [AWTView awtView:env ofAccessible:jparent];
-            }
-            if (view != nil) {
-                fParent = [JavaComponentAccessibility createWithAccessible:jparent withEnv:env withView:view];
-            }
+            fParent = [JavaComponentAccessibility createWithAccessible:jparent withEnv:env withView:fView];
             if (fParent == nil) {
                 fParent = fView;
             }
-            (*env)->DeleteLocalRef(env, jparent);
-            (*env)->DeleteLocalRef(env, jax );
         }
         [fParent retain];
     }
@@ -591,10 +560,7 @@
         return NO;
     }
 
-    jobject axContext = [self axContextWithEnv:env];
-    BOOL showing = isShowing(env, axContext, fComponent);
-    (*env)->DeleteLocalRef(env, axContext);
-    return showing;
+    return isShowing(env, [self axContextWithEnv:env], fComponent);
 }
 
 // the array of names for each role is cached in the sAttributeNamesForRoleCache
@@ -771,12 +737,7 @@
     JNIEnv* env = [ThreadUtilities getJNIEnv];
 
     jobject val = JNFCallStaticObjectMethod(env, sjm_getAccessibleDescription, fAccessible, fComponent); // AWT_THREADING Safe (AWTRunLoop)
-    if (val == NULL) {
-        return @"unknown";
-    }
-    NSString* str = JNFJavaToNSString(env, val);
-    (*env)->DeleteLocalRef(env, val);
-    return str;
+    return JNFJavaToNSString(env, val);
 }
 
 - (BOOL)accessibilityIsHelpAttributeSettable
@@ -792,12 +753,7 @@
     JNIEnv* env = [ThreadUtilities getJNIEnv];
 
     jobject axValue = JNFCallStaticObjectMethod(env, jm_getMaximumAccessibleValue, fAccessible, fComponent); // AWT_THREADING Safe (AWTRunLoop)
-    if (axValue == NULL) {
-        return [NSNumber numberWithInt:0];
-    }
-    NSNumber* num = JNFJavaToNSNumber(env, axValue);
-    (*env)->DeleteLocalRef(env, axValue);
-    return num;
+    return JNFJavaToNSNumber(env, axValue);
 }
 
 - (BOOL)accessibilityIsMaxValueAttributeSettable
@@ -813,12 +769,7 @@
     JNIEnv* env = [ThreadUtilities getJNIEnv];
 
     jobject axValue = JNFCallStaticObjectMethod(env, jm_getMinimumAccessibleValue, fAccessible, fComponent); // AWT_THREADING Safe (AWTRunLoop)
-    if (axValue == NULL) {
-        return [NSNumber numberWithInt:0];
-    }
-    NSNumber* num = JNFJavaToNSNumber(env, axValue);
-    (*env)->DeleteLocalRef(env, axValue);
-    return num;
+    return JNFJavaToNSNumber(env, axValue);
 }
 
 - (BOOL)accessibilityIsMinValueAttributeSettable
@@ -833,16 +784,13 @@
 
     // cmcnote - should batch these two calls into one that returns an array of two bools, one for vertical and one for horiz
     if (isVertical(env, axContext, fComponent)) {
-        (*env)->DeleteLocalRef(env, axContext);
         return NSAccessibilityVerticalOrientationValue;
     }
 
     if (isHorizontal(env, axContext, fComponent)) {
-        (*env)->DeleteLocalRef(env, axContext);
         return NSAccessibilityHorizontalOrientationValue;
     }
 
-    (*env)->DeleteLocalRef(env, axContext);
     return nil;
 }
 
@@ -874,7 +822,6 @@
     // Get the java screen coords, and make a NSPoint of the bottom left of the AxComponent.
     NSSize size = getAxComponentSize(env, axComponent, fComponent);
     NSPoint point = getAxComponentLocationOnScreen(env, axComponent, fComponent);
-    (*env)->DeleteLocalRef(env, axComponent);
 
     point.y += size.height;
 
@@ -924,9 +871,8 @@
         JNIEnv* env = [ThreadUtilities getJNIEnv];
 
         jobject axRole = JNFCallStaticObjectMethod(env, jm_getAccessibleRoleDisplayString, fAccessible, fComponent);
-        if (axRole != NULL) {
+        if(axRole != NULL) {
             value = JNFJavaToNSString(env, axRole);
-            (*env)->DeleteLocalRef(env, axRole);
         } else {
             value = @"unknown";
         }
@@ -961,9 +907,7 @@
 - (NSValue *)accessibilitySizeAttribute {
     JNIEnv* env = [ThreadUtilities getJNIEnv];
     jobject axComponent = JNFCallStaticObjectMethod(env, sjm_getAccessibleComponent, fAccessible, fComponent); // AWT_THREADING Safe (AWTRunLoop)
-    NSValue* size = [NSValue valueWithSize:getAxComponentSize(env, axComponent, fComponent)];
-    (*env)->DeleteLocalRef(env, axComponent);
-    return size;
+    return [NSValue valueWithSize:getAxComponentSize(env, axComponent, fComponent)];
 }
 
 - (BOOL)accessibilityIsSizeAttributeSettable
@@ -1022,12 +966,7 @@
     JNIEnv* env = [ThreadUtilities getJNIEnv];
 
     jobject val = JNFCallStaticObjectMethod(env, sjm_getAccessibleName, fAccessible, fComponent); // AWT_THREADING Safe (AWTRunLoop)
-    if (val == NULL) {
-        return @"unknown";
-    }
-    NSString* str = JNFJavaToNSString(env, val);
-    (*env)->DeleteLocalRef(env, val);
-    return str;
+    return JNFJavaToNSString(env, val);
 }
 
 - (BOOL)accessibilityIsTitleAttributeSettable
@@ -1059,20 +998,8 @@
     // a text value is taken care of in JavaTextAccessibility
 
     // cmcnote should coalesce these calls into one java call
-    NSNumber *num = nil;
     jobject axValue = JNFCallStaticObjectMethod(env, sjm_getAccessibleValue, fAccessible, fComponent); // AWT_THREADING Safe (AWTRunLoop)
-    if (axValue != NULL) {
-        jobject str = JNFCallStaticObjectMethod(env, jm_getCurrentAccessibleValue, axValue, fComponent);
-        if (str != NULL) {
-            num = JNFJavaToNSNumber(env, str); // AWT_THREADING Safe (AWTRunLoop)
-            (*env)->DeleteLocalRef(env, str);
-        }
-        (*env)->DeleteLocalRef(env, axValue);
-    }
-    if (num == nil) {
-        num = [NSNumber numberWithInt:0];
-    }
-    return num;
+    return JNFJavaToNSNumber(env, JNFCallStaticObjectMethod(env, jm_getCurrentAccessibleValue, axValue, fComponent)); // AWT_THREADING Safe (AWTRunLoop)
 }
 
 - (BOOL)accessibilityIsValueAttributeSettable
@@ -1171,10 +1098,7 @@
     id value = nil;
     if (JNFIsInstanceOf(env, jparent, &jc_Container)) {
         jobject jaccessible = JNFCallStaticObjectMethod(env, jm_accessibilityHitTest, jparent, (jfloat)point.x, (jfloat)point.y); // AWT_THREADING Safe (AWTRunLoop)
-        if (jaccessible != NULL) {
-            value = [JavaComponentAccessibility createWithAccessible:jaccessible withEnv:env withView:fView];
-            (*env)->DeleteLocalRef(env, jaccessible);
-        }
+        value = [JavaComponentAccessibility createWithAccessible:jaccessible withEnv:env withView:fView];
     }
 
     if (value == nil) {
@@ -1206,7 +1130,6 @@
         if (JNFIsInstanceOf(env, focused, &sjc_Accessible)) {
             value = [JavaComponentAccessibility createWithAccessible:focused withEnv:env withView:fView];
         }
-        (*env)->DeleteLocalRef(env, focused);
     }
 
     if (value == nil) {
@@ -1313,46 +1236,38 @@
     for (i = 0; i < _numTabs; i++) {
         aTab = (JavaComponentAccessibility *)[tabs objectAtIndex:i];
         if ([aTab isAccessibleWithEnv:env forAccessible:selAccessible]) {
-            (*env)->DeleteLocalRef(env, selAccessible);
             return aTab;
         }
     }
-    (*env)->DeleteLocalRef(env, selAccessible);
+
     return nil;
 }
 
 - (NSArray *)tabControlsWithEnv:(JNIEnv *)env withTabGroupAxContext:(jobject)axContext withTabCode:(NSInteger)whichTabs allowIgnored:(BOOL)allowIgnored
 {
-    jobjectArray jtabsAndRoles = (jobjectArray)JNFCallStaticObjectMethod(env, jm_getChildrenAndRoles, fAccessible, fComponent, whichTabs, allowIgnored); // AWT_THREADING Safe (AWTRunLoop)
+    jobjectArray jtabsAndRoles = JNFCallStaticObjectMethod(env, jm_getChildrenAndRoles, fAccessible, fComponent, whichTabs, allowIgnored); // AWT_THREADING Safe (AWTRunLoop)
     if(jtabsAndRoles == NULL) return nil;
 
     jsize arrayLen = (*env)->GetArrayLength(env, jtabsAndRoles);
-    if (arrayLen == 0) {
-        (*env)->DeleteLocalRef(env, jtabsAndRoles);
-        return nil;
-    }
+    if (arrayLen == 0) return nil;
+
     NSMutableArray *tabs = [NSMutableArray arrayWithCapacity:(arrayLen/2)];
 
     // all of the tabs have the same role, so we can just find out what that is here and use it for all the tabs
     jobject jtabJavaRole = (*env)->GetObjectArrayElement(env, jtabsAndRoles, 1); // the array entries alternate between tab/role, starting with tab. so the first role is entry 1.
-    if (jtabJavaRole == NULL) {
-        (*env)->DeleteLocalRef(env, jtabsAndRoles);
-        return nil;
-    }
-    jobject jkey = JNFGetObjectField(env, jtabJavaRole, sjf_key);
-    NSString *tabJavaRole = JNFJavaToNSString(env, jkey);
-    (*env)->DeleteLocalRef(env, jkey);
+    if (jtabJavaRole == NULL) return nil;
+
+    NSString *tabJavaRole = JNFJavaToNSString(env, JNFGetObjectField(env, jtabJavaRole, sjf_key));
 
     NSInteger i;
     NSUInteger tabIndex = (whichTabs >= 0) ? whichTabs : 0; // if we're getting one particular child, make sure to set its index correctly
     for(i = 0; i < arrayLen; i+=2) {
         jobject jtab = (*env)->GetObjectArrayElement(env, jtabsAndRoles, i);
         JavaComponentAccessibility *tab = [[[TabGroupControlAccessibility alloc] initWithParent:self withEnv:env withAccessible:jtab withIndex:tabIndex withTabGroup:axContext withView:[self view] withJavaRole:tabJavaRole] autorelease];
-        (*env)->DeleteLocalRef(env, jtab);
         [tabs addObject:tab];
         tabIndex++;
     }
-    (*env)->DeleteLocalRef(env, jtabsAndRoles);
+
     return tabs;
 }
 
@@ -1371,9 +1286,7 @@
 {
     JNIEnv *env = [ThreadUtilities getJNIEnv];
     jobject axContext = [self axContextWithEnv:env];
-    id tabs = [self tabControlsWithEnv:env withTabGroupAxContext:axContext withTabCode:JAVA_AX_ALL_CHILDREN allowIgnored:NO];
-    (*env)->DeleteLocalRef(env, axContext);
-    return tabs;
+    return [self tabControlsWithEnv:env withTabGroupAxContext:axContext withTabCode:JAVA_AX_ALL_CHILDREN allowIgnored:NO];
 }
 
 - (BOOL)accessibilityIsTabsAttributeSettable
@@ -1393,9 +1306,7 @@
 {
     JNIEnv *env = [ThreadUtilities getJNIEnv];
     jobject axContext = [self axContextWithEnv:env];
-    NSArray* cont = [self contentsWithEnv:env withTabGroupAxContext:axContext withTabCode:JAVA_AX_ALL_CHILDREN allowIgnored:NO];
-    (*env)->DeleteLocalRef(env, axContext);
-    return cont;
+    return [self contentsWithEnv:env withTabGroupAxContext:axContext withTabCode:JAVA_AX_ALL_CHILDREN allowIgnored:NO];
 }
 
 - (BOOL)accessibilityIsContentsAttributeSettable
@@ -1408,9 +1319,7 @@
 {
     JNIEnv *env = [ThreadUtilities getJNIEnv];
     jobject axContext = [self axContextWithEnv:env];
-    id val = [self currentTabWithEnv:env withAxContext:axContext];
-    (*env)->DeleteLocalRef(env, axContext);
-    return val;
+    return [self currentTabWithEnv:env withAxContext:axContext];
 }
 
 - (BOOL)accessibilityIsValueAttributeSettable
@@ -1427,7 +1336,6 @@
     JNIEnv *env = [ThreadUtilities getJNIEnv];
     jobject axContext = [self axContextWithEnv:env];
     setAxContextSelection(env, axContext, fIndex, fComponent);
-    (*env)->DeleteLocalRef(env, axContext);
 }
 
 - (NSArray *)accessibilityChildrenAttribute
@@ -1463,7 +1371,6 @@
                 result = children;
             }
         }
-        (*env)->DeleteLocalRef(env, axContext);
     } else {
         result = [super accessibilityArrayAttributeValues:attribute index:index maxCount:maxCount];
     }
@@ -1482,7 +1389,7 @@
     self = [super initWithParent:parent withEnv:env withAccessible:accessible withIndex:index withView:view withJavaRole:javaRole];
     if (self) {
         if (tabGroup != NULL) {
-            fTabGroupAxContext = JNFNewWeakGlobalRef(env, tabGroup);
+            fTabGroupAxContext = JNFNewGlobalRef(env, tabGroup);
         } else {
             fTabGroupAxContext = NULL;
         }
@@ -1495,7 +1402,7 @@
     JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
 
     if (fTabGroupAxContext != NULL) {
-        JNFDeleteWeakGlobalRef(env, fTabGroupAxContext);
+        JNFDeleteGlobalRef(env, fTabGroupAxContext);
         fTabGroupAxContext = NULL;
     }
 
@@ -1507,7 +1414,7 @@
     JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
 
     if (fTabGroupAxContext != NULL) {
-        JNFDeleteWeakGlobalRef(env, fTabGroupAxContext);
+        JNFDeleteGlobalRef(env, fTabGroupAxContext);
         fTabGroupAxContext = NULL;
     }
 
@@ -1518,14 +1425,9 @@
 {
     JNIEnv *env = [ThreadUtilities getJNIEnv];
     jobject axContext = [self axContextWithEnv:env];
-    jobject selAccessible = getAxContextSelection(env, [self tabGroup], fIndex, fComponent);
 
     // Returns the current selection of the page tab list
-    id val = [NSNumber numberWithBool:ObjectEquals(env, axContext, selAccessible, fComponent)];
-
-    (*env)->DeleteLocalRef(env, selAccessible);
-    (*env)->DeleteLocalRef(env, axContext);
-    return val;
+    return [NSNumber numberWithBool:ObjectEquals(env, axContext, getAxContextSelection(env, [self tabGroup], fIndex, fComponent), fComponent)];
 }
 
 - (void)getActionsWithEnv:(JNIEnv *)env
@@ -1540,8 +1442,7 @@
     if (fTabGroupAxContext == NULL) {
         JNIEnv* env = [ThreadUtilities getJNIEnv];
         jobject tabGroupAxContext = [(JavaComponentAccessibility *)[self parent] axContextWithEnv:env];
-        fTabGroupAxContext = JNFNewWeakGlobalRef(env, tabGroupAxContext);
-        (*env)->DeleteLocalRef(env, tabGroupAxContext);
+        fTabGroupAxContext = JNFNewGlobalRef(env, tabGroupAxContext);
     }
     return fTabGroupAxContext;
 }
@@ -1576,10 +1477,8 @@
         if ([[aElement accessibilityRoleAttribute] isEqualToString:NSAccessibilityScrollBarRole]) {
             jobject elementAxContext = [aElement axContextWithEnv:env];
             if (isHorizontal(env, elementAxContext, fComponent)) {
-                (*env)->DeleteLocalRef(env, elementAxContext);
                 return aElement;
             }
-            (*env)->DeleteLocalRef(env, elementAxContext);
         }
     }
 
@@ -1605,10 +1504,8 @@
         if ([[aElement accessibilityRoleAttribute] isEqualToString:NSAccessibilityScrollBarRole]) {
             jobject elementAxContext = [aElement axContextWithEnv:env];
             if (isVertical(env, elementAxContext, fComponent)) {
-                (*env)->DeleteLocalRef(env, elementAxContext);
                 return aElement;
             }
-            (*env)->DeleteLocalRef(env, elementAxContext);
         }
     }
 
diff --git a/jdk/src/macosx/native/sun/awt/JavaTextAccessibility.m b/jdk/src/macosx/native/sun/awt/JavaTextAccessibility.m
index f7e17b0..2809d8b 100644
--- a/jdk/src/macosx/native/sun/awt/JavaTextAccessibility.m
+++ b/jdk/src/macosx/native/sun/awt/JavaTextAccessibility.m
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -112,9 +112,7 @@
         // if it's static text, the AppKit AXValue is the java accessibleName
         jobject axName = JNFCallStaticObjectMethod(env, sjm_getAccessibleName, fAccessible, fComponent); // AWT_THREADING Safe (AWTRunLoop)
         if (axName != NULL) {
-            NSString* str = JNFJavaToNSString(env, axName);
-            (*env)->DeleteLocalRef(env, axName);
-            return str;
+            return JNFJavaToNSString(env, axName);
         }
         // value is still nil if no accessibleName for static text. Below, try to get the accessibleText.
     }
@@ -122,18 +120,12 @@
     // cmcnote: inefficient to make three distinct JNI calls. Coalesce. radr://3951923
     jobject axText = JNFCallStaticObjectMethod(env, sjm_getAccessibleText, fAccessible, fComponent); // AWT_THREADING Safe (AWTRunLoop)
     if (axText == NULL) return nil;
-    (*env)->DeleteLocalRef(env, axText);
-    
+
     jobject axEditableText = JNFCallStaticObjectMethod(env, sjm_getAccessibleEditableText, fAccessible, fComponent); // AWT_THREADING Safe (AWTRunLoop)
     if (axEditableText == NULL) return nil;
 
     static JNF_STATIC_MEMBER_CACHE(jm_getTextRange, sjc_CAccessibleText, "getTextRange", "(Ljavax/accessibility/AccessibleEditableText;IILjava/awt/Component;)Ljava/lang/String;");
-    jobject jrange = JNFCallStaticObjectMethod(env, jm_getTextRange, axEditableText, 0, getAxTextCharCount(env, axEditableText, fComponent), fComponent);
-    NSString *string = JNFJavaToNSString(env, jrange); // AWT_THREADING Safe (AWTRunLoop)
-
-    (*env)->DeleteLocalRef(env, jrange);
-    (*env)->DeleteLocalRef(env, axEditableText);
-    
+    NSString *string = JNFJavaToNSString(env, JNFCallStaticObjectMethod(env, jm_getTextRange, axEditableText, 0, getAxTextCharCount(env, axEditableText, fComponent), fComponent)); // AWT_THREADING Safe (AWTRunLoop)
     if (string == nil) string = @"";
     return string;
 }
@@ -147,7 +139,6 @@
     JNIEnv* env = [ThreadUtilities getJNIEnv];
     jobject axEditableText = JNFCallStaticObjectMethod(env, sjm_getAccessibleEditableText, fAccessible, fComponent); // AWT_THREADING Safe (AWTRunLoop)
     if (axEditableText == NULL) return NO;
-    (*env)->DeleteLocalRef(env, axEditableText);
     return YES;
 }
 
@@ -166,9 +157,7 @@
     static JNF_STATIC_MEMBER_CACHE(jm_getSelectedText, sjc_CAccessibleText, "getSelectedText", "(Ljavax/accessibility/Accessible;Ljava/awt/Component;)Ljava/lang/String;");
     jobject axText = JNFCallStaticObjectMethod(env, jm_getSelectedText, fAccessible, fComponent); // AWT_THREADING Safe (AWTRunLoop)
     if (axText == NULL) return @"";
-    NSString* str = JNFJavaToNSString(env, axText);
-    (*env)->DeleteLocalRef(env, axText);
-    return str;
+    return JNFJavaToNSString(env, axText);
 }
 
 - (BOOL)accessibilityIsSelectedTextAttributeSettable
@@ -231,9 +220,7 @@
     // also, static text doesn't always have accessibleText. if axText is null, should get the charcount of the accessibleName instead
     JNIEnv *env = [ThreadUtilities getJNIEnv];
     jobject axText = JNFCallStaticObjectMethod(env, sjm_getAccessibleText, fAccessible, fComponent); // AWT_THREADING Safe (AWTRunLoop)
-    NSNumber* num = [NSNumber numberWithInt:getAxTextCharCount(env, axText, fComponent)];
-    (*env)->DeleteLocalRef(env, axText);
-    return num;
+    return [NSNumber numberWithInt:getAxTextCharCount(env, axText, fComponent)];
 }
 
 - (BOOL)accessibilityIsNumberOfCharactersAttributeSettable
@@ -298,7 +285,7 @@
 
     JNIEnv *env = [ThreadUtilities getJNIEnv];
     static JNF_STATIC_MEMBER_CACHE(jm_getBoundsForRange, sjc_CAccessibleText, "getBoundsForRange", "(Ljavax/accessibility/Accessible;Ljava/awt/Component;II)[D");
-    jdoubleArray axBounds = (jdoubleArray)JNFCallStaticObjectMethod(env, jm_getBoundsForRange, fAccessible, fComponent, range.location, range.length); // AWT_THREADING Safe (AWTRunLoop)
+    jdoubleArray axBounds = JNFCallStaticObjectMethod(env, jm_getBoundsForRange, fAccessible, fComponent, range.location, range.length); // AWT_THREADING Safe (AWTRunLoop)
     if (axBounds == NULL) return nil;
 
     // We cheat because we know that the array is 4 elements long (x, y, width, height)
@@ -337,7 +324,7 @@
 
     JNIEnv *env = [ThreadUtilities getJNIEnv];
     static JNF_STATIC_MEMBER_CACHE(jm_getRangeForLine, sjc_CAccessibleText, "getRangeForLine", "(Ljavax/accessibility/Accessible;Ljava/awt/Component;I)[I");
-    jintArray axTextRange = (jintArray)JNFCallStaticObjectMethod(env, jm_getRangeForLine, fAccessible, fComponent, [line intValue]); // AWT_THREADING Safe (AWTRunLoop)
+    jintArray axTextRange = JNFCallStaticObjectMethod(env, jm_getRangeForLine, fAccessible, fComponent, [line intValue]); // AWT_THREADING Safe (AWTRunLoop)
     if (axTextRange == NULL) return nil;
 
     return javaIntArrayToNSRangeValue(env,axTextRange);
@@ -363,12 +350,10 @@
 
     JNIEnv *env = [ThreadUtilities getJNIEnv];
     static JNF_STATIC_MEMBER_CACHE(jm_getStringForRange, sjc_CAccessibleText, "getStringForRange", "(Ljavax/accessibility/Accessible;Ljava/awt/Component;II)Ljava/lang/String;");
-    jstring jstringForRange = (jstring)JNFCallStaticObjectMethod(env, jm_getStringForRange, fAccessible, fComponent, range.location, range.length); // AWT_THREADING Safe (AWTRunLoop)
+    jstring jstringForRange = JNFCallStaticObjectMethod(env, jm_getStringForRange, fAccessible, fComponent, range.location, range.length); // AWT_THREADING Safe (AWTRunLoop)
 
     if (jstringForRange == NULL) return @"";
-    NSString* str = JNFJavaToNSString(env, jstringForRange);
-    (*env)->DeleteLocalRef(env, jstringForRange);
-    return str;
+    return JNFJavaToNSString(env, jstringForRange);
 }
 
 //
@@ -421,7 +406,7 @@
 
     JNIEnv *env = [ThreadUtilities getJNIEnv];
     static JNF_STATIC_MEMBER_CACHE(jm_getRangeForIndex, sjc_CAccessibleText, "getRangeForIndex", "(Ljavax/accessibility/Accessible;Ljava/awt/Component;I)[I");
-    jintArray axTextRange = (jintArray)JNFCallStaticObjectMethod(env, jm_getRangeForIndex, fAccessible, fComponent, index); // AWT_THREADING Safe (AWTRunLoop)
+    jintArray axTextRange = JNFCallStaticObjectMethod(env, jm_getRangeForIndex, fAccessible, fComponent, index); // AWT_THREADING Safe (AWTRunLoop)
     if (axTextRange == NULL) return nil;
 
     return javaIntArrayToNSRangeValue(env, axTextRange);
diff --git a/jdk/src/macosx/native/sun/awt/LWCToolkit.h b/jdk/src/macosx/native/sun/awt/LWCToolkit.h
index 0a57501..c3e1b53 100644
--- a/jdk/src/macosx/native/sun/awt/LWCToolkit.h
+++ b/jdk/src/macosx/native/sun/awt/LWCToolkit.h
@@ -40,7 +40,6 @@
 @interface AWTToolkit : NSObject { }
 + (long) getEventCount;
 + (void) eventCountPlusPlus;
-+ (jint) scrollStateWithEvent: (NSEvent*) event;
 @end
 
 /*
diff --git a/jdk/src/macosx/native/sun/awt/LWCToolkit.m b/jdk/src/macosx/native/sun/awt/LWCToolkit.m
index 8f0a290..8b34eba 100644
--- a/jdk/src/macosx/native/sun/awt/LWCToolkit.m
+++ b/jdk/src/macosx/native/sun/awt/LWCToolkit.m
@@ -39,13 +39,6 @@
 
 #import "sizecalc.h"
 
-// SCROLL PHASE STATE
-#define SCROLL_PHASE_UNSUPPORTED 1
-#define SCROLL_PHASE_BEGAN 2
-#define SCROLL_PHASE_CONTINUED 3
-#define SCROLL_PHASE_CANCELLED 4
-#define SCROLL_PHASE_ENDED 5
-
 int gNumberOfButtons;
 jint* gButtonDownMasks;
 
@@ -61,23 +54,6 @@
     eventCount++;
 }
 
-+ (jint) scrollStateWithEvent: (NSEvent*) event {
-
-    if ([event type] != NSScrollWheel) {
-        return 0;
-    }
-
-    NSEventPhase phase = [event phase];
-    NSEventPhase momentumPhase = [event momentumPhase];
-
-    if (!phase && !momentumPhase) return SCROLL_PHASE_UNSUPPORTED;
-    switch (phase) {
-        case NSEventPhaseBegan: return SCROLL_PHASE_BEGAN;
-        case NSEventPhaseCancelled: return SCROLL_PHASE_CANCELLED;
-        case NSEventPhaseEnded: return SCROLL_PHASE_ENDED;
-    }
-    return SCROLL_PHASE_CONTINUED;
-}
 @end
 
 
diff --git a/jdk/src/macosx/native/sun/font/AWTFont.m b/jdk/src/macosx/native/sun/font/AWTFont.m
index 6458f17..bfb90ec 100644
--- a/jdk/src/macosx/native/sun/font/AWTFont.m
+++ b/jdk/src/macosx/native/sun/font/AWTFont.m
@@ -162,44 +162,6 @@
     return [sFontFamilyTable objectForKey:fontname];
 }
 
-static void addFont(CTFontUIFontType uiType, 
-                    NSMutableArray *allFonts,
-                    NSMutableDictionary* fontFamilyTable) {
-
-        CTFontRef font = CTFontCreateUIFontForLanguage(uiType, 0.0, NULL);
-        if (font == NULL) {
-            return;
-        }
-        CTFontDescriptorRef desc = CTFontCopyFontDescriptor(font);
-        if (desc == NULL) {
-            CFRelease(font);
-            return;
-        }
-        CFStringRef family = CTFontDescriptorCopyAttribute(desc, kCTFontFamilyNameAttribute);
-        if (family == NULL) {
-            CFRelease(desc);
-            CFRelease(font);
-            return;
-        }
-        CFStringRef name = CTFontDescriptorCopyAttribute(desc, kCTFontNameAttribute);
-        if (name == NULL) {
-            CFRelease(family);
-            CFRelease(desc);
-            CFRelease(font);
-            return;
-        }
-        [allFonts addObject:name];
-        [fontFamilyTable setObject:family forKey:name];
-#ifdef DEBUG
-        NSLog(@"name is : %@", (NSString*)name);
-        NSLog(@"family is : %@", (NSString*)family);
-#endif
-        CFRelease(family);
-        CFRelease(name);
-        CFRelease(desc);
-        CFRelease(font);
-}
- 
 static NSArray*
 GetFilteredFonts()
 {
@@ -234,16 +196,6 @@
             }
         }
 
-        /*
-         * JavaFX registers these fonts and so JDK needs to do so as well.
-         * If this isn't done we will have mis-matched rendering, since
-         * although these may include fonts that are enumerated normally
-         * they also demonstrably includes fonts that are not.
-         */
-        addFont(kCTFontUIFontSystem, allFonts, fontFamilyTable);
-        addFont(kCTFontUIFontEmphasizedSystem, allFonts, fontFamilyTable);
-        addFont(kCTFontUIFontUserFixedPitch, allFonts, fontFamilyTable);
-
         sFilteredFonts = allFonts;
         sFontFamilyTable = fontFamilyTable;
     }
diff --git a/jdk/src/macosx/native/sun/java2d/opengl/CGLLayer.h b/jdk/src/macosx/native/sun/java2d/opengl/CGLLayer.h
index 3d030e5..43724c0 100644
--- a/jdk/src/macosx/native/sun/java2d/opengl/CGLLayer.h
+++ b/jdk/src/macosx/native/sun/java2d/opengl/CGLLayer.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -31,7 +31,7 @@
 @interface CGLLayer : CAOpenGLLayer
 {
 @private
-    JNFWeakJObjectWrapper *javaLayer;
+    JNFJObjectWrapper *javaLayer;
 
     // intermediate buffer, used the RQ lock to synchronize
     GLuint textureID;
@@ -45,7 +45,7 @@
 #endif /* REMOTELAYER */
 }
 
-@property (nonatomic, retain) JNFWeakJObjectWrapper *javaLayer;
+@property (nonatomic, retain) JNFJObjectWrapper *javaLayer;
 @property (readwrite, assign) GLuint textureID;
 @property (readwrite, assign) GLenum target;
 @property (readwrite, assign) float textureWidth;
@@ -57,7 +57,7 @@
 @property (nonatomic, retain) NSObject<JRSRemoteLayer> *jrsRemoteLayer;
 #endif
 
-- (id) initWithJavaLayer:(JNFWeakJObjectWrapper *)javaLayer;
+- (id) initWithJavaLayer:(JNFJObjectWrapper *)javaLayer;
 - (void) blitTexture;
 @end
 
diff --git a/jdk/src/macosx/native/sun/java2d/opengl/CGLLayer.m b/jdk/src/macosx/native/sun/java2d/opengl/CGLLayer.m
index 87dcf1d..f300ea4 100644
--- a/jdk/src/macosx/native/sun/java2d/opengl/CGLLayer.m
+++ b/jdk/src/macosx/native/sun/java2d/opengl/CGLLayer.m
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, 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
@@ -46,7 +46,7 @@
 @synthesize jrsRemoteLayer;
 #endif
 
-- (id) initWithJavaLayer:(JNFWeakJObjectWrapper *)layer;
+- (id) initWithJavaLayer:(JNFJObjectWrapper *)layer;
 {
 AWT_ASSERT_APPKIT_THREAD;
     // Initialize ourselves
@@ -133,15 +133,6 @@
 {
     AWT_ASSERT_APPKIT_THREAD;
 
-    JNIEnv *env = [ThreadUtilities getJNIEnv];
-    static JNF_CLASS_CACHE(jc_JavaLayer, "sun/java2d/opengl/CGLLayer");
-    static JNF_MEMBER_CACHE(jm_drawInCGLContext, jc_JavaLayer, "drawInCGLContext", "()V");
-
-    jobject javaLayerLocalRef = [self.javaLayer jObjectWithEnv:env];
-    if ((*env)->IsSameObject(env, javaLayerLocalRef, NULL)) {
-        return;
-    }
-
     // Set the current context to the one given to us.
     CGLSetCurrentContext(glContext);
 
@@ -150,7 +141,12 @@
     glClear(GL_COLOR_BUFFER_BIT);
 
     glViewport(0, 0, textureWidth, textureHeight);
+    
+    JNIEnv *env = [ThreadUtilities getJNIEnv];
+    static JNF_CLASS_CACHE(jc_JavaLayer, "sun/java2d/opengl/CGLLayer");
+    static JNF_MEMBER_CACHE(jm_drawInCGLContext, jc_JavaLayer, "drawInCGLContext", "()V");
 
+    jobject javaLayerLocalRef = [self.javaLayer jObjectWithEnv:env];
     JNFCallVoidMethod(env, javaLayerLocalRef, jm_drawInCGLContext);
     (*env)->DeleteLocalRef(env, javaLayerLocalRef);
 
@@ -175,7 +171,7 @@
 
 JNF_COCOA_ENTER(env);
 
-    JNFWeakJObjectWrapper *javaLayer = [JNFWeakJObjectWrapper wrapperWithJObject:obj withEnv:env];
+    JNFJObjectWrapper *javaLayer = [JNFJObjectWrapper wrapperWithJObject:obj withEnv:env];
 
     [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
             AWT_ASSERT_APPKIT_THREAD;
diff --git a/jdk/src/macosx/native/sun/osxapp/NSApplicationAWT.m b/jdk/src/macosx/native/sun/osxapp/NSApplicationAWT.m
index d22983a..5df99a4 100644
--- a/jdk/src/macosx/native/sun/osxapp/NSApplicationAWT.m
+++ b/jdk/src/macosx/native/sun/osxapp/NSApplicationAWT.m
@@ -363,6 +363,7 @@
 {
     void (^copy)() = [block copy];
     NSInteger encode = (NSInteger) copy;
+    [copy retain];
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];    
     NSEvent* event = [NSEvent otherEventWithType: NSApplicationDefined
                                         location: NSMakePoint(0,0)
diff --git a/jdk/src/share/back/debugInit.c b/jdk/src/share/back/debugInit.c
index 3475397..25ffbff 100644
--- a/jdk/src/share/back/debugInit.c
+++ b/jdk/src/share/back/debugInit.c
@@ -1013,7 +1013,7 @@
 atexit_finish_logging(void)
 {
     /* Normal exit(0) (not _exit()) may only reach here */
-    finish_logging();  /* Only first call matters */
+    finish_logging(0);  /* Only first call matters */
 }
 
 static jboolean
@@ -1301,49 +1301,39 @@
 void
 debugInit_exit(jvmtiError error, const char *msg)
 {
-    enum exit_codes { EXIT_NO_ERRORS = 0, EXIT_JVMTI_ERROR = 1, EXIT_TRANSPORT_ERROR = 2 };
+    int exit_code = 0;
 
-    // Prepare to exit. Log error and finish logging
-    LOG_MISC(("Exiting with error %s(%d): %s", jvmtiErrorText(error), error,
-                                               ((msg == NULL) ? "" : msg)));
-
-    // coredump requested by command line. Keep JVMTI data dirty
-    if (error != JVMTI_ERROR_NONE && docoredump) {
-        LOG_MISC(("Dumping core as requested by command line"));
-        finish_logging();
-        abort();
-    }
-
-    finish_logging();
-
-    // Cleanup the JVMTI if we have one
-    if (gdata != NULL) {
-        gdata->vmDead = JNI_TRUE;
-        if (gdata->jvmti != NULL) {
-            // Dispose of jvmti (gdata->jvmti becomes NULL)
-            disposeEnvironment(gdata->jvmti);
+    /* Pick an error code */
+    if ( error != JVMTI_ERROR_NONE ) {
+        exit_code = 1;
+        if ( docoredump ) {
+            finish_logging(exit_code);
+            abort();
         }
     }
-
-    // We are here with no errors. Kill entire process and exit with zero exit code
-    if (error == JVMTI_ERROR_NONE) {
-        forceExit(EXIT_NO_ERRORS);
-        return;
+    if ( msg==NULL ) {
+        msg = "";
     }
 
-    // No transport initilized.
-    // As we don't have any details here exiting with separate exit code
-    if (error == AGENT_ERROR_TRANSPORT_INIT) {
-        forceExit(EXIT_TRANSPORT_ERROR);
-        return;
+    LOG_MISC(("Exiting with error %s(%d): %s", jvmtiErrorText(error), error, msg));
+
+    gdata->vmDead = JNI_TRUE;
+
+    /* Let's try and cleanup the JVMTI, if we even have one */
+    if ( gdata->jvmti != NULL ) {
+        /* Dispose of jvmti (gdata->jvmti becomes NULL) */
+        disposeEnvironment(gdata->jvmti);
     }
 
-    // We have JVMTI error. Call hotspot jni_FatalError handler
-    jniFatalError(NULL, msg, error, EXIT_JVMTI_ERROR);
+    /* Finish up logging. We reach here if JDWP is doing the exiting. */
+    finish_logging(exit_code);  /* Only first call matters */
 
-    // hotspot calls os:abort() so we should never reach code below,
-    // but guard against possible hotspot changes
+    /* Let's give the JNI a FatalError if non-exit 0, which is historic way */
+    if ( exit_code != 0 ) {
+        JNIEnv *env = NULL;
+        jniFatalError(env, msg, error, exit_code);
+    }
 
-    // Last chance to die, this kills the entire process.
-    forceExit(EXIT_JVMTI_ERROR);
+    /* Last chance to die, this kills the entire process. */
+    forceExit(exit_code);
 }
diff --git a/jdk/src/share/back/invoker.c b/jdk/src/share/back/invoker.c
index bd316dc..cd1cd2f 100644
--- a/jdk/src/share/back/invoker.c
+++ b/jdk/src/share/back/invoker.c
@@ -211,62 +211,6 @@
     return error;
 }
 
-/*
- * Delete saved global references - if any - for:
- * - a potentially thrown Exception
- * - a returned refernce/array value
- * See invoker_doInvoke() and invoke* methods where global references
- * are being saved.
- */
-static void
-deletePotentiallySavedGlobalRefs(JNIEnv *env, InvokeRequest *request)
-{
-    /* Delete potentially saved return value */
-    if ((request->invokeType == INVOKE_CONSTRUCTOR) ||
-        (returnTypeTag(request->methodSignature) == JDWP_TAG(OBJECT)) ||
-        (returnTypeTag(request->methodSignature) == JDWP_TAG(ARRAY))) {
-        if (request->returnValue.l != NULL) {
-            tossGlobalRef(env, &(request->returnValue.l));
-        }
-    }
-    /* Delete potentially saved exception */
-    if (request->exception != NULL) {
-        tossGlobalRef(env, &(request->exception));
-    }
-}
-
-/*
- * Delete global argument references from the request which got put there before a
- * invoke request was carried out. See fillInvokeRequest().
- */
-static void
-deleteGlobalArgumentRefs(JNIEnv *env, InvokeRequest *request)
-{
-    void *cursor;
-    jint argIndex = 0;
-    jvalue *argument = request->arguments;
-    jbyte argumentTag = firstArgumentTypeTag(request->methodSignature, &cursor);
-
-    if (request->clazz != NULL) {
-        tossGlobalRef(env, &(request->clazz));
-    }
-    if (request->instance != NULL) {
-        tossGlobalRef(env, &(request->instance));
-    }
-    /* Delete global argument references */
-    while (argIndex < request->argumentCount) {
-        if ((argumentTag == JDWP_TAG(OBJECT)) ||
-            (argumentTag == JDWP_TAG(ARRAY))) {
-            if (argument->l != NULL) {
-                tossGlobalRef(env, &(argument->l));
-            }
-        }
-        argument++;
-        argIndex++;
-        argumentTag = nextArgumentTypeTag(&cursor);
-    }
-}
-
 static jvmtiError
 fillInvokeRequest(JNIEnv *env, InvokeRequest *request,
                   jbyte invokeType, jbyte options, jint id,
@@ -376,8 +320,6 @@
 invokeConstructor(JNIEnv *env, InvokeRequest *request)
 {
     jobject object;
-
-    JDI_ASSERT_MSG(request->clazz, "Request clazz null");
     object = JNI_FUNC_PTR(env,NewObjectA)(env, request->clazz,
                                      request->method,
                                      request->arguments);
@@ -394,7 +336,6 @@
         case JDWP_TAG(OBJECT):
         case JDWP_TAG(ARRAY): {
             jobject object;
-            JDI_ASSERT_MSG(request->clazz, "Request clazz null");
             object = JNI_FUNC_PTR(env,CallStaticObjectMethodA)(env,
                                        request->clazz,
                                        request->method,
@@ -483,7 +424,6 @@
         case JDWP_TAG(OBJECT):
         case JDWP_TAG(ARRAY): {
             jobject object;
-            JDI_ASSERT_MSG(request->instance, "Request instance null");
             object = JNI_FUNC_PTR(env,CallObjectMethodA)(env,
                                  request->instance,
                                  request->method,
@@ -571,8 +511,6 @@
         case JDWP_TAG(OBJECT):
         case JDWP_TAG(ARRAY): {
             jobject object;
-            JDI_ASSERT_MSG(request->clazz, "Request clazz null");
-            JDI_ASSERT_MSG(request->instance, "Request instance null");
             object = JNI_FUNC_PTR(env,CallNonvirtualObjectMethodA)(env,
                                            request->instance,
                                            request->clazz,
@@ -669,8 +607,6 @@
     JNIEnv *env;
     jboolean startNow;
     InvokeRequest *request;
-    jbyte options;
-    jbyte invokeType;
 
     JDI_ASSERT(thread);
 
@@ -687,9 +623,6 @@
     if (startNow) {
         request->started = JNI_TRUE;
     }
-    options = request->options;
-    invokeType = request->invokeType;
-
     debugMonitorExit(invokerLock);
 
     if (!startNow) {
@@ -704,7 +637,7 @@
 
         JNI_FUNC_PTR(env,ExceptionClear)(env);
 
-        switch (invokeType) {
+        switch (request->invokeType) {
             case INVOKE_CONSTRUCTOR:
                 invokeConstructor(env, request);
                 break;
@@ -712,7 +645,7 @@
                 invokeStatic(env, request);
                 break;
             case INVOKE_INSTANCE:
-                if (options & JDWP_INVOKE_OPTIONS(NONVIRTUAL) ) {
+                if (request->options & JDWP_INVOKE_OPTIONS(NONVIRTUAL) ) {
                     invokeNonvirtual(env, request);
                 } else {
                     invokeVirtual(env, request);
@@ -790,23 +723,12 @@
     }
 
     /*
-     * At this time, there's no need to retain global references on
-     * arguments since the reply is processed. No one will deal with
-     * this request ID anymore, so we must call deleteGlobalArgumentRefs().
-     *
-     * We cannot delete saved exception or return value references
-     * since otherwise a deleted handle would escape when writing
-     * the response to the stream. Instead, we clean those refs up
-     * after writing the respone.
-     */
-    deleteGlobalArgumentRefs(env, request);
-
-    /*
      * Give up the lock before I/O operation
      */
     debugMonitorExit(invokerLock);
     eventHandler_unlock();
 
+
     if (!detached) {
         outStream_initReply(&out, id);
         (void)outStream_writeValue(env, &out, tag, returnValue);
@@ -814,16 +736,6 @@
         (void)outStream_writeObjectRef(env, &out, exc);
         outStream_sendReply(&out);
     }
-
-    /*
-     * Delete potentially saved global references of return value
-     * and exception
-     */
-    eventHandler_lock(); // for proper lock order
-    debugMonitorEnter(invokerLock);
-    deletePotentiallySavedGlobalRefs(env, request);
-    debugMonitorExit(invokerLock);
-    eventHandler_unlock();
 }
 
 jboolean
diff --git a/jdk/src/share/back/log_messages.c b/jdk/src/share/back/log_messages.c
index 32bea29..de8b69d 100644
--- a/jdk/src/share/back/log_messages.c
+++ b/jdk/src/share/back/log_messages.c
@@ -230,7 +230,7 @@
 
 /* Finish up logging, flush output to the logfile. */
 void
-finish_logging()
+finish_logging(int exit_code)
 {
 #ifdef JDWP_LOGGING
     MUTEX_LOCK(my_mutex);
diff --git a/jdk/src/share/back/log_messages.h b/jdk/src/share/back/log_messages.h
index 129fab6..0a442e9 100644
--- a/jdk/src/share/back/log_messages.h
+++ b/jdk/src/share/back/log_messages.h
@@ -29,7 +29,7 @@
 /* LOG: Must be called like:  LOG_category(("anything")) or LOG_category((format,args)) */
 
 void setup_logging(const char *, unsigned);
-void finish_logging();
+void finish_logging(int);
 
 #define LOG_NULL ((void)0)
 
diff --git a/jdk/src/share/classes/com/sun/crypto/provider/AESCrypt.java b/jdk/src/share/classes/com/sun/crypto/provider/AESCrypt.java
index c85f715..12ffe89 100644
--- a/jdk/src/share/classes/com/sun/crypto/provider/AESCrypt.java
+++ b/jdk/src/share/classes/com/sun/crypto/provider/AESCrypt.java
@@ -52,7 +52,7 @@
     private boolean ROUNDS_14 = false;
 
     /** Session and Sub keys */
-    private int[][] sessionK = null;
+    private Object[] sessionK = null;
     private int[] K = null;
 
     /** Cipher encryption/decryption key */
@@ -95,7 +95,7 @@
         }
 
         // set sub key to the corresponding session Key
-        this.K = sessionK[(decrypting? 1:0)];
+        this.K = (int[]) sessionK[(decrypting? 1:0)];
     }
 
     /**
@@ -660,7 +660,7 @@
         limit = ROUNDS*4;
 
         // store the expanded sub keys into 'sessionK'
-        sessionK = new int[][] { expandedKe, expandedKd };
+        sessionK = new Object[] { expandedKe, expandedKd };
     }
 
 
diff --git a/jdk/src/share/classes/com/sun/crypto/provider/CipherBlockChaining.java b/jdk/src/share/classes/com/sun/crypto/provider/CipherBlockChaining.java
index 5154788..51d95c1 100644
--- a/jdk/src/share/classes/com/sun/crypto/provider/CipherBlockChaining.java
+++ b/jdk/src/share/classes/com/sun/crypto/provider/CipherBlockChaining.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -26,8 +26,6 @@
 package com.sun.crypto.provider;
 
 import java.security.InvalidKeyException;
-import java.security.ProviderException;
-
 
 /**
  * This class represents ciphers in cipher block chaining (CBC) mode.
@@ -124,31 +122,31 @@
      *
      * <p>The input plain text <code>plain</code>, starting at
      * <code>plainOffset</code> and ending at
-     * <code>(plainOffset + plainLen - 1)</code>, is encrypted.
+     * <code>(plainOffset + len - 1)</code>, is encrypted.
      * The result is stored in <code>cipher</code>, starting at
      * <code>cipherOffset</code>.
      *
+     * <p>It is the application's responsibility to make sure that
+     * <code>plainLen</code> is a multiple of the embedded cipher's block size,
+     * as any excess bytes are ignored.
+     *
      * @param plain the buffer with the input data to be encrypted
      * @param plainOffset the offset in <code>plain</code>
      * @param plainLen the length of the input data
      * @param cipher the buffer for the result
      * @param cipherOffset the offset in <code>cipher</code>
-     * @exception ProviderException if <code>len</code> is not
-     * a multiple of the block size
      * @return the length of the encrypted data
      */
     int encrypt(byte[] plain, int plainOffset, int plainLen,
                 byte[] cipher, int cipherOffset)
     {
-        if ((plainLen % blockSize) != 0) {
-            throw new ProviderException("Internal error in input buffering");
-        }
+        int i;
         int endIndex = plainOffset + plainLen;
 
         for (; plainOffset < endIndex;
              plainOffset+=blockSize, cipherOffset += blockSize) {
-            for (int i = 0; i < blockSize; i++) {
-                k[i] = (byte)(plain[i + plainOffset] ^ r[i]);
+            for (i=0; i<blockSize; i++) {
+                k[i] = (byte)(plain[i+plainOffset] ^ r[i]);
             }
             embeddedCipher.encryptBlock(k, 0, cipher, cipherOffset);
             System.arraycopy(cipher, cipherOffset, r, 0, blockSize);
@@ -161,10 +159,14 @@
      *
      * <p>The input cipher text <code>cipher</code>, starting at
      * <code>cipherOffset</code> and ending at
-     * <code>(cipherOffset + cipherLen - 1)</code>, is decrypted.
+     * <code>(cipherOffset + len - 1)</code>, is decrypted.
      * The result is stored in <code>plain</code>, starting at
      * <code>plainOffset</code>.
      *
+     * <p>It is the application's responsibility to make sure that
+     * <code>cipherLen</code> is a multiple of the embedded cipher's block
+     * size, as any excess bytes are ignored.
+     *
      * <p>It is also the application's responsibility to make sure that
      * <code>init</code> has been called before this method is called.
      * (This check is omitted here, to avoid double checking.)
@@ -174,23 +176,23 @@
      * @param cipherLen the length of the input data
      * @param plain the buffer for the result
      * @param plainOffset the offset in <code>plain</code>
-     * @exception ProviderException if <code>len</code> is not
-     * a multiple of the block size
      * @return the length of the decrypted data
+     *
+     * @exception IllegalBlockSizeException if input data whose length does
+     * not correspond to the embedded cipher's block size is passed to the
+     * embedded cipher
      */
     int decrypt(byte[] cipher, int cipherOffset, int cipherLen,
                 byte[] plain, int plainOffset)
     {
-        if ((cipherLen % blockSize) != 0) {
-            throw new ProviderException("Internal error in input buffering");
-        }
+        int i;
         int endIndex = cipherOffset + cipherLen;
 
         for (; cipherOffset < endIndex;
              cipherOffset += blockSize, plainOffset += blockSize) {
             embeddedCipher.decryptBlock(cipher, cipherOffset, k, 0);
-            for (int i = 0; i < blockSize; i++) {
-                plain[i + plainOffset] = (byte)(k[i] ^ r[i]);
+            for (i = 0; i < blockSize; i++) {
+                plain[i+plainOffset] = (byte)(k[i] ^ r[i]);
             }
             System.arraycopy(cipher, cipherOffset, r, 0, blockSize);
         }
diff --git a/jdk/src/share/classes/com/sun/crypto/provider/CipherCore.java b/jdk/src/share/classes/com/sun/crypto/provider/CipherCore.java
index 592ec41..79f66cd 100644
--- a/jdk/src/share/classes/com/sun/crypto/provider/CipherCore.java
+++ b/jdk/src/share/classes/com/sun/crypto/provider/CipherCore.java
@@ -717,7 +717,7 @@
             len -= blockSize;
         }
         // do not count the trailing bytes which do not make up a unit
-        len = (len > 0 ? (len - (len % unitBytes)) : 0);
+        len = (len > 0 ? (len - (len%unitBytes)) : 0);
 
         // check output buffer capacity
         if ((output == null) ||
@@ -729,15 +729,6 @@
 
         int outLen = 0;
         if (len != 0) { // there is some work to do
-            if ((input == output)
-                 && (outputOffset < (inputOffset + inputLen))
-                 && (inputOffset < (outputOffset + buffer.length))) {
-                // copy 'input' out to avoid its content being
-                // overwritten prematurely.
-                input = Arrays.copyOfRange(input, inputOffset,
-                    inputOffset + inputLen);
-                inputOffset = 0;
-            }
             if (len <= buffered) {
                 // all to-be-processed data are from 'buffer'
                 if (decrypting) {
@@ -750,40 +741,37 @@
                     System.arraycopy(buffer, len, buffer, 0, buffered);
                 }
             } else { // len > buffered
-                int inputConsumed = len - buffered;
-                int temp;
-                if (buffered > 0) {
-                    int bufferCapacity = buffer.length - buffered;
-                    if (bufferCapacity != 0) {
-                        temp = Math.min(bufferCapacity, inputConsumed);
-                        if (unitBytes != blockSize) {
-                            temp -= ((buffered + temp) % unitBytes);
-                        }
-                        System.arraycopy(input, inputOffset, buffer, buffered, temp);
-                        inputOffset += temp;
-                        inputConsumed -= temp;
-                        inputLen -= temp;
-                        buffered += temp;
-                    }
-                    // process 'buffer'
+                if ((input != output) && (buffered == 0)) {
+                    // all to-be-processed data are from 'input'
+                    // however, note that if 'input' and 'output' are the same,
+                    // then they can't be passed directly to the underlying cipher
+                    // engine operations as data may be overwritten before they
+                    // are read.
                     if (decrypting) {
-                         outLen = cipher.decrypt(buffer, 0, buffered, output, outputOffset);
+                        outLen = cipher.decrypt(input, inputOffset, len, output, outputOffset);
                     } else {
-                         outLen = cipher.encrypt(buffer, 0, buffered, output, outputOffset);
+                        outLen = cipher.encrypt(input, inputOffset, len, output, outputOffset);
                     }
-                    outputOffset += outLen;
-                    buffered = 0;
-                }
-                if (inputConsumed > 0) { // still has input to process
+                    inputOffset += len;
+                    inputLen -= len;
+                } else {
+                    // assemble the data using both 'buffer' and 'input'
+                    byte[] in = new byte[len];
+                    int inConsumed = len - buffered;
+                    if (buffered != 0) {
+                        System.arraycopy(buffer, 0, in, 0, buffered);
+                        buffered = 0;
+                    }
+                    if (inConsumed != 0) {
+                        System.arraycopy(input, inputOffset, in, len - inConsumed, inConsumed);
+                        inputOffset += inConsumed;
+                        inputLen -= inConsumed;
+                    }
                     if (decrypting) {
-                        outLen += cipher.decrypt(input, inputOffset, inputConsumed,
-                            output, outputOffset);
+                        outLen = cipher.decrypt(in, 0, len, output, outputOffset);
                     } else {
-                        outLen += cipher.encrypt(input, inputOffset, inputConsumed,
-                            output, outputOffset);
+                        outLen = cipher.encrypt(in, 0, len, output, outputOffset);
                     }
-                    inputOffset += inputConsumed;
-                    inputLen -= inputConsumed;
                 }
             }
             // Let's keep track of how many bytes are needed to make
@@ -946,10 +934,8 @@
         byte[] finalBuf = input;
         int finalOffset = inputOffset;
         int finalBufLen = inputLen;
-        if ((buffered != 0) || (!decrypting && padding != null) ||
-            ((input == output)
-              && (outputOffset < (inputOffset + inputLen))
-              && (inputOffset < (outputOffset + buffer.length)))) {
+        if ((input == output) || (buffered != 0) ||
+            (!decrypting && padding != null)) {
             if (decrypting || padding == null) {
                 paddingLen = 0;
             }
diff --git a/jdk/src/share/classes/com/sun/crypto/provider/CipherFeedback.java b/jdk/src/share/classes/com/sun/crypto/provider/CipherFeedback.java
index 84b527e..f8e6115 100644
--- a/jdk/src/share/classes/com/sun/crypto/provider/CipherFeedback.java
+++ b/jdk/src/share/classes/com/sun/crypto/provider/CipherFeedback.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -26,7 +26,6 @@
 package com.sun.crypto.provider;
 
 import java.security.InvalidKeyException;
-import java.security.ProviderException;
 
 /**
  * This class represents ciphers in cipher-feedback (CFB) mode.
@@ -134,72 +133,66 @@
      *
      * <p>The input plain text <code>plain</code>, starting at
      * <code>plainOffset</code> and ending at
-     * <code>(plainOffset + plainLen - 1)</code>, is encrypted.
+     * <code>(plainOffset + len - 1)</code>, is encrypted.
      * The result is stored in <code>cipher</code>, starting at
      * <code>cipherOffset</code>.
      *
+     * <p>It is the application's responsibility to make sure that
+     * <code>plainLen</code> is a multiple of the stream unit size
+     * <code>numBytes</code>, as any excess bytes are ignored.
+     *
+     * <p>It is also the application's responsibility to make sure that
+     * <code>init</code> has been called before this method is called.
+     * (This check is omitted here, to avoid double checking.)
+     *
      * @param plain the buffer with the input data to be encrypted
      * @param plainOffset the offset in <code>plain</code>
      * @param plainLen the length of the input data
      * @param cipher the buffer for the result
      * @param cipherOffset the offset in <code>cipher</code>
-     * @exception ProviderException if <code>plainLen</code> is not
-     * a multiple of the <code>numBytes</code>
      * @return the length of the encrypted data
      */
     int encrypt(byte[] plain, int plainOffset, int plainLen,
-                byte[] cipher, int cipherOffset) {
-        if ((plainLen % numBytes) != 0) {
-            throw new ProviderException("Internal error in input buffering");
-        }
-
-        int nShift = blockSize - numBytes;
+                byte[] cipher, int cipherOffset)
+    {
+        int i, len;
+        len = blockSize - numBytes;
         int loopCount = plainLen / numBytes;
-
-        for (; loopCount > 0 ;
-             plainOffset += numBytes, cipherOffset += numBytes,
-             loopCount--) {
-            embeddedCipher.encryptBlock(register, 0, k, 0);
-            if (nShift != 0) {
-                System.arraycopy(register, numBytes, register, 0, nShift);
-            }
-            for (int i = 0; i < numBytes; i++) {
-                register[nShift + i] = cipher[i + cipherOffset] =
-                        (byte)(k[i] ^ plain[i + plainOffset]);
-            }
-        }
-        return plainLen;
-    }
-
-    /**
-     * Performs the last encryption operation.
-     *
-     * <p>The input plain text <code>plain</code>, starting at
-     * <code>plainOffset</code> and ending at
-     * <code>(plainOffset + plainLen - 1)</code>, is encrypted.
-     * The result is stored in <code>cipher</code>, starting at
-     * <code>cipherOffset</code>.
-     *
-     * @param plain the buffer with the input data to be encrypted
-     * @param plainOffset the offset in <code>plain</code>
-     * @param plainLen the length of the input data
-     * @param cipher the buffer for the result
-     * @param cipherOffset the offset in <code>cipher</code>
-     * @return the number of bytes placed into <code>cipher</code>
-     */
-    int encryptFinal(byte[] plain, int plainOffset, int plainLen,
-                     byte[] cipher, int cipherOffset) {
-
         int oddBytes = plainLen % numBytes;
-        int len = encrypt(plain, plainOffset, (plainLen - oddBytes),
-                          cipher, cipherOffset);
-        plainOffset += len;
-        cipherOffset += len;
-        if (oddBytes != 0) {
-            embeddedCipher.encryptBlock(register, 0, k, 0);
-            for (int i = 0; i < oddBytes; i++) {
-                 cipher[i + cipherOffset] =
-                    (byte)(k[i] ^ plain[i + plainOffset]);
+
+        if (len == 0) {
+            for (; loopCount > 0 ;
+                 plainOffset += numBytes, cipherOffset += numBytes,
+                 loopCount--) {
+                embeddedCipher.encryptBlock(register, 0, k, 0);
+                for (i = 0; i < blockSize; i++)
+                    register[i] = cipher[i+cipherOffset] =
+                        (byte)(k[i] ^ plain[i+plainOffset]);
+            }
+            if (oddBytes > 0) {
+                embeddedCipher.encryptBlock(register, 0, k, 0);
+                for (i=0; i<oddBytes; i++)
+                    register[i] = cipher[i+cipherOffset] =
+                        (byte)(k[i] ^ plain[i+plainOffset]);
+            }
+        } else {
+            for (; loopCount > 0 ;
+                 plainOffset += numBytes, cipherOffset += numBytes,
+                 loopCount--) {
+                embeddedCipher.encryptBlock(register, 0, k, 0);
+                System.arraycopy(register, numBytes, register, 0, len);
+                for (i=0; i<numBytes; i++)
+                    register[i+len] = cipher[i+cipherOffset] =
+                        (byte)(k[i] ^ plain[i+plainOffset]);
+
+            }
+            if (oddBytes != 0) {
+                embeddedCipher.encryptBlock(register, 0, k, 0);
+                System.arraycopy(register, numBytes, register, 0, len);
+                for (i=0; i<oddBytes; i++) {
+                    register[i+len] = cipher[i+cipherOffset] =
+                        (byte)(k[i] ^ plain[i+plainOffset]);
+                }
             }
         }
         return plainLen;
@@ -210,73 +203,72 @@
      *
      * <p>The input cipher text <code>cipher</code>, starting at
      * <code>cipherOffset</code> and ending at
-     * <code>(cipherOffset + cipherLen - 1)</code>, is decrypted.
+     * <code>(cipherOffset + len - 1)</code>, is decrypted.
      * The result is stored in <code>plain</code>, starting at
      * <code>plainOffset</code>.
      *
+     * <p>It is the application's responsibility to make sure that
+     * <code>cipherLen</code> is a multiple of the stream unit size
+     * <code>numBytes</code>, as any excess bytes are ignored.
+     *
+     * <p>It is also the application's responsibility to make sure that
+     * <code>init</code> has been called before this method is called.
+     * (This check is omitted here, to avoid double checking.)
+     *
      * @param cipher the buffer with the input data to be decrypted
      * @param cipherOffset the offset in <code>cipherOffset</code>
      * @param cipherLen the length of the input data
      * @param plain the buffer for the result
      * @param plainOffset the offset in <code>plain</code>
-     * @exception ProviderException if <code>cipherLen</code> is not
-     * a multiple of the <code>numBytes</code>
      * @return the length of the decrypted data
      */
     int decrypt(byte[] cipher, int cipherOffset, int cipherLen,
-                byte[] plain, int plainOffset) {
-        if ((cipherLen % numBytes) != 0) {
-            throw new ProviderException("Internal error in input buffering");
-        }
-
-        int nShift = blockSize - numBytes;
+                byte[] plain, int plainOffset)
+    {
+        int i, len;
+        len = blockSize - numBytes;
         int loopCount = cipherLen / numBytes;
-
-        for (; loopCount > 0;
-             plainOffset += numBytes, cipherOffset += numBytes,
-             loopCount--) {
-            embeddedCipher.encryptBlock(register, 0, k, 0);
-            if (nShift != 0) {
-                System.arraycopy(register, numBytes, register, 0, nShift);
-            }
-            for (int i = 0; i < numBytes; i++) {
-                register[i + nShift] = cipher[i + cipherOffset];
-                plain[i + plainOffset]
-                    = (byte)(cipher[i + cipherOffset] ^ k[i]);
-            }
-        }
-        return cipherLen;
-    }
-
-    /**
-     * Performs the last decryption operation.
-     *
-     * <p>The input cipher text <code>cipher</code>, starting at
-     * <code>cipherOffset</code> and ending at
-     * <code>(cipherOffset + cipherLen - 1)</code>, is decrypted.
-     * The result is stored in <code>plain</code>, starting at
-     * <code>plainOffset</code>.
-     *
-     * @param cipher the buffer with the input data to be decrypted
-     * @param cipherOffset the offset in <code>cipherOffset</code>
-     * @param cipherLen the length of the input data
-     * @param plain the buffer for the result
-     * @param plainOffset the offset in <code>plain</code>
-     * @return the length of the decrypted data
-     */
-    int decryptFinal(byte[] cipher, int cipherOffset, int cipherLen,
-                byte[] plain, int plainOffset) {
-
         int oddBytes = cipherLen % numBytes;
-        int len = decrypt(cipher, cipherOffset, (cipherLen - oddBytes),
-                          plain, plainOffset);
-        cipherOffset += len;
-        plainOffset += len;
-        if (oddBytes != 0) {
-            embeddedCipher.encryptBlock(register, 0, k, 0);
-            for (int i = 0; i < oddBytes; i++) {
-                plain[i + plainOffset]
-                    = (byte)(cipher[i + cipherOffset] ^ k[i]);
+
+        if (len == 0) {
+            for (; loopCount > 0;
+                 plainOffset += numBytes, cipherOffset += numBytes,
+                 loopCount--) {
+                embeddedCipher.encryptBlock(register, 0, k, 0);
+                for (i = 0; i < blockSize; i++) {
+                    register[i] = cipher[i+cipherOffset];
+                    plain[i+plainOffset]
+                        = (byte)(cipher[i+cipherOffset] ^ k[i]);
+                }
+            }
+            if (oddBytes > 0) {
+                embeddedCipher.encryptBlock(register, 0, k, 0);
+                for (i=0; i<oddBytes; i++) {
+                    register[i] = cipher[i+cipherOffset];
+                    plain[i+plainOffset]
+                        = (byte)(cipher[i+cipherOffset] ^ k[i]);
+                }
+            }
+        } else {
+            for (; loopCount > 0;
+                 plainOffset += numBytes, cipherOffset += numBytes,
+                 loopCount--) {
+                embeddedCipher.encryptBlock(register, 0, k, 0);
+                System.arraycopy(register, numBytes, register, 0, len);
+                for (i=0; i<numBytes; i++) {
+                    register[i+len] = cipher[i+cipherOffset];
+                    plain[i+plainOffset]
+                        = (byte)(cipher[i+cipherOffset] ^ k[i]);
+                }
+            }
+            if (oddBytes != 0) {
+                embeddedCipher.encryptBlock(register, 0, k, 0);
+                System.arraycopy(register, numBytes, register, 0, len);
+                for (i=0; i<oddBytes; i++) {
+                    register[i+len] = cipher[i+cipherOffset];
+                    plain[i+plainOffset]
+                        = (byte)(cipher[i+cipherOffset] ^ k[i]);
+                }
             }
         }
         return cipherLen;
diff --git a/jdk/src/share/classes/com/sun/crypto/provider/CounterMode.java b/jdk/src/share/classes/com/sun/crypto/provider/CounterMode.java
index af52bd7..438998e 100644
--- a/jdk/src/share/classes/com/sun/crypto/provider/CounterMode.java
+++ b/jdk/src/share/classes/com/sun/crypto/provider/CounterMode.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 201313, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,6 @@
 
 import java.security.InvalidKeyException;
 
-
 /**
  * This class represents ciphers in counter (CTR) mode.
  *
@@ -137,6 +136,14 @@
      * The result is stored in <code>cipher</code>, starting at
      * <code>cipherOffset</code>.
      *
+     * <p>It is the application's responsibility to make sure that
+     * <code>plainLen</code> is a multiple of the embedded cipher's block size,
+     * as any excess bytes are ignored.
+     *
+     * <p>It is also the application's responsibility to make sure that
+     * <code>init</code> has been called before this method is called.
+     * (This check is omitted here, to avoid double checking.)
+     *
      * @param in the buffer with the input data to be encrypted
      * @param inOffset the offset in <code>plain</code>
      * @param len the length of the input data
@@ -148,7 +155,30 @@
         return crypt(in, inOff, len, out, outOff);
     }
 
-    // CTR encrypt and decrypt are identical
+    /**
+     * Performs decryption operation.
+     *
+     * <p>The input cipher text <code>cipher</code>, starting at
+     * <code>cipherOffset</code> and ending at
+     * <code>(cipherOffset + len - 1)</code>, is decrypted.
+     * The result is stored in <code>plain</code>, starting at
+     * <code>plainOffset</code>.
+     *
+     * <p>It is the application's responsibility to make sure that
+     * <code>cipherLen</code> is a multiple of the embedded cipher's block
+     * size, as any excess bytes are ignored.
+     *
+     * <p>It is also the application's responsibility to make sure that
+     * <code>init</code> has been called before this method is called.
+     * (This check is omitted here, to avoid double checking.)
+     *
+     * @param in the buffer with the input data to be decrypted
+     * @param inOff the offset in <code>cipherOffset</code>
+     * @param len the length of the input data
+     * @param out the buffer for the result
+     * @param outOff the offset in <code>plain</code>
+     * @return the length of the decrypted data
+     */
     int decrypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
         return crypt(in, inOff, len, out, outOff);
     }
diff --git a/jdk/src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java b/jdk/src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java
index bd2ba6f..c71d6ab 100644
--- a/jdk/src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java
+++ b/jdk/src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java
@@ -71,17 +71,6 @@
         initialize(1024, null);
     }
 
-    private static void checkKeySize(int keysize)
-            throws InvalidParameterException {
-
-        if ((keysize < 512) || (keysize > 2048) || ((keysize & 0x3F) != 0)) {
-            throw new InvalidParameterException(
-                    "DH key size must be multiple of 64, and can only range " +
-                    "from 512 to 2048 (inclusive). " +
-                    "The specific key size " + keysize + " is not supported");
-        }
-    }
-
     /**
      * Initializes this key pair generator for a certain keysize and source of
      * randomness.
@@ -91,8 +80,12 @@
      * @param random the source of randomness
      */
     public void initialize(int keysize, SecureRandom random) {
-        checkKeySize(keysize);
-
+        if ((keysize < 512) || (keysize > 2048) || (keysize % 64 != 0)) {
+            throw new InvalidParameterException("Keysize must be multiple "
+                                                + "of 64, and can only range "
+                                                + "from 512 to 2048 "
+                                                + "(inclusive)");
+        }
         this.pSize = keysize;
         this.lSize = 0;
         this.random = random;
@@ -122,10 +115,11 @@
 
         params = (DHParameterSpec)algParams;
         pSize = params.getP().bitLength();
-        try {
-            checkKeySize(pSize);
-        } catch (InvalidParameterException ipe) {
-            throw new InvalidAlgorithmParameterException(ipe.getMessage());
+        if ((pSize < 512) || (pSize > 2048) ||
+            (pSize % 64 != 0)) {
+            throw new InvalidAlgorithmParameterException
+                ("Prime size must be multiple of 64, and can only range "
+                 + "from 512 to 2048 (inclusive)");
         }
 
         // exponent size is optional, could be 0
diff --git a/jdk/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java b/jdk/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java
index 92d4f6f..a12e945 100644
--- a/jdk/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java
+++ b/jdk/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java
@@ -59,13 +59,12 @@
     private SecureRandom random = null;
 
     private static void checkKeySize(int keysize)
-            throws InvalidParameterException {
-            if ((keysize != 2048) &&
+        throws InvalidAlgorithmParameterException {
+        if ((keysize != 2048) &&
             ((keysize < 512) || (keysize > 1024) || (keysize % 64 != 0))) {
-            throw new InvalidParameterException(
-                    "DH key size must be multiple of 64 and range " +
-                    "from 512 to 1024 (inclusive), or 2048. " +
-                    "The specific key size " + keysize + " is not supported");
+            throw new InvalidAlgorithmParameterException(
+                "Keysize must be multiple of 64 ranging from "
+                + "512 to 1024 (inclusive), or 2048");
         }
     }
 
@@ -79,7 +78,11 @@
      */
     protected void engineInit(int keysize, SecureRandom random) {
         // Re-uses DSA parameters and thus have the same range
-        checkKeySize(keysize);
+        try {
+            checkKeySize(keysize);
+        } catch (InvalidAlgorithmParameterException ex) {
+            throw new InvalidParameterException(ex.getMessage());
+        }
         this.primeSize = keysize;
         this.random = random;
     }
@@ -108,11 +111,7 @@
         primeSize = dhParamSpec.getPrimeSize();
 
         // Re-uses DSA parameters and thus have the same range
-        try {
-            checkKeySize(primeSize);
-        } catch (InvalidParameterException ipe) {
-            throw new InvalidAlgorithmParameterException(ipe.getMessage());
-        }
+        checkKeySize(primeSize);
 
         exponentSize = dhParamSpec.getExponentSize();
         if (exponentSize <= 0) {
diff --git a/jdk/src/share/classes/com/sun/crypto/provider/ElectronicCodeBook.java b/jdk/src/share/classes/com/sun/crypto/provider/ElectronicCodeBook.java
index 334e424..a407b6a 100644
--- a/jdk/src/share/classes/com/sun/crypto/provider/ElectronicCodeBook.java
+++ b/jdk/src/share/classes/com/sun/crypto/provider/ElectronicCodeBook.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -26,7 +26,6 @@
 package com.sun.crypto.provider;
 
 import java.security.InvalidKeyException;
-import java.security.ProviderException;
 
 /**
  * This class represents ciphers in electronic codebook (ECB) mode.
@@ -97,24 +96,28 @@
     /**
      * Performs encryption operation.
      *
-     * <p>The input plain text <code>in</code>, starting at
-     * <code>inOff</code> and ending at * <code>(inOff + len - 1)</code>,
-     * is encrypted. The result is stored in <code>out</code>, starting at
-     * <code>outOff</code>.
+     * <p>The input plain text <code>plain</code>, starting at
+     * <code>plainOffset</code> and ending at
+     * <code>(plainOffset + len - 1)</code>, is encrypted.
+     * The result is stored in <code>cipher</code>, starting at
+     * <code>cipherOffset</code>.
+     *
+     * <p>It is the application's responsibility to make sure that
+     * <code>plainLen</code> is a multiple of the embedded cipher's block size,
+     * as any excess bytes are ignored.
+     *
+     * <p>It is also the application's responsibility to make sure that
+     * <code>init</code> has been called before this method is called.
+     * (This check is omitted here, to avoid double checking.)
      *
      * @param in the buffer with the input data to be encrypted
-     * @param inOff the offset in <code>plain</code>
+     * @param inOffset the offset in <code>plain</code>
      * @param len the length of the input data
      * @param out the buffer for the result
      * @param outOff the offset in <code>cipher</code>
-     * @exception ProviderException if <code>len</code> is not
-     * a multiple of the block size
      * @return the length of the encrypted data
      */
     int encrypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
-        if ((len % blockSize) != 0) {
-             throw new ProviderException("Internal error in input buffering");
-        }
         for (int i = len; i >= blockSize; i -= blockSize) {
             embeddedCipher.encryptBlock(in, inOff, out, outOff);
             inOff += blockSize;
@@ -126,24 +129,28 @@
     /**
      * Performs decryption operation.
      *
-     * <p>The input cipher text <code>in</code>, starting at
-     * <code>inOff</code> and ending at * <code>(inOff + len - 1)</code>,
-     * is decrypted.The result is stored in <code>out</code>, starting at
-     * <code>outOff</code>.
+     * <p>The input cipher text <code>cipher</code>, starting at
+     * <code>cipherOffset</code> and ending at
+     * <code>(cipherOffset + len - 1)</code>, is decrypted.
+     * The result is stored in <code>plain</code>, starting at
+     * <code>plainOffset</code>.
+     *
+     * <p>It is the application's responsibility to make sure that
+     * <code>cipherLen</code> is a multiple of the embedded cipher's block
+     * size, as any excess bytes are ignored.
+     *
+     * <p>It is also the application's responsibility to make sure that
+     * <code>init</code> has been called before this method is called.
+     * (This check is omitted here, to avoid double checking.)
      *
      * @param in the buffer with the input data to be decrypted
      * @param inOff the offset in <code>cipherOffset</code>
      * @param len the length of the input data
      * @param out the buffer for the result
      * @param outOff the offset in <code>plain</code>
-     * @exception ProviderException if <code>len</code> is not
-     * a multiple of the block size
      * @return the length of the decrypted data
      */
     int decrypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
-        if ((len % blockSize) != 0) {
-             throw new ProviderException("Internal error in input buffering");
-        }
         for (int i = len; i >= blockSize; i -= blockSize) {
             embeddedCipher.decryptBlock(in, inOff, out, outOff);
             inOff += blockSize;
diff --git a/jdk/src/share/classes/com/sun/crypto/provider/GaloisCounterMode.java b/jdk/src/share/classes/com/sun/crypto/provider/GaloisCounterMode.java
index 4cb76ff..e4edbf0 100644
--- a/jdk/src/share/classes/com/sun/crypto/provider/GaloisCounterMode.java
+++ b/jdk/src/share/classes/com/sun/crypto/provider/GaloisCounterMode.java
@@ -403,21 +403,23 @@
      * and ending at <code>(inOff + len - 1)</code>, is encrypted. The result
      * is stored in <code>out</code>, starting at <code>outOfs</code>.
      *
+     * <p>It is the application's responsibility to make sure that
+     * <code>len</code> is a multiple of the embedded cipher's block size,
+     * otherwise, a ProviderException will be thrown.
+     *
+     * <p>It is also the application's responsibility to make sure that
+     * <code>init</code> has been called before this method is called.
+     * (This check is omitted here, to avoid double checking.)
+     *
      * @param in the buffer with the input data to be encrypted
      * @param inOfs the offset in <code>in</code>
      * @param len the length of the input data
      * @param out the buffer for the result
      * @param outOfs the offset in <code>out</code>
-     * @exception ProviderException if <code>len</code> is not
-     * a multiple of the block size
-     * @return the number of bytes placed into the <code>out</code> buffer
      */
     int encrypt(byte[] in, int inOfs, int len, byte[] out, int outOfs) {
         checkDataLength(processed, len);
 
-        if ((len % blockSize) != 0) {
-             throw new ProviderException("Internal error in input buffering");
-        }
         processAAD();
         if (len > 0) {
             gctrPAndC.update(in, inOfs, len, out, outOfs);
@@ -430,6 +432,9 @@
     /**
      * Performs encryption operation for the last time.
      *
+     * <p>NOTE: <code>len</code> may not be multiple of the embedded
+     * cipher's block size for this call.
+     *
      * @param in the input buffer with the data to be encrypted
      * @param inOfs the offset in <code>in</code>
      * @param len the length of the input data
@@ -474,21 +479,23 @@
      * is decrypted. The result is stored in <code>out</code>, starting at
      * <code>outOfs</code>.
      *
+     * <p>It is the application's responsibility to make sure that
+     * <code>len</code> is a multiple of the embedded cipher's block
+     * size, as any excess bytes are ignored.
+     *
+     * <p>It is also the application's responsibility to make sure that
+     * <code>init</code> has been called before this method is called.
+     * (This check is omitted here, to avoid double checking.)
+     *
      * @param in the buffer with the input data to be decrypted
      * @param inOfs the offset in <code>in</code>
      * @param len the length of the input data
      * @param out the buffer for the result
      * @param outOfs the offset in <code>out</code>
-     * @exception ProviderException if <code>len</code> is not
-     * a multiple of the block size
-     * @return the number of bytes placed into the <code>out</code> buffer
      */
     int decrypt(byte[] in, int inOfs, int len, byte[] out, int outOfs) {
         checkDataLength(ibuffer.size(), len);
 
-        if ((len % blockSize) != 0) {
-             throw new ProviderException("Internal error in input buffering");
-        }
         processAAD();
 
         if (len > 0) {
diff --git a/jdk/src/share/classes/com/sun/crypto/provider/JceKeyStore.java b/jdk/src/share/classes/com/sun/crypto/provider/JceKeyStore.java
index 5ec36fd..cbbc54e 100644
--- a/jdk/src/share/classes/com/sun/crypto/provider/JceKeyStore.java
+++ b/jdk/src/share/classes/com/sun/crypto/provider/JceKeyStore.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -864,9 +864,7 @@
                         if (computed[i] != actual[i]) {
                             throw new IOException(
                                 "Keystore was tampered with, or "
-                                + "password was incorrect",
-                                    new UnrecoverableKeyException(
-                                            "Password verification failed"));
+                                + "password was incorrect");
                         }
                     }
                 }
diff --git a/jdk/src/share/classes/com/sun/crypto/provider/OutputFeedback.java b/jdk/src/share/classes/com/sun/crypto/provider/OutputFeedback.java
index 250e60e..ea5890d 100644
--- a/jdk/src/share/classes/com/sun/crypto/provider/OutputFeedback.java
+++ b/jdk/src/share/classes/com/sun/crypto/provider/OutputFeedback.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -26,7 +26,6 @@
 package com.sun.crypto.provider;
 
 import java.security.InvalidKeyException;
-import java.security.ProviderException;
 
 /**
  * This class represents ciphers in output-feedback (OFB) mode.
@@ -133,88 +132,101 @@
      *
      * <p>The input plain text <code>plain</code>, starting at
      * <code>plainOffset</code> and ending at
-     * <code>(plainOffset + plainLen - 1)</code>, is encrypted.
+     * <code>(plainOffset + len - 1)</code>, is encrypted.
      * The result is stored in <code>cipher</code>, starting at
      * <code>cipherOffset</code>.
      *
+     * <p>It is the application's responsibility to make sure that
+     * <code>plainLen</code> is a multiple of the stream unit size
+     * <code>numBytes</code>, as any excess bytes are ignored.
+     *
+     * <p>It is also the application's responsibility to make sure that
+     * <code>init</code> has been called before this method is called.
+     * (This check is omitted here, to avoid double checking.)
+     *
      * @param plain the buffer with the input data to be encrypted
      * @param plainOffset the offset in <code>plain</code>
      * @param plainLen the length of the input data
      * @param cipher the buffer for the result
      * @param cipherOffset the offset in <code>cipher</code>
-     * @exception ProviderException if <code>plainLen</code> is not
-     * a multiple of the <code>numBytes</code>
      * @return the length of the encrypted data
      */
     int encrypt(byte[] plain, int plainOffset, int plainLen,
-                byte[] cipher, int cipherOffset) {
-
-        if ((plainLen % numBytes) != 0) {
-            throw new ProviderException("Internal error in input buffering");
-        }
-        int nShift = blockSize - numBytes;
+                byte[] cipher, int cipherOffset)
+    {
+        int i;
+        int len = blockSize - numBytes;
         int loopCount = plainLen / numBytes;
+        int oddBytes = plainLen % numBytes;
 
-        for (; loopCount > 0;
-             plainOffset += numBytes, cipherOffset += numBytes,
-             loopCount--) {
-            embeddedCipher.encryptBlock(register, 0, k, 0);
-            for (int i = 0; i < numBytes; i++) {
-                cipher[i + cipherOffset] =
-                    (byte)(k[i] ^ plain[i + plainOffset]);
-                if (nShift != 0) {
-                    System.arraycopy(register, numBytes, register, 0, nShift);
-                }
-                System.arraycopy(k, 0, register, nShift, numBytes);
+        if (len == 0) {
+            for (; loopCount > 0;
+                 plainOffset += numBytes, cipherOffset += numBytes,
+                 loopCount--) {
+                embeddedCipher.encryptBlock(register, 0, k, 0);
+                for (i=0; i<numBytes; i++)
+                    cipher[i+cipherOffset] =
+                        (byte)(k[i] ^ plain[i+plainOffset]);
+                System.arraycopy(k, 0, register, 0, numBytes);
+            }
+            if (oddBytes > 0) {
+                embeddedCipher.encryptBlock(register, 0, k, 0);
+                for (i=0; i<oddBytes; i++)
+                    cipher[i+cipherOffset] =
+                        (byte)(k[i] ^ plain[i+plainOffset]);
+                System.arraycopy(k, 0, register, 0, numBytes);
+            }
+        } else {
+            for (; loopCount > 0;
+                 plainOffset += numBytes, cipherOffset += numBytes,
+                 loopCount--) {
+                embeddedCipher.encryptBlock(register, 0, k, 0);
+                for (i=0; i<numBytes; i++)
+                    cipher[i+cipherOffset] =
+                        (byte)(k[i] ^ plain[i+plainOffset]);
+                System.arraycopy(register, numBytes, register, 0, len);
+                System.arraycopy(k, 0, register, len, numBytes);
+            }
+            if (oddBytes > 0) {
+                embeddedCipher.encryptBlock(register, 0, k, 0);
+                for (i=0; i<oddBytes; i++)
+                    cipher[i+cipherOffset] =
+                        (byte)(k[i] ^ plain[i+plainOffset]);
+                System.arraycopy(register, numBytes, register, 0, len);
+                System.arraycopy(k, 0, register, len, numBytes);
             }
         }
         return plainLen;
     }
 
     /**
-     * Performs last encryption operation.
+     * Performs decryption operation.
      *
-     * <p>The input plain text <code>plain</code>, starting at
-     * <code>plainOffset</code> and ending at
-     * <code>(plainOffset + plainLen - 1)</code>, is encrypted.
-     * The result is stored in <code>cipher</code>, starting at
-     * <code>cipherOffset</code>.
+     * <p>The input cipher text <code>cipher</code>, starting at
+     * <code>cipherOffset</code> and ending at
+     * <code>(cipherOffset + len - 1)</code>, is decrypted.
+     * The result is stored in <code>plain</code>, starting at
+     * <code>plainOffset</code>.
      *
-     * @param plain the buffer with the input data to be encrypted
+     * <p>It is the application's responsibility to make sure that
+     * <code>cipherLen</code> is a multiple of the stream unit size
+     * <code>numBytes</code>, as any excess bytes are ignored.
+     *
+     * <p>It is also the application's responsibility to make sure that
+     * <code>init</code> has been called before this method is called.
+     * (This check is omitted here, to avoid double checking.)
+     *
+     * @param cipher the buffer with the input data to be decrypted
+     * @param cipherOffset the offset in <code>cipherOffset</code>
+     * @param cipherLen the length of the input data
+     * @param plain the buffer for the result
      * @param plainOffset the offset in <code>plain</code>
-     * @param plainLen the length of the input data
-     * @param cipher the buffer for the result
-     * @param cipherOffset the offset in <code>cipher</code>
-     * @return the length of the encrypted data
+     * @return the length of the decrypted data
      */
-    int encryptFinal(byte[] plain, int plainOffset, int plainLen,
-                     byte[] cipher, int cipherOffset) {
-        int oddBytes = plainLen % numBytes;
-        int len = encrypt(plain, plainOffset, (plainLen - oddBytes),
-                          cipher, cipherOffset);
-        plainOffset += len;
-        cipherOffset += len;
-
-        if (oddBytes != 0) {
-            embeddedCipher.encryptBlock(register, 0, k, 0);
-            for (int i = 0; i < oddBytes; i++) {
-                cipher[i + cipherOffset] =
-                    (byte)(k[i] ^ plain[ i + plainOffset]);
-            }
-        }
-        return plainLen;
-    }
-
-    // OFB encrypt and decrypt are identical
     int decrypt(byte[] cipher, int cipherOffset, int cipherLen,
-                byte[] plain, int plainOffset) {
-        return encrypt(cipher, cipherOffset, cipherLen, plain, plainOffset);
-    }
-
-    // OFB encrypt and decrypt are identical
-    int decryptFinal(byte[] cipher, int cipherOffset, int cipherLen,
-                     byte[] plain, int plainOffset) {
+                        byte[] plain, int plainOffset)
+    {
         // OFB encrypt and decrypt are identical
-        return encryptFinal(cipher, cipherOffset, cipherLen, plain, plainOffset);
+        return encrypt(cipher, cipherOffset, cipherLen, plain, plainOffset);
     }
 }
diff --git a/jdk/src/share/classes/com/sun/crypto/provider/PCBC.java b/jdk/src/share/classes/com/sun/crypto/provider/PCBC.java
index fd99bb0..aefc45e 100644
--- a/jdk/src/share/classes/com/sun/crypto/provider/PCBC.java
+++ b/jdk/src/share/classes/com/sun/crypto/provider/PCBC.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -26,8 +26,6 @@
 package com.sun.crypto.provider;
 
 import java.security.InvalidKeyException;
-import java.security.ProviderException;
-
 
 /**
  * This class represents ciphers in Plaintext Cipher Block Chaining (PCBC)
@@ -120,36 +118,38 @@
      *
      * <p>The input plain text <code>plain</code>, starting at
      * <code>plainOffset</code> and ending at
-     * <code>(plainOffset + plainLen - 1)</code>, is encrypted.
+     * <code>(plainOffset + len - 1)</code>, is encrypted.
      * The result is stored in <code>cipher</code>, starting at
      * <code>cipherOffset</code>.
      *
+     * <p>It is the application's responsibility to make sure that
+     * <code>plainLen</code> is a multiple of the embedded cipher's block size,
+     * as any excess bytes are ignored.
+     *
+     * <p>It is also the application's responsibility to make sure that
+     * <code>init</code> has been called before this method is called.
+     * (This check is omitted here, to avoid double checking.)
+     *
      * @param plain the buffer with the input data to be encrypted
      * @param plainOffset the offset in <code>plain</code>
      * @param plainLen the length of the input data
      * @param cipher the buffer for the result
      * @param cipherOffset the offset in <code>cipher</code>
-     * @exception ProviderException if <code>plainLen</code> is not
-     * a multiple of the block size
-     * @return the length of the encrypted data
      */
     int encrypt(byte[] plain, int plainOffset, int plainLen,
                 byte[] cipher, int cipherOffset)
     {
-        if ((plainLen % blockSize) != 0) {
-            throw new ProviderException("Internal error in input buffering");
-        }
         int i;
         int endIndex = plainOffset + plainLen;
 
         for (; plainOffset < endIndex;
              plainOffset += blockSize, cipherOffset += blockSize) {
-            for (i = 0; i < blockSize; i++) {
-                k[i] ^= plain[i + plainOffset];
+            for (i=0; i<blockSize; i++) {
+                k[i] ^= plain[i+plainOffset];
             }
             embeddedCipher.encryptBlock(k, 0, cipher, cipherOffset);
             for (i = 0; i < blockSize; i++) {
-                k[i] = (byte)(plain[i + plainOffset] ^ cipher[i + cipherOffset]);
+                k[i] = (byte)(plain[i+plainOffset] ^ cipher[i+cipherOffset]);
             }
         }
         return plainLen;
@@ -160,25 +160,27 @@
      *
      * <p>The input cipher text <code>cipher</code>, starting at
      * <code>cipherOffset</code> and ending at
-     * <code>(cipherOffset + cipherLen - 1)</code>, is decrypted.
+     * <code>(cipherOffset + len - 1)</code>, is decrypted.
      * The result is stored in <code>plain</code>, starting at
      * <code>plainOffset</code>.
      *
+     * <p>It is the application's responsibility to make sure that
+     * <code>cipherLen</code> is a multiple of the embedded cipher's block
+     * size, as any excess bytes are ignored.
+     *
+     * <p>It is also the application's responsibility to make sure that
+     * <code>init</code> has been called before this method is called.
+     * (This check is omitted here, to avoid double checking.)
+     *
      * @param cipher the buffer with the input data to be decrypted
      * @param cipherOffset the offset in <code>cipherOffset</code>
      * @param cipherLen the length of the input data
      * @param plain the buffer for the result
      * @param plainOffset the offset in <code>plain</code>
-     * @exception ProviderException if <code>cipherLen</code> is not
-     * a multiple of the block size
-     * @return the length of the decrypted data
      */
     int decrypt(byte[] cipher, int cipherOffset, int cipherLen,
                 byte[] plain, int plainOffset)
     {
-        if ((cipherLen % blockSize) != 0) {
-             throw new ProviderException("Internal error in input buffering");
-        }
         int i;
         int endIndex = cipherOffset + cipherLen;
 
@@ -187,10 +189,10 @@
             embeddedCipher.decryptBlock(cipher, cipherOffset,
                                    plain, plainOffset);
             for (i = 0; i < blockSize; i++) {
-                plain[i + plainOffset] ^= k[i];
+                plain[i+plainOffset] ^= k[i];
             }
             for (i = 0; i < blockSize; i++) {
-                k[i] = (byte)(plain[i + plainOffset] ^ cipher[i + cipherOffset]);
+                k[i] = (byte)(plain[i+plainOffset] ^ cipher[i+cipherOffset]);
             }
         }
         return cipherLen;
diff --git a/jdk/src/share/classes/com/sun/java/accessibility/util/package-info.java b/jdk/src/share/classes/com/sun/java/accessibility/util/package-info.java
index 7d81ed6..2ae79d1 100644
--- a/jdk/src/share/classes/com/sun/java/accessibility/util/package-info.java
+++ b/jdk/src/share/classes/com/sun/java/accessibility/util/package-info.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/src/share/classes/com/sun/java/util/jar/pack/DriverResource_ja.java b/jdk/src/share/classes/com/sun/java/util/jar/pack/DriverResource_ja.java
index 66579ef..022b2be 100644
--- a/jdk/src/share/classes/com/sun/java/util/jar/pack/DriverResource_ja.java
+++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/DriverResource_ja.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,8 +61,8 @@
                 "\u4F7F\u7528\u65B9\u6CD5:  pack200 [-opt... | --option=value]... x.pack[.gz] y.jar",
                 "",
                 "\u5727\u7E2E\u30AA\u30D7\u30B7\u30E7\u30F3",
-                "  -g\u3001--no-gzip                   \u5727\u7E2E\u305B\u305A\u306B\u30D7\u30EC\u30FC\u30F3\u306A*.pack\u30D5\u30A1\u30A4\u30EB\u3092\u51FA\u529B\u3057\u307E\u3059",
-                "  --gzip                          (\u30C7\u30D5\u30A9\u30EB\u30C8) pack\u51FA\u529B\u3092gzip\u3067\u5F8C\u51E6\u7406\u3057\u307E\u3059",
+                "  -g\u3001--no-gzip                   \u30D7\u30EC\u30FC\u30F3\u306A*.pack\u30D5\u30A1\u30A4\u30EB\u3092\u5727\u7E2E\u305B\u305A\u306B\u51FA\u529B\u3057\u307E\u3059",
+                "  --gzip                          (\u30C7\u30D5\u30A9\u30EB\u30C8)\u5727\u7E2E\u51FA\u529B\u3092gzip\u3067\u5F8C\u51E6\u7406\u3057\u307E\u3059",
                 "  -G\u3001--strip-debug               \u5727\u7E2E\u4E2D\u306B\u30C7\u30D0\u30C3\u30B0\u5C5E\u6027\u3092\u524A\u9664\u3057\u307E\u3059",
                 "  -O\u3001--no-keep-file-order        \u30D5\u30A1\u30A4\u30EB\u306E\u9806\u5E8F\u4ED8\u3051\u60C5\u5831\u3092\u8EE2\u9001\u3057\u307E\u305B\u3093",
                 "  --keep-file-order               (\u30C7\u30D5\u30A9\u30EB\u30C8)\u5165\u529B\u30D5\u30A1\u30A4\u30EB\u306E\u9806\u5E8F\u4ED8\u3051\u3092\u4FDD\u6301\u3057\u307E\u3059",
diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java b/jdk/src/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java
index 4b97591..241105b 100644
--- a/jdk/src/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java
@@ -300,7 +300,7 @@
         errEx = e;
     }
 
-    protected abstract AbstractLdapNamingEnumeration<? extends NameClassPair> getReferredResults(
+    protected abstract AbstractLdapNamingEnumeration<T> getReferredResults(
             LdapReferralContext refCtx) throws NamingException;
 
     /*
@@ -360,7 +360,7 @@
      * Merge the entries and/or referrals from the supplied enumeration
      * with those of the current enumeration.
      */
-    protected void update(AbstractLdapNamingEnumeration<? extends NameClassPair> ne) {
+    protected void update(AbstractLdapNamingEnumeration<T> ne) {
         // Cleanup previous context first
         homeCtx.decEnumCount();
 
diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/DigestClientId.java b/jdk/src/share/classes/com/sun/jndi/ldap/DigestClientId.java
index 6eac44a..b4f19d0 100644
--- a/jdk/src/share/classes/com/sun/jndi/ldap/DigestClientId.java
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/DigestClientId.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -60,6 +60,7 @@
 
     final private String[] propvals;
     final private int myHash;
+    private int pHash = 0;
 
     DigestClientId(int version, String hostname, int port,
         String protocol, Control[] bindCtls, OutputStream trace,
@@ -77,9 +78,12 @@
             propvals = new String[SASL_PROPS.length];
             for (int i = 0; i < SASL_PROPS.length; i++) {
                 propvals[i] = (String) env.get(SASL_PROPS[i]);
+                if (propvals[i] != null) {
+                    pHash = pHash * 31 + propvals[i].hashCode();
+                }
             }
         }
-        myHash = super.hashCode() ^ Arrays.hashCode(propvals);
+        myHash = super.hashCode() + pHash;
     }
 
     public boolean equals(Object obj) {
@@ -88,6 +92,7 @@
         }
         DigestClientId other = (DigestClientId)obj;
         return myHash == other.myHash
+            && pHash == other.pHash
             && super.equals(obj)
             && Arrays.equals(propvals, other.propvals);
     }
diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/LdapBindingEnumeration.java b/jdk/src/share/classes/com/sun/jndi/ldap/LdapBindingEnumeration.java
index 8d385d3..65c8051 100644
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapBindingEnumeration.java
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapBindingEnumeration.java
@@ -104,9 +104,9 @@
     }
 
     @Override
-    protected AbstractLdapNamingEnumeration<? extends NameClassPair> getReferredResults(
+    protected LdapBindingEnumeration getReferredResults(
             LdapReferralContext refCtx) throws NamingException{
         // repeat the original operation at the new context
-        return (AbstractLdapNamingEnumeration<? extends NameClassPair>)refCtx.listBindings(listArg);
+        return (LdapBindingEnumeration)refCtx.listBindings(listArg);
     }
 }
diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/LdapNamingEnumeration.java b/jdk/src/share/classes/com/sun/jndi/ldap/LdapNamingEnumeration.java
index c923fda..422ce79 100644
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapNamingEnumeration.java
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapNamingEnumeration.java
@@ -72,9 +72,9 @@
     }
 
     @Override
-    protected AbstractLdapNamingEnumeration<? extends NameClassPair> getReferredResults(
+    protected LdapNamingEnumeration getReferredResults(
             LdapReferralContext refCtx) throws NamingException {
         // repeat the original operation at the new context
-        return (AbstractLdapNamingEnumeration<? extends NameClassPair>)refCtx.list(listArg);
+        return (LdapNamingEnumeration)refCtx.list(listArg);
     }
 }
diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/LdapSearchEnumeration.java b/jdk/src/share/classes/com/sun/jndi/ldap/LdapSearchEnumeration.java
index 24c421e..329b1d2 100644
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapSearchEnumeration.java
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapSearchEnumeration.java
@@ -199,15 +199,15 @@
     }
 
     @Override
-    protected AbstractLdapNamingEnumeration<? extends NameClassPair> getReferredResults(
+    protected LdapSearchEnumeration getReferredResults(
             LdapReferralContext refCtx) throws NamingException {
         // repeat the original operation at the new context
-        return (AbstractLdapNamingEnumeration<? extends NameClassPair>)refCtx.search(
+        return (LdapSearchEnumeration)refCtx.search(
                 searchArgs.name, searchArgs.filter, searchArgs.cons);
     }
 
     @Override
-    protected void update(AbstractLdapNamingEnumeration<? extends NameClassPair> ne) {
+    protected void update(AbstractLdapNamingEnumeration<SearchResult> ne) {
         super.update(ne);
 
         // Update search-specific variables
diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/SimpleClientId.java b/jdk/src/share/classes/com/sun/jndi/ldap/SimpleClientId.java
index 2915110..6fa5471 100644
--- a/jdk/src/share/classes/com/sun/jndi/ldap/SimpleClientId.java
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/SimpleClientId.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,23 +49,21 @@
                 socketFactory);
 
         this.username = username;
-        int pwdHashCode = 0;
         if (passwd == null) {
             this.passwd = null;
+        } else if (passwd instanceof String) {
+            this.passwd = passwd;
         } else if (passwd instanceof byte[]) {
             this.passwd = ((byte[])passwd).clone();
-            pwdHashCode = Arrays.hashCode((byte[])passwd);
         } else if (passwd instanceof char[]) {
             this.passwd = ((char[])passwd).clone();
-            pwdHashCode = Arrays.hashCode((char[])passwd);
         } else {
             this.passwd = passwd;
-            pwdHashCode = passwd.hashCode();
         }
 
         myHash = super.hashCode()
-            ^ (username != null ? username.hashCode() : 0)
-            ^ pwdHashCode;
+            + (username != null ? username.hashCode() : 0)
+            + (passwd != null ? passwd.hashCode() : 0);
     }
 
     public boolean equals(Object obj) {
diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/pool/Pool.java b/jdk/src/share/classes/com/sun/jndi/ldap/pool/Pool.java
index 29c4d32..f9786ca 100644
--- a/jdk/src/share/classes/com/sun/jndi/ldap/pool/Pool.java
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/pool/Pool.java
@@ -118,11 +118,7 @@
         PooledConnectionFactory factory) throws NamingException {
 
         d("get(): ", id);
-        if (debug) {
-            synchronized (map) {
-                d("size: ", map.size());
-            }
-        }
+        d("size: ", map.size());
 
         expungeStaleConnections();
 
@@ -145,9 +141,10 @@
                 // Keep the weak reference through the element of a linked list
                 weakRefs.add(weakRef);
             }
-            d("get(): size after: ", map.size());
         }
 
+        d("get(): size after: ", map.size());
+
         return conns.get(timeout, factory); // get one connection from list
     }
 
@@ -212,24 +209,19 @@
         out.println("maximum pool size: " + maxSize);
         out.println("preferred pool size: " + prefSize);
         out.println("initial pool size: " + initSize);
+        out.println("current pool size: " + map.size());
 
-        synchronized (map) {
-            out.println("current pool size: " + map.size());
-
-            for (Map.Entry<Object, ConnectionsRef> entry : map.entrySet()) {
-                id = entry.getKey();
-                conns = entry.getValue().getConnections();
-                out.println("   " + id + ":" + conns.getStats());
-            }
+        for (Map.Entry<Object, ConnectionsRef> entry : map.entrySet()) {
+            id = entry.getKey();
+            conns = entry.getValue().getConnections();
+            out.println("   " + id + ":" + conns.getStats());
         }
 
         out.println("====== Pool end =====================");
     }
 
     public String toString() {
-        synchronized (map) {
-            return super.toString() + " " + map.toString();
-        }
+        return super.toString() + " " + map.toString();
     }
 
     private void d(String msg, int i) {
diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/EventHandler.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/EventHandler.java
index cd416cc..fe6dd07 100644
--- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/EventHandler.java
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/EventHandler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -133,10 +133,6 @@
             if (!vmDied) {
                 vmDisconnectEvent(event);
             }
-            /*
-             * Inform jdb command line processor that jdb is being shutdown. JDK-8154144.
-             */
-            ((TTY)notifier).setShuttingDown(true);
             Env.shutdown(shutdownMessageKey);
             return false;
         } else {
diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTY.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTY.java
index 5338665..1958b9a 100644
--- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTY.java
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTY.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,16 +56,6 @@
      */
     private static final String progname = "jdb";
 
-    private volatile boolean shuttingDown = false;
-
-    public void setShuttingDown(boolean s) {
-       shuttingDown = s;
-    }
-
-    public boolean isShuttingDown() {
-        return shuttingDown;
-    }
-
     @Override
     public void vmStartEvent(VMStartEvent se)  {
         Thread.yield();  // fetch output
@@ -760,13 +750,7 @@
             while (true) {
                 String ln = in.readLine();
                 if (ln == null) {
-                    /*
-                     *  Jdb is being shutdown because debuggee exited, ignore any 'null'
-                     *  returned by readLine() during shutdown. JDK-8154144.
-                     */
-                    if (!isShuttingDown()) {
-                        MessageOutput.println("Input stream closed.");
-                    }
+                    MessageOutput.println("Input stream closed.");
                     ln = "quit";
                 }
 
diff --git a/jdk/src/share/classes/java/awt/Container.java b/jdk/src/share/classes/java/awt/Container.java
index b9e4f91..47e580b 100644
--- a/jdk/src/share/classes/java/awt/Container.java
+++ b/jdk/src/share/classes/java/awt/Container.java
@@ -1089,18 +1089,17 @@
             }
             checkAddToSelf(comp);
             checkNotAWindow(comp);
-            /* Reparent the component and tidy up the tree's state. */
-            if (comp.parent != null) {
-                comp.parent.remove(comp);
-                if (index > component.size()) {
-                    throw new IllegalArgumentException("illegal component position");
-                }
-            }
             if (thisGC != null) {
                 comp.checkGD(thisGC.getDevice().getIDstring());
             }
 
-
+            /* Reparent the component and tidy up the tree's state. */
+            if (comp.parent != null) {
+                comp.parent.remove(comp);
+                    if (index > component.size()) {
+                        throw new IllegalArgumentException("illegal component position");
+                    }
+            }
 
             //index == -1 means add to the end.
             if (index == -1) {
diff --git a/jdk/src/share/classes/java/awt/SplashScreen.java b/jdk/src/share/classes/java/awt/SplashScreen.java
index c51aa6f..05a38e7 100644
--- a/jdk/src/share/classes/java/awt/SplashScreen.java
+++ b/jdk/src/share/classes/java/awt/SplashScreen.java
@@ -250,7 +250,7 @@
             assert scale > 0;
             if (scale > 0 && scale != 1) {
                 bounds.setSize((int) (bounds.getWidth() / scale),
-                        (int) (bounds.getHeight() / scale));
+                        (int) (bounds.getWidth() / scale));
             }
             return bounds;
         }
diff --git a/jdk/src/share/classes/java/awt/TextArea.java b/jdk/src/share/classes/java/awt/TextArea.java
index 7c2acf0..34b2137 100644
--- a/jdk/src/share/classes/java/awt/TextArea.java
+++ b/jdk/src/share/classes/java/awt/TextArea.java
@@ -322,8 +322,9 @@
         TextAreaPeer peer = (TextAreaPeer)this.peer;
         if (peer != null) {
             peer.insert(str, pos);
+        } else {
+            text = text.substring(0, pos) + str + text.substring(pos);
         }
-        text = text.substring(0, pos) + str + text.substring(pos);
     }
 
     /**
@@ -346,7 +347,11 @@
      */
     @Deprecated
     public synchronized void appendText(String str) {
+        if (peer != null) {
             insertText(str, getText().length());
+        } else {
+            text = text + str;
+        }
     }
 
     /**
@@ -381,8 +386,9 @@
         TextAreaPeer peer = (TextAreaPeer)this.peer;
         if (peer != null) {
             peer.replaceRange(str, start, end);
+        } else {
+            text = text.substring(0, start) + str + text.substring(end);
         }
-        text = text.substring(0, start) + str + text.substring(end);
     }
 
     /**
diff --git a/jdk/src/share/classes/java/beans/MethodRef.java b/jdk/src/share/classes/java/beans/MethodRef.java
index 6be617f..59b2690 100644
--- a/jdk/src/share/classes/java/beans/MethodRef.java
+++ b/jdk/src/share/classes/java/beans/MethodRef.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -64,9 +64,10 @@
                 this.signature = null;
                 this.methodRef = null;
                 this.typeRef = null;
-                return null;
             }
-            this.methodRef = new SoftReference<>(method);
+            else {
+                this.methodRef = new SoftReference<>(method);
+            }
         }
         return isPackageAccessible(method.getDeclaringClass()) ? method : null;
     }
diff --git a/jdk/src/share/classes/java/io/CharArrayReader.java b/jdk/src/share/classes/java/io/CharArrayReader.java
index 2190be3..08d447a 100644
--- a/jdk/src/share/classes/java/io/CharArrayReader.java
+++ b/jdk/src/share/classes/java/io/CharArrayReader.java
@@ -130,10 +130,8 @@
             if (pos >= count) {
                 return -1;
             }
-
-            int avail = count - pos;
-            if (len > avail) {
-                len = avail;
+            if (pos + len > count) {
+                len = count - pos;
             }
             if (len <= 0) {
                 return 0;
@@ -159,10 +157,8 @@
     public long skip(long n) throws IOException {
         synchronized (lock) {
             ensureOpen();
-
-            long avail = count - pos;
-            if (n > avail) {
-                n = avail;
+            if (pos + n > count) {
+                n = count - pos;
             }
             if (n < 0) {
                 return 0;
diff --git a/jdk/src/share/classes/java/io/StringBufferInputStream.java b/jdk/src/share/classes/java/io/StringBufferInputStream.java
index f47eebc..509a96c 100644
--- a/jdk/src/share/classes/java/io/StringBufferInputStream.java
+++ b/jdk/src/share/classes/java/io/StringBufferInputStream.java
@@ -118,10 +118,8 @@
         if (pos >= count) {
             return -1;
         }
-
-        int avail = count - pos;
-        if (len > avail) {
-            len = avail;
+        if (pos + len > count) {
+            len = count - pos;
         }
         if (len <= 0) {
             return 0;
diff --git a/jdk/src/share/classes/java/lang/invoke/MethodHandles