changeset 1784:7de76ceb5fda

Merge
author duke
date Wed, 05 Jul 2017 16:45:33 +0200
parents 8a29755677e2 8b99bf0fa5b8
children 3ff1bccf4e2c
files
diffstat 29 files changed, 543 insertions(+), 256 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags-top-repo	Thu Jan 15 11:46:31 2009 -0800
+++ b/.hgtags-top-repo	Wed Jul 05 16:45:33 2017 +0200
@@ -17,3 +17,4 @@
 44be42de6693063fb191989bf0e188de2fa51e7c jdk7-b40
 541bdc5ad32fc33255944d0a044ad992f3d915e8 jdk7-b41
 94052b87287303527125026fe4b2698cf867ea83 jdk7-b42
+848e684279d2ba42577d9621d5b2e5af3823d12d jdk7-b43
--- a/corba/.hgtags	Thu Jan 15 11:46:31 2009 -0800
+++ b/corba/.hgtags	Wed Jul 05 16:45:33 2017 +0200
@@ -17,3 +17,4 @@
 184e21992f47a8d730df1adc5b21a108f3125489 jdk7-b40
 c90eeda9594ed2983403e2049aed8d503126c62e jdk7-b41
 ccd6a16502e0650d91d85c4b86be05cbcd461a87 jdk7-b42
+9cd740d48a4855321d69f137a7109c00bcda76be jdk7-b43
--- a/hotspot/.hgtags	Thu Jan 15 11:46:31 2009 -0800
+++ b/hotspot/.hgtags	Wed Jul 05 16:45:33 2017 +0200
@@ -17,3 +17,4 @@
 81a0cbe3b28460ce836109934ece03db7afaf9cc jdk7-b40
 f9d938ede1960d18cb7cf23c645b026519c1a678 jdk7-b41
 ad8c8ca4ab0f4c86e74c061958f44a8f4a930f2c jdk7-b42
+fc6a5ae3fef5ebacfa896dbb3ae37715e388e282 jdk7-b43
--- a/jaxp/.hgtags	Thu Jan 15 11:46:31 2009 -0800
+++ b/jaxp/.hgtags	Wed Jul 05 16:45:33 2017 +0200
@@ -17,3 +17,4 @@
 54946f466e2c047c44c903f1bec400b685c2508e jdk7-b40
 0758bd3e2852e4f931ba211cc4d48f589450eeb4 jdk7-b41
 036e0dca841a5a17f784d15c86a9da88d2a6f1e6 jdk7-b42
+96fe28d4a9131e1a97bfe00f779e5626cd09c4d0 jdk7-b43
--- a/jdk/.hgtags	Thu Jan 15 11:46:31 2009 -0800
+++ b/jdk/.hgtags	Wed Jul 05 16:45:33 2017 +0200
@@ -17,3 +17,4 @@
 2201dad60231a3c3e0346e3a0250d69ca3b71fd4 jdk7-b40
 44941f893cea95ecdd5987b12e548069bd803849 jdk7-b41
 3ef0bdfa7609f79d4f2ea621f30cf593a2e432ce jdk7-b42
+50c67678b0d180063ade199d398b67a54063fa7f jdk7-b43
--- a/jdk/make/com/sun/java/pack/Makefile	Thu Jan 15 11:46:31 2009 -0800
+++ b/jdk/make/com/sun/java/pack/Makefile	Wed Jul 05 16:45:33 2017 +0200
@@ -142,9 +142,11 @@
 $(UNPACK_EXE): $(UNPACK_EXE_FILES_o) winres 
 	$(prep-target)
 	$(LINKER)  $(LDDFLAGS) $(UNPACK_EXE_FILES_o) $(RES) $(LIBCXX) $(LDOUTPUT)$(TEMPDIR)/unpack200$(EXE_SUFFIX)
+ifdef MT
+	$(MT) /manifest $(TEMPDIR)/unpack200$(EXE_SUFFIX).manifest /outputresource:$(TEMPDIR)/unpack200$(EXE_SUFFIX);#1
+endif
 	$(CP) $(TEMPDIR)/unpack200$(EXE_SUFFIX) $(UNPACK_EXE)
 
-
 ifeq ($(PLATFORM), windows) 
 $(RES):: $(VERSIONINFO_RESOURCE)
 	$(prep-target)
--- a/jdk/make/common/Defs-windows.gmk	Thu Jan 15 11:46:31 2009 -0800
+++ b/jdk/make/common/Defs-windows.gmk	Wed Jul 05 16:45:33 2017 +0200
@@ -68,11 +68,24 @@
 
 # The following DLL's are considered MS runtime libraries and should
 #     not to be REBASEd, see deploy/make/common/Release.gmk.
-#     msvcrt.dll, msvcr71.dll: Microsoft runtimes
+#     msvcrt.dll, msvcrnn.dll [msvcr71 or msvcr80 or msvcr90] : Microsoft runtimes
 MS_RUNTIME_LIBRARIES = msvcrt.dll
+MSVCRNN_DLL =
 ifeq ($(ARCH_DATA_MODEL), 32)
   ifeq ($(COMPILER_VERSION), VS2003)
-    MS_RUNTIME_LIBRARIES += msvcr71.dll
+    MSVCRNN_DLL = msvcr71.dll
+    MSVCPNN_DLL = msvcp71.dll
+    MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL)
+  endif
+  ifeq ($(COMPILER_VERSION), VS2005)
+    MSVCRNN_DLL = msvcr80.dll
+    MSVCPNN_DLL = msvcp80.dll
+    MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL)
+  endif
+  ifeq ($(COMPILER_VERSION), VS2008)
+    MSVCRNN_DLL = msvcr90.dll
+    MSVCPNN_DLL = msvcp90.dll
+    MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL)
   endif
 endif
 
@@ -178,9 +191,22 @@
       CC_OPT/LOWER   = -O1
     endif
   endif
+  ifeq ($(COMPILER_VERSION), VS2008)
+    # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
+    AUTOMATIC_PCH_OPTION =
+    GX_OPTION = -EHsc
+    ifeq ($(ARCH_DATA_MODEL), 32)
+      CC_OPT/HIGHEST = -O2
+      CC_OPT/HIGHER  = -O1
+      CC_OPT/LOWER   = -O1
+    else
+      CC_OPT/HIGHEST = -O2
+      CC_OPT/HIGHER  = -O1
+      CC_OPT/LOWER   = -O1
+    endif
+  endif
 
 else # CC_VERSION
-  
   # GCC not supported, but left for historical reference...
   CC_OPT/NONE     =
   CC_OPT/LOWER    = -O2
@@ -200,10 +226,13 @@
 #   -MTd       Use static debug version (better than -MDd, no runtime issues)
 #   -D_DEBUG   Change use of malloc/free/etc to use special debug ones (-MTd)
 #
-#      NOTE: We also will use /D _STATIC_CPPLIB  so we don't need msvcp71.dll
+#      NOTE: We also will use /D _STATIC_CPPLIB  so we don't need msvcpnn.dll
 #
+# If MS_RUNTIME_STATIC is requested, use -MT only with VS2003.
 ifeq ($(MS_RUNTIME_STATIC),true)
-  MS_RUNTIME_OPTION=-MT
+  ifeq ($(COMPILER_VERSION), VS2003)
+    MS_RUNTIME_OPTION=-MT
+  endif
 else
   MS_RUNTIME_OPTION=-MD
 endif
@@ -238,7 +267,7 @@
   #   -YX -Fp/.../foobar.pch   Use precompiled headers (try someday?)
   #   -nologo  Don't print out startup message
   #   /D _STATIC_CPPLIB  
-  #            Use static link for the C++ runtime (so msvcp71.dll not needed)
+  #            Use static link for the C++ runtime (so msvcpnn.dll not needed)
   #   
   CFLAGS_COMMON  += -Zi -nologo
   CFLAGS_OPT      = $(CC_OPT)
@@ -277,8 +306,16 @@
   # Always add bufferoverflowU.lib to VS2005 link commands (pack uses LDDFLAGS)
   LFLAGS_VS2005 = $(BUFFEROVERFLOWLIB)
 
+  # VS2008 has bufferoverflow baked in:
+  LFLAGS_VS2008 = 
+
   # LFLAGS are the flags given to $(LINK) and used to build the actual DLL file
   BASELFLAGS = -nologo /opt:REF /incremental:no
+ifdef MT
+    # VS2005, VS2008, and beyond: ask LINK to generate manifests for .dll & .exe
+    BASELFLAGS += /manifest
+endif
+
   LFLAGS = $(BASELFLAGS) $(LDEBUG) $(EXTRA_LFLAGS) $(LFLAGS_$(COMPILER_VERSION))
   LDDFLAGS += $(LFLAGS_$(COMPILER_VERSION))
   
--- a/jdk/make/common/Library.gmk	Thu Jan 15 11:46:31 2009 -0800
+++ b/jdk/make/common/Library.gmk	Wed Jul 05 16:45:33 2017 +0200
@@ -179,6 +179,9 @@
 # build it into $(OBJDIR) so that the other generated files get put 
 # there, then copy just the DLL (and MAP file) to the requested directory.
 #
+# In VS2005 or VS2008 the link command creates a .manifest file that we want
+# to insert into the linked artifact so we do not need to track it separately.
+# Use ";#2" for .dll and ";#1" for .exe in the MT command below:
 $(ACTUAL_LIBRARY):: $(OBJDIR)/$(LIBRARY).lcf
 	@$(prep-target)
 	@$(MKDIR) -p $(OBJDIR)
@@ -186,6 +189,9 @@
 	  -map:$(OBJDIR)/$(LIBRARY).map \
 	  $(LFLAGS) @$(OBJDIR)/$(LIBRARY).lcf \
 	  $(OTHER_LCF) $(JAVALIB) $(LDLIBS)
+ifdef MT
+	$(MT) /manifest $(OBJDIR)/$(@F).manifest /outputresource:$(OBJDIR)/$(@F);#2
+endif
 	$(CP) $(OBJDIR)/$(@F) $@
 	$(CP) $(OBJDIR)/$(LIBRARY).map $(@D)
 	$(CP) $(OBJDIR)/$(LIBRARY).pdb $(@D)
--- a/jdk/make/common/Program.gmk	Thu Jan 15 11:46:31 2009 -0800
+++ b/jdk/make/common/Program.gmk	Wed Jul 05 16:45:33 2017 +0200
@@ -153,6 +153,9 @@
   STACK_SIZE=1048576
 endif
 
+# In VS2005 or VS2008 the link command creates a .manifest file that we want
+# to insert into the linked artifact so we do not need to track it separately.
+# Use ";#2" for .dll and ";#1" for .exe in the MT command below:
 $(OBJDIR)/$(PROGRAM)$(EXE_SUFFIX):: $(OBJDIR)/$(PROGRAM).lcf $(FILES_o) $(JLI_LCF) 
 	@$(prep-target)
 	@set -- $?; \
@@ -160,6 +163,9 @@
 	$(LINK) -out:$@ /STACK:$(STACK_SIZE) \
 	    -map:$(OBJDIR)/$(PROGRAM).map $(LFLAGS) $(LDFLAGS) \
 	    @$(OBJDIR)/$(PROGRAM).lcf $(LDLIBS)
+ifdef MT
+	$(MT) /manifest $(OBJDIR)/$(PROGRAM).exe.manifest /outputresource:$@;#1
+endif
 
 else # PLATFORM
 
--- a/jdk/make/common/shared/Compiler-msvc.gmk	Thu Jan 15 11:46:31 2009 -0800
+++ b/jdk/make/common/shared/Compiler-msvc.gmk	Wed Jul 05 16:45:33 2017 +0200
@@ -54,17 +54,10 @@
   ifeq ($(ARCH_DATA_MODEL), 32)
     LINK_VER := $(shell $(LINK) | $(HEAD) -n 1 | $(NAWK) '{print $$6}')
     CC_MAJORVER :=$(call MajorVersion,$(CC_VER))
-    REQUIRED_CC_VER = 13.10.3077
-    REQUIRED_LINK_VER = 7.10.3077
-    ifeq ($(CC_MAJORVER), 12)
-      # This should be: CC_VER=12.00.8168 LINK_VER=6.00.8447
-      COMPILER_NAME=Visual C++ 6.0 Professional + VC6-SP 3
-      COMPILER_VERSION=VC6
-      REBASE     = $(COMPILER_PATH)rebase
-      MTL        = $(COMPILER_PATH)midl
-    endif
     ifeq ($(CC_MAJORVER), 13)
       # This should be: CC_VER=13.10.3077 LINK_VER=7.10.3077
+      REQUIRED_CC_VER = 13.10.3077
+      REQUIRED_LINK_VER = 7.10.3077
       COMPILER_NAME=Visual Studio .NET 2003 Professional C++
       COMPILER_VERSION=VS2003
       REBASE     = $(COMPILER_PATH)../../Common7/Tools/Bin/rebase
@@ -74,17 +67,34 @@
       endif
     endif
     ifeq ($(CC_MAJORVER), 14)
-      # This should be: CC_VER=14.00.0000 LINK_VER=8.00.0000
-      # NOTE: This compiler has not been tried yet on 32bit systems
-      COMPILER_NAME=Visual Studio .NET 2005
+      # This should be: CC_VER=14.00.50727.42 LINK_VER=8.00.50727.42
+      REQUIRED_CC_VER = 14.00.50727.42
+      REQUIRED_LINK_VER = 8.00.50727.42
+      COMPILER_NAME=Visual Studio 8
       COMPILER_VERSION=VS2005
       REBASE     = $(COMPILER_PATH)../../Common8/Tools/Bin/rebase
       MTL        = $(COMPILER_PATH)../../Common8/Tools/Bin/midl
+      MT         = $(MSDEVTOOLS_PATH)mt
+      ifndef COMPILER_PATH
+	COMPILER_PATH := $(error COMPILER_PATH cannot be empty here)
+      endif
+    endif
+    ifeq ($(CC_MAJORVER), 15)
+      # This should be: CC_VER=15.00.21022.08 LINK_VER=9.00.21022.08
+      REQUIRED_CC_VER = 15.00.21022.08
+      REQUIRED_LINK_VER = 9.00.21022.08
+      COMPILER_NAME=Visual Studio 9
+      COMPILER_VERSION=VS2008
+      #rebase and midl moved out of Visual Studio into the SDK:
+      REBASE     = $(MSDEVTOOLS_PATH)/rebase
+      MTL        = $(MSDEVTOOLS_PATH)/midl.exe
+      MT         = $(MSDEVTOOLS_PATH)mt
       ifndef COMPILER_PATH
 	COMPILER_PATH := $(error COMPILER_PATH cannot be empty here)
       endif
     endif
   else
+    # else ARCH_DATA_MODEL is 64
     LINK_VER := $(shell $(LINK) | $(HEAD) -n 1 | $(NAWK) '{print $$6}')
     CC_MAJORVER :=$(call MajorVersion,$(CC_VER))
     CC_MINORVER :=$(call MinorVersion,$(CC_VER))
--- a/jdk/make/common/shared/Defs-windows.gmk	Thu Jan 15 11:46:31 2009 -0800
+++ b/jdk/make/common/shared/Defs-windows.gmk	Wed Jul 05 16:45:33 2017 +0200
@@ -74,7 +74,7 @@
 #   The ALT values should never really have spaces or use \.
 #   Suspect these environment variables to have spaces and/or \ characters:
 #     SYSTEMROOT, SystemRoot, WINDIR, windir, PROGRAMFILES, ProgramFiles,
-#     DXSDK_DIR, MSTOOLS, Mstools, MSSDK, MSSdk, VC71COMNTOOLS, 
+#     DXSDK_DIR, MSTOOLS, Mstools, MSSDK, MSSdk, VCnnCOMNTOOLS, 
 #     MSVCDIR, MSVCDir.
 #     So use $(subst \,/,) on them first adding quotes and placing them in
 #         their own variable assigned with :=, then use FullPath.
@@ -247,22 +247,36 @@
       endif
     endif
   endif
-  ifneq ($(subst MSDev98,OLDOLDOLD,$(_msvc_dir)),$(_msvc_dir))
-    _msvc_dir :=
-  endif
-  # If we still don't have it, look for VS71COMNTOOLS, setup by installer?
+  # If we still don't have it, look for VSnnCOMNTOOLS (newest first),
+  # set by installer?
   ifeq ($(_msvc_dir),)
+    ifdef VS90COMNTOOLS  # /Common/Tools directory, use ../../Vc
+      xVS90COMNTOOLS :="$(subst \,/,$(VS90COMNTOOLS))"
+      _vs90tools     :=$(call FullPath,$(xVS90COMNTOOLS))
+    endif
+    ifneq ($(_vs90tools),)
+      _msvc_dir :=$(_vs90tools)/../../Vc
+      _redist_sdk   :=$(_msvc_dir)/../SDK/v3.5/Bin
+    endif
+    ifdef VS80COMNTOOLS  # /Common/Tools directory, use ../../Vc
+      xVS80COMNTOOLS :="$(subst \,/,$(VS80COMNTOOLS))"
+      _vs80tools     :=$(call FullPath,$(xVS80COMNTOOLS))
+    endif
+    ifneq ($(_vs80tools),)
+      _msvc_dir :=$(_vs80tools)/../../Vc
+      _redist_sdk   :=$(_msvc_dir)/../SDK/v2.0/Bin
+    endif
     ifdef VS71COMNTOOLS  # /Common/Tools directory, use ../../Vc7
       xVS71COMNTOOLS :="$(subst \,/,$(VS71COMNTOOLS))"
       _vs71tools     :=$(call FullPath,$(xVS71COMNTOOLS))
     endif
     ifneq ($(_vs71tools),)
       _msvc_dir :=$(_vs71tools)/../../Vc7
+      _redist_sdk    :=$(_vs71tools)/../..
     endif
   endif
   ifneq ($(_msvc_dir),)
     _compiler_bin :=$(_msvc_dir)/Bin
-    _redist_sdk   :=$(_msvc_dir)/../SDK/v1.1/Bin
     _ms_sdk       :=$(_msvc_dir)/PlatformSDK
   endif
 endif
@@ -410,8 +424,8 @@
 	else \
 	  echo "false"; \
 	fi)
-_REDIST71_SDK_EXISTS := $(shell \
-	if [ -f "$(_redist_sdk)/msvcr71.dll" ]; then \
+_REDISTNN_SDK_EXISTS := $(shell \
+	if [ -f "$(_redist_sdk)/$(MSVCRNN_DLL)" ]; then \
 	  echo "true"; \
 	else \
 	  echo "false"; \
@@ -435,20 +449,20 @@
   MSVCRT_DLL_PATH:=$(call AltCheckSpaces,MSVCRT_DLL_PATH)
   MSVCRT_DLL_PATH:=$(call AltCheckValue,MSVCRT_DLL_PATH)
   
-  # MSVCR71_DLL_PATH: location of msvcr71.dll that will be re-distributed
-  ifdef ALT_MSVCR71_DLL_PATH
-    xALT_MSVCR71_DLL_PATH :="$(subst \,/,$(ALT_MSVCR71_DLL_PATH))"
-    MSVCR71_DLL_PATH      :=$(call FullPath,$(xALT_MSVCR71_DLL_PATH))
+  # MSVCRNN_DLL_PATH: location of msvcrnn.dll that will be re-distributed
+  ifdef ALT_MSVCRNN_DLL_PATH
+    xALT_MSVCRNN_DLL_PATH :="$(subst \,/,$(ALT_MSVCRNN_DLL_PATH))"
+    MSVCRNN_DLL_PATH      :=$(call FullPath,$(xALT_MSVCRNN_DLL_PATH))
   else
-    ifeq ($(_REDIST71_SDK_EXISTS), true)
-      xREDIST71_DIR  :=$(_redist_sdk)
+    ifeq ($(_REDISTNN_SDK_EXISTS), true)
+      xREDISTNN_DIR  :=$(_redist_sdk)
     else
-      xREDIST71_DIR  :=$(_system_root)/system32
+      xREDISTNN_DIR  :=$(_system_root)/system32
     endif
-    MSVCR71_DLL_PATH :=$(call FullPath,$(xREDIST71_DIR))
+    MSVCRNN_DLL_PATH :=$(call FullPath,$(xREDISTNN_DIR))
   endif
-  MSVCR71_DLL_PATH :=$(call AltCheckSpaces,MSVCR71_DLL_PATH)
-  MSVCR71_DLL_PATH:=$(call AltCheckValue,MSVCR71_DLL_PATH)
+  MSVCRNN_DLL_PATH :=$(call AltCheckSpaces,MSVCRNN_DLL_PATH)
+  MSVCRNN_DLL_PATH:=$(call AltCheckValue,MSVCRNN_DLL_PATH)
   
 else
 
--- a/jdk/make/common/shared/Sanity-Settings.gmk	Thu Jan 15 11:46:31 2009 -0800
+++ b/jdk/make/common/shared/Sanity-Settings.gmk	Wed Jul 05 16:45:33 2017 +0200
@@ -98,7 +98,7 @@
 ifeq ($(PLATFORM),windows)
   ALL_SETTINGS+=$(call addAltSetting,MSVCRT_DLL_PATH)
   ifeq ($(ARCH_DATA_MODEL), 32)
-    ALL_SETTINGS+=$(call addAltSetting,MSVCR71_DLL_PATH)
+    ALL_SETTINGS+=$(call addAltSetting,MSVCRNN_DLL_PATH)
   endif
   ALL_SETTINGS+=$(call addAltSetting,MSDEVTOOLS_PATH)
 endif
--- a/jdk/make/common/shared/Sanity.gmk	Thu Jan 15 11:46:31 2009 -0800
+++ b/jdk/make/common/shared/Sanity.gmk	Wed Jul 05 16:45:33 2017 +0200
@@ -835,15 +835,13 @@
 	    "" >> $(ERROR_FILE) ; \
 	fi
   ifeq ($(ARCH_DATA_MODEL), 32)
-    ifeq ($(COMPILER_VERSION), VS2003)
-	@if [ ! -r "$(MSVCR71_DLL_PATH)/msvcr71.dll" ]; then \
-	  $(ECHO) "ERROR: You do not have access to msvcr71.dll. \n" \
+	@if [ ! -r "$(MSVCRNN_DLL_PATH)/$(MSVCRNN_DLL)" ]; then \
+	  $(ECHO) "ERROR: You do not have access to $(MSVCRNN_DLL). \n" \
 	    "      Please check your access to \n" \
-	    "          $(MSVCR71_DLL_PATH) \n" \
-	    "      and/or check your value of ALT_MSVCR71_DLL_PATH. \n" \
+	    "          $(MSVCRNN_DLL_PATH) \n" \
+	    "      and/or check your value of ALT_MSVCRNN_DLL_PATH. \n" \
 	    "" >> $(ERROR_FILE) ; \
 	fi
-    endif
   endif
 endif
 
--- a/jdk/make/docs/Makefile	Thu Jan 15 11:46:31 2009 -0800
+++ b/jdk/make/docs/Makefile	Wed Jul 05 16:45:33 2017 +0200
@@ -64,7 +64,7 @@
 		-bottom $(JAVADOCBOTTOM_SWITCH)		\
 		$(OVERVIEW_OPTION)
 
-DRAFT = '<br><b>DRAFT&nbsp;'$(MILESTONE)-$(BUILD_NUMBER)'</b>'
+DRAFT = '<br><strong>DRAFT&nbsp;'$(MILESTONE)-$(BUILD_NUMBER)'</strong>'
 THIS_YEAR := $(shell $(DATE) | $(SED) -e 's/  / /g' | $(CUT) -d' ' -f6)
 TRADEMARK = &\#x2122;
 
@@ -95,7 +95,7 @@
 
 JAVADOCTITLE  = 'Java$(TRADEMARK) Platform, Standard Edition $(JDK_MINOR_VERSION)<br>API Specification'
 JAVADOCWINDOWTITLE  = 'Java Platform SE $(JDK_MINOR_VERSION)'
-JAVADOCHEADER = '<b>Java$(TRADEMARK)&nbsp;Platform<br>Standard&nbsp;Ed.&nbsp;$(JDK_MINOR_VERSION)</b>'
+JAVADOCHEADER = '<strong>Java$(TRADEMARK)&nbsp;Platform<br>Standard&nbsp;Ed.&nbsp;$(JDK_MINOR_VERSION)</strong>'
 JAVADOCBOTTOM = '<font size="-1"><a href="http://bugs.sun.com/services/bugreport/index.jsp">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="{@docroot}/../../webnotes/devdocs-vs-specs.html">Java SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Copyright $(THIS_YEAR) Sun Microsystems, Inc. All Rights Reserved. Use is subject to <a href="{@docroot}/../legal/license.html">license terms</a>. Also see the <a href="http://java.sun.com/docs/redist.html">documentation redistribution policy</a>.</font>'
 JAVADOCOVERVIEW = $(SHARE_SRC)/classes/overview-core.html
 
@@ -120,7 +120,7 @@
                     -group $(DOMAPI_GROUPNAME) $(DOMAPI_REGEXP)
 DOMAPI_JAVADOCTITLE  = 'Common DOM API'
 DOMAPI_JAVADOCWINDOWTITLE  = 'Common DOM API'
-DOMAPI_JAVADOCHEADER = '<b>Common DOM API</b>'
+DOMAPI_JAVADOCHEADER = '<strong>Common DOM API</strong>'
 DOMAPI_JAVADOCBOTTOM = '<font size="-1"><a href="http://bugs.sun.com/services/bugreport/index.jsp">Submit a bug or feature</a><br>Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.<br>Copyright $(THIS_YEAR) Sun Microsystems, Inc. 4150 Network Circle<br>Santa Clara, California, 95054, U.S.A.  All Rights Reserved.</font>'
 DOMAPI_GROUPNAME = "Packages"
 DOMAPI_REGEXP = "com.sun.java.browser.dom:org.w3c.dom*"
@@ -140,7 +140,7 @@
                     -overview $(MIRROR_OVERVIEW)
 MIRROR_JAVADOCTITLE = 'Mirror API'
 MIRROR_JAVADOCWINDOWTITLE = 'Mirror API'
-MIRROR_JAVADOCHEADER = '<b>Mirror API</b>'
+MIRROR_JAVADOCHEADER = '<strong>Mirror API</strong>'
 MIRROR_JAVADOCBOTTOM = '<font size="-1"><a href="http://bugs.sun.com/services/bugreport/index.jsp">Report a bug or request a feature.</a><br>Copyright $(THIS_YEAR) Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.</font>'
 MIRROR_GROUPNAME = "Packages"
 MIRROR_OVERVIEW = $(IMPORTSRCDIR)/com/sun/mirror/overview.html
@@ -163,7 +163,7 @@
                     -group $(DOCLETAPI_GROUPNAME) $(DOCLETAPI_REGEXP)
 DOCLETAPI_JAVADOCTITLE  = 'Doclet API'
 DOCLETAPI_JAVADOCWINDOWTITLE  = 'Doclet API'
-DOCLETAPI_JAVADOCHEADER = '<b>Doclet API</b>'
+DOCLETAPI_JAVADOCHEADER = '<strong>Doclet API</strong>'
 DOCLETAPI_JAVADOCBOTTOM = '<font size="-1"><a href="http://bugs.sun.com/services/bugreport/index.jsp">Submit a bug or feature</a><br>Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.<br>Copyright 1993-$(THIS_YEAR) Sun Microsystems, Inc. 4150 Network Circle<br>Santa Clara, California, 95054, U.S.A.  All Rights Reserved.</font>'
 DOCLETAPI_GROUPNAME = "Packages"
 DOCLETAPI_REGEXP = "com.sun.javadoc"
@@ -407,7 +407,7 @@
 #
 TREEAPI_JAVADOCTITLE = 'Compiler Tree API'
 TREEAPI_JAVADOCWINDOWTITLE = 'Compiler Tree API'
-TREEAPI_JAVADOCHEADER = '<b>Compiler Tree API</b>'
+TREEAPI_JAVADOCHEADER = '<strong>Compiler Tree API</strong>'
 TREEAPI_JAVADOCBOTTOM = '<font size="-1"><a href="http://bugs.sun.com/services/bugreport/index.jsp">Report a bug or request a feature.</a><br>Copyright $(THIS_YEAR) Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.</font>'
 TREEAPI_GROUPNAME = "Packages"
 TREEAPI_OVERVIEW = $(SHARE_SRC)/classes/com/sun/source/overview.html
--- a/jdk/make/java/main/java/Makefile	Thu Jan 15 11:46:31 2009 -0800
+++ b/jdk/make/java/main/java/Makefile	Wed Jul 05 16:45:33 2017 +0200
@@ -28,11 +28,10 @@
 PRODUCT = java
 
 #
-# Statically link java to avoid the dependency on msvcr71.dll.  This
+# Statically link java to avoid the dependency on msvcrNN.dll.  This
 # must be set before Defs.gmk is included.
 #
 MS_RUNTIME_STATIC = true
-
 #
 # Statically link java to avoid the dependency on jli.dll.  This
 # must be set before Program.gmk is included.
@@ -44,6 +43,7 @@
 # Override the default version info with our own resource file (see 5106536)
 ifeq ($(PLATFORM), windows)
 LDLIBS_COMMON += user32.lib comctl32.lib
+
 ifdef OPENJDK
     RC_FLAGS += -i "$(PLATFORM_SRC)/resource/icons"
 else
--- a/jdk/make/java/main/javaw/Makefile	Thu Jan 15 11:46:31 2009 -0800
+++ b/jdk/make/java/main/javaw/Makefile	Wed Jul 05 16:45:33 2017 +0200
@@ -32,11 +32,10 @@
 PRODUCT = java
 
 #
-# Statically link javaw to avoid the dependency on msvcr71.dll.  This
+# Statically link javaw to avoid the dependency on msvcrNN.dll.  This
 # must be set before Defs.gmk is included.
 #
 MS_RUNTIME_STATIC = true
-
 #
 # Statically link javaw to avoid the dependency on jli.dll.  This
 # must be set before Program.gmk is included.
--- a/jdk/make/java/redist/Makefile	Thu Jan 15 11:46:31 2009 -0800
+++ b/jdk/make/java/redist/Makefile	Wed Jul 05 16:45:33 2017 +0200
@@ -109,7 +109,7 @@
 $(BINDIR)/msvcrt.dll: $(MSVCRT_DLL_PATH)/msvcrt.dll
 	$(install-import-file)
 	$(CHMOD) a+x $@
-$(BINDIR)/msvcr71.dll: $(MSVCR71_DLL_PATH)/msvcr71.dll
+$(BINDIR)/$(MSVCRNN_DLL): $(MSVCRNN_DLL_PATH)/$(MSVCRNN_DLL)
 	$(install-import-file)
 	$(CHMOD) a+x $@
 
--- a/jdk/src/share/bin/main.c	Thu Jan 15 11:46:31 2009 -0800
+++ b/jdk/src/share/bin/main.c	Wed Jul 05 16:45:33 2017 +0200
@@ -32,6 +32,43 @@
 
 #include "defines.h"
 
+#ifdef _MSC_VER
+#if _MSC_VER > 1400
+
+/*
+ * When building for Microsoft Windows, main has a dependency on msvcr??.dll.
+ *
+ * When using Visual Studio 2005 or later, that must be recorded in
+ * the [java,javaw].exe.manifest file.
+ *
+ * Reference:
+ *     C:/Program Files/Microsoft SDKs/Windows/v6.1/include/crtdefs.h
+ */
+#include <crtassem.h>
+#ifdef _M_IX86
+
+#pragma comment(linker,"/manifestdependency:\"type='win32' "            \
+        "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' "              \
+        "version='" _CRT_ASSEMBLY_VERSION "' "                          \
+        "processorArchitecture='x86' "                                  \
+        "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
+
+#endif /* _M_IX86 */
+
+//This may not be necessary yet for the Windows 64-bit build, but it
+//will be when that build environment is updated.  Need to test to see
+//if it is harmless:
+#ifdef _M_AMD64
+
+#pragma comment(linker,"/manifestdependency:\"type='win32' "            \
+        "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' "              \
+        "version='" _CRT_ASSEMBLY_VERSION "' "                          \
+        "processorArchitecture='amd64' "                                \
+        "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
+
+#endif  /* _M_AMD64 */
+#endif  /* _MSC_VER > 1400 */
+#endif  /* _MSC_VER */
 
 /*
  * Entry point.
--- a/jdk/src/share/classes/sun/security/ssl/CipherBox.java	Thu Jan 15 11:46:31 2009 -0800
+++ b/jdk/src/share/classes/sun/security/ssl/CipherBox.java	Wed Jul 05 16:45:33 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright 1996-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1996-2008 Sun Microsystems, 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
@@ -486,4 +486,21 @@
 
         return newlen;
     }
+
+    /*
+     * Dispose of any intermediate state in the underlying cipher.
+     * For PKCS11 ciphers, this will release any attached sessions, and
+     * thus make finalization faster.
+     */
+    void dispose() {
+        try {
+            if (cipher != null) {
+                // ignore return value.
+                cipher.doFinal();
+            }
+        } catch (GeneralSecurityException e) {
+            // swallow for now.
+        }
+    }
+
 }
--- a/jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java	Thu Jan 15 11:46:31 2009 -0800
+++ b/jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java	Wed Jul 05 16:45:33 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, 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
@@ -547,6 +547,8 @@
 
         // ... create decompressor
 
+        CipherBox oldCipher = readCipher;
+
         try {
             readCipher = handshaker.newReadCipher();
             readMAC = handshaker.newReadMAC();
@@ -555,6 +557,16 @@
             throw (SSLException)new SSLException
                                 ("Algorithm missing:  ").initCause(e);
         }
+
+        /*
+         * Dispose of any intermediate state in the underlying cipher.
+         * For PKCS11 ciphers, this will release any attached sessions,
+         * and thus make finalization faster.
+         *
+         * Since MAC's doFinal() is called for every SSL/TLS packet, it's
+         * not necessary to do the same with MAC's.
+         */
+        oldCipher.dispose();
     }
 
     /*
@@ -572,6 +584,8 @@
 
         // ... create compressor
 
+        CipherBox oldCipher = writeCipher;
+
         try {
             writeCipher = handshaker.newWriteCipher();
             writeMAC = handshaker.newWriteMAC();
@@ -580,6 +594,9 @@
             throw (SSLException)new SSLException
                                 ("Algorithm missing:  ").initCause(e);
         }
+
+        // See comment above.
+        oldCipher.dispose();
     }
 
     /*
@@ -1231,6 +1248,9 @@
             break;
         }
 
+        // See comment in changeReadCiphers()
+        writeCipher.dispose();
+
         connectionState = cs_CLOSED;
     }
 
@@ -1271,6 +1291,10 @@
 
         closeOutboundInternal();
         inboundDone = true;
+
+        // See comment in changeReadCiphers()
+        readCipher.dispose();
+
         connectionState = cs_CLOSED;
     }
 
@@ -1457,6 +1481,10 @@
 
         connectionState = cs_CLOSED;
 
+        // See comment in changeReadCiphers()
+        readCipher.dispose();
+        writeCipher.dispose();
+
         if (cause instanceof RuntimeException) {
             throw (RuntimeException)cause;
         } else {
--- a/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java	Thu Jan 15 11:46:31 2009 -0800
+++ b/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java	Wed Jul 05 16:45:33 2017 +0200
@@ -1427,6 +1427,10 @@
                     waitForClose(false);
                 }
 
+                // See comment in changeReadCiphers()
+                readCipher.dispose();
+                writeCipher.dispose();
+
                 // state will be set to cs_CLOSED in the finally block below
 
                 break;
@@ -1633,6 +1637,11 @@
          * Clean up our side.
          */
         closeSocket();
+
+        // See comment in changeReadCiphers()
+        readCipher.dispose();
+        writeCipher.dispose();
+
         connectionState = (oldState == cs_APP_CLOSED) ? cs_APP_CLOSED
                                                       : cs_CLOSED;
         throw closeReason;
@@ -1763,6 +1772,8 @@
 
         // ... create decompressor
 
+        CipherBox oldCipher = readCipher;
+
         try {
             readCipher = handshaker.newReadCipher();
             readMAC = handshaker.newReadMAC();
@@ -1771,6 +1782,16 @@
             throw (SSLException)new SSLException
                                 ("Algorithm missing:  ").initCause(e);
         }
+
+        /*
+         * Dispose of any intermediate state in the underlying cipher.
+         * For PKCS11 ciphers, this will release any attached sessions,
+         * and thus make finalization faster.
+         *
+         * Since MAC's doFinal() is called for every SSL/TLS packet, it's
+         * not necessary to do the same with MAC's.
+         */
+        oldCipher.dispose();
     }
 
     // used by Handshaker
@@ -1783,6 +1804,8 @@
 
         // ... create compressor
 
+        CipherBox oldCipher = writeCipher;
+
         try {
             writeCipher = handshaker.newWriteCipher();
             writeMAC = handshaker.newWriteMAC();
@@ -1791,6 +1814,9 @@
             throw (SSLException)new SSLException
                                 ("Algorithm missing:  ").initCause(e);
         }
+
+        // See comment above.
+        oldCipher.dispose();
     }
 
     /*
--- a/jdk/src/share/classes/sun/tools/jar/Main.java	Thu Jan 15 11:46:31 2009 -0800
+++ b/jdk/src/share/classes/sun/tools/jar/Main.java	Wed Jul 05 16:45:33 2017 +0200
@@ -46,9 +46,18 @@
     String zname = "";
     String[] files;
     String rootjar = null;
-    Hashtable filesTable = new Hashtable();
-    Vector paths = new Vector();
-    Vector v;
+
+    // An entryName(path)->File map generated during "expand", it helps to
+    // decide whether or not an existing entry in a jar file needs to be
+    // replaced, during the "update" operation.
+    Map<String, File> entryMap = new HashMap<String, File>();
+
+    // All files need to be added/updated.
+    Set<File> entries = new LinkedHashSet<File>();
+
+    // Directories specified by "-C" operation.
+    List<String> paths = new ArrayList<String>();
+
     CRC32 crc32 = new CRC32();
     /*
      * cflag: create
@@ -175,7 +184,8 @@
                         vflag = false;
                     }
                 }
-                create(new BufferedOutputStream(out), expand(files), manifest);
+                expand(null, files, false);
+                create(new BufferedOutputStream(out, 4096), manifest);
                 if (in != null) {
                     in.close();
                 }
@@ -198,8 +208,8 @@
                 }
                 InputStream manifest = (!Mflag && (mname != null)) ?
                     (new FileInputStream(mname)) : null;
-                expand(files);
-                boolean updateOk = update(in, new BufferedOutputStream(out), manifest);
+                expand(null, files, true);
+                boolean updateOk = update(in, new BufferedOutputStream(out), manifest, null);
                 if (ok) {
                     ok = updateOk;
                 }
@@ -354,7 +364,7 @@
                         while (dir.indexOf("//") > -1) {
                             dir = dir.replace("//", "/");
                         }
-                        paths.addElement(dir.replace(File.separatorChar, '/'));
+                        paths.add(dir.replace(File.separatorChar, '/'));
                         nameBuf[k++] = dir + args[++i];
                     } else {
                         nameBuf[k++] = args[i];
@@ -387,17 +397,7 @@
      * Expands list of files to process into full list of all files that
      * can be found by recursively descending directories.
      */
-    String[] expand(String[] files) {
-        v = new Vector();
-        expand(null, files, v, filesTable);
-        files = new String[v.size()];
-        for (int i = 0; i < files.length; i++) {
-            files[i] = ((File)v.elementAt(i)).getPath();
-        }
-        return files;
-    }
-
-    void expand(File dir, String[] files, Vector v, Hashtable t) {
+    void expand(File dir, String[] files, boolean isUpdate) {
         if (files == null) {
             return;
         }
@@ -409,17 +409,20 @@
                 f = new File(dir, files[i]);
             }
             if (f.isFile()) {
-                if (!t.contains(f)) {
-                    t.put(entryName(f.getPath()), f);
-                    v.addElement(f);
+                if (entries.add(f)) {
+                    if (isUpdate)
+                        entryMap.put(entryName(f.getPath()), f);
                 }
             } else if (f.isDirectory()) {
-                String dirPath = f.getPath();
-                dirPath = (dirPath.endsWith(File.separator)) ? dirPath :
-                    (dirPath + File.separator);
-                t.put(entryName(dirPath), f);
-                v.addElement(f);
-                expand(f, f.list(), v, t);
+                if (entries.add(f)) {
+                    if (isUpdate) {
+                        String dirPath = f.getPath();
+                        dirPath = (dirPath.endsWith(File.separator)) ? dirPath :
+                            (dirPath + File.separator);
+                        entryMap.put(entryName(dirPath), f);
+                    }
+                    expand(f, f.list(), isUpdate);
+                }
             } else {
                 error(formatMsg("error.nosuch.fileordir", String.valueOf(f)));
                 ok = false;
@@ -430,7 +433,7 @@
     /*
      * Creates a new JAR file.
      */
-    void create(OutputStream out, String[] files, Manifest manifest)
+    void create(OutputStream out, Manifest manifest)
         throws IOException
     {
         ZipOutputStream zos = new JarOutputStream(out);
@@ -455,8 +458,8 @@
             manifest.write(zos);
             zos.closeEntry();
         }
-        for (int i = 0; i < files.length; i++) {
-            addFile(zos, new File(files[i]));
+        for (File file: entries) {
+            addFile(zos, file);
         }
         zos.close();
     }
@@ -465,10 +468,9 @@
      * update an existing jar file.
      */
     boolean update(InputStream in, OutputStream out,
-                InputStream newManifest) throws IOException
+                   InputStream newManifest,
+                   JarIndex jarIndex) throws IOException
     {
-        Hashtable t = filesTable;
-        Vector v = this.v;
         ZipInputStream zis = new ZipInputStream(in);
         ZipOutputStream zos = new JarOutputStream(out);
         ZipEntry e = null;
@@ -477,8 +479,8 @@
         int n = 0;
         boolean updateOk = true;
 
-        if (t.containsKey(INDEX)) {
-            addIndex((JarIndex)t.get(INDEX), zos);
+        if (jarIndex != null) {
+            addIndex(jarIndex, zos);
         }
 
         // put the old entries first, replace if necessary
@@ -488,9 +490,8 @@
             boolean isManifestEntry = name.toUpperCase(
                                             java.util.Locale.ENGLISH).
                                         equals(MANIFEST);
-            if ((name.toUpperCase().equals(INDEX)
-                    && t.containsKey(INDEX))
-                    || (Mflag && isManifestEntry)) {
+            if ((name.toUpperCase().equals(INDEX) && jarIndex != null)
+                || (Mflag && isManifestEntry)) {
                 continue;
             } else if (isManifestEntry && ((newManifest != null) ||
                         (ename != null))) {
@@ -514,8 +515,7 @@
                 }
                 updateManifest(old, zos);
             } else {
-                if (!t.containsKey(name)) { // copy the old stuff
-
+                if (!entryMap.containsKey(name)) { // copy the old stuff
                     // do our own compression
                     ZipEntry e2 = new ZipEntry(name);
                     e2.setMethod(e.getMethod());
@@ -531,21 +531,17 @@
                         zos.write(buf, 0, n);
                     }
                 } else { // replace with the new files
-                    addFile(zos, (File)(t.get(name)));
-                    t.remove(name);
+                    File f = entryMap.get(name);
+                    addFile(zos, f);
+                    entryMap.remove(name);
+                    entries.remove(f);
                 }
             }
         }
-        t.remove(INDEX);
 
         // add the remaining new files
-        if (!t.isEmpty()) {
-            for (int i = 0; i < v.size(); i++) {
-                File f = (File)v.elementAt(i);
-                if (t.containsValue(f)) {
-                    addFile(zos, f);
-                }
-            }
+        for (File f: entries) {
+            addFile(zos, f);
         }
         if (!foundManifest) {
             if (newManifest != null) {
@@ -611,8 +607,7 @@
     private String entryName(String name) {
         name = name.replace(File.separatorChar, '/');
         String matchPath = "";
-        for (int i = 0; i < paths.size(); i++) {
-            String path = (String)paths.elementAt(i);
+        for (String path : paths) {
             if (name.startsWith(path) && (path.length() > matchPath.length())) {
                 matchPath = path;
             }
@@ -669,7 +664,6 @@
     void addFile(ZipOutputStream zos, File file) throws IOException {
         String name = file.getPath();
         boolean isDir = file.isDirectory();
-
         if (isDir) {
             name = name.endsWith(File.separator) ? name :
                 (name + File.separator);
@@ -704,7 +698,7 @@
         }
         zos.putNextEntry(e);
         if (!isDir) {
-            byte[] buf = new byte[1024];
+            byte[] buf = new byte[8192];
             int len;
             InputStream is = new BufferedInputStream(new FileInputStream(file));
             while ((len = is.read(buf, 0, buf.length)) != -1) {
@@ -749,7 +743,7 @@
      */
     private void crc32File(ZipEntry e, File f) throws IOException {
         InputStream is = new BufferedInputStream(new FileInputStream(f));
-        byte[] buf = new byte[1024];
+        byte[] buf = new byte[8192];
         crc32.reset();
         int r = 0;
         int nread = 0;
@@ -772,7 +766,7 @@
     void extract(InputStream in, String files[]) throws IOException {
         ZipInputStream zis = new ZipInputStream(in);
         ZipEntry e;
-        // Set of all directory entries specified in archive.  Dissallows
+        // Set of all directory entries specified in archive.  Disallows
         // null entries.  Disallows all entries if using pre-6.0 behavior.
         Set<ZipEntry> dirs = new HashSet<ZipEntry>() {
             public boolean add(ZipEntry e) {
@@ -897,17 +891,16 @@
         }
     }
 
-
     /**
      * Output the class index table to the INDEX.LIST file of the
      * root jar file.
      */
     void dumpIndex(String rootjar, JarIndex index) throws IOException {
-        filesTable.put(INDEX, index);
         File scratchFile = File.createTempFile("scratch", null, new File("."));
         File jarFile = new File(rootjar);
         boolean updateOk = update(new FileInputStream(jarFile),
-                new FileOutputStream(scratchFile), null);
+                                  new FileOutputStream(scratchFile),
+                                  null, index);
         jarFile.delete();
         if (!scratchFile.renameTo(jarFile)) {
             scratchFile.delete();
--- a/jdk/src/share/native/java/io/io_util.c	Thu Jan 15 11:46:31 2009 -0800
+++ b/jdk/src/share/native/java/io/io_util.c	Wed Jul 05 16:45:33 2017 +0200
@@ -25,6 +25,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <stddef.h>
 
 #include "jni.h"
 #include "jni_util.h"
@@ -34,9 +35,9 @@
 
 /* IO helper functions */
 
-int
+jint
 readSingle(JNIEnv *env, jobject this, jfieldID fid) {
-    int nread;
+    jint nread;
     char ret;
     FD fd = GET_FD(this, fid);
     if (fd == -1) {
@@ -49,7 +50,7 @@
     } else if (nread == JVM_IO_ERR) { /* error */
         JNU_ThrowIOExceptionWithLastError(env, "Read error");
     } else if (nread == JVM_IO_INTR) {
-        JNU_ThrowByName(env, "java/io/InterruptedIOException", 0);
+        JNU_ThrowByName(env, "java/io/InterruptedIOException", NULL);
     }
     return ret & 0xFF;
 }
@@ -58,25 +59,35 @@
  */
 #define BUF_SIZE 8192
 
+/*
+ * Returns true if the array slice defined by the given offset and length
+ * is out of bounds.
+ */
+static int
+outOfBounds(JNIEnv *env, jint off, jint len, jbyteArray array) {
+    return ((off < 0) ||
+            (len < 0) ||
+            // We are very careful to avoid signed integer overflow,
+            // the result of which is undefined in C.
+            ((*env)->GetArrayLength(env, array) - off < len));
+}
 
-int
+jint
 readBytes(JNIEnv *env, jobject this, jbyteArray bytes,
           jint off, jint len, jfieldID fid)
 {
-    int nread, datalen;
+    jint nread;
     char stackBuf[BUF_SIZE];
-    char *buf = 0;
+    char *buf = NULL;
     FD fd;
 
     if (IS_NULL(bytes)) {
-        JNU_ThrowNullPointerException(env, 0);
+        JNU_ThrowNullPointerException(env, NULL);
         return -1;
     }
-    datalen = (*env)->GetArrayLength(env, bytes);
 
-    if ((off < 0) || (off > datalen) ||
-        (len < 0) || ((off + len) > datalen) || ((off + len) < 0)) {
-        JNU_ThrowByName(env, "java/lang/IndexOutOfBoundsException", 0);
+    if (outOfBounds(env, off, len, bytes)) {
+        JNU_ThrowByName(env, "java/lang/IndexOutOfBoundsException", NULL);
         return -1;
     }
 
@@ -84,8 +95,8 @@
         return 0;
     } else if (len > BUF_SIZE) {
         buf = malloc(len);
-        if (buf == 0) {
-            JNU_ThrowOutOfMemoryError(env, 0);
+        if (buf == NULL) {
+            JNU_ThrowOutOfMemoryError(env, NULL);
             return 0;
         }
     } else {
@@ -95,18 +106,18 @@
     fd = GET_FD(this, fid);
     if (fd == -1) {
         JNU_ThrowIOException(env, "Stream Closed");
-        return -1;
-    }
-
-    nread = IO_Read(fd, buf, len);
-    if (nread > 0) {
-        (*env)->SetByteArrayRegion(env, bytes, off, nread, (jbyte *)buf);
-    } else if (nread == JVM_IO_ERR) {
-        JNU_ThrowIOExceptionWithLastError(env, "Read error");
-    } else if (nread == JVM_IO_INTR) { /* EOF */
-        JNU_ThrowByName(env, "java/io/InterruptedIOException", 0);
-    } else { /* EOF */
         nread = -1;
+    } else {
+        nread = IO_Read(fd, buf, len);
+        if (nread > 0) {
+            (*env)->SetByteArrayRegion(env, bytes, off, nread, (jbyte *)buf);
+        } else if (nread == JVM_IO_ERR) {
+            JNU_ThrowIOExceptionWithLastError(env, "Read error");
+        } else if (nread == JVM_IO_INTR) {
+            JNU_ThrowByName(env, "java/io/InterruptedIOException", NULL);
+        } else { /* EOF */
+            nread = -1;
+        }
     }
 
     if (buf != stackBuf) {
@@ -117,8 +128,9 @@
 
 void
 writeSingle(JNIEnv *env, jobject this, jint byte, jfieldID fid) {
-    char c = byte;
-    int n;
+    // Discard the 24 high-order bits of byte. See OutputStream#write(int)
+    char c = (char) byte;
+    jint n;
     FD fd = GET_FD(this, fid);
     if (fd == -1) {
         JNU_ThrowIOException(env, "Stream Closed");
@@ -128,28 +140,26 @@
     if (n == JVM_IO_ERR) {
         JNU_ThrowIOExceptionWithLastError(env, "Write error");
     } else if (n == JVM_IO_INTR) {
-        JNU_ThrowByName(env, "java/io/InterruptedIOException", 0);
+        JNU_ThrowByName(env, "java/io/InterruptedIOException", NULL);
     }
 }
 
 void
 writeBytes(JNIEnv *env, jobject this, jbyteArray bytes,
-          jint off, jint len, jfieldID fid)
+           jint off, jint len, jfieldID fid)
 {
-    int n, datalen;
+    jint n;
     char stackBuf[BUF_SIZE];
-    char *buf = 0;
+    char *buf = NULL;
     FD fd;
 
     if (IS_NULL(bytes)) {
-        JNU_ThrowNullPointerException(env, 0);
+        JNU_ThrowNullPointerException(env, NULL);
         return;
     }
-    datalen = (*env)->GetArrayLength(env, bytes);
 
-    if ((off < 0) || (off > datalen) ||
-        (len < 0) || ((off + len) > datalen) || ((off + len) < 0)) {
-        JNU_ThrowByName(env, "java/lang/IndexOutOfBoundsException", 0);
+    if (outOfBounds(env, off, len, bytes)) {
+        JNU_ThrowByName(env, "java/lang/IndexOutOfBoundsException", NULL);
         return;
     }
 
@@ -157,8 +167,8 @@
         return;
     } else if (len > BUF_SIZE) {
         buf = malloc(len);
-        if (buf == 0) {
-            JNU_ThrowOutOfMemoryError(env, 0);
+        if (buf == NULL) {
+            JNU_ThrowOutOfMemoryError(env, NULL);
             return;
         }
     } else {
@@ -180,7 +190,7 @@
                 JNU_ThrowIOExceptionWithLastError(env, "Write error");
                 break;
             } else if (n == JVM_IO_INTR) {
-                JNU_ThrowByName(env, "java/io/InterruptedIOException", 0);
+                JNU_ThrowByName(env, "java/io/InterruptedIOException", NULL);
                 break;
             }
             off += n;
@@ -196,19 +206,19 @@
 throwFileNotFoundException(JNIEnv *env, jstring path)
 {
     char buf[256];
-    int n;
+    jint n;
     jobject x;
     jstring why = NULL;
 
     n = JVM_GetLastErrorString(buf, sizeof(buf));
     if (n > 0) {
-    why = JNU_NewStringPlatform(env, buf);
+        why = JNU_NewStringPlatform(env, buf);
     }
     x = JNU_NewObjectByName(env,
-                "java/io/FileNotFoundException",
-                "(Ljava/lang/String;Ljava/lang/String;)V",
-                path, why);
+                            "java/io/FileNotFoundException",
+                            "(Ljava/lang/String;Ljava/lang/String;)V",
+                            path, why);
     if (x != NULL) {
-    (*env)->Throw(env, x);
+        (*env)->Throw(env, x);
     }
 }
--- a/jdk/src/share/native/java/io/io_util.h	Thu Jan 15 11:46:31 2009 -0800
+++ b/jdk/src/share/native/java/io/io_util.h	Wed Jul 05 16:45:33 2017 +0200
@@ -38,9 +38,9 @@
  * IO helper functions
  */
 
-int readSingle(JNIEnv *env, jobject this, jfieldID fid);
-int readBytes(JNIEnv *env, jobject this, jbyteArray bytes, jint off,
-              jint len, jfieldID fid);
+jint readSingle(JNIEnv *env, jobject this, jfieldID fid);
+jint readBytes(JNIEnv *env, jobject this, jbyteArray bytes, jint off,
+               jint len, jfieldID fid);
 void writeSingle(JNIEnv *env, jobject this, jint byte, jfieldID fid);
 void writeBytes(JNIEnv *env, jobject this, jbyteArray bytes, jint off,
                 jint len, jfieldID fid);
--- a/jdk/src/windows/bin/java_md.c	Thu Jan 15 11:46:31 2009 -0800
+++ b/jdk/src/windows/bin/java_md.c	Wed Jul 05 16:45:33 2017 +0200
@@ -41,7 +41,6 @@
 
 #define JVM_DLL "jvm.dll"
 #define JAVA_DLL "java.dll"
-#define CRT_DLL "msvcr71.dll"
 
 /*
  * Prototypes.
@@ -206,7 +205,15 @@
      * assumed to be present in the "JRE path" directory.  If it is not found
      * there (or "JRE path" fails to resolve), skip the explicit load and let
      * nature take its course, which is likely to be a failure to execute.
+     *
+     * (NOTE: the above statement is only true for Visual Studio 2003 and
+     *  msvcr71.dll.)
      */
+#ifdef _MSC_VER
+#if _MSC_VER < 1400
+#define CRT_DLL "msvcr71.dll"
+#endif
+#ifdef CRT_DLL
     if (GetJREPath(crtpath, MAXPATHLEN)) {
         (void)JLI_StrCat(crtpath, "\\bin\\" CRT_DLL);   /* Add crt dll */
         JLI_TraceLauncher("CRT path is %s\n", crtpath);
@@ -217,6 +224,8 @@
             }
         }
     }
+#endif /* CRT_DLL */
+#endif /* _MSC_VER */
 
     /* Load the Java VM DLL */
     if ((handle = LoadLibrary(jvmpath)) == 0) {
--- a/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c	Thu Jan 15 11:46:31 2009 -0800
+++ b/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c	Wed Jul 05 16:45:33 2017 +0200
@@ -345,7 +345,6 @@
     DataBlock data;
     DataBlock* pData;
     DWORD* pCode;
-    DWORD numBytes;
     DWORD stubLen;
     HANDLE hProcess, hThread;
     jint argsLen, i;
@@ -400,7 +399,7 @@
         JNU_ThrowIOExceptionWithLastError(env, "VirtualAllocEx failed");
         return;
     }
-    WriteProcessMemory( hProcess, (LPVOID)pData, (LPVOID)&data, (DWORD)sizeof(DataBlock), &numBytes );
+    WriteProcessMemory( hProcess, (LPVOID)pData, (LPCVOID)&data, (SIZE_T)sizeof(DataBlock), NULL );
 
 
     stubLen = (DWORD)(*env)->GetArrayLength(env, stub);
@@ -412,7 +411,7 @@
         VirtualFreeEx(hProcess, pData, 0, MEM_RELEASE);
         return;
     }
-    WriteProcessMemory( hProcess, (LPVOID)pCode, (LPVOID)stubCode, (DWORD)stubLen, &numBytes );
+    WriteProcessMemory( hProcess, (LPVOID)pCode, (LPCVOID)stubCode, (SIZE_T)stubLen, NULL );
     if (isCopy) {
         (*env)->ReleaseByteArrayElements(env, stub, stubCode, JNI_ABORT);
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/readBytes/MemoryLeak.java	Wed Jul 05 16:45:33 2017 +0200
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2008 Sun Microsystems, 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6791458
+ * @summary Reading from closed input files leaks native memory
+ */
+
+import java.io.*;
+
+public class MemoryLeak {
+    public static void main(String[] args) throws Throwable {
+        byte[] bytes = new byte[1 << 20];
+        String dir = System.getProperty("test.src", ".");
+        File testFile = new File(dir, "input.txt");
+        FileInputStream s = new FileInputStream(testFile);
+        s.close();
+        for (int i = 0; i < 10000; i++) {
+            try {
+                s.read(bytes);
+                throw new Error("expected IOException");
+            } catch (IOException _) {
+                /* OK */
+            } catch (OutOfMemoryError oome) {
+                System.out.printf("Got OutOfMemoryError, i=%d%n", i);
+                throw oome;
+            }
+        }
+    }
+}
--- a/jdk/test/java/io/readBytes/ReadBytesBounds.java	Thu Jan 15 11:46:31 2009 -0800
+++ b/jdk/test/java/io/readBytes/ReadBytesBounds.java	Wed Jul 05 16:45:33 2017 +0200
@@ -22,107 +22,76 @@
  */
 
 /*
-  @test
-  @bug 4017728 4079849
-  @summary Check for correct Array Bounds check in read of FileInputStream and
-  RandomAccessFile
-  */
+ * @test
+ * @bug 4017728 4079849 6788196
+ * @summary Check for correct Array Bounds check in read of FileInputStream and
+ * RandomAccessFile
+ */
 
 import java.io.*;
 
-
 /*
- * The test calls the read(byte buf[] , int off , int len) of FileInputStream with
- * different values of off and len to see if the ArrayOutOfBoundsException is
- * thrown according to the JLS1.0 specification.  The read(...) method calls
- * readBytes(...) in native code(io_util.c).  The read(...) method in RandomAccessFile
- * also calls the same native method.  So one should see similar results.
+ * The test calls the read(byte buf[] , int off , int len) of
+ * FileInputStream with different values of off and len to see if the
+ * IndexOutOfBoundsException is thrown.  The read(...) method calls
+ * readBytes(...) in native code(io_util.c).  The read(...) method in
+ * RandomAccessFile also calls the same native method.  So one should
+ * see similar results.
  */
 
-
 public class ReadBytesBounds {
 
-    public static void main(String argv[]) throws Exception{
+    static final FileInputStream fis;
+    static final RandomAccessFile raf;
+    static final byte[] b = new byte[32];
 
-        int num_test_cases = 12;
-        int off[] =     {-1 , -1 ,  0 , 0  , 33 , 33 , 0  , 32 , 32 , 4  , 1  , 0};
-        int len[] =     {-1 ,  0 , -1 , 33 , 0  , 4  , 32 , 0  , 4  , 16 , 31 , 0};
-        boolean results[] = { false ,  false ,  false , false  , false  , false  ,
-                              true  , true  , false  , true  , true  , true};
+    static {
+        try {
+            String dir = System.getProperty("test.src", ".");
+            File testFile = new File(dir, "input.txt");
+            fis = new FileInputStream(testFile);
+            raf = new RandomAccessFile(testFile , "r");
+        } catch (Throwable t) {
+            throw new Error(t);
+        }
+    }
 
+    public static void main(String argv[]) throws Throwable {
+        byte b[] = new byte[32];
+        testRead(-1, -1, false);
+        testRead(-1,  0, false);
+        testRead( 0, -1, false);
+        testRead( 0, 33, false);
+        testRead(33,  0, false);
+        testRead(33,  4, false);
+        testRead( 0, 32, true);
+        testRead(32,  0, true);
+        testRead(32,  4, false);
+        testRead( 4, 16, true);
+        testRead( 1, 31, true);
+        testRead( 0,  0, true);
+        testRead(31,  Integer.MAX_VALUE, false);
+        testRead( 0,  Integer.MAX_VALUE, false);
+        testRead(-1,  Integer.MAX_VALUE, false);
+        testRead(-4,  Integer.MIN_VALUE, false);
+        testRead( 0,  Integer.MIN_VALUE, false);
+    }
 
-        FileInputStream fis = null;
-        RandomAccessFile raf = null;
-        byte b[] = new byte[32];
-
-        int num_good = 0;
-        int num_bad = 0;
-
-        String dir = System.getProperty("test.src", ".");
-        File testFile = new File(dir, "input.txt");
-        fis = new FileInputStream(testFile);
-        for(int i = 0; i < num_test_cases; i++) {
-
-            try {
-                int bytes_read = fis.read(b , off[i] , len[i]);
-            } catch(IndexOutOfBoundsException aiobe) {
-                if (results[i]) {
-                    throw new RuntimeException("Unexpected result");
-                }
-                else {
-                    num_good++;
-                }
-                continue;
-            }
-
-            if (results[i]) {
-                num_good++;
-            }
-            else {
-                throw new RuntimeException("Unexpected result");
-            }
-
-        }
-        System.out.println("Results for FileInputStream.read");
-        System.out.println("\nTotal number of test cases = " + num_test_cases +
-                           "\nNumber succeded = " + num_good +
-                           "\nNumber failed   = " + num_bad);
-
-
-
-        num_good = 0;
-        num_bad = 0;
-
-        raf = new RandomAccessFile(testFile , "r");
-        for(int i = 0; i < num_test_cases; i++) {
-
-            try {
-                int bytes_read = raf.read(b , off[i] , len[i]);
-            } catch(IndexOutOfBoundsException aiobe) {
-                if (results[i]) {
-                    throw new RuntimeException("Unexpected result");
-                }
-                else {
-                    num_good++;
-                }
-                continue;
-            }
-
-            if (results[i]) {
-                num_good++;
-            }
-            else {
-                throw new RuntimeException("Unexpected result");
-            }
-
+    static void testRead(int off, int len, boolean expected) throws Throwable {
+        System.err.printf("off=%d len=%d expected=%b%n", off, len, expected);
+        boolean result;
+        try {
+            fis.read(b, off, len);
+            raf.read(b, off, len);
+            result = true;
+        } catch (IndexOutOfBoundsException e) {
+            result = false;
         }
 
-        System.out.println("Results for RandomAccessFile.read");
-        System.out.println("\nTotal number of test cases = " + num_test_cases +
-                           "\nNumber succeded = " + num_good +
-                           "\nNumber failed   = " + num_bad);
-
-
+        if (result != expected) {
+            throw new RuntimeException
+                (String.format("Unexpected result off=%d len=%d expected=%b",
+                               off, len, expected));
+        }
     }
-
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/jvmstat/monitor/MonitoredVm/CR6672135.java	Wed Jul 05 16:45:33 2017 +0200
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2004 Sun Microsystems, 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import java.net.URISyntaxException;
+import java.util.Set;
+import sun.jvmstat.monitor.MonitorException;
+import sun.jvmstat.monitor.MonitoredHost;
+import sun.jvmstat.monitor.MonitoredVm;
+import sun.jvmstat.monitor.VmIdentifier;
+
+/**
+ *
+ * @test
+ * @bug 6672135
+ * @summary setInterval() for local MonitoredHost and local MonitoredVm
+ * @author Tomas Hurka
+ */
+public class CR6672135 {
+
+    private static final int INTERVAL = 2000;
+
+    public static void main(String[] args) {
+        int vmInterval;
+        int hostInterval;
+
+        try {
+            MonitoredHost localHost = MonitoredHost.getMonitoredHost("localhost");
+            Set vms = localHost.activeVms();
+            Integer vmInt =  (Integer) vms.iterator().next();
+            String uriString = "//" + vmInt + "?mode=r"; // NOI18N
+            VmIdentifier vmId = new VmIdentifier(uriString);
+            MonitoredVm vm = localHost.getMonitoredVm(vmId);
+
+            vm.setInterval(INTERVAL);
+            localHost.setInterval(INTERVAL);
+            vmInterval = vm.getInterval();
+            hostInterval = localHost.getInterval();
+        } catch (Exception ex) {
+            throw new Error ("Test failed",ex);
+        }
+        System.out.println("VM "+vmInterval);
+        if (vmInterval != INTERVAL) {
+            throw new Error("Test failed");
+        }
+        System.out.println("Host "+hostInterval);
+        if (hostInterval != INTERVAL) {
+            throw new Error("Test failed");
+        }
+    }
+}
+