Merge
authorzmajo
Mon, 07 Mar 2016 09:34:29 +0100
changeset 36559 b35fcd3da015
parent 36558 d55cd2e4a39c (current diff)
parent 36405 e38c9a1ee108 (diff)
child 36560 59ca2b7f6162
Merge
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/development/Server16.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/development/Server24.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/About16.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/About24.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/Delete16.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/Delete24.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/Find16.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/Help16.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/Help24.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/History16.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/History24.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/Information16.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/Information24.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/New16.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/New24.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/Open16.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/Open24.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/Save24.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/SaveAs16.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/SaveAs24.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/Zoom16.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/ZoomIn16.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/ZoomIn24.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/navigation/Down16.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/navigation/Up16.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/text/AlignCenter16.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/text/AlignCenter24.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/text/AlignLeft16.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/text/AlignLeft24.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/text/AlignRight16.gif
hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/text/AlignRight24.gif
hotspot/src/share/vm/c1/c1_Compiler.cpp
hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
hotspot/src/share/vm/c1/c1_LIRGenerator.hpp
hotspot/src/share/vm/classfile/vmSymbols.hpp
hotspot/src/share/vm/opto/c2compiler.cpp
hotspot/src/share/vm/opto/library_call.cpp
hotspot/src/share/vm/runtime/arguments.cpp
hotspot/src/share/vm/runtime/globals.hpp
hotspot/test/serviceability/dcmd/jvmti/LoadJavaAgentDcmdTest.java
jdk/src/java.base/share/classes/sun/misc/Version.java.template
jdk/src/java.base/share/native/libjava/Version.c
jdk/test/java/lang/invoke/T8139885.java
jdk/test/sun/misc/Version/Version.java
--- a/.hgtags	Fri Mar 04 13:16:50 2016 +0000
+++ b/.hgtags	Mon Mar 07 09:34:29 2016 +0100
@@ -350,3 +350,4 @@
 db483b34fa7148d257a429acddbde9c13687dcae jdk-9+105
 6c644cca3f3fc2763e2ff7d669849a75d34543ba jdk-9+106
 1c076468bf7dad5b8f2ee5dcf66e2279caa3e208 jdk-9+107
+257b579d813201682931d6b42f0445ffe5b4210d jdk-9+108
--- a/.hgtags-top-repo	Fri Mar 04 13:16:50 2016 +0000
+++ b/.hgtags-top-repo	Mon Mar 07 09:34:29 2016 +0100
@@ -350,3 +350,4 @@
 be58b02c11f90b88c67e4d0e2cb5e4cf2d9b3c57 jdk-9+105
 54575d8783b3a39a2d710c28cda675d44261f9d9 jdk-9+106
 4d65eba233a8730f913734a6804910b842d2cb54 jdk-9+107
+c7be2a78c31b3b6132f2f5e9e4b3d3bb1c20245c jdk-9+108
--- a/common/conf/jib-profiles.js	Fri Mar 04 13:16:50 2016 +0000
+++ b/common/conf/jib-profiles.js	Mon Mar 07 09:34:29 2016 +0100
@@ -311,6 +311,16 @@
             labels: [ "open" ]
         },
 
+        "linux-x86-open": {
+            target_os: mainProfiles["linux-x86"].target_os,
+            target_cpu: mainProfiles["linux-x86"].target_cpu,
+            dependencies: mainProfiles["linux-x86"].dependencies,
+            configure_args: concat(mainProfiles["linux-x86"].configure_args,
+                "--enable-openjdk-only"),
+            make_args: mainProfiles["linux-x86"].make_args,
+            labels: [ "open" ]
+        },
+
         "solaris-x64-open": {
             target_os: mainProfiles["solaris-x64"].target_os,
             target_cpu: mainProfiles["solaris-x64"].target_cpu,
@@ -319,6 +329,16 @@
                 "--enable-openjdk-only"),
             make_args: mainProfiles["solaris-x64"].make_args,
             labels: [ "open" ]
+        },
+
+        "windows-x86-open": {
+            target_os: mainProfiles["windows-x86"].target_os,
+            target_cpu: mainProfiles["windows-x86"].target_cpu,
+            dependencies: mainProfiles["windows-x86"].dependencies,
+            configure_args: concat(mainProfiles["windows-x86"].configure_args,
+                "--enable-openjdk-only"),
+            make_args: mainProfiles["windows-x86"].make_args,
+            labels: [ "open" ]
         }
     };
     profiles = concatObjects(profiles, jprtOpenProfiles);
--- a/corba/.hgtags	Fri Mar 04 13:16:50 2016 +0000
+++ b/corba/.hgtags	Mon Mar 07 09:34:29 2016 +0100
@@ -350,3 +350,4 @@
 64006ae915b3aa85ac7e6fac679024d2da7fe526 jdk-9+105
 8ec4f97943fe56f93e4621f622b56b7144c0181a jdk-9+106
 49202432b69445164a42be7cbdf74ed5fce98157 jdk-9+107
+84f2862a25eb3232ff36c376b4e2bf2a83dfced3 jdk-9+108
--- a/hotspot/.hgtags	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/.hgtags	Mon Mar 07 09:34:29 2016 +0100
@@ -510,3 +510,4 @@
 266fa9bb5297bf02cb2a7b038b10a109817d2b48 jdk-9+105
 7232de4c17c37f60aecec4f3191090bd3d41d334 jdk-9+106
 c5146d4da417f76edfc43097d2e2ced042a65b4e jdk-9+107
+934f6793f5f7dca44f69b4559d525fa64b31840d jdk-9+108
--- a/hotspot/make/aix/makefiles/trace.make	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/make/aix/makefiles/trace.make	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -57,11 +57,6 @@
 TraceGeneratedNames +=  \
 	traceRequestables.hpp \
     traceEventControl.hpp
-
-ifneq ($(INCLUDE_TRACE), false)
-TraceGeneratedNames += traceProducer.cpp
-endif
-
 endif
 
 TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%)
@@ -100,9 +95,6 @@
 $(TraceOutDir)/traceEventClasses.hpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceEventClasses.xsl $(XML_DEPS)
 	$(GENERATE_CODE)
 
-$(TraceOutDir)/traceProducer.cpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceProducer.xsl $(XML_DEPS)
-	$(GENERATE_CODE)
-
 $(TraceOutDir)/traceRequestables.hpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceRequestables.xsl $(XML_DEPS)
 	$(GENERATE_CODE)
 
--- a/hotspot/make/bsd/makefiles/trace.make	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/make/bsd/makefiles/trace.make	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -57,11 +57,6 @@
 TraceGeneratedNames +=  \
 	traceRequestables.hpp \
     traceEventControl.hpp
-
-ifneq ($(INCLUDE_TRACE), false)
-TraceGeneratedNames += traceProducer.cpp
-endif
-
 endif
 
 
@@ -101,9 +96,6 @@
 $(TraceOutDir)/traceEventClasses.hpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceEventClasses.xsl $(XML_DEPS)
 	$(GENERATE_CODE)
 
-$(TraceOutDir)/traceProducer.cpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceProducer.xsl $(XML_DEPS)
-	$(GENERATE_CODE)
-
 $(TraceOutDir)/traceRequestables.hpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceRequestables.xsl $(XML_DEPS)
 	$(GENERATE_CODE)
 
--- a/hotspot/make/linux/makefiles/trace.make	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/make/linux/makefiles/trace.make	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -57,11 +57,6 @@
 TraceGeneratedNames +=  \
 	traceRequestables.hpp \
     traceEventControl.hpp
-
-ifneq ($(INCLUDE_TRACE), false)
-TraceGeneratedNames += traceProducer.cpp
-endif
-
 endif
 
 TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%)
@@ -100,9 +95,6 @@
 $(TraceOutDir)/traceEventClasses.hpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceEventClasses.xsl $(XML_DEPS)
 	$(GENERATE_CODE)
 
-$(TraceOutDir)/traceProducer.cpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceProducer.xsl $(XML_DEPS)
-	$(GENERATE_CODE)
-
 $(TraceOutDir)/traceRequestables.hpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceRequestables.xsl $(XML_DEPS)
 	$(GENERATE_CODE)
 
--- a/hotspot/make/solaris/makefiles/amd64.make	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/make/solaris/makefiles/amd64.make	Mon Mar 07 09:34:29 2016 +0100
@@ -39,7 +39,7 @@
 # of OPT_CFLAGS. Restore it here.
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
   OPT_CFLAGS/generateOptoStub.o += -g0 -xs
-  OPT_CFLAGS/LinearScan.o += -g0 -xs
+  OPT_CFLAGS/c1_LinearScan.o += -g0 -xs
 endif
 
 else
--- a/hotspot/make/solaris/makefiles/trace.make	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/make/solaris/makefiles/trace.make	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -56,8 +56,7 @@
 ifeq ($(HAS_ALT_SRC), true)
 TraceGeneratedNames +=  \
 	traceRequestables.hpp \
-    traceEventControl.hpp \
-    traceProducer.cpp
+    traceEventControl.hpp
 endif
 
 TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%)
@@ -96,9 +95,6 @@
 $(TraceOutDir)/traceEventClasses.hpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceEventClasses.xsl $(XML_DEPS)
 	$(GENERATE_CODE)
 
-$(TraceOutDir)/traceProducer.cpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceProducer.xsl $(XML_DEPS)
-	$(GENERATE_CODE)
-
 $(TraceOutDir)/traceRequestables.hpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceRequestables.xsl $(XML_DEPS)
 	$(GENERATE_CODE)
 
--- a/hotspot/make/windows/makefiles/trace.make	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/make/windows/makefiles/trace.make	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -43,8 +43,7 @@
 !if EXISTS($(TraceAltSrcDir))
 TraceGeneratedNames = $(TraceGeneratedNames) \
     traceRequestables.hpp \
-    traceEventControl.hpp \
-    traceProducer.cpp
+    traceEventControl.hpp
 !endif
 
 
@@ -58,8 +57,7 @@
 !if EXISTS($(TraceAltSrcDir))
 TraceGeneratedFiles = $(TraceGeneratedFiles) \
 	$(TraceOutDir)/traceRequestables.hpp \
-    $(TraceOutDir)/traceEventControl.hpp \
-	$(TraceOutDir)/traceProducer.cpp
+    $(TraceOutDir)/traceEventControl.hpp
 !endif
 
 XSLT = $(QUIETLY) $(REMOTE) $(RUN_JAVA) -classpath $(JvmtiOutDir) jvmtiGen
@@ -98,10 +96,6 @@
 	@echo Generating AltSrc $@
 	@$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceAltSrcDir)/traceEventClasses.xsl -OUT $(TraceOutDir)/traceEventClasses.hpp
 
-$(TraceOutDir)/traceProducer.cpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceProducer.xsl $(XML_DEPS)
-	@echo Generating AltSrc $@
-	@$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceAltSrcDir)/traceProducer.xsl -OUT $(TraceOutDir)/traceProducer.cpp
-
 $(TraceOutDir)/traceRequestables.hpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceRequestables.xsl $(XML_DEPS)
 	@echo Generating AltSrc $@
 	@$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceAltSrcDir)/traceRequestables.xsl -OUT $(TraceOutDir)/traceRequestables.hpp
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/development/Server16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/development/Server24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/About16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/About24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/Delete16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/Delete24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/Find16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/Help16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/Help24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/History16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/History24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/Information16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/Information24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/New16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/New24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/Open16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/Open24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/Save24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/SaveAs16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/SaveAs24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/Zoom16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/ZoomIn16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/general/ZoomIn24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/navigation/Down16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/navigation/Up16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/text/AlignCenter16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/text/AlignCenter24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/text/AlignLeft16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/text/AlignLeft24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/text/AlignRight16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/images/toolbarButtonGraphics/text/AlignRight24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/development/Server16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/development/Server24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/general/About16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/general/About24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/general/Delete16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/general/Delete24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/general/Find16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/general/Help16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/general/Help24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/general/History16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/general/History24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/general/Information16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/general/Information24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/general/New16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/general/New24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/general/Open16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/general/Open24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/general/Save24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/general/SaveAs16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/general/SaveAs24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/general/Zoom16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/general/ZoomIn16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/general/ZoomIn24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/navigation/Down16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/navigation/Up16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/text/AlignCenter16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/text/AlignCenter24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/text/AlignLeft16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/text/AlignLeft24.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/text/AlignRight16.gif has changed
Binary file hotspot/src/jdk.hotspot.agent/share/classes/toolbarButtonGraphics/text/AlignRight24.gif has changed
--- a/hotspot/src/os/aix/vm/os_aix.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/os/aix/vm/os_aix.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2015 SAP SE. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016 SAP SE. 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
@@ -36,6 +36,7 @@
 #include "compiler/compileBroker.hpp"
 #include "interpreter/interpreter.hpp"
 #include "jvm_aix.h"
+#include "logging/log.hpp"
 #include "libo4.hpp"
 #include "libperfstat_aix.hpp"
 #include "libodm_aix.hpp"
@@ -791,13 +792,8 @@
   const pthread_t pthread_id = ::pthread_self();
   const tid_t kernel_thread_id = ::thread_self();
 
-  trcVerbose("newborn Thread : pthread-id %u, ktid " UINT64_FORMAT
-    ", stack %p ... %p, stacksize 0x%IX (%IB)",
-    pthread_id, kernel_thread_id,
-    thread->stack_end(),
-    thread->stack_base(),
-    thread->stack_size(),
-    thread->stack_size());
+  log_info(os, thread)("Thread is alive (tid: " UINTX_FORMAT ", kernel thread id: " UINTX_FORMAT ").",
+    os::current_thread_id(), (uintx) kernel_thread_id);
 
   // Normally, pthread stacks on AIX live in the data segment (are allocated with malloc()
   // by the pthread library). In rare cases, this may not be the case, e.g. when third-party
@@ -805,7 +801,7 @@
   // guard pages on those stacks, because the stacks may reside in memory which is not
   // protectable (shmated).
   if (thread->stack_base() > ::sbrk(0)) {
-    trcVerbose("Thread " UINT64_FORMAT ": stack not in data segment.", (uint64_t) pthread_id);
+    log_warning(os, thread)("Thread stack not in data segment.");
   }
 
   // Try to randomize the cache line index of hot stack frames.
@@ -839,8 +835,8 @@
   // Call one more level start routine.
   thread->run();
 
-  trcVerbose("Thread finished : pthread-id %u, ktid " UINT64_FORMAT ".",
-    pthread_id, kernel_thread_id);
+  log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ", kernel thread id: " UINTX_FORMAT ").",
+    os::current_thread_id(), (uintx) kernel_thread_id);
 
   return 0;
 }
@@ -908,20 +904,19 @@
   pthread_t tid;
   int ret = pthread_create(&tid, &attr, (void* (*)(void*)) java_start, thread);
 
-  pthread_attr_destroy(&attr);
-
+
+  char buf[64];
   if (ret == 0) {
-    trcVerbose("Created New Thread : pthread-id %u", tid);
+    log_info(os, thread)("Thread started (pthread id: " UINTX_FORMAT ", attributes: %s). ",
+      (uintx) tid, os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
   } else {
-    if (os::Aix::on_pase()) {
-      // QIBM_MULTI_THREADED=Y is needed when the launcher is started on iSeries
-      // using QSH. Otherwise pthread_create fails with errno=11.
-      trcVerbose("(Please make sure you set the environment variable "
-              "QIBM_MULTI_THREADED=Y before running this program.)");
-    }
-    if (PrintMiscellaneous && (Verbose || WizardMode)) {
-      perror("pthread_create()");
-    }
+    log_warning(os, thread)("Failed to start thread - pthread_create failed (%s) for attributes: %s.",
+      strerror(ret), os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
+  }
+
+  pthread_attr_destroy(&attr);
+
+  if (ret != 0) {
     // Need to clean up stuff we've allocated so far
     thread->set_osthread(NULL);
     delete osthread;
@@ -958,13 +953,6 @@
   const pthread_t pthread_id = ::pthread_self();
   const tid_t kernel_thread_id = ::thread_self();
 
-  trcVerbose("attaching Thread : pthread-id %u, ktid " UINT64_FORMAT ", stack %p ... %p, stacksize 0x%IX (%IB)",
-    pthread_id, kernel_thread_id,
-    thread->stack_end(),
-    thread->stack_base(),
-    thread->stack_size(),
-    thread->stack_size());
-
   // OSThread::thread_id is the pthread id.
   osthread->set_thread_id(pthread_id);
 
@@ -990,6 +978,9 @@
   // and save the caller's signal mask
   os::Aix::hotspot_sigmask(thread);
 
+  log_info(os, thread)("Thread attached (tid: " UINTX_FORMAT ", kernel thread id: " UINTX_FORMAT ").",
+    os::current_thread_id(), (uintx) kernel_thread_id);
+
   return true;
 }
 
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -32,6 +32,7 @@
 #include "compiler/disassembler.hpp"
 #include "interpreter/interpreter.hpp"
 #include "jvm_bsd.h"
+#include "logging/log.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/filemap.hpp"
 #include "mutex_bsd.inline.hpp"
@@ -681,6 +682,9 @@
 
   osthread->set_thread_id(os::Bsd::gettid());
 
+  log_info(os, thread)("Thread is alive (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT ").",
+    os::current_thread_id(), (uintx) pthread_self());
+
 #ifdef __APPLE__
   uint64_t unique_thread_id = locate_unique_thread_id(osthread->thread_id());
   guarantee(unique_thread_id != 0, "unique thread id was not found");
@@ -716,6 +720,9 @@
   // call one more level start routine
   thread->run();
 
+  log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT ").",
+    os::current_thread_id(), (uintx) pthread_self());
+
   return 0;
 }
 
@@ -776,12 +783,18 @@
     pthread_t tid;
     int ret = pthread_create(&tid, &attr, (void* (*)(void*)) java_start, thread);
 
+    char buf[64];
+    if (ret == 0) {
+      log_info(os, thread)("Thread started (pthread id: " UINTX_FORMAT ", attributes: %s). ",
+        (uintx) tid, os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
+    } else {
+      log_warning(os, thread)("Failed to start thread - pthread_create failed (%s) for attributes: %s.",
+        strerror(ret), os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
+    }
+
     pthread_attr_destroy(&attr);
 
     if (ret != 0) {
-      if (PrintMiscellaneous && (Verbose || WizardMode)) {
-        perror("pthread_create()");
-      }
       // Need to clean up stuff we've allocated so far
       thread->set_osthread(NULL);
       delete osthread;
@@ -858,6 +871,9 @@
   // and save the caller's signal mask
   os::Bsd::hotspot_sigmask(thread);
 
+  log_info(os, thread)("Thread attached (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT ").",
+    os::current_thread_id(), (uintx) pthread_self());
+
   return true;
 }
 
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -662,6 +662,9 @@
 
   osthread->set_thread_id(os::current_thread_id());
 
+  log_info(os, thread)("Thread is alive (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT ").",
+    os::current_thread_id(), (uintx) pthread_self());
+
   if (UseNUMA) {
     int lgrp_id = os::numa_get_group_id();
     if (lgrp_id != -1) {
@@ -691,6 +694,9 @@
   // call one more level start routine
   thread->run();
 
+  log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT ").",
+    os::current_thread_id(), (uintx) pthread_self());
+
   return 0;
 }
 
@@ -756,12 +762,18 @@
     pthread_t tid;
     int ret = pthread_create(&tid, &attr, (void* (*)(void*)) java_start, thread);
 
+    char buf[64];
+    if (ret == 0) {
+      log_info(os, thread)("Thread started (pthread id: " UINTX_FORMAT ", attributes: %s). ",
+        (uintx) tid, os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
+    } else {
+      log_warning(os, thread)("Failed to start thread - pthread_create failed (%s) for attributes: %s.",
+        strerror(ret), os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
+    }
+
     pthread_attr_destroy(&attr);
 
     if (ret != 0) {
-      if (PrintMiscellaneous && (Verbose || WizardMode)) {
-        perror("pthread_create()");
-      }
       // Need to clean up stuff we've allocated so far
       thread->set_osthread(NULL);
       delete osthread;
@@ -858,6 +870,9 @@
   // and save the caller's signal mask
   os::Linux::hotspot_sigmask(thread);
 
+  log_info(os, thread)("Thread attached (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT ").",
+    os::current_thread_id(), (uintx) pthread_self());
+
   return true;
 }
 
--- a/hotspot/src/os/posix/vm/os_posix.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/os/posix/vm/os_posix.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1071,6 +1071,19 @@
 #endif
 }
 
+char* os::Posix::describe_pthread_attr(char* buf, size_t buflen, const pthread_attr_t* attr) {
+  size_t stack_size = 0;
+  size_t guard_size = 0;
+  int detachstate = 0;
+  pthread_attr_getstacksize(attr, &stack_size);
+  pthread_attr_getguardsize(attr, &guard_size);
+  pthread_attr_getdetachstate(attr, &detachstate);
+  jio_snprintf(buf, buflen, "stacksize: " SIZE_FORMAT "k, guardsize: " SIZE_FORMAT "k, %s",
+    stack_size / 1024, guard_size / 1024,
+    (detachstate == PTHREAD_CREATE_DETACHED ? "detached" : "joinable"));
+  return buf;
+}
+
 
 os::WatcherThreadCrashProtection::WatcherThreadCrashProtection() {
   assert(Thread::current()->is_Watcher_thread(), "Must be WatcherThread");
--- a/hotspot/src/os/posix/vm/os_posix.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/os/posix/vm/os_posix.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -76,6 +76,11 @@
   static address ucontext_get_pc(const ucontext_t* ctx);
   // Set PC into context. Needed for continuation after signal.
   static void ucontext_set_pc(ucontext_t* ctx, address pc);
+
+  // Helper function; describes pthread attributes as short string. String is written
+  // to buf with len buflen; buf is returned.
+  static char* describe_pthread_attr(char* buf, size_t buflen, const pthread_attr_t* attr);
+
 };
 
 /*
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@
 #include "compiler/disassembler.hpp"
 #include "interpreter/interpreter.hpp"
 #include "jvm_solaris.h"
+#include "logging/log.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/filemap.hpp"
 #include "mutex_solaris.inline.hpp"
@@ -68,6 +69,7 @@
 #include "utilities/defaultStream.hpp"
 #include "utilities/events.hpp"
 #include "utilities/growableArray.hpp"
+#include "utilities/macros.hpp"
 #include "utilities/vmError.hpp"
 
 // put OS-includes here
@@ -736,6 +738,9 @@
   osthr->set_lwp_id(_lwp_self());  // Store lwp in case we are bound
   thread->_schedctl = (void *) schedctl_init();
 
+  log_info(os, thread)("Thread is alive (tid: " UINTX_FORMAT ").",
+    os::current_thread_id());
+
   if (UseNUMA) {
     int lgrp_id = os::numa_get_group_id();
     if (lgrp_id != -1) {
@@ -781,6 +786,8 @@
     Atomic::dec(&os::Solaris::_os_thread_count);
   }
 
+  log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ").", os::current_thread_id());
+
   if (UseDetachedThreads) {
     thr_exit(NULL);
     ShouldNotReachHere();
@@ -853,6 +860,9 @@
   // and save the caller's signal mask
   os::Solaris::hotspot_sigmask(thread);
 
+  log_info(os, thread)("Thread attached (tid: " UINTX_FORMAT ").",
+    os::current_thread_id());
+
   return true;
 }
 
@@ -879,6 +889,24 @@
   return true;
 }
 
+// Helper function to trace thread attributes, similar to os::Posix::describe_pthread_attr()
+static char* describe_thr_create_attributes(char* buf, size_t buflen,
+                                            size_t stacksize, long flags) {
+  stringStream ss(buf, buflen);
+  ss.print("stacksize: " SIZE_FORMAT "k, ", stacksize / 1024);
+  ss.print("flags: ");
+  #define PRINT_FLAG(f) if (flags & f) ss.print( #f " ");
+  #define ALL(X) \
+    X(THR_SUSPENDED) \
+    X(THR_DETACHED) \
+    X(THR_BOUND) \
+    X(THR_NEW_LWP) \
+    X(THR_DAEMON)
+  ALL(PRINT_FLAG)
+  #undef ALL
+  #undef PRINT_FLAG
+  return buf;
+}
 
 bool os::create_thread(Thread* thread, ThreadType thr_type,
                        size_t stack_size) {
@@ -974,10 +1002,17 @@
   osthread->set_thread_id(-1);
 
   status = thr_create(NULL, stack_size, java_start, thread, flags, &tid);
+
+  char buf[64];
+  if (status == 0) {
+    log_info(os, thread)("Thread started (tid: " UINTX_FORMAT ", attributes: %s). ",
+      (uintx) tid, describe_thr_create_attributes(buf, sizeof(buf), stack_size, flags));
+  } else {
+    log_warning(os, thread)("Failed to start thread - thr_create failed (%s) for attributes: %s.",
+      strerror(status), describe_thr_create_attributes(buf, sizeof(buf), stack_size, flags));
+  }
+
   if (status != 0) {
-    if (PrintMiscellaneous && (Verbose || WizardMode)) {
-      perror("os::create_thread");
-    }
     thread->set_osthread(NULL);
     // Need to clean up stuff we've allocated so far
     delete osthread;
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -35,6 +35,7 @@
 #include "compiler/disassembler.hpp"
 #include "interpreter/interpreter.hpp"
 #include "jvm_windows.h"
+#include "logging/log.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/filemap.hpp"
 #include "mutex_windows.inline.hpp"
@@ -71,6 +72,7 @@
 #include "utilities/defaultStream.hpp"
 #include "utilities/events.hpp"
 #include "utilities/growableArray.hpp"
+#include "utilities/macros.hpp"
 #include "utilities/vmError.hpp"
 
 #ifdef _DEBUG
@@ -436,6 +438,8 @@
     res = 20115;    // java thread
   }
 
+  log_info(os, thread)("Thread is alive (tid: " UINTX_FORMAT ").", os::current_thread_id());
+
   // Install a win32 structured exception handler around every thread created
   // by VM, so VM can generate error dump when an exception occurred in non-
   // Java thread (e.g. VM thread).
@@ -446,6 +450,8 @@
     // Nothing to do.
   }
 
+  log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ").", os::current_thread_id());
+
   // One less thread is executing
   // When the VMThread gets here, the main thread may have already exited
   // which frees the CodeHeap containing the Atomic::add code
@@ -509,6 +515,10 @@
   osthread->set_state(RUNNABLE);
 
   thread->set_osthread(osthread);
+
+  log_info(os, thread)("Thread attached (tid: " UINTX_FORMAT ").",
+    os::current_thread_id());
+
   return true;
 }
 
@@ -530,6 +540,27 @@
   return true;
 }
 
+// Helper function to trace _beginthreadex attributes,
+//  similar to os::Posix::describe_pthread_attr()
+static char* describe_beginthreadex_attributes(char* buf, size_t buflen,
+                                               size_t stacksize, unsigned initflag) {
+  stringStream ss(buf, buflen);
+  if (stacksize == 0) {
+    ss.print("stacksize: default, ");
+  } else {
+    ss.print("stacksize: " SIZE_FORMAT "k, ", stacksize / 1024);
+  }
+  ss.print("flags: ");
+  #define PRINT_FLAG(f) if (initflag & f) ss.print( #f " ");
+  #define ALL(X) \
+    X(CREATE_SUSPENDED) \
+    X(STACK_SIZE_PARAM_IS_A_RESERVATION)
+  ALL(PRINT_FLAG)
+  #undef ALL
+  #undef PRINT_FLAG
+  return buf;
+}
+
 // Allocate and initialize a new OSThread
 bool os::create_thread(Thread* thread, ThreadType thr_type,
                        size_t stack_size) {
@@ -596,14 +627,24 @@
   // document because JVM uses C runtime library. The good news is that the
   // flag appears to work with _beginthredex() as well.
 
+  const unsigned initflag = CREATE_SUSPENDED | STACK_SIZE_PARAM_IS_A_RESERVATION;
   HANDLE thread_handle =
     (HANDLE)_beginthreadex(NULL,
                            (unsigned)stack_size,
                            (unsigned (__stdcall *)(void*)) java_start,
                            thread,
-                           CREATE_SUSPENDED | STACK_SIZE_PARAM_IS_A_RESERVATION,
+                           initflag,
                            &thread_id);
 
+  char buf[64];
+  if (thread_handle != NULL) {
+    log_info(os, thread)("Thread started (tid: %u, attributes: %s)",
+      thread_id, describe_beginthreadex_attributes(buf, sizeof(buf), stack_size, initflag));
+  } else {
+    log_warning(os, thread)("Failed to start thread - _beginthreadex failed (%s) for attributes: %s.",
+      strerror(errno), describe_beginthreadex_attributes(buf, sizeof(buf), stack_size, initflag));
+  }
+
   if (thread_handle == NULL) {
     // Need to clean up stuff we've allocated so far
     CloseHandle(osthread->interrupt_event());
@@ -1668,8 +1709,7 @@
     if (is_workstation) {
       st->print("10");
     } else {
-      // The server version name of Windows 10 is not known at this time
-      st->print("%d.%d", major_version, minor_version);
+      st->print("Server 2016");
     }
     break;
 
--- a/hotspot/src/share/vm/c1/c1_Compiler.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/c1/c1_Compiler.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -229,8 +229,6 @@
   case vmIntrinsics::_getCharStringU:
   case vmIntrinsics::_putCharStringU:
 #ifdef TRACE_HAVE_INTRINSICS
-  case vmIntrinsics::_classID:
-  case vmIntrinsics::_threadID:
   case vmIntrinsics::_counterTime:
 #endif
     break;
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -43,6 +43,9 @@
 #if INCLUDE_ALL_GCS
 #include "gc/g1/heapRegion.hpp"
 #endif // INCLUDE_ALL_GCS
+#ifdef TRACE_HAVE_INTRINSICS
+#include "trace/traceMacros.hpp"
+#endif
 
 #ifdef ASSERT
 #define __ gen()->lir(__FILE__, __LINE__)->
@@ -3086,42 +3089,7 @@
   __ move(reg, result);
 }
 
-#ifdef TRACE_HAVE_INTRINSICS
-void LIRGenerator::do_ThreadIDIntrinsic(Intrinsic* x) {
-    LIR_Opr thread = getThreadPointer();
-    LIR_Opr osthread = new_pointer_register();
-    __ move(new LIR_Address(thread, in_bytes(JavaThread::osthread_offset()), osthread->type()), osthread);
-    size_t thread_id_size = OSThread::thread_id_size();
-    if (thread_id_size == (size_t) BytesPerLong) {
-      LIR_Opr id = new_register(T_LONG);
-      __ move(new LIR_Address(osthread, in_bytes(OSThread::thread_id_offset()), T_LONG), id);
-      __ convert(Bytecodes::_l2i, id, rlock_result(x));
-    } else if (thread_id_size == (size_t) BytesPerInt) {
-      __ move(new LIR_Address(osthread, in_bytes(OSThread::thread_id_offset()), T_INT), rlock_result(x));
-    } else {
-      ShouldNotReachHere();
-    }
-}
-
-void LIRGenerator::do_ClassIDIntrinsic(Intrinsic* x) {
-    CodeEmitInfo* info = state_for(x);
-    CodeEmitInfo* info2 = new CodeEmitInfo(info); // Clone for the second null check
-    BasicType klass_pointer_type = NOT_LP64(T_INT) LP64_ONLY(T_LONG);
-    assert(info != NULL, "must have info");
-    LIRItem arg(x->argument_at(1), this);
-    arg.load_item();
-    LIR_Opr klass = new_pointer_register();
-    __ move(new LIR_Address(arg.result(), java_lang_Class::klass_offset_in_bytes(), klass_pointer_type), klass, info);
-    LIR_Opr id = new_register(T_LONG);
-    ByteSize offset = TRACE_ID_OFFSET;
-    LIR_Address* trace_id_addr = new LIR_Address(klass, in_bytes(offset), T_LONG);
-    __ move(trace_id_addr, id);
-    __ logical_or(id, LIR_OprFact::longConst(0x01l), id);
-    __ store(id, trace_id_addr);
-    __ logical_and(id, LIR_OprFact::longConst(~0x3l), id);
-    __ move(id, rlock_result(x));
-}
-#endif
+
 
 void LIRGenerator::do_Intrinsic(Intrinsic* x) {
   switch (x->id()) {
@@ -3134,8 +3102,6 @@
   }
 
 #ifdef TRACE_HAVE_INTRINSICS
-  case vmIntrinsics::_threadID: do_ThreadIDIntrinsic(x); break;
-  case vmIntrinsics::_classID: do_ClassIDIntrinsic(x); break;
   case vmIntrinsics::_counterTime:
     do_RuntimeCall(CAST_FROM_FN_PTR(address, TRACE_TIME_METHOD), x);
     break;
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -441,10 +441,7 @@
   void do_SwitchRanges(SwitchRangeArray* x, LIR_Opr value, BlockBegin* default_sux);
 
   void do_RuntimeCall(address routine, Intrinsic* x);
-#ifdef TRACE_HAVE_INTRINSICS
-  void do_ThreadIDIntrinsic(Intrinsic* x);
-  void do_ClassIDIntrinsic(Intrinsic* x);
-#endif
+
   ciKlass* profile_type(ciMethodData* md, int md_first_offset, int md_offset, intptr_t profiled_k,
                         Value arg, LIR_Opr& mdp, bool not_null, ciKlass* signature_at_call_k,
                         ciKlass* callee_signature_k);
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -5380,7 +5380,7 @@
     }
   }
 
-  TRACE_INIT_ID(ik);
+  TRACE_INIT_KLASS_ID(ik);
 
   // If we reach here, all is well.
   // Now remove the InstanceKlass* from the _klass_to_deallocate field
--- a/hotspot/src/share/vm/classfile/classLoader.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -37,6 +37,7 @@
 #include "gc/shared/generation.hpp"
 #include "interpreter/bytecodeStream.hpp"
 #include "interpreter/oopMapCache.hpp"
+#include "logging/logTag.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/filemap.hpp"
 #include "memory/oopFactory.hpp"
@@ -417,34 +418,30 @@
 #if INCLUDE_CDS
 void ClassLoader::exit_with_path_failure(const char* error, const char* message) {
   assert(DumpSharedSpaces, "only called at dump time");
-  tty->print_cr("Hint: enable -XX:+TraceClassPaths to diagnose the failure");
+  tty->print_cr("Hint: enable -Xlog:classpath=info to diagnose the failure");
   vm_exit_during_initialization(error, message);
 }
 #endif
 
-void ClassLoader::trace_class_path(outputStream* out, const char* msg, const char* name) {
-  if (!TraceClassPaths) {
-    return;
-  }
-
-  if (msg) {
-    out->print("%s", msg);
-  }
-  if (name) {
-    if (strlen(name) < 256) {
-      out->print("%s", name);
-    } else {
-      // For very long paths, we need to print each character separately,
-      // as print_cr() has a length limit
-      while (name[0] != '\0') {
-        out->print("%c", name[0]);
-        name++;
+void ClassLoader::trace_class_path(const char* msg, const char* name) {
+  if (log_is_enabled(Info, classpath)) {
+    ResourceMark rm;
+    outputStream* out = LogHandle(classpath)::info_stream();
+    if (msg) {
+      out->print("%s", msg);
+    }
+    if (name) {
+      if (strlen(name) < 256) {
+        out->print("%s", name);
+      } else {
+        // For very long paths, we need to print each character separately,
+        // as print_cr() has a length limit
+        while (name[0] != '\0') {
+          out->print("%c", name[0]);
+          name++;
+        }
       }
     }
-  }
-  if (msg && msg[0] == '[') {
-    out->print_cr("]");
-  } else {
     out->cr();
   }
 }
@@ -470,11 +467,13 @@
 void ClassLoader::setup_bootstrap_search_path() {
   assert(_first_entry == NULL, "should not setup bootstrap class search path twice");
   const char* sys_class_path = Arguments::get_sysclasspath();
+  const char* java_class_path = Arguments::get_appclasspath();
   if (PrintSharedArchiveAndExit) {
     // Don't print sys_class_path - this is the bootcp of this current VM process, not necessarily
     // the same as the bootcp of the shared archive.
   } else {
-    trace_class_path(tty, "[Bootstrap loader class path=", sys_class_path);
+    trace_class_path("bootstrap loader class path=", sys_class_path);
+    trace_class_path("classpath: ", java_class_path);
   }
 #if INCLUDE_CDS
   if (DumpSharedSpaces) {
@@ -578,9 +577,7 @@
         }
       }
     }
-    if (TraceClassPaths) {
-      tty->print_cr("[Opened %s]", path);
-    }
+    log_info(classpath)("opened: %s", path);
     log_info(classload)("opened: %s", path);
   } else {
     // Directory
--- a/hotspot/src/share/vm/classfile/classLoader.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/classfile/classLoader.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -331,7 +331,7 @@
   static void  exit_with_path_failure(const char* error, const char* message);
 #endif
 
-  static void  trace_class_path(outputStream* out, const char* msg, const char* name = NULL);
+  static void  trace_class_path(const char* msg, const char* name = NULL);
 
   // VM monitoring and management support
   static jlong classloader_time_ms();
--- a/hotspot/src/share/vm/classfile/dictionary.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/classfile/dictionary.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -135,8 +135,10 @@
     //          via a store to _pd_set.
     OrderAccess::release_store_ptr(&_pd_set, new_head);
   }
-  if (TraceProtectionDomainVerification && WizardMode) {
-    print();
+  if (log_is_enabled(Trace, protectiondomain)) {
+    ResourceMark rm;
+    outputStream* log = LogHandle(protectiondomain)::trace_stream();
+    print_count(log);
   }
 }
 
--- a/hotspot/src/share/vm/classfile/dictionary.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/classfile/dictionary.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -29,6 +29,7 @@
 #include "oops/instanceKlass.hpp"
 #include "oops/oop.hpp"
 #include "utilities/hashtable.hpp"
+#include "utilities/ostream.hpp"
 
 class DictionaryEntry;
 class PSPromotionManager;
@@ -323,14 +324,14 @@
     return (klass->name() == class_name && _loader_data == loader_data);
   }
 
-  void print() {
+  void print_count(outputStream *st) {
     int count = 0;
     for (ProtectionDomainEntry* current = _pd_set;
                                 current != NULL;
                                 current = current->_next) {
       count++;
     }
-    tty->print_cr("pd set = #%d", count);
+    st->print_cr("pd set count = #%d", count);
   }
 };
 
--- a/hotspot/src/share/vm/classfile/klassFactory.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/classfile/klassFactory.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
 #include "classfile/klassFactory.hpp"
 #include "memory/resourceArea.hpp"
 #include "prims/jvmtiEnvBase.hpp"
+#include "trace/traceMacros.hpp"
 
 static ClassFileStream* prologue(ClassFileStream* stream,
                                  Symbol* name,
@@ -136,5 +137,7 @@
     result->set_cached_class_file(cached_class_file);
   }
 
+  TRACE_KLASS_CREATION(result, parser, THREAD);
+
   return result;
 }
--- a/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,15 +26,15 @@
 #include "classfile/classLoader.hpp"
 #include "classfile/classLoaderData.inline.hpp"
 #include "classfile/sharedPathsMiscInfo.hpp"
+#include "logging/log.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/metaspaceShared.hpp"
 #include "runtime/arguments.hpp"
+#include "utilities/ostream.hpp"
 
 void SharedPathsMiscInfo::add_path(const char* path, int type) {
-  if (TraceClassPaths) {
-    tty->print("[type=%s] ", type_name(type));
-    trace_class_path("[Add misc shared path ", path);
-  }
+  log_info(classpath)("type=%s ", type_name(type));
+  ClassLoader::trace_class_path("add misc shared path ", path);
   write(path, strlen(path) + 1);
   write_jint(jint(type));
 }
@@ -67,11 +67,29 @@
 }
 
 bool SharedPathsMiscInfo::fail(const char* msg, const char* name) {
-  ClassLoader::trace_class_path(tty, msg, name);
+  ClassLoader::trace_class_path(msg, name);
   MetaspaceShared::set_archive_loading_failed();
   return false;
 }
 
+void SharedPathsMiscInfo::print_path(int type, const char* path) {
+  ResourceMark rm;
+  outputStream* out = LogHandle(classpath)::info_stream();
+  switch (type) {
+  case BOOT:
+    out->print("Expecting -Dsun.boot.class.path=%s", path);
+    break;
+  case NON_EXIST:
+    out->print("Expecting that %s does not exist", path);
+    break;
+  case REQUIRED:
+    out->print("Expecting that file %s must exist and is not altered", path);
+    break;
+  default:
+    ShouldNotReachHere();
+  }
+}
+
 bool SharedPathsMiscInfo::check() {
   // The whole buffer must be 0 terminated so that we can use strlen and strcmp
   // without fear.
@@ -90,17 +108,14 @@
     if (!read_jint(&type)) {
       return fail("Corrupted archive file header");
     }
-    if (TraceClassPaths) {
-      tty->print("[type=%s ", type_name(type));
-      print_path(tty, type, path);
-      tty->print_cr("]");
-    }
+    log_info(classpath)("type=%s ", type_name(type));
+    print_path(type, path);
     if (!check(type, path)) {
       if (!PrintSharedArchiveAndExit) {
         return false;
       }
     } else {
-      trace_class_path("[ok");
+      ClassLoader::trace_class_path("ok");
     }
   }
 
--- a/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -64,9 +64,6 @@
   void write(const void* ptr, size_t size);
   bool read(void* ptr, size_t size);
 
-  static void trace_class_path(const char* msg, const char* name = NULL) {
-    ClassLoader::trace_class_path(tty, msg, name);
-  }
 protected:
   static bool fail(const char* msg, const char* name = NULL);
   virtual bool check(jint type, const char* path);
@@ -144,21 +141,7 @@
     }
   }
 
-  virtual void print_path(outputStream* out, int type, const char* path) {
-    switch (type) {
-    case BOOT:
-      out->print("Expecting -Dsun.boot.class.path=%s", path);
-      break;
-    case NON_EXIST:
-      out->print("Expecting that %s does not exist", path);
-      break;
-    case REQUIRED:
-      out->print("Expecting that file %s must exist and is not altered", path);
-      break;
-    default:
-      ShouldNotReachHere();
-    }
-  }
+  virtual void print_path(int type, const char* path);
 
   bool check();
   bool read_jint(jint *ptr) {
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -430,12 +430,15 @@
 
   // Now we have to call back to java to check if the initating class has access
   JavaValue result(T_VOID);
-  if (TraceProtectionDomainVerification) {
+  if (log_is_enabled(Debug, protectiondomain)) {
+    ResourceMark rm;
     // Print out trace information
-    tty->print_cr("Checking package access");
-    tty->print(" - class loader:      "); class_loader()->print_value_on(tty);      tty->cr();
-    tty->print(" - protection domain: "); protection_domain()->print_value_on(tty); tty->cr();
-    tty->print(" - loading:           "); klass()->print_value_on(tty);             tty->cr();
+    outputStream* log = LogHandle(protectiondomain)::debug_stream();
+    log->print_cr("Checking package access");
+    log->print("class loader: "); class_loader()->print_value_on(log);
+    log->print(" protection domain: "); protection_domain()->print_value_on(log);
+    log->print(" loading: "); klass()->print_value_on(log);
+    log->cr();
   }
 
   KlassHandle system_loader(THREAD, SystemDictionary::ClassLoader_klass());
@@ -448,13 +451,10 @@
                          protection_domain,
                          THREAD);
 
-  if (TraceProtectionDomainVerification) {
-    if (HAS_PENDING_EXCEPTION) {
-      tty->print_cr(" -> DENIED !!!!!!!!!!!!!!!!!!!!!");
-    } else {
-     tty->print_cr(" -> granted");
-    }
-    tty->cr();
+  if (HAS_PENDING_EXCEPTION) {
+    log_debug(protectiondomain)("DENIED !!!!!!!!!!!!!!!!!!!!!");
+  } else {
+   log_debug(protectiondomain)("granted");
   }
 
   if (HAS_PENDING_EXCEPTION) return;
--- a/hotspot/src/share/vm/classfile/vmSymbols.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/classfile/vmSymbols.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -328,8 +328,6 @@
   assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
   switch(id) {
 #ifdef TRACE_HAVE_INTRINSICS
-  case vmIntrinsics::_classID:
-  case vmIntrinsics::_threadID:
   case vmIntrinsics::_counterTime:
 #endif
   case vmIntrinsics::_currentTimeMillis:
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -123,7 +123,7 @@
   template(sun_misc_Launcher_ExtClassLoader,          "sun/misc/Launcher$ExtClassLoader")         \
                                                                                                   \
   /* Java runtime version access */                                                               \
-  template(sun_misc_Version,                          "sun/misc/Version")                         \
+  template(java_lang_VersionProps,                    "java/lang/VersionProps")                   \
   template(java_runtime_name_name,                    "java_runtime_name")                        \
   template(java_runtime_version_name,                 "java_runtime_version")                     \
                                                                                                   \
--- a/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -615,7 +615,7 @@
   : DefNewGeneration(rs, initial_byte_size, "PCopy"),
   _overflow_list(NULL),
   _is_alive_closure(this),
-  _plab_stats(YoungPLABSize, PLABWeight)
+  _plab_stats("Young", YoungPLABSize, PLABWeight)
 {
   NOT_PRODUCT(_overflow_counter = ParGCWorkQueueOverflowInterval;)
   NOT_PRODUCT(_num_par_pushes = 0;)
@@ -1008,9 +1008,7 @@
   from()->set_concurrent_iteration_safe_limit(from()->top());
   to()->set_concurrent_iteration_safe_limit(to()->top());
 
-  if (ResizePLAB) {
-    plab_stats()->adjust_desired_plab_sz();
-  }
+  plab_stats()->adjust_desired_plab_sz();
 
   TASKQUEUE_STATS_ONLY(thread_state_set.print_termination_stats());
   TASKQUEUE_STATS_ONLY(thread_state_set.print_taskqueue_stats());
--- a/hotspot/src/share/vm/gc/g1/concurrentG1Refine.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/concurrentG1Refine.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,19 +36,19 @@
 {
   // Ergonomically select initial concurrent refinement parameters
   if (FLAG_IS_DEFAULT(G1ConcRefinementGreenZone)) {
-    FLAG_SET_DEFAULT(G1ConcRefinementGreenZone, (intx)ParallelGCThreads);
+    FLAG_SET_DEFAULT(G1ConcRefinementGreenZone, ParallelGCThreads);
   }
   set_green_zone(G1ConcRefinementGreenZone);
 
   if (FLAG_IS_DEFAULT(G1ConcRefinementYellowZone)) {
     FLAG_SET_DEFAULT(G1ConcRefinementYellowZone, green_zone() * 3);
   }
-  set_yellow_zone(MAX2<int>(G1ConcRefinementYellowZone, green_zone()));
+  set_yellow_zone(MAX2(G1ConcRefinementYellowZone, green_zone()));
 
   if (FLAG_IS_DEFAULT(G1ConcRefinementRedZone)) {
     FLAG_SET_DEFAULT(G1ConcRefinementRedZone, yellow_zone() * 2);
   }
-  set_red_zone(MAX2<int>(G1ConcRefinementRedZone, yellow_zone()));
+  set_red_zone(MAX2(G1ConcRefinementRedZone, yellow_zone()));
 }
 
 ConcurrentG1Refine* ConcurrentG1Refine::create(G1CollectedHeap* g1h, CardTableEntryClosure* refine_closure, jint* ecode) {
--- a/hotspot/src/share/vm/gc/g1/concurrentG1Refine.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/concurrentG1Refine.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,11 +61,11 @@
   * 2) green = 0. Means no caching. Can be a good way to minimize the
   *    amount of time spent updating rsets during a collection.
   */
-  int _green_zone;
-  int _yellow_zone;
-  int _red_zone;
+  size_t _green_zone;
+  size_t _yellow_zone;
+  size_t _red_zone;
 
-  int _thread_threshold_step;
+  size_t _thread_threshold_step;
 
   // We delay the refinement of 'hot' cards using the hot card cache.
   G1HotCardCache _hot_card_cache;
@@ -100,17 +100,17 @@
 
   void print_worker_threads_on(outputStream* st) const;
 
-  void set_green_zone(int x)  { _green_zone = x;  }
-  void set_yellow_zone(int x) { _yellow_zone = x; }
-  void set_red_zone(int x)    { _red_zone = x;    }
+  void set_green_zone(size_t x)  { _green_zone = x;  }
+  void set_yellow_zone(size_t x) { _yellow_zone = x; }
+  void set_red_zone(size_t x)    { _red_zone = x;    }
 
-  int green_zone() const      { return _green_zone;  }
-  int yellow_zone() const     { return _yellow_zone; }
-  int red_zone() const        { return _red_zone;    }
+  size_t green_zone() const      { return _green_zone;  }
+  size_t yellow_zone() const     { return _yellow_zone; }
+  size_t red_zone() const        { return _red_zone;    }
 
   uint worker_thread_num() const { return _n_worker_threads; }
 
-  int thread_threshold_step() const { return _thread_threshold_step; }
+  size_t thread_threshold_step() const { return _thread_threshold_step; }
 
   G1HotCardCache* hot_card_cache() { return &_hot_card_cache; }
 
--- a/hotspot/src/share/vm/gc/g1/concurrentG1RefineThread.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/concurrentG1RefineThread.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -67,10 +67,12 @@
 
 void ConcurrentG1RefineThread::initialize() {
   // Current thread activation threshold
-  _threshold = MIN2<int>(cg1r()->thread_threshold_step() * (_worker_id + 1) + cg1r()->green_zone(),
-                         cg1r()->yellow_zone());
+  _threshold = MIN2(cg1r()->thread_threshold_step() * (_worker_id + 1) + cg1r()->green_zone(),
+                    cg1r()->yellow_zone());
   // A thread deactivates once the number of buffer reached a deactivation threshold
-  _deactivation_threshold = MAX2<int>(_threshold - cg1r()->thread_threshold_step(), cg1r()->green_zone());
+   _deactivation_threshold =
+     MAX2(_threshold - MIN2(_threshold, cg1r()->thread_threshold_step()),
+          cg1r()->green_zone());
 }
 
 void ConcurrentG1RefineThread::wait_for_completed_buffers() {
@@ -127,14 +129,14 @@
     }
 
     DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
-    log_debug(gc, refine)("Activated %d, on threshold: %d, current: %d",
+    log_debug(gc, refine)("Activated %d, on threshold: " SIZE_FORMAT ", current: " SIZE_FORMAT,
                           _worker_id, _threshold, dcqs.completed_buffers_num());
 
     {
       SuspendibleThreadSetJoiner sts_join;
 
       do {
-        int curr_buffer_num = (int)dcqs.completed_buffers_num();
+        size_t curr_buffer_num = dcqs.completed_buffers_num();
         // If the number of the buffers falls down into the yellow zone,
         // that means that the transition period after the evacuation pause has ended.
         if (dcqs.completed_queue_padding() > 0 && curr_buffer_num <= cg1r()->yellow_zone()) {
@@ -151,7 +153,7 @@
                                                       false /* during_pause */));
 
       deactivate();
-      log_debug(gc, refine)("Deactivated %d, off threshold: %d, current: %d",
+      log_debug(gc, refine)("Deactivated %d, off threshold: " SIZE_FORMAT ", current: " SIZE_FORMAT,
                             _worker_id, _deactivation_threshold,
                             dcqs.completed_buffers_num());
     }
--- a/hotspot/src/share/vm/gc/g1/concurrentG1RefineThread.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/concurrentG1RefineThread.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,11 +53,11 @@
   // The closure applied to completed log buffers.
   CardTableEntryClosure* _refine_closure;
 
-  int _thread_threshold_step;
+  size_t _thread_threshold_step;
   // This thread activation threshold
-  int _threshold;
+  size_t _threshold;
   // This thread deactivation threshold
-  int _deactivation_threshold;
+  size_t _deactivation_threshold;
 
   void wait_for_completed_buffers();
 
--- a/hotspot/src/share/vm/gc/g1/dirtyCardQueue.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/dirtyCardQueue.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -207,22 +207,24 @@
 }
 
 
-BufferNode* DirtyCardQueueSet::get_completed_buffer(int stop_at) {
+BufferNode* DirtyCardQueueSet::get_completed_buffer(size_t stop_at) {
   BufferNode* nd = NULL;
   MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag);
 
-  if ((int)_n_completed_buffers <= stop_at) {
+  if (_n_completed_buffers <= stop_at) {
     _process_completed = false;
     return NULL;
   }
 
   if (_completed_buffers_head != NULL) {
     nd = _completed_buffers_head;
+    assert(_n_completed_buffers > 0, "Invariant");
     _completed_buffers_head = nd->next();
-    if (_completed_buffers_head == NULL)
+    _n_completed_buffers--;
+    if (_completed_buffers_head == NULL) {
+      assert(_n_completed_buffers == 0, "Invariant");
       _completed_buffers_tail = NULL;
-    _n_completed_buffers--;
-    assert(_n_completed_buffers >= 0, "Invariant");
+    }
   }
   DEBUG_ONLY(assert_completed_buffer_list_len_correct_locked());
   return nd;
@@ -230,7 +232,7 @@
 
 bool DirtyCardQueueSet::apply_closure_to_completed_buffer(CardTableEntryClosure* cl,
                                                           uint worker_i,
-                                                          int stop_at,
+                                                          size_t stop_at,
                                                           bool during_pause) {
   assert(!during_pause || stop_at == 0, "Should not leave any completed buffers during a pause");
   BufferNode* nd = get_completed_buffer(stop_at);
--- a/hotspot/src/share/vm/gc/g1/dirtyCardQueue.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/dirtyCardQueue.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -134,10 +134,10 @@
   // is returned to the completed buffer set, and this call returns false.
   bool apply_closure_to_completed_buffer(CardTableEntryClosure* cl,
                                          uint worker_i,
-                                         int stop_at,
+                                         size_t stop_at,
                                          bool during_pause);
 
-  BufferNode* get_completed_buffer(int stop_at);
+  BufferNode* get_completed_buffer(size_t stop_at);
 
   // Applies the current closure to all completed buffers,
   // non-consumptively.
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1400,7 +1400,6 @@
       JavaThread::dirty_card_queue_set().abandon_logs();
       assert(dirty_card_queue_set().completed_buffers_num() == 0, "DCQS should be empty");
 
-      _young_list->reset_sampled_info();
       // At this point there should be no regions in the
       // entire heap tagged as young.
       assert(check_young_list_empty(true /* check_heap */),
@@ -1761,8 +1760,8 @@
   _young_list(new YoungList(this)),
   _gc_time_stamp(0),
   _summary_bytes_used(0),
-  _survivor_evac_stats(YoungPLABSize, PLABWeight),
-  _old_evac_stats(OldPLABSize, PLABWeight),
+  _survivor_evac_stats("Young", YoungPLABSize, PLABWeight),
+  _old_evac_stats("Old", OldPLABSize, PLABWeight),
   _expand_heap_after_alloc_failure(true),
   _old_marking_cycles_started(0),
   _old_marking_cycles_completed(0),
@@ -1985,8 +1984,8 @@
   JavaThread::dirty_card_queue_set().initialize(_refine_cte_cl,
                                                 DirtyCardQ_CBL_mon,
                                                 DirtyCardQ_FL_lock,
-                                                concurrent_g1_refine()->yellow_zone(),
-                                                concurrent_g1_refine()->red_zone(),
+                                                (int)concurrent_g1_refine()->yellow_zone(),
+                                                (int)concurrent_g1_refine()->red_zone(),
                                                 Shared_DirtyCardQ_lock,
                                                 NULL,  // fl_owner
                                                 true); // init_free_ids
@@ -3385,13 +3384,15 @@
 
         g1_policy()->clear_collection_set();
 
+        record_obj_copy_mem_stats();
+        _survivor_evac_stats.adjust_desired_plab_sz();
+        _old_evac_stats.adjust_desired_plab_sz();
+
         // Start a new incremental collection set for the next pause.
         g1_policy()->start_incremental_cset_building();
 
         clear_cset_fast_test();
 
-        _young_list->reset_sampled_info();
-
         // Don't check the whole heap at this point as the
         // GC alloc regions from this pause have been tagged
         // as survivors and moved on to the survivor list.
@@ -4398,6 +4399,8 @@
   { }
 
   void work(uint worker_id) {
+    G1GCParPhaseTimesTracker x(_g1h->g1_policy()->phase_times(), G1GCPhaseTimes::PreserveCMReferents, worker_id);
+
     ResourceMark rm;
     HandleMark   hm;
 
@@ -4461,13 +4464,8 @@
   g1_policy()->phase_times()->record_ref_proc_time(ref_proc_time * 1000.0);
 }
 
-// Weak Reference processing during an evacuation pause (part 1).
-void G1CollectedHeap::process_discovered_references(G1ParScanThreadStateSet* per_thread_states) {
-  double ref_proc_start = os::elapsedTime();
-
-  ReferenceProcessor* rp = _ref_processor_stw;
-  assert(rp->discovery_enabled(), "should have been enabled");
-
+void G1CollectedHeap::preserve_cm_referents(G1ParScanThreadStateSet* per_thread_states) {
+  double preserve_cm_referents_start = os::elapsedTime();
   // Any reference objects, in the collection set, that were 'discovered'
   // by the CM ref processor should have already been copied (either by
   // applying the external root copy closure to the discovered lists, or
@@ -4495,9 +4493,18 @@
                                                  per_thread_states,
                                                  no_of_gc_workers,
                                                  _task_queues);
-
   workers()->run_task(&keep_cm_referents);
 
+  g1_policy()->phase_times()->record_preserve_cm_referents_time_ms((os::elapsedTime() - preserve_cm_referents_start) * 1000.0);
+}
+
+// Weak Reference processing during an evacuation pause (part 1).
+void G1CollectedHeap::process_discovered_references(G1ParScanThreadStateSet* per_thread_states) {
+  double ref_proc_start = os::elapsedTime();
+
+  ReferenceProcessor* rp = _ref_processor_stw;
+  assert(rp->discovery_enabled(), "should have been enabled");
+
   // Closure to test whether a referent is alive.
   G1STWIsAliveClosure is_alive(this);
 
@@ -4529,6 +4536,8 @@
                                               NULL,
                                               _gc_timer_stw);
   } else {
+    uint no_of_gc_workers = workers()->active_workers();
+
     // Parallel reference processing
     assert(rp->num_q() == no_of_gc_workers, "sanity");
     assert(no_of_gc_workers <= rp->max_num_q(), "sanity");
@@ -4586,6 +4595,12 @@
   g1_policy()->phase_times()->record_ref_enq_time(ref_enq_time * 1000.0);
 }
 
+void G1CollectedHeap::merge_per_thread_state_info(G1ParScanThreadStateSet* per_thread_states) {
+  double merge_pss_time_start = os::elapsedTime();
+  per_thread_states->flush();
+  g1_policy()->phase_times()->record_merge_pss_time_ms((os::elapsedTime() - merge_pss_time_start) * 1000.0);
+}
+
 void G1CollectedHeap::pre_evacuate_collection_set() {
   _expand_heap_after_alloc_failure = true;
   _evacuation_failed = false;
@@ -4644,6 +4659,7 @@
   // objects (and their reachable sub-graphs) that were
   // not copied during the pause.
   if (g1_policy()->should_process_references()) {
+    preserve_cm_referents(per_thread_states);
     process_discovered_references(per_thread_states);
   } else {
     ref_processor_stw()->verify_no_references_recorded();
@@ -4687,12 +4703,7 @@
 
   _allocator->release_gc_alloc_regions(evacuation_info);
 
-  per_thread_states->flush();
-
-  record_obj_copy_mem_stats();
-
-  _survivor_evac_stats.adjust_desired_plab_sz();
-  _old_evac_stats.adjust_desired_plab_sz();
+  merge_per_thread_state_info(per_thread_states);
 
   // Reset and re-enable the hot card cache.
   // Note the counts for the cards in the regions in the
@@ -5188,8 +5199,8 @@
   bool success() { return _success; }
 };
 
-bool G1CollectedHeap::check_young_list_empty(bool check_heap, bool check_sample) {
-  bool ret = _young_list->check_list_empty(check_sample);
+bool G1CollectedHeap::check_young_list_empty(bool check_heap) {
+  bool ret = _young_list->check_list_empty();
 
   if (check_heap) {
     NoYoungRegionsClosure closure;
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -511,6 +511,9 @@
   // allocated block, or else "NULL".
   HeapWord* expand_and_allocate(size_t word_size, AllocationContext_t context);
 
+  // Preserve any referents discovered by concurrent marking that have not yet been
+  // copied by the STW pause.
+  void preserve_cm_referents(G1ParScanThreadStateSet* per_thread_states);
   // Process any reference objects discovered during
   // an incremental evacuation pause.
   void process_discovered_references(G1ParScanThreadStateSet* per_thread_states);
@@ -519,6 +522,9 @@
   // after processing.
   void enqueue_discovered_references(G1ParScanThreadStateSet* per_thread_states);
 
+  // Merges the information gathered on a per-thread basis for all worker threads
+  // during GC into global variables.
+  void merge_per_thread_state_info(G1ParScanThreadStateSet* per_thread_states);
 public:
   WorkGang* workers() const { return _workers; }
 
@@ -1333,8 +1339,7 @@
     return _young_list->check_list_well_formed();
   }
 
-  bool check_young_list_empty(bool check_heap,
-                              bool check_sample = true);
+  bool check_young_list_empty(bool check_heap);
 
   // *** Stuff related to concurrent marking.  It's not clear to me that so
   // many of these need to be public.
--- a/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -787,10 +787,9 @@
   return survivor_regions_evac_time;
 }
 
-void G1CollectorPolicy::revise_young_list_target_length_if_necessary() {
+void G1CollectorPolicy::revise_young_list_target_length_if_necessary(size_t rs_lengths) {
   guarantee( adaptive_young_list_length(), "should not call this otherwise" );
 
-  size_t rs_lengths = _g1->young_list()->sampled_rs_lengths();
   if (rs_lengths > _rs_lengths_prediction) {
     // add 10% to avoid having to recalculate often
     size_t rs_lengths_prediction = rs_lengths * 1100 / 1000;
@@ -1118,14 +1117,15 @@
   _short_lived_surv_rate_group->start_adding_regions();
   // Do that for any other surv rate groups
 
+  double scan_hcc_time_ms = ConcurrentG1Refine::hot_card_cache_enabled() ? average_time_ms(G1GCPhaseTimes::ScanHCC) : 0.0;
+
   if (update_stats) {
     double cost_per_card_ms = 0.0;
-    double cost_scan_hcc = average_time_ms(G1GCPhaseTimes::ScanHCC);
     if (_pending_cards > 0) {
-      cost_per_card_ms = (average_time_ms(G1GCPhaseTimes::UpdateRS) - cost_scan_hcc) / (double) _pending_cards;
+      cost_per_card_ms = (average_time_ms(G1GCPhaseTimes::UpdateRS) - scan_hcc_time_ms) / (double) _pending_cards;
       _cost_per_card_ms_seq->add(cost_per_card_ms);
     }
-    _cost_scan_hcc_seq->add(cost_scan_hcc);
+    _cost_scan_hcc_seq->add(scan_hcc_time_ms);
 
     double cost_per_entry_ms = 0.0;
     if (cards_scanned > 10) {
@@ -1215,8 +1215,6 @@
   // Note that _mmu_tracker->max_gc_time() returns the time in seconds.
   double update_rs_time_goal_ms = _mmu_tracker->max_gc_time() * MILLIUNITS * G1RSetUpdatingPauseTimePercent / 100.0;
 
-  double scan_hcc_time_ms = average_time_ms(G1GCPhaseTimes::ScanHCC);
-
   if (update_rs_time_goal_ms < scan_hcc_time_ms) {
     log_debug(gc, ergo, refine)("Adjust concurrent refinement thresholds (scanning the HCC expected to take longer than Update RS time goal)."
                                 "Update RS time goal: %1.2fms Scan HCC time: %1.2fms",
@@ -1302,12 +1300,12 @@
     const int k_gy = 3, k_gr = 6;
     const double inc_k = 1.1, dec_k = 0.9;
 
-    int g = cg1r->green_zone();
+    size_t g = cg1r->green_zone();
     if (update_rs_time > goal_ms) {
-      g = (int)(g * dec_k);  // Can become 0, that's OK. That would mean a mutator-only processing.
+      g = (size_t)(g * dec_k);  // Can become 0, that's OK. That would mean a mutator-only processing.
     } else {
       if (update_rs_time < goal_ms && update_rs_processed_buffers > g) {
-        g = (int)MAX2(g * inc_k, g + 1.0);
+        g = (size_t)MAX2(g * inc_k, g + 1.0);
       }
     }
     // Change the refinement threads params
@@ -1316,15 +1314,15 @@
     cg1r->set_red_zone(g * k_gr);
     cg1r->reinitialize_threads();
 
-    int processing_threshold_delta = MAX2((int)(cg1r->green_zone() * _predictor.sigma()), 1);
-    int processing_threshold = MIN2(cg1r->green_zone() + processing_threshold_delta,
+    size_t processing_threshold_delta = MAX2<size_t>(cg1r->green_zone() * _predictor.sigma(), 1);
+    size_t processing_threshold = MIN2(cg1r->green_zone() + processing_threshold_delta,
                                     cg1r->yellow_zone());
     // Change the barrier params
-    dcqs.set_process_completed_threshold(processing_threshold);
-    dcqs.set_max_completed_queue(cg1r->red_zone());
+    dcqs.set_process_completed_threshold((int)processing_threshold);
+    dcqs.set_max_completed_queue((int)cg1r->red_zone());
   }
 
-  int curr_queue_size = dcqs.completed_buffers_num();
+  size_t curr_queue_size = dcqs.completed_buffers_num();
   if (curr_queue_size >= cg1r->yellow_zone()) {
     dcqs.set_completed_queue_padding(curr_queue_size);
   } else {
--- a/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -471,7 +471,7 @@
   // Check the current value of the young list RSet lengths and
   // compare it against the last prediction. If the current value is
   // higher, recalculate the young list target length prediction.
-  void revise_young_list_target_length_if_necessary();
+  void revise_young_list_target_length_if_necessary(size_t rs_lengths);
 
   // This should be called after the heap is resized.
   void record_new_heap_size(uint new_number_of_regions);
--- a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1097,7 +1097,7 @@
     reset_marking_state();
   } else {
     {
-      GCTraceTime(Debug, gc) trace("GC Aggregate Data", g1h->gc_timer_cm());
+      GCTraceTime(Debug, gc) trace("Aggregate Data", g1h->gc_timer_cm());
 
       // Aggregate the per-task counting data that we have accumulated
       // while marking.
@@ -2018,7 +2018,7 @@
   // Inner scope to exclude the cleaning of the string and symbol
   // tables from the displayed time.
   {
-    GCTraceTime(Debug, gc) trace("GC Ref Proc", g1h->gc_timer_cm());
+    GCTraceTime(Debug, gc) trace("Reference Processing", g1h->gc_timer_cm());
 
     ReferenceProcessor* rp = g1h->ref_processor_cm();
 
@@ -2271,7 +2271,7 @@
   SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set();
   guarantee(has_overflown() ||
             satb_mq_set.completed_buffers_num() == 0,
-            "Invariant: has_overflown = %s, num buffers = %d",
+            "Invariant: has_overflown = %s, num buffers = " SIZE_FORMAT,
             BOOL_TO_STR(has_overflown()),
             satb_mq_set.completed_buffers_num());
 
@@ -2702,11 +2702,8 @@
 };
 
 static ReferenceProcessor* get_cm_oop_closure_ref_processor(G1CollectedHeap* g1h) {
-  ReferenceProcessor* result = NULL;
-  if (G1UseConcMarkReferenceProcessing) {
-    result = g1h->ref_processor_cm();
-    assert(result != NULL, "should not be NULL");
-  }
+  ReferenceProcessor* result = g1h->ref_processor_cm();
+  assert(result != NULL, "CM reference processor should not be NULL");
   return result;
 }
 
--- a/hotspot/src/share/vm/gc/g1/g1EvacStats.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1EvacStats.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,15 +29,26 @@
 #include "logging/log.hpp"
 #include "trace/tracing.hpp"
 
+void G1EvacStats::log_plab_allocation() {
+  PLABStats::log_plab_allocation();
+  log_debug(gc, plab)("%s other allocation: "
+                      "region end waste: " SIZE_FORMAT "B, "
+                      "regions filled: %u, "
+                      "direct allocated: " SIZE_FORMAT "B, "
+                      "failure used: " SIZE_FORMAT "B, "
+                      "failure wasted: " SIZE_FORMAT "B",
+                      _description,
+                      _region_end_waste * HeapWordSize,
+                      _regions_filled,
+                      _direct_allocated * HeapWordSize,
+                      _failure_used * HeapWordSize,
+                      _failure_waste * HeapWordSize);
+}
+
 void G1EvacStats::adjust_desired_plab_sz() {
+  log_plab_allocation();
+
   if (!ResizePLAB) {
-    log_debug(gc, plab)(" (allocated = " SIZE_FORMAT " wasted = " SIZE_FORMAT " "
-                        "unused = " SIZE_FORMAT " used = " SIZE_FORMAT " "
-                        "undo_waste = " SIZE_FORMAT " region_end_waste = " SIZE_FORMAT " "
-                        "regions filled = %u direct_allocated = " SIZE_FORMAT " "
-                        "failure_used = " SIZE_FORMAT " failure_waste = " SIZE_FORMAT ") ",
-                        _allocated, _wasted, _unused, used(), _undo_wasted, _region_end_waste,
-                        _regions_filled, _direct_allocated, _failure_used, _failure_waste);
     // Clear accumulators for next round.
     reset();
     return;
@@ -107,18 +118,19 @@
   // Latch the result
   _desired_net_plab_sz = plab_sz;
 
-  log_debug(gc, plab)(" (allocated = " SIZE_FORMAT " wasted = " SIZE_FORMAT " "
-                      "unused = " SIZE_FORMAT " used = " SIZE_FORMAT " "
-                      "undo_waste = " SIZE_FORMAT " region_end_waste = " SIZE_FORMAT " "
-                      "regions filled = %u direct_allocated = " SIZE_FORMAT " "
-                      "failure_used = " SIZE_FORMAT " failure_waste = " SIZE_FORMAT ") "
-                      " (plab_sz = " SIZE_FORMAT " desired_plab_sz = " SIZE_FORMAT ")",
-                      _allocated, _wasted, _unused, used(), _undo_wasted, _region_end_waste,
-                      _regions_filled, _direct_allocated, _failure_used, _failure_waste,
-                      cur_plab_sz, plab_sz);
-
+  log_sizing(cur_plab_sz, plab_sz);
   // Clear accumulators for next round.
   reset();
 }
 
+G1EvacStats::G1EvacStats(const char* description, size_t desired_plab_sz_, unsigned wt) :
+  PLABStats(description, desired_plab_sz_, wt),
+  _region_end_waste(0),
+  _regions_filled(0),
+  _direct_allocated(0),
+  _failure_used(0),
+  _failure_waste(0) {
+}
+
+
 G1EvacStats::~G1EvacStats() { }
--- a/hotspot/src/share/vm/gc/g1/g1EvacStats.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1EvacStats.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,20 +51,15 @@
     _failure_waste = 0;
   }
 
+  virtual void log_plab_allocation();
+
  public:
-  G1EvacStats(size_t desired_plab_sz_, unsigned wt) : PLABStats(desired_plab_sz_, wt),
-    _region_end_waste(0), _regions_filled(0), _direct_allocated(0),
-    _failure_used(0), _failure_waste(0) {
-  }
+  G1EvacStats(const char* description, size_t desired_plab_sz_, unsigned wt);
+
+  ~G1EvacStats();
 
   virtual void adjust_desired_plab_sz();
 
-  size_t allocated() const { return _allocated; }
-  size_t wasted() const { return _wasted; }
-  size_t unused() const { return _unused; }
-  size_t used() const { return allocated() - (wasted() + unused()); }
-  size_t undo_wasted() const { return _undo_wasted; }
-
   uint regions_filled() const { return _regions_filled; }
   size_t region_end_waste() const { return _region_end_waste; }
   size_t direct_allocated() const { return _direct_allocated; }
@@ -77,8 +72,6 @@
   inline void add_direct_allocated(size_t value);
   inline void add_region_end_waste(size_t value);
   inline void add_failure_used_and_waste(size_t used, size_t waste);
-
-  ~G1EvacStats();
 };
 
 #endif // SHARE_VM_GC_G1_G1EVACSTATS_HPP
--- a/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,107 +28,70 @@
 #include "gc/g1/g1GCPhaseTimes.hpp"
 #include "gc/g1/g1StringDedup.hpp"
 #include "gc/g1/workerDataArray.inline.hpp"
-#include "memory/allocation.hpp"
+#include "memory/resourceArea.hpp"
 #include "logging/log.hpp"
 #include "runtime/timer.hpp"
 #include "runtime/os.hpp"
 
-// Helper class for avoiding interleaved logging
-class LineBuffer: public StackObj {
-
-private:
-  static const int BUFFER_LEN = 1024;
-  static const int INDENT_CHARS = 3;
-  char _buffer[BUFFER_LEN];
-  int _indent_level;
-  int _cur;
-
-  void vappend(const char* format, va_list ap)  ATTRIBUTE_PRINTF(2, 0) {
-    int res = vsnprintf(&_buffer[_cur], BUFFER_LEN - _cur, format, ap);
-    if (res != -1) {
-      _cur += res;
-    } else {
-      DEBUG_ONLY(warning("buffer too small in LineBuffer");)
-      _buffer[BUFFER_LEN -1] = 0;
-      _cur = BUFFER_LEN; // vsnprintf above should not add to _buffer if we are called again
-    }
-  }
-
-public:
-  explicit LineBuffer(int indent_level): _indent_level(indent_level), _cur(0) {
-    for (; (_cur < BUFFER_LEN && _cur < (_indent_level * INDENT_CHARS)); _cur++) {
-      _buffer[_cur] = ' ';
-    }
-  }
-
-#ifndef PRODUCT
-  ~LineBuffer() {
-    assert(_cur == _indent_level * INDENT_CHARS, "pending data in buffer - append_and_print_cr() not called?");
-  }
-#endif
-
-  void append(const char* format, ...)  ATTRIBUTE_PRINTF(2, 3) {
-    va_list ap;
-    va_start(ap, format);
-    vappend(format, ap);
-    va_end(ap);
-  }
-
-  const char* to_string() {
-    _cur = _indent_level * INDENT_CHARS;
-    return _buffer;
-  }
-};
-
-static const char* Indents[4] = {"", "   ", "      ", "         "};
+static const char* Indents[5] = {"", "  ", "    ", "     ", "       "};
 
 G1GCPhaseTimes::G1GCPhaseTimes(uint max_gc_threads) :
   _max_gc_threads(max_gc_threads)
 {
   assert(max_gc_threads > 0, "Must have some GC threads");
 
-  _gc_par_phases[GCWorkerStart] = new WorkerDataArray<double>(max_gc_threads, "GC Worker Start:", false, 2);
-  _gc_par_phases[ExtRootScan] = new WorkerDataArray<double>(max_gc_threads, "Ext Root Scanning:", true, 2);
+  _gc_par_phases[GCWorkerStart] = new WorkerDataArray<double>(max_gc_threads, "GC Worker Start (ms):");
+  _gc_par_phases[ExtRootScan] = new WorkerDataArray<double>(max_gc_threads, "Ext Root Scanning (ms):");
 
   // Root scanning phases
-  _gc_par_phases[ThreadRoots] = new WorkerDataArray<double>(max_gc_threads, "Thread Roots:", true, 3);
-  _gc_par_phases[StringTableRoots] = new WorkerDataArray<double>(max_gc_threads, "StringTable Roots:", true, 3);
-  _gc_par_phases[UniverseRoots] = new WorkerDataArray<double>(max_gc_threads, "Universe Roots:", true, 3);
-  _gc_par_phases[JNIRoots] = new WorkerDataArray<double>(max_gc_threads, "JNI Handles Roots:", true, 3);
-  _gc_par_phases[ObjectSynchronizerRoots] = new WorkerDataArray<double>(max_gc_threads, "ObjectSynchronizer Roots:", true, 3);
-  _gc_par_phases[FlatProfilerRoots] = new WorkerDataArray<double>(max_gc_threads, "FlatProfiler Roots:", true, 3);
-  _gc_par_phases[ManagementRoots] = new WorkerDataArray<double>(max_gc_threads, "Management Roots:", true, 3);
-  _gc_par_phases[SystemDictionaryRoots] = new WorkerDataArray<double>(max_gc_threads, "SystemDictionary Roots:", true, 3);
-  _gc_par_phases[CLDGRoots] = new WorkerDataArray<double>(max_gc_threads, "CLDG Roots:", true, 3);
-  _gc_par_phases[JVMTIRoots] = new WorkerDataArray<double>(max_gc_threads, "JVMTI Roots:", true, 3);
-  _gc_par_phases[CMRefRoots] = new WorkerDataArray<double>(max_gc_threads, "CM RefProcessor Roots:", true, 3);
-  _gc_par_phases[WaitForStrongCLD] = new WorkerDataArray<double>(max_gc_threads, "Wait For Strong CLD:", true, 3);
-  _gc_par_phases[WeakCLDRoots] = new WorkerDataArray<double>(max_gc_threads, "Weak CLD Roots:", true, 3);
-  _gc_par_phases[SATBFiltering] = new WorkerDataArray<double>(max_gc_threads, "SATB Filtering:", true, 3);
+  _gc_par_phases[ThreadRoots] = new WorkerDataArray<double>(max_gc_threads, "Thread Roots (ms):");
+  _gc_par_phases[StringTableRoots] = new WorkerDataArray<double>(max_gc_threads, "StringTable Roots (ms):");
+  _gc_par_phases[UniverseRoots] = new WorkerDataArray<double>(max_gc_threads, "Universe Roots (ms):");
+  _gc_par_phases[JNIRoots] = new WorkerDataArray<double>(max_gc_threads, "JNI Handles Roots (ms):");
+  _gc_par_phases[ObjectSynchronizerRoots] = new WorkerDataArray<double>(max_gc_threads, "ObjectSynchronizer Roots (ms):");
+  _gc_par_phases[FlatProfilerRoots] = new WorkerDataArray<double>(max_gc_threads, "FlatProfiler Roots (ms):");
+  _gc_par_phases[ManagementRoots] = new WorkerDataArray<double>(max_gc_threads, "Management Roots (ms):");
+  _gc_par_phases[SystemDictionaryRoots] = new WorkerDataArray<double>(max_gc_threads, "SystemDictionary Roots (ms):");
+  _gc_par_phases[CLDGRoots] = new WorkerDataArray<double>(max_gc_threads, "CLDG Roots (ms):");
+  _gc_par_phases[JVMTIRoots] = new WorkerDataArray<double>(max_gc_threads, "JVMTI Roots (ms):");
+  _gc_par_phases[CMRefRoots] = new WorkerDataArray<double>(max_gc_threads, "CM RefProcessor Roots (ms):");
+  _gc_par_phases[WaitForStrongCLD] = new WorkerDataArray<double>(max_gc_threads, "Wait For Strong CLD (ms):");
+  _gc_par_phases[WeakCLDRoots] = new WorkerDataArray<double>(max_gc_threads, "Weak CLD Roots (ms):");
+  _gc_par_phases[SATBFiltering] = new WorkerDataArray<double>(max_gc_threads, "SATB Filtering (ms):");
 
-  _gc_par_phases[UpdateRS] = new WorkerDataArray<double>(max_gc_threads, "Update RS:", true, 2);
-  _gc_par_phases[ScanHCC] = new WorkerDataArray<double>(max_gc_threads, "Scan HCC:", true, 3);
-  _gc_par_phases[ScanHCC]->set_enabled(ConcurrentG1Refine::hot_card_cache_enabled());
-  _gc_par_phases[ScanRS] = new WorkerDataArray<double>(max_gc_threads, "Scan RS:", true, 2);
-  _gc_par_phases[CodeRoots] = new WorkerDataArray<double>(max_gc_threads, "Code Root Scanning:", true, 2);
-  _gc_par_phases[ObjCopy] = new WorkerDataArray<double>(max_gc_threads, "Object Copy:", true, 2);
-  _gc_par_phases[Termination] = new WorkerDataArray<double>(max_gc_threads, "Termination:", true, 2);
-  _gc_par_phases[GCWorkerTotal] = new WorkerDataArray<double>(max_gc_threads, "GC Worker Total:", true, 2);
-  _gc_par_phases[GCWorkerEnd] = new WorkerDataArray<double>(max_gc_threads, "GC Worker End:", false, 2);
-  _gc_par_phases[Other] = new WorkerDataArray<double>(max_gc_threads, "GC Worker Other:", true, 2);
+  _gc_par_phases[UpdateRS] = new WorkerDataArray<double>(max_gc_threads, "Update RS (ms):");
+  if (ConcurrentG1Refine::hot_card_cache_enabled()) {
+    _gc_par_phases[ScanHCC] = new WorkerDataArray<double>(max_gc_threads, "Scan HCC (ms):");
+  } else {
+    _gc_par_phases[ScanHCC] = NULL;
+  }
+  _gc_par_phases[ScanRS] = new WorkerDataArray<double>(max_gc_threads, "Scan RS (ms):");
+  _gc_par_phases[CodeRoots] = new WorkerDataArray<double>(max_gc_threads, "Code Root Scanning (ms):");
+  _gc_par_phases[ObjCopy] = new WorkerDataArray<double>(max_gc_threads, "Object Copy (ms):");
+  _gc_par_phases[Termination] = new WorkerDataArray<double>(max_gc_threads, "Termination (ms):");
+  _gc_par_phases[GCWorkerTotal] = new WorkerDataArray<double>(max_gc_threads, "GC Worker Total (ms):");
+  _gc_par_phases[GCWorkerEnd] = new WorkerDataArray<double>(max_gc_threads, "GC Worker End (ms):");
+  _gc_par_phases[Other] = new WorkerDataArray<double>(max_gc_threads, "GC Worker Other (ms):");
 
-  _update_rs_processed_buffers = new WorkerDataArray<size_t>(max_gc_threads, "Processed Buffers:", true, 3);
+  _update_rs_processed_buffers = new WorkerDataArray<size_t>(max_gc_threads, "Processed Buffers:");
   _gc_par_phases[UpdateRS]->link_thread_work_items(_update_rs_processed_buffers);
 
-  _termination_attempts = new WorkerDataArray<size_t>(max_gc_threads, "Termination Attempts:", true, 3);
+  _termination_attempts = new WorkerDataArray<size_t>(max_gc_threads, "Termination Attempts:");
   _gc_par_phases[Termination]->link_thread_work_items(_termination_attempts);
 
-  _gc_par_phases[StringDedupQueueFixup] = new WorkerDataArray<double>(max_gc_threads, "Queue Fixup:", true, 2);
-  _gc_par_phases[StringDedupTableFixup] = new WorkerDataArray<double>(max_gc_threads, "Table Fixup:", true, 2);
+  if (UseStringDeduplication) {
+    _gc_par_phases[StringDedupQueueFixup] = new WorkerDataArray<double>(max_gc_threads, "Queue Fixup (ms):");
+    _gc_par_phases[StringDedupTableFixup] = new WorkerDataArray<double>(max_gc_threads, "Table Fixup (ms):");
+  } else {
+    _gc_par_phases[StringDedupQueueFixup] = NULL;
+    _gc_par_phases[StringDedupTableFixup] = NULL;
+  }
 
-  _gc_par_phases[RedirtyCards] = new WorkerDataArray<double>(max_gc_threads, "Parallel Redirty:", true, 3);
-  _redirtied_cards = new WorkerDataArray<size_t>(max_gc_threads, "Redirtied Cards:", true, 3);
+  _gc_par_phases[RedirtyCards] = new WorkerDataArray<double>(max_gc_threads, "Parallel Redirty (ms):");
+  _redirtied_cards = new WorkerDataArray<size_t>(max_gc_threads, "Redirtied Cards:");
   _gc_par_phases[RedirtyCards]->link_thread_work_items(_redirtied_cards);
+
+  _gc_par_phases[PreserveCMReferents] = new WorkerDataArray<double>(max_gc_threads, "Parallel Preserve CM Refs (ms):");
 }
 
 void G1GCPhaseTimes::note_gc_start(uint active_gc_threads) {
@@ -140,11 +103,10 @@
   _external_accounted_time_ms = 0.0;
 
   for (int i = 0; i < GCParPhasesSentinel; i++) {
-    _gc_par_phases[i]->reset();
+    if (_gc_par_phases[i] != NULL) {
+      _gc_par_phases[i]->reset();
+    }
   }
-
-  _gc_par_phases[StringDedupQueueFixup]->set_enabled(G1StringDedup::is_enabled());
-  _gc_par_phases[StringDedupTableFixup]->set_enabled(G1StringDedup::is_enabled());
 }
 
 void G1GCPhaseTimes::note_gc_end() {
@@ -166,45 +128,12 @@
   }
 
   for (int i = 0; i < GCParPhasesSentinel; i++) {
-    _gc_par_phases[i]->verify(_active_gc_threads);
+    if (_gc_par_phases[i] != NULL) {
+      _gc_par_phases[i]->verify(_active_gc_threads);
+    }
   }
 }
 
-void G1GCPhaseTimes::print_stats(const char* indent, const char* str, double value) {
-  log_debug(gc, phases)("%s%s: %.1lf ms", indent, str, value);
-}
-
-double G1GCPhaseTimes::accounted_time_ms() {
-    // First subtract any externally accounted time
-    double misc_time_ms = _external_accounted_time_ms;
-
-    // Subtract the root region scanning wait time. It's initialized to
-    // zero at the start of the pause.
-    misc_time_ms += _root_region_scan_wait_time_ms;
-
-    misc_time_ms += _cur_collection_par_time_ms;
-
-    // Now subtract the time taken to fix up roots in generated code
-    misc_time_ms += _cur_collection_code_root_fixup_time_ms;
-
-    // Strong code root purge time
-    misc_time_ms += _cur_strong_code_root_purge_time_ms;
-
-    if (G1StringDedup::is_enabled()) {
-      // String dedup fixup time
-      misc_time_ms += _cur_string_dedup_fixup_time_ms;
-    }
-
-    // Subtract the time taken to clean the card table from the
-    // current value of "other time"
-    misc_time_ms += _cur_clear_ct_time_ms;
-
-    // Remove expand heap time from "other time"
-    misc_time_ms += _cur_expand_heap_time_ms;
-
-    return misc_time_ms;
-}
-
 // record the time a phase took in seconds
 void G1GCPhaseTimes::record_time_secs(GCParPhases phase, uint worker_i, double secs) {
   _gc_par_phases[phase]->set(worker_i, secs);
@@ -224,193 +153,144 @@
   return _gc_par_phases[phase]->average(_active_gc_threads) * 1000.0;
 }
 
-double G1GCPhaseTimes::get_time_ms(GCParPhases phase, uint worker_i) {
-  return _gc_par_phases[phase]->get(worker_i) * 1000.0;
-}
-
-double G1GCPhaseTimes::sum_time_ms(GCParPhases phase) {
-  return _gc_par_phases[phase]->sum(_active_gc_threads) * 1000.0;
-}
-
-double G1GCPhaseTimes::min_time_ms(GCParPhases phase) {
-  return _gc_par_phases[phase]->minimum(_active_gc_threads) * 1000.0;
-}
-
-double G1GCPhaseTimes::max_time_ms(GCParPhases phase) {
-  return _gc_par_phases[phase]->maximum(_active_gc_threads) * 1000.0;
-}
-
-size_t G1GCPhaseTimes::get_thread_work_item(GCParPhases phase, uint worker_i) {
-  assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count");
-  return _gc_par_phases[phase]->thread_work_items()->get(worker_i);
-}
-
 size_t G1GCPhaseTimes::sum_thread_work_items(GCParPhases phase) {
   assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count");
   return _gc_par_phases[phase]->thread_work_items()->sum(_active_gc_threads);
 }
 
-double G1GCPhaseTimes::average_thread_work_items(GCParPhases phase) {
-  assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count");
-  return _gc_par_phases[phase]->thread_work_items()->average(_active_gc_threads);
+template <class T>
+void G1GCPhaseTimes::details(T* phase, const char* indent) {
+  LogHandle(gc, phases, task) log;
+  if (log.is_level(LogLevel::Trace)) {
+    outputStream* trace_out = log.trace_stream();
+    trace_out->print("%s", indent);
+    phase->print_details_on(trace_out, _active_gc_threads);
+  }
 }
 
-size_t G1GCPhaseTimes::min_thread_work_items(GCParPhases phase) {
-  assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count");
-  return _gc_par_phases[phase]->thread_work_items()->minimum(_active_gc_threads);
-}
+void G1GCPhaseTimes::log_phase(WorkerDataArray<double>* phase, uint indent, outputStream* out, bool print_sum) {
+  out->print("%s", Indents[indent]);
+  phase->print_summary_on(out, _active_gc_threads, print_sum);
+  details(phase, Indents[indent]);
 
-size_t G1GCPhaseTimes::max_thread_work_items(GCParPhases phase) {
-  assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count");
-  return _gc_par_phases[phase]->thread_work_items()->maximum(_active_gc_threads);
+  WorkerDataArray<size_t>* work_items = phase->thread_work_items();
+  if (work_items != NULL) {
+    out->print("%s", Indents[indent + 1]);
+    work_items->print_summary_on(out, _active_gc_threads, true);
+    details(work_items, Indents[indent + 1]);
+  }
 }
 
-class G1GCParPhasePrinter : public StackObj {
-  G1GCPhaseTimes* _phase_times;
- public:
-  G1GCParPhasePrinter(G1GCPhaseTimes* phase_times) : _phase_times(phase_times) {}
-
-  void print(G1GCPhaseTimes::GCParPhases phase_id) {
-    WorkerDataArray<double>* phase = _phase_times->_gc_par_phases[phase_id];
-
-    if (phase->_length == 1) {
-      print_single_length(phase_id, phase);
-    } else {
-      print_multi_length(phase_id, phase);
-    }
+void G1GCPhaseTimes::debug_phase(WorkerDataArray<double>* phase) {
+  LogHandle(gc, phases) log;
+  if (log.is_level(LogLevel::Debug)) {
+    ResourceMark rm;
+    log_phase(phase, 2, log.debug_stream(), true);
   }
-
+}
 
- private:
-  void print_single_length(G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray<double>* phase) {
-    // No need for min, max, average and sum for only one worker
-    log_debug(gc, phases)("%s%s:  %.1lf", Indents[phase->_indent_level], phase->_title, _phase_times->get_time_ms(phase_id, 0));
-
-    WorkerDataArray<size_t>* work_items = phase->_thread_work_items;
-    if (work_items != NULL) {
-      log_debug(gc, phases)("%s%s:  " SIZE_FORMAT, Indents[work_items->_indent_level], work_items->_title, _phase_times->sum_thread_work_items(phase_id));
-    }
+void G1GCPhaseTimes::trace_phase(WorkerDataArray<double>* phase, bool print_sum) {
+  LogHandle(gc, phases) log;
+  if (log.is_level(LogLevel::Trace)) {
+    ResourceMark rm;
+    log_phase(phase, 3, log.trace_stream(), print_sum);
   }
+}
 
-  void print_time_values(const char* indent, G1GCPhaseTimes::GCParPhases phase_id) {
-    if (log_is_enabled(Trace, gc)) {
-      LineBuffer buf(0);
-      uint active_length = _phase_times->_active_gc_threads;
-      for (uint i = 0; i < active_length; ++i) {
-        buf.append(" %4.1lf", _phase_times->get_time_ms(phase_id, i));
-      }
-      const char* line = buf.to_string();
-      log_trace(gc, phases)("%s%-25s%s", indent, "", line);
-    }
-  }
+#define PHASE_DOUBLE_FORMAT "%s%s: %.1lfms"
+#define PHASE_SIZE_FORMAT "%s%s: " SIZE_FORMAT
 
-  void print_count_values(const char* indent, G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray<size_t>* thread_work_items) {
-    if (log_is_enabled(Trace, gc)) {
-      LineBuffer buf(0);
-      uint active_length = _phase_times->_active_gc_threads;
-      for (uint i = 0; i < active_length; ++i) {
-        buf.append("  " SIZE_FORMAT, _phase_times->get_thread_work_item(phase_id, i));
-      }
-      const char* line = buf.to_string();
-      log_trace(gc, phases)("%s%-25s%s", indent, "", line);
-    }
-  }
+#define info_line(str, value) \
+  log_info(gc, phases)(PHASE_DOUBLE_FORMAT, Indents[1], str, value);
 
-  void print_thread_work_items(G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray<size_t>* thread_work_items) {
-    const char* indent = Indents[thread_work_items->_indent_level];
-
-    assert(thread_work_items->_print_sum, "%s does not have print sum true even though it is a count", thread_work_items->_title);
+#define debug_line(str, value) \
+  log_debug(gc, phases)(PHASE_DOUBLE_FORMAT, Indents[2], str, value);
 
-    log_debug(gc, phases)("%s%-25s Min: " SIZE_FORMAT ", Avg: %4.1lf, Max: " SIZE_FORMAT ", Diff: " SIZE_FORMAT ", Sum: " SIZE_FORMAT,
-        indent, thread_work_items->_title,
-        _phase_times->min_thread_work_items(phase_id), _phase_times->average_thread_work_items(phase_id), _phase_times->max_thread_work_items(phase_id),
-        _phase_times->max_thread_work_items(phase_id) - _phase_times->min_thread_work_items(phase_id), _phase_times->sum_thread_work_items(phase_id));
+#define trace_line(str, value) \
+  log_trace(gc, phases)(PHASE_DOUBLE_FORMAT, Indents[3], str, value);
 
-    print_count_values(indent, phase_id, thread_work_items);
-  }
-
-  void print_multi_length(G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray<double>* phase) {
-    const char* indent = Indents[phase->_indent_level];
+#define trace_line_sz(str, value) \
+  log_trace(gc, phases)(PHASE_SIZE_FORMAT, Indents[3], str, value);
 
-    if (phase->_print_sum) {
-      log_debug(gc, phases)("%s%-25s Min: %4.1lf, Avg: %4.1lf, Max: %4.1lf, Diff: %4.1lf, Sum: %4.1lf",
-          indent, phase->_title,
-          _phase_times->min_time_ms(phase_id), _phase_times->average_time_ms(phase_id), _phase_times->max_time_ms(phase_id),
-          _phase_times->max_time_ms(phase_id) - _phase_times->min_time_ms(phase_id), _phase_times->sum_time_ms(phase_id));
-    } else {
-      log_debug(gc, phases)("%s%-25s Min: %4.1lf, Avg: %4.1lf, Max: %4.1lf, Diff: %4.1lf",
-          indent, phase->_title,
-          _phase_times->min_time_ms(phase_id), _phase_times->average_time_ms(phase_id), _phase_times->max_time_ms(phase_id),
-          _phase_times->max_time_ms(phase_id) - _phase_times->min_time_ms(phase_id));
-    }
+#define trace_line_ms(str, value) \
+  log_trace(gc, phases)(PHASE_SIZE_FORMAT, Indents[3], str, value);
 
-    print_time_values(indent, phase_id);
-
-    if (phase->_thread_work_items != NULL) {
-      print_thread_work_items(phase_id, phase->_thread_work_items);
-    }
-  }
-};
+#define info_line_and_account(str, value) \
+  info_line(str, value);                  \
+  accounted_time_ms += value;
 
 void G1GCPhaseTimes::print() {
   note_gc_end();
 
-  G1GCParPhasePrinter par_phase_printer(this);
-
+  double accounted_time_ms = _external_accounted_time_ms;
   if (_root_region_scan_wait_time_ms > 0.0) {
-    print_stats(Indents[1], "Root Region Scan Waiting", _root_region_scan_wait_time_ms);
-  }
-
-  print_stats(Indents[1], "Parallel Time", _cur_collection_par_time_ms);
-  for (int i = 0; i <= GCMainParPhasesLast; i++) {
-    par_phase_printer.print((GCParPhases) i);
+    info_line_and_account("Root Region Scan Waiting", _root_region_scan_wait_time_ms);
   }
 
-  print_stats(Indents[1], "Code Root Fixup", _cur_collection_code_root_fixup_time_ms);
-  print_stats(Indents[1], "Code Root Purge", _cur_strong_code_root_purge_time_ms);
+  info_line_and_account("Evacuate Collection Set", _cur_collection_par_time_ms);
+  trace_phase(_gc_par_phases[GCWorkerStart], false);
+  debug_phase(_gc_par_phases[ExtRootScan]);
+  for (int i = ThreadRoots; i <= SATBFiltering; i++) {
+    trace_phase(_gc_par_phases[i]);
+  }
+  debug_phase(_gc_par_phases[UpdateRS]);
+  if (ConcurrentG1Refine::hot_card_cache_enabled()) {
+    trace_phase(_gc_par_phases[ScanHCC]);
+  }
+  debug_phase(_gc_par_phases[ScanRS]);
+  debug_phase(_gc_par_phases[CodeRoots]);
+  debug_phase(_gc_par_phases[ObjCopy]);
+  debug_phase(_gc_par_phases[Termination]);
+  debug_phase(_gc_par_phases[Other]);
+  debug_phase(_gc_par_phases[GCWorkerTotal]);
+  trace_phase(_gc_par_phases[GCWorkerEnd], false);
+
+  info_line_and_account("Code Roots", _cur_collection_code_root_fixup_time_ms + _cur_strong_code_root_purge_time_ms);
+  debug_line("Code Roots Fixup", _cur_collection_code_root_fixup_time_ms);
+  debug_line("Code Roots Purge", _cur_strong_code_root_purge_time_ms);
+
   if (G1StringDedup::is_enabled()) {
-    print_stats(Indents[1], "String Dedup Fixup", _cur_string_dedup_fixup_time_ms);
-    for (int i = StringDedupPhasesFirst; i <= StringDedupPhasesLast; i++) {
-      par_phase_printer.print((GCParPhases) i);
-    }
+    info_line_and_account("String Dedup Fixup", _cur_string_dedup_fixup_time_ms);
+    debug_phase(_gc_par_phases[StringDedupQueueFixup]);
+    debug_phase(_gc_par_phases[StringDedupTableFixup]);
   }
-  print_stats(Indents[1], "Clear CT", _cur_clear_ct_time_ms);
-  print_stats(Indents[1], "Expand Heap After Collection", _cur_expand_heap_time_ms);
-  double misc_time_ms = _gc_pause_time_ms - accounted_time_ms();
-  print_stats(Indents[1], "Other", misc_time_ms);
+  info_line_and_account("Clear Card Table", _cur_clear_ct_time_ms);
+  info_line_and_account("Expand Heap After Collection", _cur_expand_heap_time_ms);
+
+  double free_cset_time = _recorded_young_free_cset_time_ms + _recorded_non_young_free_cset_time_ms;
+  info_line_and_account("Free Collection Set", free_cset_time);
+  debug_line("Young Free Collection Set", _recorded_young_free_cset_time_ms);
+  debug_line("Non-Young Free Collection Set", _recorded_non_young_free_cset_time_ms);
+  info_line_and_account("Merge Per-Thread State", _recorded_merge_pss_time_ms);
+
+  info_line("Other", _gc_pause_time_ms - accounted_time_ms);
   if (_cur_verify_before_time_ms > 0.0) {
-    print_stats(Indents[2], "Verify Before", _cur_verify_before_time_ms);
+    debug_line("Verify Before", _cur_verify_before_time_ms);
   }
   if (G1CollectedHeap::heap()->evacuation_failed()) {
     double evac_fail_handling = _cur_evac_fail_recalc_used + _cur_evac_fail_remove_self_forwards +
       _cur_evac_fail_restore_remsets;
-    print_stats(Indents[2], "Evacuation Failure", evac_fail_handling);
-    log_trace(gc, phases)("%sRecalculate Used: %.1lf ms", Indents[3], _cur_evac_fail_recalc_used);
-    log_trace(gc, phases)("%sRemove Self Forwards: %.1lf ms", Indents[3], _cur_evac_fail_remove_self_forwards);
-    log_trace(gc, phases)("%sRestore RemSet: %.1lf ms", Indents[3], _cur_evac_fail_restore_remsets);
+    debug_line("Evacuation Failure", evac_fail_handling);
+    trace_line("Recalculate Used", _cur_evac_fail_recalc_used);
+    trace_line("Remove Self Forwards",_cur_evac_fail_remove_self_forwards);
+    trace_line("Restore RemSet", _cur_evac_fail_restore_remsets);
   }
-  print_stats(Indents[2], "Choose CSet",
-    (_recorded_young_cset_choice_time_ms +
-    _recorded_non_young_cset_choice_time_ms));
-  print_stats(Indents[2], "Ref Proc", _cur_ref_proc_time_ms);
-  print_stats(Indents[2], "Ref Enq", _cur_ref_enq_time_ms);
-  print_stats(Indents[2], "Redirty Cards", _recorded_redirty_logged_cards_time_ms);
-  par_phase_printer.print(RedirtyCards);
+  debug_line("Choose CSet", (_recorded_young_cset_choice_time_ms + _recorded_non_young_cset_choice_time_ms));
+  debug_line("Preserve CM Refs", _recorded_preserve_cm_referents_time_ms);
+  debug_line("Reference Processing", _cur_ref_proc_time_ms);
+  debug_line("Reference Enqueuing", _cur_ref_enq_time_ms);
+  debug_line("Redirty Cards", _recorded_redirty_logged_cards_time_ms);
+  trace_phase(_gc_par_phases[RedirtyCards]);
+  trace_phase(_gc_par_phases[PreserveCMReferents]);
   if (G1EagerReclaimHumongousObjects) {
-    print_stats(Indents[2], "Humongous Register", _cur_fast_reclaim_humongous_register_time_ms);
-
-    log_trace(gc, phases)("%sHumongous Total: " SIZE_FORMAT, Indents[3], _cur_fast_reclaim_humongous_total);
-    log_trace(gc, phases)("%sHumongous Candidate: " SIZE_FORMAT, Indents[3], _cur_fast_reclaim_humongous_candidates);
-    print_stats(Indents[2], "Humongous Reclaim", _cur_fast_reclaim_humongous_time_ms);
-    log_trace(gc, phases)("%sHumongous Reclaimed: " SIZE_FORMAT, Indents[3], _cur_fast_reclaim_humongous_reclaimed);
+    debug_line("Humongous Register", _cur_fast_reclaim_humongous_register_time_ms);
+    trace_line_sz("Humongous Total", _cur_fast_reclaim_humongous_total);
+    trace_line_sz("Humongous Candidate", _cur_fast_reclaim_humongous_candidates);
+    debug_line("Humongous Reclaim", _cur_fast_reclaim_humongous_time_ms);
+    trace_line_sz("Humongous Reclaimed", _cur_fast_reclaim_humongous_reclaimed);
   }
-  print_stats(Indents[2], "Free CSet",
-    (_recorded_young_free_cset_time_ms +
-    _recorded_non_young_free_cset_time_ms));
-  log_trace(gc, phases)("%sYoung Free CSet: %.1lf ms", Indents[3], _recorded_young_free_cset_time_ms);
-  log_trace(gc, phases)("%sNon-Young Free CSet: %.1lf ms", Indents[3], _recorded_non_young_free_cset_time_ms);
   if (_cur_verify_after_time_ms > 0.0) {
-    print_stats(Indents[2], "Verify After", _cur_verify_after_time_ms);
+    debug_line("Verify After", _cur_verify_after_time_ms);
   }
 }
 
--- a/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,8 +32,6 @@
 template <class T> class WorkerDataArray;
 
 class G1GCPhaseTimes : public CHeapObj<mtGC> {
-  friend class G1GCParPhasePrinter;
-
   uint _active_gc_threads;
   uint _max_gc_threads;
   jlong _gc_start_counter;
@@ -69,6 +67,7 @@
     StringDedupQueueFixup,
     StringDedupTableFixup,
     RedirtyCards,
+    PreserveCMReferents,
     GCParPhasesSentinel
   };
 
@@ -108,6 +107,10 @@
 
   double _recorded_redirty_logged_cards_time_ms;
 
+  double _recorded_preserve_cm_referents_time_ms;
+
+  double _recorded_merge_pss_time_ms;
+
   double _recorded_young_free_cset_time_ms;
   double _recorded_non_young_free_cset_time_ms;
 
@@ -120,10 +123,13 @@
   double _cur_verify_before_time_ms;
   double _cur_verify_after_time_ms;
 
-  // Helper methods for detailed logging
-  void print_stats(const char*, const char* str, double value);
+  void note_gc_end();
 
-  void note_gc_end();
+  template <class T>
+  void details(T* phase, const char* indent);
+  void log_phase(WorkerDataArray<double>* phase, uint indent, outputStream* out, bool print_sum);
+  void debug_phase(WorkerDataArray<double>* phase);
+  void trace_phase(WorkerDataArray<double>* phase, bool print_sum = true);
 
  public:
   G1GCPhaseTimes(uint max_gc_threads);
@@ -143,16 +149,6 @@
 
   size_t sum_thread_work_items(GCParPhases phase);
 
- private:
-  double get_time_ms(GCParPhases phase, uint worker_i);
-  double sum_time_ms(GCParPhases phase);
-  double min_time_ms(GCParPhases phase);
-  double max_time_ms(GCParPhases phase);
-  size_t get_thread_work_item(GCParPhases phase, uint worker_i);
-  double average_thread_work_items(GCParPhases phase);
-  size_t min_thread_work_items(GCParPhases phase);
-  size_t max_thread_work_items(GCParPhases phase);
-
  public:
 
   void record_clear_ct_time(double ms) {
@@ -234,6 +230,14 @@
     _recorded_redirty_logged_cards_time_ms = time_ms;
   }
 
+  void record_preserve_cm_referents_time_ms(double time_ms) {
+    _recorded_preserve_cm_referents_time_ms = time_ms;
+  }
+
+  void record_merge_pss_time_ms(double time_ms) {
+    _recorded_merge_pss_time_ms = time_ms;
+  }
+
   void record_cur_collection_start_sec(double time_ms) {
     _cur_collection_start_sec = time_ms;
   }
@@ -250,8 +254,6 @@
     _external_accounted_time_ms += time_ms;
   }
 
-  double accounted_time_ms();
-
   double cur_collection_start_sec() {
     return _cur_collection_start_sec;
   }
--- a/hotspot/src/share/vm/gc/g1/g1HotCardCache.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1HotCardCache.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -81,10 +81,7 @@
 }
 
 void G1HotCardCache::drain(CardTableEntryClosure* cl, uint worker_i) {
-  if (!default_use_cache()) {
-    assert(_hot_cache == NULL, "Logic");
-    return;
-  }
+  assert(default_use_cache(), "Drain only necessary if we use the hot card cache.");
 
   assert(_hot_cache != NULL, "Logic");
   assert(!use_cache(), "cache should be disabled");
--- a/hotspot/src/share/vm/gc/g1/g1IHOPControl.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1IHOPControl.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,14 +47,16 @@
 
 void G1IHOPControl::print() {
   size_t cur_conc_mark_start_threshold = get_conc_mark_start_threshold();
-  log_debug(gc, ihop)("Basic information (value update), threshold: " SIZE_FORMAT "B (%1.2f), target occupancy: " SIZE_FORMAT "B, current occupancy: " SIZE_FORMAT "B,"
-                      " recent old gen allocation rate: %1.2f, recent marking phase length: %1.2f",
+  log_debug(gc, ihop)("Basic information (value update), threshold: " SIZE_FORMAT "B (%1.2f), target occupancy: " SIZE_FORMAT "B, current occupancy: " SIZE_FORMAT "B, "
+                      "recent allocation size: " SIZE_FORMAT "B, recent allocation duration: %1.2fms, recent old gen allocation rate: %1.2fB/s, recent marking phase length: %1.2fms",
                       cur_conc_mark_start_threshold,
                       cur_conc_mark_start_threshold * 100.0 / _target_occupancy,
                       _target_occupancy,
                       G1CollectedHeap::heap()->used(),
+                      _last_allocated_bytes,
+                      _last_allocation_time_s * 1000.0,
                       _last_allocation_time_s > 0.0 ? _last_allocated_bytes / _last_allocation_time_s : 0.0,
-                      last_marking_length_s());
+                      last_marking_length_s() * 1000.0);
 }
 
 void G1IHOPControl::send_trace_event(G1NewTracer* tracer) {
@@ -191,13 +193,16 @@
 void G1AdaptiveIHOPControl::print() {
   G1IHOPControl::print();
   size_t actual_target = actual_target_threshold();
-  log_debug(gc, ihop)("Adaptive IHOP information (value update), threshold: " SIZE_FORMAT "B (%1.2f), internal target occupancy: " SIZE_FORMAT "B,"
-                      " predicted old gen allocation rate: %1.2f, predicted marking phase length: %1.2f, prediction active: %s",
+  log_debug(gc, ihop)("Adaptive IHOP information (value update), threshold: " SIZE_FORMAT "B (%1.2f), internal target occupancy: " SIZE_FORMAT "B, "
+                      "occupancy: " SIZE_FORMAT "B, additional buffer size: " SIZE_FORMAT "B, predicted old gen allocation rate: %1.2fB/s, "
+                      "predicted marking phase length: %1.2fms, prediction active: %s",
                       get_conc_mark_start_threshold(),
                       percent_of(get_conc_mark_start_threshold(), actual_target),
                       actual_target,
+                      G1CollectedHeap::heap()->used(),
+                      _last_unrestrained_young_size,
                       _predictor->get_new_prediction(&_allocation_rate_s),
-                      _predictor->get_new_prediction(&_marking_times_s),
+                      _predictor->get_new_prediction(&_marking_times_s) * 1000.0,
                       have_enough_data_for_prediction() ? "true" : "false");
 }
 
--- a/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -327,6 +327,9 @@
 
 G1ParScanThreadState* G1ParScanThreadStateSet::state_for_worker(uint worker_id) {
   assert(worker_id < _n_workers, "out of bounds access");
+  if (_states[worker_id] == NULL) {
+    _states[worker_id] = new_par_scan_state(worker_id, _young_cset_length);
+  }
   return _states[worker_id];
 }
 
@@ -352,6 +355,10 @@
   for (uint worker_index = 0; worker_index < _n_workers; ++worker_index) {
     G1ParScanThreadState* pss = _states[worker_index];
 
+    if (pss == NULL) {
+      continue;
+    }
+
     _total_cards_scanned += _cards_scanned[worker_index];
 
     pss->flush(_surviving_young_words_total);
--- a/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -200,6 +200,7 @@
   size_t* _surviving_young_words_total;
   size_t* _cards_scanned;
   size_t _total_cards_scanned;
+  size_t _young_cset_length;
   uint _n_workers;
   bool _flushed;
 
@@ -210,10 +211,11 @@
       _surviving_young_words_total(NEW_C_HEAP_ARRAY(size_t, young_cset_length, mtGC)),
       _cards_scanned(NEW_C_HEAP_ARRAY(size_t, n_workers, mtGC)),
       _total_cards_scanned(0),
+      _young_cset_length(young_cset_length),
       _n_workers(n_workers),
       _flushed(false) {
     for (uint i = 0; i < n_workers; ++i) {
-      _states[i] = new_par_scan_state(i, young_cset_length);
+      _states[i] = NULL;
     }
     memset(_surviving_young_words_total, 0, young_cset_length * sizeof(size_t));
     memset(_cards_scanned, 0, n_workers * sizeof(size_t));
--- a/hotspot/src/share/vm/gc/g1/g1RemSet.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1RemSet.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -238,7 +238,7 @@
   RefineRecordRefsIntoCSCardTableEntryClosure into_cset_update_rs_cl(_g1, into_cset_dcq);
 
   G1GCParPhaseTimesTracker x(_g1p->phase_times(), G1GCPhaseTimes::UpdateRS, worker_i);
-  {
+  if (ConcurrentG1Refine::hot_card_cache_enabled()) {
     // Apply the closure to the entries of the hot card cache.
     G1GCParPhaseTimesTracker y(_g1p->phase_times(), G1GCPhaseTimes::ScanHCC, worker_i);
     _g1->iterate_hcc_closure(&into_cset_update_rs_cl, worker_i);
@@ -291,7 +291,6 @@
   _g1->cleanUpCardTable();
 
   DirtyCardQueueSet& into_cset_dcqs = _into_cset_dirty_card_queue_set;
-  int into_cset_n_buffers = into_cset_dcqs.completed_buffers_num();
 
   if (_g1->evacuation_failed()) {
     double restore_remembered_set_start = os::elapsedTime();
--- a/hotspot/src/share/vm/gc/g1/g1YoungRemSetSamplingThread.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1YoungRemSetSamplingThread.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -26,6 +26,8 @@
 #include "gc/g1/g1CollectedHeap.inline.hpp"
 #include "gc/g1/g1CollectorPolicy.hpp"
 #include "gc/g1/g1YoungRemSetSamplingThread.hpp"
+#include "gc/g1/heapRegion.inline.hpp"
+#include "gc/g1/heapRegionRemSet.hpp"
 #include "gc/g1/suspendibleThreadSet.hpp"
 #include "runtime/mutexLocker.hpp"
 
@@ -55,21 +57,21 @@
   }
 }
 
-G1YoungRemSetSamplingThread::G1YoungRemSetSamplingThread() : ConcurrentGCThread() {
-  _monitor = new Monitor(Mutex::nonleaf,
-                         "G1YoungRemSetSamplingThread monitor",
-                         true,
-                         Monitor::_safepoint_check_never);
-
+G1YoungRemSetSamplingThread::G1YoungRemSetSamplingThread() :
+    ConcurrentGCThread(),
+    _monitor(Mutex::nonleaf,
+             "G1YoungRemSetSamplingThread monitor",
+             true,
+             Monitor::_safepoint_check_never) {
   set_name("G1 Young RemSet Sampling");
   create_and_start();
 }
 
 void G1YoungRemSetSamplingThread::sleep_before_next_cycle() {
-  MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag);
+  MutexLockerEx x(&_monitor, Mutex::_no_safepoint_check_flag);
   if (!_should_terminate) {
-    intx waitms = G1ConcRefinementServiceIntervalMillis; // 300, really should be?
-    _monitor->wait(Mutex::_no_safepoint_check_flag, waitms);
+    uintx waitms = G1ConcRefinementServiceIntervalMillis; // 300, really should be?
+    _monitor.wait(Mutex::_no_safepoint_check_flag, waitms);
   }
 }
 
@@ -90,8 +92,8 @@
 }
 
 void G1YoungRemSetSamplingThread::stop_service() {
-  MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag);
-  _monitor->notify();
+  MutexLockerEx x(&_monitor, Mutex::_no_safepoint_check_flag);
+  _monitor.notify();
 }
 
 void G1YoungRemSetSamplingThread::sample_young_list_rs_lengths() {
@@ -100,22 +102,35 @@
   G1CollectorPolicy* g1p = g1h->g1_policy();
   if (g1p->adaptive_young_list_length()) {
     int regions_visited = 0;
-    g1h->young_list()->rs_length_sampling_init();
-    while (g1h->young_list()->rs_length_sampling_more()) {
-      g1h->young_list()->rs_length_sampling_next();
+    HeapRegion* hr = g1h->young_list()->first_region();
+    size_t sampled_rs_lengths = 0;
+
+    while (hr != NULL) {
+      size_t rs_length = hr->rem_set()->occupied();
+      sampled_rs_lengths += rs_length;
+
+      // The current region may not yet have been added to the
+      // incremental collection set (it gets added when it is
+      // retired as the current allocation region).
+      if (hr->in_collection_set()) {
+        // Update the collection set policy information for this region
+        g1p->update_incremental_cset_info(hr, rs_length);
+      }
+
       ++regions_visited;
 
       // we try to yield every time we visit 10 regions
       if (regions_visited == 10) {
         if (sts.should_yield()) {
           sts.yield();
-          // we just abandon the iteration
-          break;
+          // A gc may have occurred and our sampling data is stale and further
+          // traversal of the young list is unsafe
+          return;
         }
         regions_visited = 0;
       }
+      hr = hr->get_next_young_region();
     }
-
-    g1p->revise_young_list_target_length_if_necessary();
+    g1p->revise_young_list_target_length_if_necessary(sampled_rs_lengths);
   }
 }
--- a/hotspot/src/share/vm/gc/g1/g1YoungRemSetSamplingThread.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1YoungRemSetSamplingThread.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,7 +41,7 @@
 // increase the young gen size to keep pause time length goal.
 class G1YoungRemSetSamplingThread: public ConcurrentGCThread {
 private:
-  Monitor* _monitor;
+  Monitor _monitor;
 
   void sample_young_list_rs_lengths();
 
--- a/hotspot/src/share/vm/gc/g1/g1_globals.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1_globals.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -71,10 +71,6 @@
           "draining concurrent marking work queues.")                       \
           range(1, max_intx)                                                \
                                                                             \
-  experimental(bool, G1UseConcMarkReferenceProcessing, true,                \
-          "If true, enable reference discovery during concurrent "          \
-          "marking and reference processing at the end of remark.")         \
-                                                                            \
   experimental(double, G1LastPLABAverageOccupancy, 50.0,                    \
                "The expected average occupancy of the last PLAB in "        \
                "percent.")                                                  \
@@ -107,35 +103,35 @@
           "Size of an update buffer")                                       \
           range(1, NOT_LP64(32*M) LP64_ONLY(1*G))                           \
                                                                             \
-  product(intx, G1ConcRefinementYellowZone, 0,                              \
+  product(size_t, G1ConcRefinementYellowZone, 0,                            \
           "Number of enqueued update buffers that will "                    \
           "trigger concurrent processing. Will be selected ergonomically "  \
           "by default.")                                                    \
           range(0, max_intx)                                                \
                                                                             \
-  product(intx, G1ConcRefinementRedZone, 0,                                 \
+  product(size_t, G1ConcRefinementRedZone, 0,                               \
           "Maximum number of enqueued update buffers before mutator "       \
           "threads start processing new ones instead of enqueueing them. "  \
           "Will be selected ergonomically by default. Zero will disable "   \
           "concurrent processing.")                                         \
           range(0, max_intx)                                                \
                                                                             \
-  product(intx, G1ConcRefinementGreenZone, 0,                               \
+  product(size_t, G1ConcRefinementGreenZone, 0,                             \
           "The number of update buffers that are left in the queue by the " \
           "concurrent processing threads. Will be selected ergonomically "  \
           "by default.")                                                    \
           range(0, max_intx)                                                \
                                                                             \
-  product(intx, G1ConcRefinementServiceIntervalMillis, 300,                 \
+  product(uintx, G1ConcRefinementServiceIntervalMillis, 300,                \
           "The last concurrent refinement thread wakes up every "           \
           "specified number of milliseconds to do miscellaneous work.")     \
           range(0, max_jint)                                                \
                                                                             \
-  product(intx, G1ConcRefinementThresholdStep, 0,                           \
+  product(size_t, G1ConcRefinementThresholdStep, 0,                         \
           "Each time the rset update queue increases by this amount "       \
           "activate the next refinement thread if available. "              \
           "Will be selected ergonomically by default.")                     \
-          range(0, max_jint)                                                \
+          range(0, SIZE_MAX)                                                \
                                                                             \
   product(intx, G1RSetUpdatingPauseTimePercent, 10,                         \
           "A target percentage of time that is allowed to be spend on "     \
--- a/hotspot/src/share/vm/gc/g1/heapRegion.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/heapRegion.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -781,7 +781,9 @@
           ResourceMark rm;
           _containing_obj->print_on(log.error_stream());
           log.error("points to obj " PTR_FORMAT " in region " HR_FORMAT, p2i(obj), HR_FORMAT_PARAMS(to));
-          obj->print_on(log.error_stream());
+          if (obj->is_oop()) {
+            obj->print_on(log.error_stream());
+          }
           log.error("Obj head CTE = %d, field CTE = %d.", cv_obj, cv_field);
           log.error("----------");
           _failures = true;
--- a/hotspot/src/share/vm/gc/g1/ptrQueue.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/ptrQueue.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,8 @@
 #include "runtime/mutexLocker.hpp"
 #include "runtime/thread.inline.hpp"
 
+#include <new>
+
 PtrQueue::PtrQueue(PtrQueueSet* qset, bool permanent, bool active) :
   _qset(qset), _buf(NULL), _index(0), _sz(0), _active(active),
   _permanent(permanent), _lock(NULL)
@@ -87,6 +89,19 @@
 }
 
 
+BufferNode* BufferNode::allocate(size_t byte_size) {
+  assert(byte_size > 0, "precondition");
+  assert(is_size_aligned(byte_size, sizeof(void**)),
+         "Invalid buffer size " SIZE_FORMAT, byte_size);
+  void* data = NEW_C_HEAP_ARRAY(char, buffer_offset() + byte_size, mtGC);
+  return new (data) BufferNode;
+}
+
+void BufferNode::deallocate(BufferNode* node) {
+  node->~BufferNode();
+  FREE_C_HEAP_ARRAY(char, node);
+}
+
 PtrQueueSet::PtrQueueSet(bool notify_when_complete) :
   _max_completed_queue(0),
   _cbl_mon(NULL), _fl_lock(NULL),
@@ -123,17 +138,23 @@
 
 void** PtrQueueSet::allocate_buffer() {
   assert(_sz > 0, "Didn't set a buffer size.");
-  MutexLockerEx x(_fl_owner->_fl_lock, Mutex::_no_safepoint_check_flag);
-  if (_fl_owner->_buf_free_list != NULL) {
-    void** res = BufferNode::make_buffer_from_node(_fl_owner->_buf_free_list);
-    _fl_owner->_buf_free_list = _fl_owner->_buf_free_list->next();
-    _fl_owner->_buf_free_list_sz--;
-    return res;
+  BufferNode* node = NULL;
+  {
+    MutexLockerEx x(_fl_owner->_fl_lock, Mutex::_no_safepoint_check_flag);
+    node = _fl_owner->_buf_free_list;
+    if (node != NULL) {
+      _fl_owner->_buf_free_list = node->next();
+      _fl_owner->_buf_free_list_sz--;
+    }
+  }
+  if (node == NULL) {
+    node = BufferNode::allocate(_sz);
   } else {
-    // Allocate space for the BufferNode in front of the buffer.
-    char *b =  NEW_C_HEAP_ARRAY(char, _sz + BufferNode::aligned_size(), mtGC);
-    return BufferNode::make_buffer_from_block(b);
+    // Reinitialize buffer obtained from free list.
+    node->set_index(0);
+    node->set_next(NULL);
   }
+  return BufferNode::make_buffer_from_node(node);
 }
 
 void PtrQueueSet::deallocate_buffer(void** buf) {
@@ -150,13 +171,13 @@
   // For now we'll adopt the strategy of deleting half.
   MutexLockerEx x(_fl_lock, Mutex::_no_safepoint_check_flag);
   size_t n = _buf_free_list_sz / 2;
-  while (n > 0) {
-    assert(_buf_free_list != NULL, "_buf_free_list_sz must be wrong.");
-    void* b = BufferNode::make_block_from_node(_buf_free_list);
-    _buf_free_list = _buf_free_list->next();
-    FREE_C_HEAP_ARRAY(char, b);
-    _buf_free_list_sz --;
-    n--;
+  for (size_t i = 0; i < n; ++i) {
+    assert(_buf_free_list != NULL,
+           "_buf_free_list_sz is wrong: " SIZE_FORMAT, _buf_free_list_sz);
+    BufferNode* node = _buf_free_list;
+    _buf_free_list = node->next();
+    _buf_free_list_sz--;
+    BufferNode::deallocate(node);
   }
 }
 
@@ -236,8 +257,9 @@
 
 void PtrQueueSet::enqueue_complete_buffer(void** buf, size_t index) {
   MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag);
-  BufferNode* cbn = BufferNode::new_from_buffer(buf);
+  BufferNode* cbn = BufferNode::make_node_from_buffer(buf);
   cbn->set_index(index);
+  cbn->set_next(NULL);
   if (_completed_buffers_tail == NULL) {
     assert(_completed_buffers_head == NULL, "Well-formedness");
     _completed_buffers_head = cbn;
@@ -249,16 +271,17 @@
   _n_completed_buffers++;
 
   if (!_process_completed && _process_completed_threshold >= 0 &&
-      _n_completed_buffers >= _process_completed_threshold) {
+      _n_completed_buffers >= (size_t)_process_completed_threshold) {
     _process_completed = true;
-    if (_notify_when_complete)
+    if (_notify_when_complete) {
       _cbl_mon->notify();
+    }
   }
   DEBUG_ONLY(assert_completed_buffer_list_len_correct_locked());
 }
 
-int PtrQueueSet::completed_buffers_list_length() {
-  int n = 0;
+size_t PtrQueueSet::completed_buffers_list_length() {
+  size_t n = 0;
   BufferNode* cbn = _completed_buffers_head;
   while (cbn != NULL) {
     n++;
@@ -312,7 +335,8 @@
 
 void PtrQueueSet::notify_if_necessary() {
   MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag);
-  if (_n_completed_buffers >= _process_completed_threshold || _max_completed_queue == 0) {
+  assert(_process_completed_threshold >= 0, "_process_completed is negative");
+  if (_n_completed_buffers >= (size_t)_process_completed_threshold || _max_completed_queue == 0) {
     _process_completed = true;
     if (_notify_when_complete)
       _cbl_mon->notify();
--- a/hotspot/src/share/vm/gc/g1/ptrQueue.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/ptrQueue.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,9 +33,6 @@
 // the addresses of modified old-generation objects.  This type supports
 // this operation.
 
-// The definition of placement operator new(size_t, void*) in the <new>.
-#include <new>
-
 class PtrQueueSet;
 class PtrQueue VALUE_OBJ_CLASS_SPEC {
   friend class VMStructs;
@@ -168,42 +165,38 @@
 class BufferNode {
   size_t _index;
   BufferNode* _next;
+  void* _buffer[1];             // Pseudo flexible array member.
+
+  BufferNode() : _index(0), _next(NULL) { }
+  ~BufferNode() { }
+
+  static size_t buffer_offset() {
+    return offset_of(BufferNode, _buffer);
+  }
+
 public:
-  BufferNode() : _index(0), _next(NULL) { }
   BufferNode* next() const     { return _next;  }
   void set_next(BufferNode* n) { _next = n;     }
   size_t index() const         { return _index; }
   void set_index(size_t i)     { _index = i;    }
 
-  // Align the size of the structure to the size of the pointer
-  static size_t aligned_size() {
-    static const size_t alignment = round_to(sizeof(BufferNode), sizeof(void*));
-    return alignment;
-  }
+  // Allocate a new BufferNode with the "buffer" having size bytes.
+  static BufferNode* allocate(size_t byte_size);
 
-  // BufferNode is allocated before the buffer.
-  // The chunk of memory that holds both of them is a block.
+  // Free a BufferNode.
+  static void deallocate(BufferNode* node);
 
-  // Produce a new BufferNode given a buffer.
-  static BufferNode* new_from_buffer(void** buf) {
-    return new (make_block_from_buffer(buf)) BufferNode;
+  // Return the BufferNode containing the buffer.
+  static BufferNode* make_node_from_buffer(void** buffer) {
+    return reinterpret_cast<BufferNode*>(
+      reinterpret_cast<char*>(buffer) - buffer_offset());
   }
 
-  // The following are the required conversion routines:
-  static BufferNode* make_node_from_buffer(void** buf) {
-    return (BufferNode*)make_block_from_buffer(buf);
-  }
+  // Return the buffer for node.
   static void** make_buffer_from_node(BufferNode *node) {
-    return make_buffer_from_block(node);
-  }
-  static void* make_block_from_node(BufferNode *node) {
-    return (void*)node;
-  }
-  static void** make_buffer_from_block(void* p) {
-    return (void**)((char*)p + aligned_size());
-  }
-  static void* make_block_from_buffer(void** p) {
-    return (void*)((char*)p - aligned_size());
+    // &_buffer[0] might lead to index out of bounds warnings.
+    return reinterpret_cast<void**>(
+      reinterpret_cast<char*>(node) + buffer_offset());
   }
 };
 
@@ -216,7 +209,7 @@
   Monitor* _cbl_mon;  // Protects the fields below.
   BufferNode* _completed_buffers_head;
   BufferNode* _completed_buffers_tail;
-  int _n_completed_buffers;
+  size_t _n_completed_buffers;
   int _process_completed_threshold;
   volatile bool _process_completed;
 
@@ -240,9 +233,9 @@
   // Maximum number of elements allowed on completed queue: after that,
   // enqueuer does the work itself.  Zero indicates no maximum.
   int _max_completed_queue;
-  int _completed_queue_padding;
+  size_t _completed_queue_padding;
 
-  int completed_buffers_list_length();
+  size_t completed_buffers_list_length();
   void assert_completed_buffer_list_len_correct_locked();
   void assert_completed_buffer_list_len_correct();
 
@@ -306,15 +299,15 @@
   // list size may be reduced, if that is deemed desirable.
   void reduce_free_list();
 
-  int completed_buffers_num() { return _n_completed_buffers; }
+  size_t completed_buffers_num() { return _n_completed_buffers; }
 
   void merge_bufferlists(PtrQueueSet* src);
 
   void set_max_completed_queue(int m) { _max_completed_queue = m; }
   int max_completed_queue() { return _max_completed_queue; }
 
-  void set_completed_queue_padding(int padding) { _completed_queue_padding = padding; }
-  int completed_queue_padding() { return _completed_queue_padding; }
+  void set_completed_queue_padding(size_t padding) { _completed_queue_padding = padding; }
+  size_t completed_queue_padding() { return _completed_queue_padding; }
 
   // Notify the consumer if the number of buffers crossed the threshold
   void notify_if_necessary();
--- a/hotspot/src/share/vm/gc/g1/workerDataArray.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/workerDataArray.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -24,18 +24,53 @@
 
 #include "precompiled.hpp"
 #include "gc/g1/workerDataArray.inline.hpp"
+#include "utilities/ostream.hpp"
+
+template <>
+void WorkerDataArray<double>::WDAPrinter::summary(outputStream* out, const char* title, double min, double avg, double max, double diff, double sum, bool print_sum) {
+  out->print("%-25s Min: %4.1lf, Avg: %4.1lf, Max: %4.1lf, Diff: %4.1lf", title, min * MILLIUNITS, avg * MILLIUNITS, max * MILLIUNITS, diff* MILLIUNITS);
+  if (print_sum) {
+    out->print_cr(", Sum: %4.1lf", sum * MILLIUNITS);
+  } else {
+    out->cr();
+  }
+}
+
+template <>
+void WorkerDataArray<size_t>::WDAPrinter::summary(outputStream* out, const char* title, size_t min, double avg, size_t max, size_t diff, size_t sum, bool print_sum) {
+  out->print("%-25s Min: " SIZE_FORMAT ", Avg: %4.1lf, Max: " SIZE_FORMAT ", Diff: " SIZE_FORMAT, title, min, avg, max, diff);
+  if (print_sum) {
+    out->print_cr(", Sum: " SIZE_FORMAT, sum);
+  } else {
+    out->cr();
+  }
+}
+
+template <>
+void WorkerDataArray<double>::WDAPrinter::details(const WorkerDataArray<double>* phase, outputStream* out, uint active_threads) {
+  out->print("%-25s", "");
+  for (uint i = 0; i < active_threads; ++i) {
+    out->print(" %4.1lf", phase->get(i) * 1000.0);
+  }
+  out->cr();
+}
+
+template <>
+void WorkerDataArray<size_t>::WDAPrinter::details(const WorkerDataArray<size_t>* phase, outputStream* out, uint active_threads) {
+  out->print("%-25s", "");
+  for (uint i = 0; i < active_threads; ++i) {
+    out->print("  " SIZE_FORMAT, phase->get(i));
+  }
+  out->cr();
+}
 
 #ifndef PRODUCT
 void WorkerDataArray_test() {
   const uint length = 3;
   const char* title = "Test array";
-  const bool print_sum = false;
-  const uint indent_level = 2;
 
-  WorkerDataArray<size_t> array(length, title, print_sum, indent_level);
+  WorkerDataArray<size_t> array(length, title);
   assert(strncmp(array.title(), title, strlen(title)) == 0 , "Expected titles to match");
-  assert(array.should_print_sum() == print_sum, "Expected should_print_sum to match print_sum");
-  assert(array.indentation() == indent_level, "Expected indentation to match");
 
   const size_t expected[length] = {5, 3, 7};
   for (uint i = 0; i < length; i++) {
@@ -46,10 +81,7 @@
   }
 
   assert(array.sum(length) == (5 + 3 + 7), "Expected sums to match");
-  assert(array.minimum(length) == 3, "Expected mininum to match");
-  assert(array.maximum(length) == 7, "Expected maximum to match");
-  assert(array.diff(length) == (7 - 3), "Expected diffs to match");
-  assert(array.average(length) == 5, "Expected averages to match");
+  assert(array.average(length) == 5.0, "Expected averages to match");
 
   for (uint i = 0; i < length; i++) {
     array.add(i, 1);
--- a/hotspot/src/share/vm/gc/g1/workerDataArray.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/workerDataArray.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -22,18 +22,19 @@
  *
  */
 
+#ifndef SHARE_VM_GC_G1_WORKERDATAARRAY_HPP
+#define SHARE_VM_GC_G1_WORKERDATAARRAY_HPP
+
 #include "memory/allocation.hpp"
 #include "utilities/debug.hpp"
 
+class outputStream;
+
 template <class T>
 class WorkerDataArray  : public CHeapObj<mtGC> {
-  friend class G1GCParPhasePrinter;
   T*          _data;
   uint        _length;
   const char* _title;
-  bool        _print_sum;
-  uint        _indent_level;
-  bool        _enabled;
 
   WorkerDataArray<size_t>* _thread_work_items;
 
@@ -42,11 +43,7 @@
   void set_all(T value);
 
  public:
-  WorkerDataArray(uint length,
-                  const char* title,
-                  bool print_sum,
-                  uint indent_level);
-
+  WorkerDataArray(uint length, const char* title);
   ~WorkerDataArray();
 
   void link_thread_work_items(WorkerDataArray<size_t>* thread_work_items);
@@ -62,27 +59,30 @@
 
   double average(uint active_threads) const;
   T sum(uint active_threads) const;
-  T minimum(uint active_threads) const;
-  T maximum(uint active_threads) const;
-  T diff(uint active_threads) const;
-
-  uint indentation() const {
-    return _indent_level;
-  }
 
   const char* title() const {
     return _title;
   }
 
-  bool should_print_sum() const {
-    return _print_sum;
-  }
-
   void clear();
-  void set_enabled(bool enabled) {
-    _enabled = enabled;
-  }
 
   void reset() PRODUCT_RETURN;
   void verify(uint active_threads) const PRODUCT_RETURN;
+
+
+ private:
+  class WDAPrinter {
+  public:
+    static void summary(outputStream* out, const char* title, double min, double avg, double max, double diff, double sum, bool print_sum);
+    static void summary(outputStream* out, const char* title, size_t min, double avg, size_t max, size_t diff, size_t sum, bool print_sum);
+
+    static void details(const WorkerDataArray<double>* phase, outputStream* out, uint active_threads);
+    static void details(const WorkerDataArray<size_t>* phase, outputStream* out, uint active_threads);
+  };
+
+ public:
+  void print_summary_on(outputStream* out, uint active_threads, bool print_sum = true) const;
+  void print_details_on(outputStream* out, uint active_threads) const;
 };
+
+#endif // SHARE_VM_GC_G1_WORKERDATAARRAY_HPP
--- a/hotspot/src/share/vm/gc/g1/workerDataArray.inline.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/workerDataArray.inline.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -22,20 +22,18 @@
  *
  */
 
+#ifndef SHARE_VM_GC_G1_WORKERDATAARRAY_INLINE_HPP
+#define SHARE_VM_GC_G1_WORKERDATAARRAY_INLINE_HPP
+
 #include "gc/g1/workerDataArray.hpp"
 #include "memory/allocation.inline.hpp"
+#include "utilities/ostream.hpp"
 
 template <typename T>
-WorkerDataArray<T>::WorkerDataArray(uint length,
-                                    const char* title,
-                                    bool print_sum,
-                                    uint indent_level) :
+WorkerDataArray<T>::WorkerDataArray(uint length, const char* title) :
  _title(title),
  _length(0),
- _print_sum(print_sum),
- _indent_level(indent_level),
- _thread_work_items(NULL),
- _enabled(true) {
+ _thread_work_items(NULL) {
   assert(length > 0, "Must have some workers to store data for");
   _length = length;
   _data = NEW_C_HEAP_ARRAY(T, _length, mtGC);
@@ -94,29 +92,6 @@
 }
 
 template <typename T>
-T WorkerDataArray<T>::minimum(uint active_threads) const {
-  T min = get(0);
-  for (uint i = 1; i < active_threads; ++i) {
-    min = MIN2(min, get(i));
-  }
-  return min;
-}
-
-template <typename T>
-T WorkerDataArray<T>::maximum(uint active_threads) const {
-  T max = get(0);
-  for (uint i = 1; i < active_threads; ++i) {
-    max = MAX2(max, get(i));
-  }
-  return max;
-}
-
-template <typename T>
-T WorkerDataArray<T>::diff(uint active_threads) const {
-  return maximum(active_threads) - minimum(active_threads);
-}
-
-template <typename T>
 void WorkerDataArray<T>::clear() {
   set_all(0);
 }
@@ -128,6 +103,27 @@
   }
 }
 
+template <class T>
+void WorkerDataArray<T>::print_summary_on(outputStream* out, uint active_threads, bool print_sum) const {
+  T max = get(0);
+  T min = max;
+  T sum = 0;
+  for (uint i = 1; i < active_threads; ++i) {
+    T value = get(i);
+    max = MAX2(max, value);
+    min = MIN2(min, value);
+    sum += value;
+  }
+  T diff = max - min;
+  double avg = sum / (double) active_threads;
+  WDAPrinter::summary(out, title(), min, avg, max, diff, sum, print_sum);
+}
+
+template <class T>
+void WorkerDataArray<T>::print_details_on(outputStream* out, uint active_threads) const {
+  WDAPrinter::details(this, out, active_threads);
+}
+
 #ifndef PRODUCT
 template <typename T>
 void WorkerDataArray<T>::reset() {
@@ -139,10 +135,6 @@
 
 template <typename T>
 void WorkerDataArray<T>::verify(uint active_threads) const {
-  if (!_enabled) {
-    return;
-  }
-
   assert(active_threads <= _length, "Wrong number of active threads");
   for (uint i = 0; i < active_threads; i++) {
     assert(_data[i] != uninitialized(),
@@ -163,3 +155,5 @@
   return -1.0;
 }
 #endif
+
+#endif // SHARE_VM_GC_G1_WORKERDATAARRAY_INLINE_HPP
--- a/hotspot/src/share/vm/gc/g1/youngList.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/youngList.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -33,9 +33,9 @@
 #include "utilities/ostream.hpp"
 
 YoungList::YoungList(G1CollectedHeap* g1h) :
-    _g1h(g1h), _head(NULL), _length(0), _last_sampled_rs_lengths(0),
+    _g1h(g1h), _head(NULL), _length(0),
     _survivor_head(NULL), _survivor_tail(NULL), _survivor_length(0) {
-  guarantee(check_list_empty(false), "just making sure...");
+  guarantee(check_list_empty(), "just making sure...");
 }
 
 void YoungList::push_region(HeapRegion *hr) {
@@ -86,9 +86,7 @@
   _survivor_tail = NULL;
   _survivor_length = 0;
 
-  _last_sampled_rs_lengths = 0;
-
-  assert(check_list_empty(false), "just making sure...");
+  assert(check_list_empty(), "just making sure...");
 }
 
 bool YoungList::check_list_well_formed() {
@@ -119,17 +117,13 @@
   return ret;
 }
 
-bool YoungList::check_list_empty(bool check_sample) {
+bool YoungList::check_list_empty() {
   bool ret = true;
 
   if (_length != 0) {
     log_error(gc, verify)("### YOUNG LIST should have 0 length, not %u", _length);
     ret = false;
   }
-  if (check_sample && _last_sampled_rs_lengths != 0) {
-    log_error(gc, verify)("### YOUNG LIST has non-zero last sampled RS lengths");
-    ret = false;
-  }
   if (_head != NULL) {
     log_error(gc, verify)("### YOUNG LIST does not have a NULL head");
     ret = false;
@@ -142,38 +136,6 @@
 }
 
 void
-YoungList::rs_length_sampling_init() {
-  _sampled_rs_lengths = 0;
-  _curr               = _head;
-}
-
-bool
-YoungList::rs_length_sampling_more() {
-  return _curr != NULL;
-}
-
-void
-YoungList::rs_length_sampling_next() {
-  assert( _curr != NULL, "invariant" );
-  size_t rs_length = _curr->rem_set()->occupied();
-
-  _sampled_rs_lengths += rs_length;
-
-  // The current region may not yet have been added to the
-  // incremental collection set (it gets added when it is
-  // retired as the current allocation region).
-  if (_curr->in_collection_set()) {
-    // Update the collection set policy information for this region
-    _g1h->g1_policy()->update_incremental_cset_info(_curr, rs_length);
-  }
-
-  _curr = _curr->get_next_young_region();
-  if (_curr == NULL) {
-    _last_sampled_rs_lengths = _sampled_rs_lengths;
-  }
-}
-
-void
 YoungList::reset_auxilary_lists() {
   guarantee( is_empty(), "young list should be empty" );
   assert(check_list_well_formed(), "young list should be well formed");
--- a/hotspot/src/share/vm/gc/g1/youngList.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/youngList.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -37,14 +37,9 @@
   HeapRegion* _survivor_head;
   HeapRegion* _survivor_tail;
 
-  HeapRegion* _curr;
-
   uint        _length;
   uint        _survivor_length;
 
-  size_t      _last_sampled_rs_lengths;
-  size_t      _sampled_rs_lengths;
-
   void         empty_list(HeapRegion* list);
 
 public:
@@ -72,15 +67,6 @@
     return (size_t) survivor_length() * HeapRegion::GrainBytes;
   }
 
-  void rs_length_sampling_init();
-  bool rs_length_sampling_more();
-  void rs_length_sampling_next();
-
-  void reset_sampled_info() {
-    _last_sampled_rs_lengths =   0;
-  }
-  size_t sampled_rs_lengths() { return _last_sampled_rs_lengths; }
-
   // for development purposes
   void reset_auxilary_lists();
   void clear() { _head = NULL; _length = 0; }
@@ -97,7 +83,7 @@
 
   // debugging
   bool          check_list_well_formed();
-  bool          check_list_empty(bool check_sample = true);
+  bool          check_list_empty();
   void          print();
 };
 
--- a/hotspot/src/share/vm/gc/shared/collectedHeap.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/shared/collectedHeap.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -405,7 +405,9 @@
 oop CollectedHeap::new_store_pre_barrier(JavaThread* thread, oop new_obj) {
   // If a previous card-mark was deferred, flush it now.
   flush_deferred_store_barrier(thread);
-  if (can_elide_initializing_store_barrier(new_obj)) {
+  if (can_elide_initializing_store_barrier(new_obj) ||
+      new_obj->is_typeArray()) {
+    // Arrays of non-references don't need a pre-barrier.
     // The deferred_card_mark region should be empty
     // following the flush above.
     assert(thread->deferred_card_mark().is_empty(), "Error");
--- a/hotspot/src/share/vm/gc/shared/copyFailedInfo.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/shared/copyFailedInfo.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 #define SHARE_VM_GC_SHARED_COPYFAILEDINFO_HPP
 
 #include "runtime/thread.hpp"
+#include "trace/traceMacros.hpp"
 #include "utilities/globalDefinitions.hpp"
 
 class CopyFailedInfo : public CHeapObj<mtGC> {
@@ -63,26 +64,28 @@
 };
 
 class PromotionFailedInfo : public CopyFailedInfo {
-  OSThread* _thread;
+  traceid _thread_trace_id;
 
  public:
-  PromotionFailedInfo() : CopyFailedInfo(), _thread(NULL) {}
+  PromotionFailedInfo() : CopyFailedInfo(), _thread_trace_id(0) {}
 
   void register_copy_failure(size_t size) {
     CopyFailedInfo::register_copy_failure(size);
-    if (_thread == NULL) {
-      _thread = Thread::current()->osthread();
+    if (_thread_trace_id == 0) {
+      _thread_trace_id = THREAD_TRACE_ID(Thread::current());
     } else {
-      assert(_thread == Thread::current()->osthread(), "The PromotionFailedInfo should be thread local.");
+      assert(THREAD_TRACE_ID(Thread::current()) == _thread_trace_id,
+        "The PromotionFailedInfo should be thread local.");
     }
   }
 
   void reset() {
     CopyFailedInfo::reset();
-    _thread = NULL;
+    _thread_trace_id = 0;
   }
 
-  OSThread* thread() const { return _thread; }
+  traceid thread_trace_id() const { return _thread_trace_id; }
+
 };
 
 class EvacuationFailedInfo : public CopyFailedInfo {};
--- a/hotspot/src/share/vm/gc/shared/gcTraceSend.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/shared/gcTraceSend.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -174,7 +174,7 @@
   if (e.should_commit()) {
     e.set_gcId(GCId::current());
     e.set_data(to_trace_struct(pf_info));
-    e.set_thread(pf_info.thread()->thread_id());
+    e.set_thread(pf_info.thread_trace_id());
     e.commit();
   }
 }
--- a/hotspot/src/share/vm/gc/shared/plab.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/shared/plab.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -110,6 +110,30 @@
   }
 }
 
+void PLABStats::log_plab_allocation() {
+  log_debug(gc, plab)("%s PLAB allocation: "
+                      "allocated: " SIZE_FORMAT "B, "
+                      "wasted: " SIZE_FORMAT "B, "
+                      "unused: " SIZE_FORMAT "B, "
+                      "used: " SIZE_FORMAT "B, "
+                      "undo waste: " SIZE_FORMAT "B, ",
+                      _description,
+                      _allocated * HeapWordSize,
+                      _wasted * HeapWordSize,
+                      _unused * HeapWordSize,
+                      used() * HeapWordSize,
+                      _undo_wasted * HeapWordSize);
+}
+
+void PLABStats::log_sizing(size_t calculated_words, size_t net_desired_words) {
+  log_debug(gc, plab)("%s sizing: "
+                      "calculated: " SIZE_FORMAT "B, "
+                      "actual: " SIZE_FORMAT "B",
+                      _description,
+                      calculated_words * HeapWordSize,
+                      net_desired_words * HeapWordSize);
+}
+
 // Calculates plab size for current number of gc worker threads.
 size_t PLABStats::desired_plab_sz(uint no_of_gc_workers) {
   return MAX2(min_size(), (size_t)align_object_size(_desired_net_plab_sz / no_of_gc_workers));
@@ -119,7 +143,13 @@
 // use. This should be called once at the end of parallel
 // scavenge; it clears the sensor accumulators.
 void PLABStats::adjust_desired_plab_sz() {
-  assert(ResizePLAB, "Not set");
+  log_plab_allocation();
+
+  if (!ResizePLAB) {
+    // Clear accumulators for next round.
+    reset();
+    return;
+  }
 
   assert(is_object_aligned(max_size()) && min_size() <= max_size(),
          "PLAB clipping computation may be incorrect");
@@ -150,8 +180,9 @@
   new_plab_sz = MIN2(max_size(), new_plab_sz);
   new_plab_sz = align_object_size(new_plab_sz);
   // Latch the result
-  log_trace(gc, plab)("plab_size = " SIZE_FORMAT " desired_net_plab_sz = " SIZE_FORMAT ") ", recent_plab_sz, new_plab_sz);
   _desired_net_plab_sz = new_plab_sz;
 
+  log_sizing(recent_plab_sz, new_plab_sz);
+
   reset();
 }
--- a/hotspot/src/share/vm/gc/shared/plab.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/gc/shared/plab.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -146,6 +146,8 @@
 // PLAB book-keeping.
 class PLABStats : public CHeapObj<mtGC> {
  protected:
+  const char* _description;   // Identifying string.
+
   size_t _allocated;          // Total allocated
   size_t _wasted;             // of which wasted (internal fragmentation)
   size_t _undo_wasted;        // of which wasted on undo (is not used for calculation of PLAB size)
@@ -160,8 +162,12 @@
     _undo_wasted = 0;
     _unused      = 0;
   }
+
+  virtual void log_plab_allocation();
+  virtual void log_sizing(size_t calculated, size_t net_desired);
  public:
-  PLABStats(size_t desired_net_plab_sz_, unsigned wt) :
+  PLABStats(const char* description, size_t desired_net_plab_sz_, unsigned wt) :
+    _description(description),
     _allocated(0),
     _wasted(0),
     _undo_wasted(0),
@@ -172,6 +178,12 @@
 
   virtual ~PLABStats() { }
 
+  size_t allocated() const { return _allocated; }
+  size_t wasted() const { return _wasted; }
+  size_t unused() const { return _unused; }
+  size_t used() const { return allocated() - (wasted() + unused()); }
+  size_t undo_wasted() const { return _undo_wasted; }
+
   static const size_t min_size() {
     return PLAB::min_size();
   }
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -762,14 +762,6 @@
   ConstantPoolCacheEntry* cp_cache_entry = cache_entry(thread);
   if (cp_cache_entry->is_resolved(bytecode)) return;
 
-  if (bytecode == Bytecodes::_invokeinterface) {
-    if (log_develop_is_enabled(Trace, itables)) {
-      ResourceMark rm(thread);
-      log_develop_trace(itables)("Resolving: klass: %s to method: %s",
-                                 info.resolved_klass()->name()->as_C_string(),
-                                 info.resolved_method()->name()->as_C_string());
-    }
-  }
 #ifdef ASSERT
   if (bytecode == Bytecodes::_invokeinterface) {
     if (info.resolved_method()->method_holder() ==
--- a/hotspot/src/share/vm/logging/logPrefix.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/logging/logPrefix.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -58,6 +58,7 @@
   LOG_PREFIX(GCId::print_prefix, LOG_TAGS(gc, metaspace)) \
   LOG_PREFIX(GCId::print_prefix, LOG_TAGS(gc, phases)) \
   LOG_PREFIX(GCId::print_prefix, LOG_TAGS(gc, phases, start)) \
+  LOG_PREFIX(GCId::print_prefix, LOG_TAGS(gc, phases, task)) \
   LOG_PREFIX(GCId::print_prefix, LOG_TAGS(gc, plab)) \
   LOG_PREFIX(GCId::print_prefix, LOG_TAGS(gc, region)) \
   LOG_PREFIX(GCId::print_prefix, LOG_TAGS(gc, remset)) \
--- a/hotspot/src/share/vm/logging/logTag.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/logging/logTag.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -43,6 +43,7 @@
   LOG_TAG(classload) /* Trace all classes loaded */ \
   LOG_TAG(classloaderdata) /* class loader loader_data lifetime */ \
   LOG_TAG(classunload) /* Trace unloading of classes */ \
+  LOG_TAG(classpath) \
   LOG_TAG(compaction) \
   LOG_TAG(cpu) \
   LOG_TAG(cset) \
@@ -66,6 +67,7 @@
   LOG_TAG(phases) \
   LOG_TAG(plab) \
   LOG_TAG(promotion) \
+  LOG_TAG(protectiondomain) /* "Trace protection domain verification" */ \
   LOG_TAG(ref) \
   LOG_TAG(refine) \
   LOG_TAG(region) \
@@ -81,6 +83,7 @@
   LOG_TAG(survivor) \
   LOG_TAG(sweep) \
   LOG_TAG(task) \
+  LOG_TAG(thread) \
   LOG_TAG(tlab) \
   LOG_TAG(time) \
   LOG_TAG(verify) \
--- a/hotspot/src/share/vm/memory/filemap.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/memory/filemap.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -208,9 +208,7 @@
         count ++;
         bytes += (int)entry_size;
         bytes += name_bytes;
-        if (TraceClassPaths) {
-          tty->print_cr("[Add main shared path (%s) %s]", (cpe->is_jar_file() ? "jar" : "dir"), name);
-        }
+        log_info(classpath)("add main shared path (%s) %s", (cpe->is_jar_file() ? "jar" : "dir"), name);
       } else {
         SharedClassPathEntry* ent = shared_classpath(cur_entry);
         if (cpe->is_jar_file()) {
@@ -275,9 +273,7 @@
     struct stat st;
     const char* name = ent->_name;
     bool ok = true;
-    if (TraceClassPaths) {
-      tty->print_cr("[Checking shared classpath entry: %s]", name);
-    }
+    log_info(classpath)("checking shared classpath entry: %s", name);
     if (os::stat(name, &st) != 0) {
       fail_continue("Required classpath entry does not exist: %s", name);
       ok = false;
@@ -301,9 +297,7 @@
       }
     }
     if (ok) {
-      if (TraceClassPaths) {
-        tty->print_cr("[ok]");
-      }
+      log_info(classpath)("ok");
     } else if (!PrintSharedArchiveAndExit) {
       _validating_classpath_entry_table = false;
       return false;
@@ -888,10 +882,8 @@
   char header_version[JVM_IDENT_MAX];
   get_header_version(header_version);
   if (strncmp(_jvm_ident, header_version, JVM_IDENT_MAX-1) != 0) {
-    if (TraceClassPaths) {
-      tty->print_cr("Expected: %s", header_version);
-      tty->print_cr("Actual:   %s", _jvm_ident);
-    }
+    log_info(classpath)("expected: %s", header_version);
+    log_info(classpath)("actual:   %s", _jvm_ident);
     FileMapInfo::fail_continue("The shared archive file was created by a different"
                   " version or build of HotSpot");
     return false;
@@ -919,7 +911,7 @@
   if (status) {
     if (!ClassLoader::check_shared_paths_misc_info(_paths_misc_info, _header->_paths_misc_info_size)) {
       if (!PrintSharedArchiveAndExit) {
-        fail_continue("shared class paths mismatch (hint: enable -XX:+TraceClassPaths to diagnose the failure)");
+        fail_continue("shared class paths mismatch (hint: enable -Xlog:classpath=info to diagnose the failure)");
         status = false;
       }
     }
--- a/hotspot/src/share/vm/oops/arrayKlass.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/oops/arrayKlass.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -89,7 +89,7 @@
     set_super(Universe::is_bootstrapping() ? (Klass*)NULL : SystemDictionary::Object_klass());
     set_layout_helper(Klass::_lh_neutral_value);
     set_is_cloneable(); // All arrays are considered to be cloneable (See JLS 20.1.5)
-    TRACE_INIT_ID(this);
+    TRACE_INIT_KLASS_ID(this);
 }
 
 
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -839,7 +839,7 @@
 
   // support for stub routines
   static ByteSize init_state_offset()  { return in_ByteSize(offset_of(InstanceKlass, _init_state)); }
-  TRACE_DEFINE_OFFSET;
+  TRACE_DEFINE_KLASS_TRACE_ID_OFFSET;
   static ByteSize init_thread_offset() { return in_ByteSize(offset_of(InstanceKlass, _init_thread)); }
 
   // subclass/subinterface checks
--- a/hotspot/src/share/vm/oops/klass.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/oops/klass.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -494,7 +494,7 @@
 }
 
 void Klass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) {
-  TRACE_INIT_ID(this);
+  TRACE_INIT_KLASS_ID(this);
   // If an exception happened during CDS restore, some of these fields may already be
   // set.  We leave the class on the CLD list, even if incomplete so that we don't
   // modify the CLD list outside a safepoint.
--- a/hotspot/src/share/vm/oops/klass.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/oops/klass.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -132,7 +132,7 @@
   jint        _modifier_flags;  // Processed access flags, for use by Class.getModifiers.
   AccessFlags _access_flags;    // Access flags. The class/interface distinction is stored here.
 
-  TRACE_DEFINE_KLASS_TRACE_ID;
+  TRACE_DEFINE_TRACE_ID_FIELD;
 
   // Biased locking implementation and statistics
   // (the 64-bit chunk goes first, to avoid some fragmentation)
@@ -569,7 +569,7 @@
   jlong last_biased_lock_bulk_revocation_time() { return _last_biased_lock_bulk_revocation_time; }
   void  set_last_biased_lock_bulk_revocation_time(jlong cur_time) { _last_biased_lock_bulk_revocation_time = cur_time; }
 
-  TRACE_DEFINE_KLASS_METHODS;
+  TRACE_DEFINE_TRACE_ID_METHODS;
 
   // garbage collection support
   void oops_do(OopClosure* cl);
--- a/hotspot/src/share/vm/oops/typeArrayOop.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/oops/typeArrayOop.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -129,7 +129,7 @@
   Metadata* metadata_at(int which) const {
     return (Metadata*)*long_at_addr(which); }
   void metadata_at_put(int which, Metadata* contents) {
-    *long_at_addr(which) = (long)contents;
+    *long_at_addr(which) = (jlong)contents;
   }
 #else
   Metadata* metadata_at(int which) const {
--- a/hotspot/src/share/vm/opto/c2compiler.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/opto/c2compiler.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -493,8 +493,6 @@
   case vmIntrinsics::_currentThread:
   case vmIntrinsics::_isInterrupted:
 #ifdef TRACE_HAVE_INTRINSICS
-  case vmIntrinsics::_classID:
-  case vmIntrinsics::_threadID:
   case vmIntrinsics::_counterTime:
 #endif
   case vmIntrinsics::_currentTimeMillis:
--- a/hotspot/src/share/vm/opto/library_call.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -50,7 +50,9 @@
 #include "prims/nativeLookup.hpp"
 #include "prims/unsafe.hpp"
 #include "runtime/sharedRuntime.hpp"
+#ifdef TRACE_HAVE_INTRINSICS
 #include "trace/traceMacros.hpp"
+#endif
 
 class LibraryIntrinsic : public InlineCallGenerator {
   // Extend the set of intrinsics known to the runtime:
@@ -250,10 +252,7 @@
   bool inline_unsafe_newArray(bool uninitialized);
   bool inline_unsafe_copyMemory();
   bool inline_native_currentThread();
-#ifdef TRACE_HAVE_INTRINSICS
-  bool inline_native_classID();
-  bool inline_native_threadID();
-#endif
+
   bool inline_native_time_funcs(address method, const char* funcName);
   bool inline_native_isInterrupted();
   bool inline_native_Class_query(vmIntrinsics::ID id);
@@ -706,8 +705,6 @@
   case vmIntrinsics::_isInterrupted:            return inline_native_isInterrupted();
 
 #ifdef TRACE_HAVE_INTRINSICS
-  case vmIntrinsics::_classID:                  return inline_native_classID();
-  case vmIntrinsics::_threadID:                 return inline_native_threadID();
   case vmIntrinsics::_counterTime:              return inline_native_time_funcs(CAST_FROM_FN_PTR(address, TRACE_TIME_METHOD), "counterTime");
 #endif
   case vmIntrinsics::_currentTimeMillis:        return inline_native_time_funcs(CAST_FROM_FN_PTR(address, os::javaTimeMillis), "currentTimeMillis");
@@ -3183,52 +3180,6 @@
   return true;
 }
 
-#ifdef TRACE_HAVE_INTRINSICS
-/*
- * oop -> myklass
- * myklass->trace_id |= USED
- * return myklass->trace_id & ~0x3
- */
-bool LibraryCallKit::inline_native_classID() {
-  null_check_receiver();  // null-check, then ignore
-  Node* cls = null_check(argument(1), T_OBJECT);
-  Node* kls = load_klass_from_mirror(cls, false, NULL, 0);
-  kls = null_check(kls, T_OBJECT);
-  ByteSize offset = TRACE_ID_OFFSET;
-  Node* insp = basic_plus_adr(kls, in_bytes(offset));
-  Node* tvalue = make_load(NULL, insp, TypeLong::LONG, T_LONG, MemNode::unordered);
-  Node* bits = longcon(~0x03l); // ignore bit 0 & 1
-  Node* andl = _gvn.transform(new AndLNode(tvalue, bits));
-  Node* clsused = longcon(0x01l); // set the class bit
-  Node* orl = _gvn.transform(new OrLNode(tvalue, clsused));
-
-  const TypePtr *adr_type = _gvn.type(insp)->isa_ptr();
-  store_to_memory(control(), insp, orl, T_LONG, adr_type, MemNode::unordered);
-  set_result(andl);
-  return true;
-}
-
-bool LibraryCallKit::inline_native_threadID() {
-  Node* tls_ptr = NULL;
-  Node* cur_thr = generate_current_thread(tls_ptr);
-  Node* p = basic_plus_adr(top()/*!oop*/, tls_ptr, in_bytes(JavaThread::osthread_offset()));
-  Node* osthread = make_load(NULL, p, TypeRawPtr::NOTNULL, T_ADDRESS, MemNode::unordered);
-  p = basic_plus_adr(top()/*!oop*/, osthread, in_bytes(OSThread::thread_id_offset()));
-
-  Node* threadid = NULL;
-  size_t thread_id_size = OSThread::thread_id_size();
-  if (thread_id_size == (size_t) BytesPerLong) {
-    threadid = ConvL2I(make_load(control(), p, TypeLong::LONG, T_LONG, MemNode::unordered));
-  } else if (thread_id_size == (size_t) BytesPerInt) {
-    threadid = make_load(control(), p, TypeInt::INT, T_INT, MemNode::unordered);
-  } else {
-    ShouldNotReachHere();
-  }
-  set_result(threadid);
-  return true;
-}
-#endif
-
 //------------------------inline_native_time_funcs--------------
 // inline code for System.currentTimeMillis() and System.nanoTime()
 // these have the same type and signature
--- a/hotspot/src/share/vm/prims/jni.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/prims/jni.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -73,6 +73,7 @@
 #include "runtime/vm_operations.hpp"
 #include "services/memTracker.hpp"
 #include "services/runtimeService.hpp"
+#include "trace/traceMacros.hpp"
 #include "trace/tracing.hpp"
 #include "utilities/defaultStream.hpp"
 #include "utilities/dtrace.hpp"
@@ -88,7 +89,7 @@
 #include "jvmci/jvmciRuntime.hpp"
 #endif
 
-static jint CurrentVersion = JNI_VERSION_1_8;
+static jint CurrentVersion = JNI_VERSION_9;
 
 #ifdef _WIN32
 extern LONG WINAPI topLevelExceptionFilter(_EXCEPTION_POINTERS* );
@@ -3929,7 +3930,7 @@
 
     EventThreadStart event;
     if (event.should_commit()) {
-      event.set_javalangthread(java_lang_Thread::thread_id(thread->threadObj()));
+      event.set_thread(THREAD_TRACE_ID(thread));
       event.commit();
     }
 
@@ -4149,7 +4150,7 @@
 
   EventThreadStart event;
   if (event.should_commit()) {
-    event.set_javalangthread(java_lang_Thread::thread_id(thread->threadObj()));
+    event.set_thread(THREAD_TRACE_ID(thread));
     event.commit();
   }
 
--- a/hotspot/src/share/vm/prims/jni.h	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/prims/jni.h	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1952,6 +1952,7 @@
 #define JNI_VERSION_1_4 0x00010004
 #define JNI_VERSION_1_6 0x00010006
 #define JNI_VERSION_1_8 0x00010008
+#define JNI_VERSION_9   0x00090000
 
 #ifdef __cplusplus
 } /* extern "C" */
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -3940,6 +3940,10 @@
   scratch_class->set_methods(_old_methods);     // To prevent potential GCing of the old methods,
                                           // and to be able to undo operation easily.
 
+  Array<int>* old_ordering = the_class->method_ordering();
+  the_class->set_method_ordering(scratch_class->method_ordering());
+  scratch_class->set_method_ordering(old_ordering);
+
   ConstantPool* old_constants = the_class->constants();
   the_class->set_constants(scratch_class->constants());
   scratch_class->set_constants(old_constants);  // See the previous comment.
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -372,6 +372,7 @@
   { "PreInflateSpin",                JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
   { "JNIDetachReleasesMonitors",     JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
   { "UseAltSigs",                    JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
+  { "SegmentedHeapDumpThreshold",    JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
 
 #ifdef TEST_VERIFY_SPECIAL_JVM_FLAGS
   { "dep > obs",                    JDK_Version::jdk(9), JDK_Version::jdk(8), JDK_Version::undefined() },
@@ -405,8 +406,9 @@
 
 static AliasedLoggingFlag const aliased_logging_flags[] = {
   { "TraceClassLoading",         LogLevel::Info,  true,  LogTag::_classload },
+  { "TraceClassPaths",           LogLevel::Info,  true,  LogTag::_classpath },
+  { "TraceClassResolution",      LogLevel::Info,  true,  LogTag::_classresolve },
   { "TraceClassUnloading",       LogLevel::Info,  true,  LogTag::_classunload },
-  { "TraceClassResolution",      LogLevel::Info,  true,  LogTag::_classresolve },
   { "TraceExceptions",           LogLevel::Info,  true,  LogTag::_exceptions },
   { "TraceMonitorInflation",     LogLevel::Debug, true,  LogTag::_monitorinflation },
   { "TraceBiasedLocking",        LogLevel::Info,  true,  LogTag::_biasedlocking },
@@ -3271,7 +3273,7 @@
 
   // PrintSharedArchiveAndExit will turn on
   //   -Xshare:on
-  //   -XX:+TraceClassPaths
+  //   -Xlog:classpath=info
   if (PrintSharedArchiveAndExit) {
     if (FLAG_SET_CMDLINE(bool, UseSharedSpaces, true) != Flag::SUCCESS) {
       return JNI_EINVAL;
@@ -3279,9 +3281,7 @@
     if (FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true) != Flag::SUCCESS) {
       return JNI_EINVAL;
     }
-    if (FLAG_SET_CMDLINE(bool, TraceClassPaths, true) != Flag::SUCCESS) {
-      return JNI_EINVAL;
-    }
+    LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(classpath));
   }
 
   // Change the default value for flags  which have different default values
@@ -3334,10 +3334,6 @@
     _java_class_path->set_value(copy);
     FreeHeap(copy); // a copy was made by set_value, so don't need this anymore
   }
-
-  if (!PrintSharedArchiveAndExit) {
-    ClassLoader::trace_class_path(tty, "[classpath: ", _java_class_path->value());
-  }
 }
 
 static bool has_jar_files(const char* directory) {
--- a/hotspot/src/share/vm/runtime/fprofiler.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/runtime/fprofiler.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -836,8 +836,7 @@
     vm_thread_profiler->inc_thread_ticks();
 
     // Get a snapshot of a current VMThread pc (and leave it running!)
-    // The call may fail if, for instance the VM thread is interrupted while
-    // holding the Interrupt_lock or for other reasons.
+    // The call may fail in some circumstances
     epc = os::get_thread_pc(VMThread::vm_thread());
     if(epc.pc() != NULL) {
       if (os::dll_address_to_function_name(epc.pc(), buf, sizeof(buf), NULL)) {
--- a/hotspot/src/share/vm/runtime/globals.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1055,10 +1055,6 @@
           "directory) of the dump file (defaults to java_pid<pid>.hprof "   \
           "in the working directory)")                                      \
                                                                             \
-  develop(size_t, SegmentedHeapDumpThreshold, 2*G,                          \
-          "Generate a segmented heap dump (JAVA PROFILE 1.0.2 format) "     \
-          "when the heap usage is larger than this")                        \
-                                                                            \
   develop(size_t, HeapDumpSegmentSize, 1*G,                                 \
           "Approximate segment size when generating a segmented heap dump") \
                                                                             \
@@ -1437,9 +1433,6 @@
   product(bool, VerifyMergedCPBytecodes, true,                              \
           "Verify bytecodes after RedefineClasses constant pool merging")   \
                                                                             \
-  develop(bool, TraceJNIHandleAllocation, false,                            \
-          "Trace allocation/deallocation of JNI handle blocks")             \
-                                                                            \
   develop(bool, TraceBytecodes, false,                                      \
           "Trace bytecode execution")                                       \
                                                                             \
@@ -1482,9 +1475,6 @@
   develop(bool, TraceCompiledIC, false,                                     \
           "Trace changes of compiled IC")                                   \
                                                                             \
-  develop(bool, TraceProtectionDomainVerification, false,                   \
-          "Trace protection domain verification")                           \
-                                                                            \
   develop(bool, TraceClearedExceptions, false,                              \
           "Print when an exception is forcibly cleared")                    \
                                                                             \
@@ -2403,9 +2393,6 @@
   product(bool, IgnoreEmptyClassPaths, false,                               \
           "Ignore empty path elements in -classpath")                       \
                                                                             \
-  product(bool, TraceClassPaths, false,                                     \
-          "Trace processing of class paths")                                \
-                                                                            \
   product(bool, TraceClassLoadingPreorder, false,                           \
           "Trace all classes loaded in order referenced (not loaded)")      \
                                                                             \
--- a/hotspot/src/share/vm/runtime/java.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/runtime/java.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -64,6 +64,7 @@
 #include "runtime/timer.hpp"
 #include "runtime/vm_operations.hpp"
 #include "services/memTracker.hpp"
+#include "trace/traceMacros.hpp"
 #include "trace/tracing.hpp"
 #include "utilities/dtrace.hpp"
 #include "utilities/globalDefinitions.hpp"
@@ -485,7 +486,7 @@
 
   EventThreadEnd event;
   if (event.should_commit()) {
-      event.set_javalangthread(java_lang_Thread::thread_id(thread->threadObj()));
+      event.set_thread(THREAD_TRACE_ID(thread));
       event.commit();
   }
 
--- a/hotspot/src/share/vm/runtime/jniHandles.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/runtime/jniHandles.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -278,10 +278,6 @@
       // Allocate new block
       block = new JNIHandleBlock();
       _blocks_allocated++;
-      if (TraceJNIHandleAllocation) {
-        tty->print_cr("JNIHandleBlock " INTPTR_FORMAT " allocated (%d total blocks)",
-                      p2i(block), _blocks_allocated);
-      }
       if (ZapJNIHandleArea) block->zap();
       #ifndef PRODUCT
       // Link new block to list of all allocated blocks
@@ -499,10 +495,6 @@
     // Not as many free handles as we would like - compute number of new blocks to append
     _allocate_before_rebuild = (extra + block_size_in_oops - 1) / block_size_in_oops;
   }
-  if (TraceJNIHandleAllocation) {
-    tty->print_cr("Rebuild free list JNIHandleBlock " INTPTR_FORMAT " blocks=%d used=%d free=%d add=%d",
-                  p2i(this), blocks, total-free, free, _allocate_before_rebuild);
-  }
 }
 
 
--- a/hotspot/src/share/vm/runtime/mutex.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/runtime/mutex.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1320,15 +1320,12 @@
     // The rank Mutex::native  is an exception in that it is not subject
     // to the verification rules.
     // Here are some further notes relating to mutex acquisition anomalies:
-    // . under Solaris, the interrupt lock gets acquired when doing
-    //   profiling, so any lock could be held.
     // . it is also ok to acquire Safepoint_lock at the very end while we
     //   already hold Terminator_lock - may happen because of periodic safepoints
     if (this->rank() != Mutex::native &&
         this->rank() != Mutex::suspend_resume &&
         locks != NULL && locks->rank() <= this->rank() &&
         !SafepointSynchronize::is_at_safepoint() &&
-        this != Interrupt_lock && this != ProfileVM_lock &&
         !(this == Safepoint_lock && contains(locks, Terminator_lock) &&
         SafepointSynchronize::is_synchronizing())) {
       new_owner->print_owned_locks();
--- a/hotspot/src/share/vm/runtime/mutexLocker.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/runtime/mutexLocker.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,6 @@
 Mutex*   JfieldIdCreation_lock        = NULL;
 Monitor* JNICritical_lock             = NULL;
 Mutex*   JvmtiThreadState_lock        = NULL;
-Monitor* JvmtiPendingEvent_lock       = NULL;
 Monitor* Heap_lock                    = NULL;
 Mutex*   ExpandHeap_lock              = NULL;
 Mutex*   AdapterHandlerLibrary_lock   = NULL;
@@ -73,8 +72,6 @@
 Monitor* STS_lock                     = NULL;
 Monitor* SLT_lock                     = NULL;
 Monitor* FullGCCount_lock             = NULL;
-Monitor* CMark_lock                   = NULL;
-Mutex*   CMRegionStack_lock           = NULL;
 Mutex*   SATB_Q_FL_lock               = NULL;
 Monitor* SATB_Q_CBL_mon               = NULL;
 Mutex*   Shared_SATB_Q_lock           = NULL;
@@ -94,11 +91,8 @@
 Monitor* Terminator_lock              = NULL;
 Monitor* BeforeExit_lock              = NULL;
 Monitor* Notify_lock                  = NULL;
-Monitor* Interrupt_lock               = NULL;
-Monitor* ProfileVM_lock               = NULL;
 Mutex*   ProfilePrint_lock            = NULL;
 Mutex*   ExceptionCache_lock          = NULL;
-Monitor* ObjAllocPost_lock            = NULL;
 Mutex*   OsrList_lock                 = NULL;
 
 #ifndef PRODUCT
@@ -184,8 +178,6 @@
   }
   if (UseG1GC) {
 
-    def(CMark_lock                 , Monitor, nonleaf,     true,  Monitor::_safepoint_check_never);      // coordinate concurrent mark thread
-    def(CMRegionStack_lock         , Mutex,   leaf,        true,  Monitor::_safepoint_check_never);
     def(SATB_Q_FL_lock             , Mutex  , special,     true,  Monitor::_safepoint_check_never);
     def(SATB_Q_CBL_mon             , Monitor, nonleaf,     true,  Monitor::_safepoint_check_never);
     def(Shared_SATB_Q_lock         , Mutex,   nonleaf,     true,  Monitor::_safepoint_check_never);
@@ -206,12 +198,10 @@
   def(ParGCRareEvent_lock          , Mutex  , leaf     ,   true,  Monitor::_safepoint_check_sometimes);
   def(DerivedPointerTableGC_lock   , Mutex,   leaf,        true,  Monitor::_safepoint_check_never);
   def(CodeCache_lock               , Mutex  , special,     true,  Monitor::_safepoint_check_never);
-  def(Interrupt_lock               , Monitor, special,     true,  Monitor::_safepoint_check_never);      // used for interrupt processing
   def(RawMonitor_lock              , Mutex,   special,     true,  Monitor::_safepoint_check_never);
   def(OopMapCacheAlloc_lock        , Mutex,   leaf,        true,  Monitor::_safepoint_check_always);     // used for oop_map_cache allocation.
 
   def(Patching_lock                , Mutex  , special,     true,  Monitor::_safepoint_check_never);      // used for safepointing and code patching.
-  def(ObjAllocPost_lock            , Monitor, special,     false, Monitor::_safepoint_check_never);
   def(Service_lock                 , Monitor, special,     true,  Monitor::_safepoint_check_never);      // used for service thread operations
   def(JmethodIdCreation_lock       , Mutex  , leaf,        true,  Monitor::_safepoint_check_always);     // used for creating jmethodIDs.
 
@@ -267,7 +257,6 @@
   def(MultiArray_lock              , Mutex  , nonleaf+2,   false, Monitor::_safepoint_check_always);     // locks SymbolTable_lock
 
   def(JvmtiThreadState_lock        , Mutex  , nonleaf+2,   false, Monitor::_safepoint_check_always);     // Used by JvmtiThreadState/JvmtiEventController
-  def(JvmtiPendingEvent_lock       , Monitor, nonleaf,     false, Monitor::_safepoint_check_never);      // Used by JvmtiCodeBlobEvents
   def(Management_lock              , Mutex  , nonleaf+2,   false, Monitor::_safepoint_check_always);     // used for JVM management
 
   def(Compile_lock                 , Mutex  , nonleaf+3,   true,  Monitor::_safepoint_check_sometimes);
@@ -277,7 +266,6 @@
   def(MethodCompileQueue_lock      , Monitor, nonleaf+4,   true,  Monitor::_safepoint_check_always);
   def(Debug2_lock                  , Mutex  , nonleaf+4,   true,  Monitor::_safepoint_check_never);
   def(Debug3_lock                  , Mutex  , nonleaf+4,   true,  Monitor::_safepoint_check_never);
-  def(ProfileVM_lock               , Monitor, special,     false, Monitor::_safepoint_check_never);      // used for profiling of the VMThread
   def(CompileThread_lock           , Monitor, nonleaf+5,   false, Monitor::_safepoint_check_always);
   def(PeriodicTask_lock            , Monitor, nonleaf+5,   true,  Monitor::_safepoint_check_sometimes);
   if (WhiteBoxAPI) {
--- a/hotspot/src/share/vm/runtime/mutexLocker.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/runtime/mutexLocker.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,6 @@
 extern Mutex*   JfieldIdCreation_lock;           // a lock on creating JNI static field identifiers
 extern Monitor* JNICritical_lock;                // a lock used while entering and exiting JNI critical regions, allows GC to sometimes get in
 extern Mutex*   JvmtiThreadState_lock;           // a lock on modification of JVMTI thread data
-extern Monitor* JvmtiPendingEvent_lock;          // a lock on the JVMTI pending events list
 extern Monitor* Heap_lock;                       // a lock on the heap
 extern Mutex*   ExpandHeap_lock;                 // a lock on expanding the heap
 extern Mutex*   AdapterHandlerLibrary_lock;      // a lock on the AdapterHandlerLibrary
@@ -68,8 +67,6 @@
 extern Monitor* STS_lock;                        // used for joining/leaving SuspendibleThreadSet.
 extern Monitor* SLT_lock;                        // used in CMS GC for acquiring PLL
 extern Monitor* FullGCCount_lock;                // in support of "concurrent" full gc
-extern Monitor* CMark_lock;                      // used for concurrent mark thread coordination
-extern Mutex*   CMRegionStack_lock;              // used for protecting accesses to the CM region stack
 extern Mutex*   SATB_Q_FL_lock;                  // Protects SATB Q
                                                  // buffer free list.
 extern Monitor* SATB_Q_CBL_mon;                  // Protects SATB Q
@@ -98,8 +95,6 @@
 extern Monitor* Terminator_lock;                 // a lock used to guard termination of the vm
 extern Monitor* BeforeExit_lock;                 // a lock used to guard cleanups and shutdown hooks
 extern Monitor* Notify_lock;                     // a lock used to synchronize the start-up of the vm
-extern Monitor* Interrupt_lock;                  // a lock used for condition variable mediated interrupt processing
-extern Monitor* ProfileVM_lock;                  // a lock used for profiling the VMThread
 extern Mutex*   ProfilePrint_lock;               // a lock used to serialize the printing of profiles
 extern Mutex*   ExceptionCache_lock;             // a lock used to synchronize exception cache updates
 extern Mutex*   OsrList_lock;                    // a lock used to serialize access to OSR queues
--- a/hotspot/src/share/vm/runtime/objectMonitor.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/runtime/objectMonitor.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -401,7 +401,7 @@
 
   if (event.should_commit()) {
     event.set_klass(((oop)this->object())->klass());
-    event.set_previousOwner((TYPE_JAVALANGTHREAD)_previous_owner_tid);
+    event.set_previousOwner((TYPE_THREAD)_previous_owner_tid);
     event.set_address((TYPE_ADDRESS)(uintptr_t)(this->object_addr()));
     event.commit();
   }
@@ -937,7 +937,7 @@
   // get the owner's thread id for the MonitorEnter event
   // if it is enabled and the thread isn't suspended
   if (not_suspended && Tracing::is_event_enabled(TraceJavaMonitorEnterEvent)) {
-    _previous_owner_tid = SharedRuntime::get_java_tid(Self);
+    _previous_owner_tid = THREAD_TRACE_ID(Self);
   }
 #endif
 
@@ -1391,11 +1391,12 @@
                                             jlong notifier_tid,
                                             jlong timeout,
                                             bool timedout) {
+  assert(event != NULL, "invariant");
   event->set_klass(((oop)this->object())->klass());
-  event->set_timeout((TYPE_ULONG)timeout);
-  event->set_address((TYPE_ADDRESS)(uintptr_t)(this->object_addr()));
-  event->set_notifier((TYPE_OSTHREAD)notifier_tid);
-  event->set_timedOut((TYPE_BOOLEAN)timedout);
+  event->set_timeout(timeout);
+  event->set_address((TYPE_ADDRESS)this->object_addr());
+  event->set_notifier(notifier_tid);
+  event->set_timedOut(timedout);
   event->commit();
 }
 
@@ -1655,7 +1656,7 @@
       iterator->TState = ObjectWaiter::TS_ENTER;
     }
     iterator->_notified = 1;
-    iterator->_notifier_tid = Self->osthread()->thread_id();
+    iterator->_notifier_tid = THREAD_TRACE_ID(Self);
 
     ObjectWaiter * list = _EntryList;
     if (list != NULL) {
--- a/hotspot/src/share/vm/runtime/thread.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -324,6 +324,10 @@
   // record thread's native stack, stack grows downward
   MemTracker::record_thread_stack(stack_end(), stack_size());
 #endif // INCLUDE_NMT
+  log_debug(os, thread)("Thread " UINTX_FORMAT " stack dimensions: "
+    PTR_FORMAT "-" PTR_FORMAT " (" SIZE_FORMAT "k).",
+    os::current_thread_id(), p2i(stack_base() - stack_size()),
+    p2i(stack_base()), stack_size()/1024);
 }
 
 
@@ -1005,9 +1009,9 @@
 char java_runtime_name[128] = "";
 char java_runtime_version[128] = "";
 
-// extract the JRE name from sun.misc.Version.java_runtime_name
+// extract the JRE name from java.lang.VersionProps.java_runtime_name
 static const char* get_java_runtime_name(TRAPS) {
-  Klass* k = SystemDictionary::find(vmSymbols::sun_misc_Version(),
+  Klass* k = SystemDictionary::find(vmSymbols::java_lang_VersionProps(),
                                     Handle(), Handle(), CHECK_AND_CLEAR_NULL);
   fieldDescriptor fd;
   bool found = k != NULL &&
@@ -1027,9 +1031,9 @@
   }
 }
 
-// extract the JRE version from sun.misc.Version.java_runtime_version
+// extract the JRE version from java.lang.VersionProps.java_runtime_version
 static const char* get_java_runtime_version(TRAPS) {
-  Klass* k = SystemDictionary::find(vmSymbols::sun_misc_Version(),
+  Klass* k = SystemDictionary::find(vmSymbols::java_lang_VersionProps(),
                                     Handle(), Handle(), CHECK_AND_CLEAR_NULL);
   fieldDescriptor fd;
   bool found = k != NULL &&
@@ -1690,7 +1694,7 @@
 
   EventThreadStart event;
   if (event.should_commit()) {
-    event.set_javalangthread(java_lang_Thread::thread_id(this->threadObj()));
+    event.set_thread(THREAD_TRACE_ID(this));
     event.commit();
   }
 
@@ -1795,7 +1799,7 @@
     // from java_lang_Thread object
     EventThreadEnd event;
     if (event.should_commit()) {
-      event.set_javalangthread(java_lang_Thread::thread_id(this->threadObj()));
+      event.set_thread(THREAD_TRACE_ID(this));
       event.commit();
     }
 
@@ -1924,6 +1928,10 @@
   }
 #endif // INCLUDE_ALL_GCS
 
+  log_info(os, thread)("JavaThread %s (tid: " UINTX_FORMAT ").",
+    exit_type == JavaThread::normal_exit ? "exiting" : "detaching",
+    os::current_thread_id());
+
   // Remove from list of active threads list, and notify VM thread if we are the last non-daemon thread
   Threads::remove(this);
 }
@@ -2491,18 +2499,25 @@
   // warning("Guarding at " PTR_FORMAT " for len " SIZE_FORMAT "\n", low_addr, len);
 
   if (allocate && !os::create_stack_guard_pages((char *) low_addr, len)) {
-    warning("Attempt to allocate stack guard pages failed.");
+    log_warning(os, thread)("Attempt to allocate stack guard pages failed.");
     return;
   }
 
   if (os::guard_memory((char *) low_addr, len)) {
     _stack_guard_state = stack_guard_enabled;
   } else {
-    warning("Attempt to protect stack guard pages failed.");
+    log_warning(os, thread)("Attempt to protect stack guard pages failed ("
+      PTR_FORMAT "-" PTR_FORMAT ").", p2i(low_addr), p2i(low_addr + len));
     if (os::uncommit_memory((char *) low_addr, len)) {
-      warning("Attempt to deallocate stack guard pages failed.");
+      log_warning(os, thread)("Attempt to deallocate stack guard pages failed.");
     }
+    return;
   }
+
+  log_debug(os, thread)("Thread " UINTX_FORMAT " stack guard pages activated: "
+    PTR_FORMAT "-" PTR_FORMAT ".",
+    os::current_thread_id(), p2i(low_addr), p2i(low_addr + len));
+
 }
 
 void JavaThread::remove_stack_guard_pages() {
@@ -2515,16 +2530,25 @@
     if (os::remove_stack_guard_pages((char *) low_addr, len)) {
       _stack_guard_state = stack_guard_unused;
     } else {
-      warning("Attempt to deallocate stack guard pages failed.");
+      log_warning(os, thread)("Attempt to deallocate stack guard pages failed ("
+        PTR_FORMAT "-" PTR_FORMAT ").", p2i(low_addr), p2i(low_addr + len));
+      return;
     }
   } else {
     if (_stack_guard_state == stack_guard_unused) return;
     if (os::unguard_memory((char *) low_addr, len)) {
       _stack_guard_state = stack_guard_unused;
     } else {
-      warning("Attempt to unprotect stack guard pages failed.");
+      log_warning(os, thread)("Attempt to unprotect stack guard pages failed ("
+        PTR_FORMAT "-" PTR_FORMAT ").", p2i(low_addr), p2i(low_addr + len));
+      return;
     }
   }
+
+  log_debug(os, thread)("Thread " UINTX_FORMAT " stack guard pages removed: "
+    PTR_FORMAT "-" PTR_FORMAT ".",
+    os::current_thread_id(), p2i(low_addr), p2i(low_addr + len));
+
 }
 
 void JavaThread::enable_stack_reserved_zone() {
@@ -3530,6 +3554,10 @@
     return status;
   }
 
+  if (TRACE_INITIALIZE() != JNI_OK) {
+    vm_exit_during_initialization("Failed to initialize tracing backend");
+  }
+
   // Should be done after the heap is fully created
   main_thread->cache_global_variables();
 
@@ -3598,11 +3626,6 @@
 
   quicken_jni_functions();
 
-  // Must be run after init_ft which initializes ft_enabled
-  if (TRACE_INITIALIZE() != JNI_OK) {
-    vm_exit_during_initialization("Failed to initialize tracing backend");
-  }
-
   // No more stub generation allowed after that point.
   StubCodeDesc::freeze();
 
@@ -4110,6 +4133,7 @@
   if (version == JNI_VERSION_1_4) return JNI_TRUE;
   if (version == JNI_VERSION_1_6) return JNI_TRUE;
   if (version == JNI_VERSION_1_8) return JNI_TRUE;
+  if (version == JNI_VERSION_9) return JNI_TRUE;
   return JNI_FALSE;
 }
 
--- a/hotspot/src/share/vm/runtime/thread.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/runtime/thread.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -448,7 +448,8 @@
   void incr_allocated_bytes(jlong size) { _allocated_bytes += size; }
   inline jlong cooked_allocated_bytes();
 
-  TRACE_DATA* trace_data()              { return &_trace_data; }
+  TRACE_DEFINE_THREAD_TRACE_DATA_OFFSET;
+  TRACE_DATA* trace_data() const        { return &_trace_data; }
 
   const ThreadExt& ext() const          { return _ext; }
   ThreadExt& ext()                      { return _ext; }
--- a/hotspot/src/share/vm/runtime/vmThread.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/runtime/vmThread.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -359,7 +359,7 @@
       // Only write caller thread information for non-concurrent vm operations.
       // For concurrent vm operations, the thread id is set to 0 indicating thread is unknown.
       // This is because the caller thread could have exited already.
-      event.set_caller(is_concurrent ? 0 : op->calling_thread()->osthread()->thread_id());
+      event.set_caller(is_concurrent ? 0 : THREAD_TRACE_ID(op->calling_thread()));
       event.commit();
     }
 
--- a/hotspot/src/share/vm/services/heapDumper.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/services/heapDumper.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,8 +53,7 @@
  *   src/share/demo/jvmti/hprof/hprof_io.c
  *
  *
- *  header    "JAVA PROFILE 1.0.1" or "JAVA PROFILE 1.0.2"
- *            (0-terminated)
+ *  header    "JAVA PROFILE 1.0.2" (0-terminated)
  *
  *  u4        size of identifiers. Identifiers are used to represent
  *            UTF8 strings, objects, stack traces, etc. They usually
@@ -385,6 +384,8 @@
   size_t _size;
   size_t _pos;
 
+  jlong _dump_start;
+
   char* _error;   // error message when I/O fails
 
   void set_file_descriptor(int fd)              { _fd = fd; }
@@ -408,6 +409,10 @@
   bool is_open() const                  { return file_descriptor() >= 0; }
   void flush();
 
+  jlong dump_start() const                      { return _dump_start; }
+  void set_dump_start(jlong pos);
+  julong current_record_length();
+
   // total number of bytes written to the disk
   julong bytes_written() const          { return _bytes_written; }
 
@@ -449,6 +454,7 @@
   _pos = 0;
   _error = NULL;
   _bytes_written = 0L;
+  _dump_start = (jlong)-1;
   _fd = os::create_binary_file(path, false);    // don't replace existing file
 
   // if the open failed we record the error
@@ -476,6 +482,22 @@
   }
 }
 
+// sets the dump starting position
+void DumpWriter::set_dump_start(jlong pos) {
+  _dump_start = pos;
+}
+
+julong DumpWriter::current_record_length() {
+  if (is_open()) {
+    // calculate the size of the dump record
+    julong dump_end = bytes_written() + bytes_unwritten();
+    assert(dump_end == (size_t)current_offset(), "checking");
+    julong dump_len = dump_end - dump_start() - 4;
+    return dump_len;
+  }
+  return 0;
+}
+
 // write directly to the file
 void DumpWriter::write_internal(void* s, size_t len) {
   if (is_open()) {
@@ -645,6 +667,18 @@
   static void dump_prim_array(DumpWriter* writer, typeArrayOop array);
   // create HPROF_FRAME record for the given method and bci
   static void dump_stack_frame(DumpWriter* writer, int frame_serial_num, int class_serial_num, Method* m, int bci);
+
+  // check if we need to truncate an array
+  static int calculate_array_max_length(DumpWriter* writer, arrayOop array, short header_size);
+
+  // writes a HPROF_HEAP_DUMP_SEGMENT record
+  static void write_dump_header(DumpWriter* writer);
+
+  // fixes up the length of the current dump record
+  static void write_current_dump_record_length(DumpWriter* writer);
+
+  // fixes up the current dump record and writes HPROF_HEAP_DUMP_END record
+  static void end_of_dump(DumpWriter* writer);
 };
 
 // write a header of the given type
@@ -1005,50 +1039,102 @@
   }
 }
 
+// Hprof uses an u4 as record length field,
+// which means we need to truncate arrays that are too long.
+int DumperSupport::calculate_array_max_length(DumpWriter* writer, arrayOop array, short header_size) {
+  BasicType type = ArrayKlass::cast(array->klass())->element_type();
+  assert(type >= T_BOOLEAN && type <= T_OBJECT, "invalid array element type");
+
+  int length = array->length();
+
+  int type_size;
+  if (type == T_OBJECT) {
+    type_size = sizeof(address);
+  } else {
+    type_size = type2aelembytes(type);
+  }
+
+  size_t length_in_bytes = (size_t)length * type_size;
+
+  // Create a new record if the current record is non-empty and the array can't fit.
+  julong current_record_length = writer->current_record_length();
+  if (current_record_length > 0 &&
+      (current_record_length + header_size + length_in_bytes) > max_juint) {
+    write_current_dump_record_length(writer);
+    write_dump_header(writer);
+
+    // We now have an empty record.
+    current_record_length = 0;
+  }
+
+  // Calculate max bytes we can use.
+  uint max_bytes = max_juint - (header_size + current_record_length);
+
+  // Array too long for the record?
+  // Calculate max length and return it.
+  if (length_in_bytes > max_bytes) {
+    length = max_bytes / type_size;
+    length_in_bytes = (size_t)length * type_size;
+
+    warning("cannot dump array of type %s[] with length %d; truncating to length %d",
+            type2name_tab[type], array->length(), length);
+  }
+  return length;
+}
+
 // creates HPROF_GC_OBJ_ARRAY_DUMP record for the given object array
 void DumperSupport::dump_object_array(DumpWriter* writer, objArrayOop array) {
+  // sizeof(u1) + 2 * sizeof(u4) + sizeof(objectID) + sizeof(classID)
+  short header_size = 1 + 2 * 4 + 2 * sizeof(address);
+
+  int length = calculate_array_max_length(writer, array, header_size);
 
   writer->write_u1(HPROF_GC_OBJ_ARRAY_DUMP);
   writer->write_objectID(array);
   writer->write_u4(STACK_TRACE_ID);
-  writer->write_u4((u4)array->length());
+  writer->write_u4(length);
 
   // array class ID
   writer->write_classID(array->klass());
 
   // [id]* elements
-  for (int index=0; index<array->length(); index++) {
+  for (int index = 0; index < length; index++) {
     oop o = array->obj_at(index);
     writer->write_objectID(o);
   }
 }
 
-#define WRITE_ARRAY(Array, Type, Size) \
-  for (int i=0; i<Array->length(); i++) { writer->write_##Size((Size)array->Type##_at(i)); }
-
+#define WRITE_ARRAY(Array, Type, Size, Length) \
+  for (int i = 0; i < Length; i++) { writer->write_##Size((Size)Array->Type##_at(i)); }
 
 // creates HPROF_GC_PRIM_ARRAY_DUMP record for the given type array
 void DumperSupport::dump_prim_array(DumpWriter* writer, typeArrayOop array) {
   BasicType type = TypeArrayKlass::cast(array->klass())->element_type();
 
+  // 2 * sizeof(u1) + 2 * sizeof(u4) + sizeof(objectID)
+  short header_size = 2 * 1 + 2 * 4 + sizeof(address);
+
+  int length = calculate_array_max_length(writer, array, header_size);
+  int type_size = type2aelembytes(type);
+  u4 length_in_bytes = (u4)length * type_size;
+
   writer->write_u1(HPROF_GC_PRIM_ARRAY_DUMP);
   writer->write_objectID(array);
   writer->write_u4(STACK_TRACE_ID);
-  writer->write_u4((u4)array->length());
+  writer->write_u4(length);
   writer->write_u1(type2tag(type));
 
   // nothing to copy
-  if (array->length() == 0) {
+  if (length == 0) {
     return;
   }
 
   // If the byte ordering is big endian then we can copy most types directly
-  u4 length_in_bytes = (u4)array->length() * type2aelembytes(type);
 
   switch (type) {
     case T_INT : {
       if (Bytes::is_Java_byte_ordering_different()) {
-        WRITE_ARRAY(array, int, u4);
+        WRITE_ARRAY(array, int, u4, length);
       } else {
         writer->write_raw((void*)(array->int_at_addr(0)), length_in_bytes);
       }
@@ -1060,7 +1146,7 @@
     }
     case T_CHAR : {
       if (Bytes::is_Java_byte_ordering_different()) {
-        WRITE_ARRAY(array, char, u2);
+        WRITE_ARRAY(array, char, u2, length);
       } else {
         writer->write_raw((void*)(array->char_at_addr(0)), length_in_bytes);
       }
@@ -1068,7 +1154,7 @@
     }
     case T_SHORT : {
       if (Bytes::is_Java_byte_ordering_different()) {
-        WRITE_ARRAY(array, short, u2);
+        WRITE_ARRAY(array, short, u2, length);
       } else {
         writer->write_raw((void*)(array->short_at_addr(0)), length_in_bytes);
       }
@@ -1076,7 +1162,7 @@
     }
     case T_BOOLEAN : {
       if (Bytes::is_Java_byte_ordering_different()) {
-        WRITE_ARRAY(array, bool, u1);
+        WRITE_ARRAY(array, bool, u1, length);
       } else {
         writer->write_raw((void*)(array->bool_at_addr(0)), length_in_bytes);
       }
@@ -1084,7 +1170,7 @@
     }
     case T_LONG : {
       if (Bytes::is_Java_byte_ordering_different()) {
-        WRITE_ARRAY(array, long, u8);
+        WRITE_ARRAY(array, long, u8, length);
       } else {
         writer->write_raw((void*)(array->long_at_addr(0)), length_in_bytes);
       }
@@ -1096,14 +1182,14 @@
     // use IEEE 754.
 
     case T_FLOAT : {
-      for (int i=0; i<array->length(); i++) {
-        dump_float( writer, array->float_at(i) );
+      for (int i = 0; i < length; i++) {
+        dump_float(writer, array->float_at(i));
       }
       break;
     }
     case T_DOUBLE : {
-      for (int i=0; i<array->length(); i++) {
-        dump_double( writer, array->double_at(i) );
+      for (int i = 0; i < length; i++) {
+        dump_double(writer, array->double_at(i));
       }
       break;
     }
@@ -1320,8 +1406,6 @@
   JavaThread*           _oome_thread;
   Method*               _oome_constructor;
   bool _gc_before_heap_dump;
-  bool _is_segmented_dump;
-  jlong _dump_start;
   GrowableArray<Klass*>* _klass_map;
   ThreadStackTrace** _stack_traces;
   int _num_threads;
@@ -1340,11 +1424,6 @@
   void clear_global_dumper() { _global_dumper = NULL; }
   void clear_global_writer() { _global_writer = NULL; }
 
-  bool is_segmented_dump() const                { return _is_segmented_dump; }
-  void set_segmented_dump()                     { _is_segmented_dump = true; }
-  jlong dump_start() const                      { return _dump_start; }
-  void set_dump_start(jlong pos);
-
   bool skip_operation() const;
 
   // writes a HPROF_LOAD_CLASS record
@@ -1369,16 +1448,6 @@
   // HPROF_TRACE and HPROF_FRAME records
   void dump_stack_traces();
 
-  // writes a HPROF_HEAP_DUMP or HPROF_HEAP_DUMP_SEGMENT record
-  void write_dump_header();
-
-  // fixes up the length of the current dump record
-  void write_current_dump_record_length();
-
-  // fixes up the current dump record )and writes HPROF_HEAP_DUMP_END
-  // record in the case of a segmented heap dump)
-  void end_of_dump();
-
  public:
   VM_HeapDumper(DumpWriter* writer, bool gc_before_heap_dump, bool oome) :
     VM_GC_Operation(0 /* total collections,      dummy, ignored */,
@@ -1387,8 +1456,6 @@
                     gc_before_heap_dump) {
     _local_writer = writer;
     _gc_before_heap_dump = gc_before_heap_dump;
-    _is_segmented_dump = false;
-    _dump_start = (jlong)-1;
     _klass_map = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<Klass*>(INITIAL_CLASS_COUNT, true);
     _stack_traces = NULL;
     _num_threads = 0;
@@ -1428,35 +1495,23 @@
   return false;
 }
 
-// sets the dump starting position
-void VM_HeapDumper::set_dump_start(jlong pos) {
-  _dump_start = pos;
-}
-
- // writes a HPROF_HEAP_DUMP or HPROF_HEAP_DUMP_SEGMENT record
-void VM_HeapDumper::write_dump_header() {
-  if (writer()->is_open()) {
-    if (is_segmented_dump()) {
-      writer()->write_u1(HPROF_HEAP_DUMP_SEGMENT);
-    } else {
-      writer()->write_u1(HPROF_HEAP_DUMP);
-    }
-    writer()->write_u4(0); // current ticks
+ // writes a HPROF_HEAP_DUMP_SEGMENT record
+void DumperSupport::write_dump_header(DumpWriter* writer) {
+  if (writer->is_open()) {
+    writer->write_u1(HPROF_HEAP_DUMP_SEGMENT);
+    writer->write_u4(0); // current ticks
 
     // record the starting position for the dump (its length will be fixed up later)
-    set_dump_start(writer()->current_offset());
-    writer()->write_u4(0);
+    writer->set_dump_start(writer->current_offset());
+    writer->write_u4(0);
   }
 }
 
 // fixes up the length of the current dump record
-void VM_HeapDumper::write_current_dump_record_length() {
-  if (writer()->is_open()) {
-    assert(dump_start() >= 0, "no dump start recorded");
-
-    // calculate the size of the dump record
-    julong dump_end = writer()->current_offset();
-    julong dump_len = (dump_end - dump_start() - 4);
+void DumperSupport::write_current_dump_record_length(DumpWriter* writer) {
+  if (writer->is_open()) {
+    julong dump_end = writer->bytes_written() + writer->bytes_unwritten();
+    julong dump_len = writer->current_record_length();
 
     // record length must fit in a u4
     if (dump_len > max_juint) {
@@ -1464,17 +1519,18 @@
     }
 
     // seek to the dump start and fix-up the length
-    writer()->seek_to_offset(dump_start());
-    writer()->write_u4((u4)dump_len);
+    assert(writer->dump_start() >= 0, "no dump start recorded");
+    writer->seek_to_offset(writer->dump_start());
+    writer->write_u4((u4)dump_len);
 
     // adjust the total size written to keep the bytes written correct.
-    writer()->adjust_bytes_written(-((jlong) sizeof(u4)));
+    writer->adjust_bytes_written(-((jlong) sizeof(u4)));
 
     // seek to dump end so we can continue
-    writer()->seek_to_offset(dump_end);
+    writer->seek_to_offset(dump_end);
 
     // no current dump record
-    set_dump_start((jlong)-1);
+    writer->set_dump_start((jlong)-1);
   }
 }
 
@@ -1482,33 +1538,23 @@
 // new segment.
 void VM_HeapDumper::check_segment_length() {
   if (writer()->is_open()) {
-    if (is_segmented_dump()) {
-      // don't use current_offset that would be too expensive on a per record basis
-      julong dump_end = writer()->bytes_written() + writer()->bytes_unwritten();
-      assert(dump_end == (julong)writer()->current_offset(), "checking");
-      julong dump_len = (dump_end - dump_start() - 4);
-      assert(dump_len <= max_juint, "bad dump length");
+    julong dump_len = writer()->current_record_length();
 
-      if (dump_len > HeapDumpSegmentSize) {
-        write_current_dump_record_length();
-        write_dump_header();
-      }
+    if (dump_len > 2UL*G) {
+      DumperSupport::write_current_dump_record_length(writer());
+      DumperSupport::write_dump_header(writer());
     }
   }
 }
 
-// fixes up the current dump record )and writes HPROF_HEAP_DUMP_END
-// record in the case of a segmented heap dump)
-void VM_HeapDumper::end_of_dump() {
-  if (writer()->is_open()) {
-    write_current_dump_record_length();
+// fixes up the current dump record and writes HPROF_HEAP_DUMP_END record
+void DumperSupport::end_of_dump(DumpWriter* writer) {
+  if (writer->is_open()) {
+    write_current_dump_record_length(writer);
 
-    // for segmented dump we write the end record
-    if (is_segmented_dump()) {
-      writer()->write_u1(HPROF_HEAP_DUMP_END);
-      writer()->write_u4(0);
-      writer()->write_u4(0);
-    }
+    writer->write_u1(HPROF_HEAP_DUMP_END);
+    writer->write_u4(0);
+    writer->write_u4(0);
   }
 }
 
@@ -1686,16 +1732,17 @@
 //  [HPROF_LOAD_CLASS]*
 //  [[HPROF_FRAME]*|HPROF_TRACE]*
 //  [HPROF_GC_CLASS_DUMP]*
-//  HPROF_HEAP_DUMP
+//  [HPROF_HEAP_DUMP_SEGMENT]*
+//  HPROF_HEAP_DUMP_END
 //
 // The HPROF_TRACE records represent the stack traces where the heap dump
 // is generated and a "dummy trace" record which does not include
 // any frames. The dummy trace record is used to be referenced as the
 // unknown object alloc site.
 //
-// The HPROF_HEAP_DUMP record has a length following by sub-records. To allow
-// the heap dump be generated in a single pass we remember the position of
-// the dump length and fix it up after all sub-records have been written.
+// Each HPROF_HEAP_DUMP_SEGMENT record has a length followed by sub-records.
+// To allow the heap dump be generated in a single pass we remember the position
+// of the dump length and fix it up after all sub-records have been written.
 // To generate the sub-records we iterate over the heap, writing
 // HPROF_GC_INSTANCE_DUMP, HPROF_GC_OBJ_ARRAY_DUMP, and HPROF_GC_PRIM_ARRAY_DUMP
 // records as we go. Once that is done we write records for some of the GC
@@ -1722,15 +1769,9 @@
   set_global_dumper();
   set_global_writer();
 
-  // Write the file header - use 1.0.2 for large heaps, otherwise 1.0.1
+  // Write the file header - we always use 1.0.2
   size_t used = ch->used();
-  const char* header;
-  if (used > SegmentedHeapDumpThreshold) {
-    set_segmented_dump();
-    header = "JAVA PROFILE 1.0.2";
-  } else {
-    header = "JAVA PROFILE 1.0.1";
-  }
+  const char* header = "JAVA PROFILE 1.0.2";
 
   // header is few bytes long - no chance to overflow int
   writer()->write_raw((void*)header, (int)strlen(header));
@@ -1750,8 +1791,8 @@
   // this must be called after _klass_map is built when iterating the classes above.
   dump_stack_traces();
 
-  // write HPROF_HEAP_DUMP or HPROF_HEAP_DUMP_SEGMENT
-  write_dump_header();
+  // write HPROF_HEAP_DUMP_SEGMENT
+  DumperSupport::write_dump_header(writer());
 
   // Writes HPROF_GC_CLASS_DUMP records
   ClassLoaderDataGraph::classes_do(&do_class_dump);
@@ -1759,9 +1800,9 @@
   check_segment_length();
 
   // writes HPROF_GC_INSTANCE_DUMP records.
-  // After each sub-record is written check_segment_length will be invoked. When
-  // generated a segmented heap dump this allows us to check if the current
-  // segment exceeds a threshold and if so, then a new segment is started.
+  // After each sub-record is written check_segment_length will be invoked
+  // to check if the current segment exceeds a threshold. If so, a new
+  // segment is started.
   // The HPROF_GC_CLASS_DUMP and HPROF_GC_INSTANCE_DUMP are the vast bulk
   // of the heap dump.
   HeapObjectDumper obj_dumper(this, writer());
@@ -1785,9 +1826,8 @@
   StickyClassDumper class_dumper(writer());
   SystemDictionary::always_strong_classes_do(&class_dumper);
 
-  // fixes up the length of the dump record. In the case of a segmented
-  // heap then the HPROF_HEAP_DUMP_END record is also written.
-  end_of_dump();
+  // fixes up the length of the dump record and writes the HPROF_HEAP_DUMP_END record.
+  DumperSupport::end_of_dump(writer());
 
   // Now we clear the global variables, so that a future dumper might run.
   clear_global_dumper();
--- a/hotspot/src/share/vm/trace/trace.xml	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/trace/trace.xml	Mon Mar 07 09:34:29 2016 +0100
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
- Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
  This code is free software; you can redistribute it and/or modify it
@@ -73,12 +73,12 @@
   <events>
     <event id="ThreadStart" path="java/thread_start" label="Java Thread Start"
            has_thread="true" is_instant="true">
-      <value type="JAVALANGTHREAD" field="javalangthread" label="Java Thread"/>
+      <value type="THREAD" field="thread" label="Java Thread"/>
     </event>
 
     <event id="ThreadEnd" path="java/thread_end" label="Java Thread End"
            has_thread="true" is_instant="true">
-      <value type="JAVALANGTHREAD" field="javalangthread" label="Java Thread"/>
+      <value type="THREAD" field="thread" label="Java Thread"/>
     </event>
 
     <event id="ThreadSleep" path="java/thread_sleep" label="Java Thread Sleep"
@@ -96,14 +96,14 @@
     <event id="JavaMonitorEnter" path="java/monitor_enter" label="Java Monitor Blocked"
             has_thread="true" has_stacktrace="true" is_instant="false">
       <value type="CLASS" field="klass" label="Monitor Class"/>
-      <value type="JAVALANGTHREAD" field="previousOwner" label="Previous Monitor Owner"/>
+      <value type="THREAD" field="previousOwner" label="Previous Monitor Owner"/>
       <value type="ADDRESS" field="address" label="Monitor Address" relation="JAVA_MONITOR_ADDRESS"/>
     </event>
 
     <event id="JavaMonitorWait" path="java/monitor_wait" label="Java Monitor Wait" description="Waiting on a Java monitor"
             has_thread="true" has_stacktrace="true" is_instant="false">
       <value type="CLASS" field="klass" label="Monitor Class" description="Class of object waited on"/>
-      <value type="OSTHREAD" field="notifier" label="Notifier Thread" description="Notifying Thread"/>
+      <value type="THREAD" field="notifier" label="Notifier Thread" description="Notifying Thread"/>
       <value type="MILLIS" field="timeout" label="Timeout" description="Maximum wait time"/>
       <value type="BOOLEAN" field="timedOut" label="Timed Out" description="Wait has been timed out"/>
       <value type="ADDRESS" field="address" label="Monitor Address" description="Address of object waited on" relation="JAVA_MONITOR_ADDRESS"/>
@@ -434,7 +434,7 @@
            description="Promotion of an object failed">
       <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
       <structvalue type="CopyFailed" field="data" label="Data"/>
-      <value type="OSTHREAD" field="thread" label="Running thread"/>
+      <value type="THREAD" field="thread" label="Running thread"/>
     </event>
 
     <event id="EvacuationFailed" path="vm/gc/detailed/evacuation_failed" label="Evacuation Failed" is_instant="true"
@@ -496,6 +496,11 @@
       <value type="UINT" field="allocContext" label="Allocation Context" />
     </event>
 
+    <event id="VMError" path="vm/runtime/vm_error" label="VM Error"
+           description="VM shutdown due to an error" has_stacktrace="true" has_thread="true">
+      <value type="BOOLEAN" field="out_of_java_memory" label="Java Out Of Memory"/>
+    </event>
+
     <!-- Compiler events -->
 
     <event id="Compilation" path="vm/compiler/compilation" label="Compilation"
@@ -569,7 +574,7 @@
       <value type="VMOPERATIONTYPE" field="operation" label="Operation" />
       <value type="BOOLEAN" field="safepoint" label="At Safepoint" description="If the operation occured at a safepoint."/>
       <value type="BOOLEAN" field="blocking" label="Caller Blocked" description="If the calling thread was blocked until the operation was complete."/>
-      <value type="OSTHREAD" field="caller" label="Caller" transition="FROM" description="Thread requesting operation. If non-blocking, will be set to 0 indicating thread is unknown."/>
+      <value type="THREAD" field="caller" label="Caller" transition="FROM" description="Thread requesting operation. If non-blocking, will be set to 0 indicating thread is unknown."/>
     </event>
 
     <!-- Allocation events -->
--- a/hotspot/src/share/vm/trace/traceBackend.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/trace/traceBackend.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,6 +47,10 @@
 
   static void on_unloading_classes(void) {
   }
+
+  static void on_vm_error(bool) {
+  }
+
 };
 
 class TraceThreadData {
--- a/hotspot/src/share/vm/trace/traceDataTypes.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/trace/traceDataTypes.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,39 +31,32 @@
 
 enum {
   CONTENT_TYPE_NONE             = 0,
-  CONTENT_TYPE_BYTES            = 1,
-  CONTENT_TYPE_EPOCHMILLIS      = 2,
-  CONTENT_TYPE_MILLIS           = 3,
-  CONTENT_TYPE_NANOS            = 4,
-  CONTENT_TYPE_TICKS            = 5,
-  CONTENT_TYPE_ADDRESS          = 6,
+  CONTENT_TYPE_CLASS            = 20,
+  CONTENT_TYPE_UTF8             = 21,
+  CONTENT_TYPE_THREAD           = 22,
+  CONTENT_TYPE_STACKTRACE       = 23,
+  CONTENT_TYPE_BYTES            = 24,
+  CONTENT_TYPE_EPOCHMILLIS      = 25,
+  CONTENT_TYPE_MILLIS           = 26,
+  CONTENT_TYPE_NANOS            = 27,
+  CONTENT_TYPE_TICKS            = 28,
+  CONTENT_TYPE_ADDRESS          = 29,
+  CONTENT_TYPE_PERCENTAGE       = 30,
 
-  CONTENT_TYPE_OSTHREAD,
-  CONTENT_TYPE_JAVALANGTHREAD,
-  CONTENT_TYPE_STACKTRACE,
-  CONTENT_TYPE_CLASS,
-  CONTENT_TYPE_PERCENTAGE,
-
-  JVM_CONTENT_TYPES_START       = 30,
-  JVM_CONTENT_TYPES_END         = 100
+  JVM_CONTENT_TYPES_START       = 33,
+  JVM_CONTENT_TYPES_END         = 255
 };
 
 enum ReservedEvent {
-  EVENT_PRODUCERS,
+  EVENT_METADATA,
   EVENT_CHECKPOINT,
   EVENT_BUFFERLOST,
 
-  NUM_RESERVED_EVENTS
+  NUM_RESERVED_EVENTS = JVM_CONTENT_TYPES_END
 };
 
 typedef enum ReservedEvent ReservedEvent;
 
-typedef u8 classid;
-typedef u8 stacktraceid;
-typedef u8 methodid;
-typedef u8 fieldid;
-
-class TraceUnicodeString;
+class Symbol;
 
 #endif // SHARE_VM_TRACE_TRACEDATATYPES_HPP
-
--- a/hotspot/src/share/vm/trace/traceEvent.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/trace/traceEvent.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -62,7 +62,6 @@
     _endTime = time;
   }
 
- public:
   TraceEvent(EventStartTime timing=TIMED) :
     _startTime(0),
     _endTime(0),
@@ -76,12 +75,21 @@
   {
     if (T::is_enabled()) {
       _started = true;
-      if (timing == TIMED && !T::isInstant) {
-        static_cast<T *>(this)->set_starttime(Tracing::time());
+      if (TIMED == timing && !T::isInstant) {
+        static_cast<T*>(this)->set_starttime(Tracing::time());
       }
     }
   }
 
+ public:
+  void set_starttime(const Ticks& time) {
+    _startTime = time.value();
+  }
+
+  void set_endtime(const Ticks& time) {
+    _endTime = time.value();
+  }
+
   static bool is_enabled() {
     return Tracing::is_event_enabled(T::eventId);
   }
@@ -90,67 +98,68 @@
     return _started;
   }
 
-  void ignoreCheck() {
-    DEBUG_ONLY(_ignore_check = true);
-  }
-
   void commit() {
     if (!should_commit()) {
-        cancel();
-        return;
+      DEBUG_ONLY(cancel());
+      return;
     }
-    if (_endTime == 0) {
+    assert(!_cancelled, "Committing an event that has already been cancelled");
+    if (_startTime == 0) {
+      static_cast<T*>(this)->set_starttime(Tracing::time());
+    } else if (_endTime == 0) {
       static_cast<T*>(this)->set_endtime(Tracing::time());
     }
     if (static_cast<T*>(this)->should_write()) {
       static_cast<T*>(this)->writeEvent();
     }
-    set_commited();
+    DEBUG_ONLY(set_commited());
   }
 
-  void set_starttime(const Ticks& time) {
-    _startTime = time.value();
-  }
-
-  void set_endtime(const Ticks& time) {
-    _endTime = time.value();
-  }
-
-  TraceEventId id() const {
+  static TraceEventId id() {
     return T::eventId;
   }
 
-  bool is_instant() const {
+  static bool is_instant() {
     return T::isInstant;
   }
 
-  bool is_requestable() const {
+  static bool is_requestable() {
     return T::isRequestable;
   }
 
-  bool has_thread() const {
+  static bool has_thread() {
     return T::hasThread;
   }
 
-  bool has_stacktrace() const {
+  static bool has_stacktrace() {
     return T::hasStackTrace;
   }
 
   void cancel() {
-    assert(!_committed && !_cancelled, "event was already committed/cancelled");
+    assert(!_committed && !_cancelled,
+      "event was already committed/cancelled");
     DEBUG_ONLY(_cancelled = true);
   }
 
-  void set_commited() {
-    assert(!_committed, "event has already been committed");
-    DEBUG_ONLY(_committed = true);
-  }
-
   ~TraceEvent() {
     if (_started) {
-      assert(_ignore_check || _committed || _cancelled, "event was not committed/cancelled");
+      assert(_ignore_check || _committed || _cancelled,
+        "event was not committed/cancelled");
     }
   }
+
+#ifdef ASSERT
+ protected:
+  void ignoreCheck() {
+    _ignore_check = true;
+  }
+
+ private:
+  void set_commited() {
+    assert(!_committed, "event has already been committed");
+    _committed = true;
+  }
+#endif // ASSERT
 };
 
 #endif // INCLUDE_TRACE
--- a/hotspot/src/share/vm/trace/traceEventClasses.xsl	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/trace/traceEventClasses.xsl	Mon Mar 07 09:34:29 2016 +0100
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
- Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
  This code is free software; you can redistribute it and/or modify it
@@ -52,8 +52,8 @@
 class TraceEvent {
 public:
   TraceEvent() {}
-  void set_starttime(const Ticks&amp; time) {}
-  void set_endtime(const Ticks&amp; time) {}
+  void set_starttime(const Ticks&amp; ignore) {}
+  void set_endtime(const Ticks&amp; ignore) {}
   bool should_commit() const { return false; }
   static bool is_enabled() { return false; }
   void commit() {}
--- a/hotspot/src/share/vm/trace/traceEventIds.xsl	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/trace/traceEventIds.xsl	Mon Mar 07 09:34:29 2016 +0100
@@ -43,7 +43,7 @@
   _traceeventbase = (NUM_RESERVED_EVENTS-1), // Make sure we start at right index.
   
   // Events -> enum entry
-<xsl:for-each select="trace/events/event">
+<xsl:for-each select="trace/events/*">
   <xsl:value-of select="concat('  Trace', @id, 'Event,', $newline)"/>
 </xsl:for-each>
   MaxTraceEventId
--- a/hotspot/src/share/vm/trace/traceMacros.hpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/trace/traceMacros.hpp	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,19 +25,29 @@
 #ifndef SHARE_VM_TRACE_TRACEMACROS_HPP
 #define SHARE_VM_TRACE_TRACEMACROS_HPP
 
+typedef u8 traceid;
+
 #define EVENT_THREAD_EXIT(thread)
 #define EVENT_THREAD_DESTRUCT(thread)
+#define TRACE_KLASS_CREATION(k, p, t)
 
-#define TRACE_INIT_ID(k)
+#define TRACE_INIT_KLASS_ID(k)
+#define TRACE_INIT_THREAD_ID(td)
 #define TRACE_DATA TraceThreadData
 
+#define THREAD_TRACE_ID(thread) ((traceid)thread->osthread()->thread_id())
 #define TRACE_START() JNI_OK
 #define TRACE_INITIALIZE() JNI_OK
 
-#define TRACE_DEFINE_KLASS_METHODS typedef int ___IGNORED_hs_trace_type1
-#define TRACE_DEFINE_KLASS_TRACE_ID typedef int ___IGNORED_hs_trace_type2
-#define TRACE_DEFINE_OFFSET typedef int ___IGNORED_hs_trace_type3
-#define TRACE_ID_OFFSET in_ByteSize(0); ShouldNotReachHere()
+#define TRACE_DEFINE_TRACE_ID_METHODS typedef int ___IGNORED_hs_trace_type1
+#define TRACE_DEFINE_TRACE_ID_FIELD typedef int ___IGNORED_hs_trace_type2
+#define TRACE_DEFINE_KLASS_TRACE_ID_OFFSET typedef int ___IGNORED_hs_trace_type3
+#define TRACE_KLASS_TRACE_ID_OFFSET in_ByteSize(0); ShouldNotReachHere()
+#define TRACE_DEFINE_THREAD_TRACE_DATA_OFFSET typedef int ___IGNORED_hs_trace_type4
+#define TRACE_THREAD_TRACE_DATA_OFFSET in_ByteSize(0); ShouldNotReachHere()
+#define TRACE_DEFINE_THREAD_TRACE_ID_OFFSET typedef int ___IGNORED_hs_trace_type5
+#define TRACE_THREAD_TRACE_ID_OFFSET in_ByteSize(0); ShouldNotReachHere()
+#define TRACE_DEFINE_THREAD_ID_SIZE typedef int ___IGNORED_hs_trace_type6
 #define TRACE_TEMPLATES(template)
 #define TRACE_INTRINSICS(do_intrinsic, do_class, do_name, do_signature, do_alias)
 
--- a/hotspot/src/share/vm/trace/tracetypes.xml	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/trace/tracetypes.xml	Mon Mar 07 09:34:29 2016 +0100
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
- Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
  This code is free software; you can redistribute it and/or modify it
@@ -60,27 +60,16 @@
  <types>
   <content_types>
     <content_type id="Thread" hr_name="Thread"
-                  type="U4" builtin_type="OSTHREAD">
-      <value type="UTF8" field="name" label="Thread name"/>
-    </content_type>
-
-    <content_type id="VMThread" hr_name="VM Thread"
-                  type="U8" jvm_type="VMTHREAD">
-      <value type="OSTHREAD" field="thread" label="VM Thread"/>
-    </content_type>
-
-    <content_type id="JavaThread" hr_name="Java thread"
-                  type="U8" builtin_type="JAVALANGTHREAD">
-      <value type="OSTHREAD" field="thread" label="OS Thread ID"/>
-      <value type="BYTES64" field="allocInsideTla"
-             label="Allocated bytes inside TLAs"/>
-      <value type="BYTES64" field="allocOutsideTla"
-             label="Allocated bytes outside TLAs"/>
+                  type="U8" builtin_type="THREAD">
+      <value type="UTF8" field="osName" label="OS Thread Name"/>
+      <value type="LONG" field="osThreadID" label="OS Thread ID"/>
+      <value type="UTF8" field="javaName" label="Java Lang Thread Name"/>
+      <value type="LONG" field="javaThreadID" label="Java Lang Thread ID"/>
       <value type="THREADGROUP" field="group" label="Java Thread Group"/>
     </content_type>
 
     <content_type id="ThreadGroup" hr_name="Thread group"
-                  type="U4" jvm_type="THREADGROUP">
+                  type="U8" jvm_type="THREADGROUP">
       <value type="THREADGROUP" field="parent" label="Parent"/>
       <value type="UTF8" field="name" label="Name"/>
     </content_type>
@@ -107,82 +96,82 @@
     </content_type>
 
     <content_type id="ThreadState" hr_name="Java Thread State"
-                  type="U2" jvm_type="THREADSTATE">
+                  type="U8" jvm_type="THREADSTATE">
       <value type="UTF8" field="name" label="Name"/>
     </content_type>
 
     <content_type id="GCName" hr_name="GC Name"
-                  type="U1" jvm_type="GCNAME">
+                  type="U8" jvm_type="GCNAME">
       <value type="UTF8" field="name" label="name" />
     </content_type>
 
     <content_type id="GCCause" hr_name="GC Cause"
-                  type="U2" jvm_type="GCCAUSE">
+                  type="U8" jvm_type="GCCAUSE">
       <value type="UTF8" field="cause" label="cause" />
     </content_type>
 
     <content_type id="GCWhen" hr_name="GC When"
-                  type="U1" jvm_type="GCWHEN">
+                  type="U8" jvm_type="GCWHEN">
       <value type="UTF8" field="when" label="when" />
     </content_type>
 
     <content_type id="G1HeapRegionType" hr_name="G1 Heap Region Type"
-                  type="U1" jvm_type="G1HEAPREGIONTYPE">
+                  type="U8" jvm_type="G1HEAPREGIONTYPE">
       <value type="UTF8" field="type" label="type" />
     </content_type>
     
     <content_type id="G1YCType" hr_name="G1 YC Type"
-                  type="U1" jvm_type="G1YCTYPE">
+                  type="U8" jvm_type="G1YCTYPE">
       <value type="UTF8" field="type" label="type" />
     </content_type>
 
     <content_type id="GCThresholdUpdater" hr_name="GC Treshold Updater"
-                  type="U1" jvm_type="GCTHRESHOLDUPDATER">
+                  type="U8" jvm_type="GCTHRESHOLDUPDATER">
       <value type="UTF8" field="updater" label="updater" />
     </content_type>
 
     <content_type id="ReferenceType" hr_name="Reference Type"
-                  type="U1" jvm_type="REFERENCETYPE">
+                  type="U8" jvm_type="REFERENCETYPE">
       <value type="UTF8" field="type" label="type" />
     </content_type>
 
     <content_type id="MetadataType" hr_name="Metadata Type"
-                  type="U1" jvm_type="METADATATYPE">
+                  type="U8" jvm_type="METADATATYPE">
       <value type="UTF8" field="type" label="type" />
     </content_type>
 
     <content_type id="MetaspaceObjectType" hr_name="Metaspace Object Type"
-                  type="U1" jvm_type="METASPACEOBJTYPE">
+                  type="U8" jvm_type="METASPACEOBJTYPE">
       <value type="UTF8" field="type" label="type" />
     </content_type>
 
     <content_type id="NARROW_OOP_MODE" hr_name="Narrow Oop Mode"
-                  type="U1" jvm_type="NARROWOOPMODE">
+                  type="U8" jvm_type="NARROWOOPMODE">
       <value type="UTF8" field="mode" label="mode" />
     </content_type>
 
     <content_type id="VMOperationType" hr_name="VM Operation Type"
-                  type="U2" jvm_type="VMOPERATIONTYPE">
+                  type="U8" jvm_type="VMOPERATIONTYPE">
       <value type="UTF8" field="type" label="type" />
     </content_type>
 
     <content_type id="CompilerPhaseType" hr_name="Compiler Phase Type"
-                  type="U1" jvm_type="COMPILERPHASETYPE">
+                  type="U8" jvm_type="COMPILERPHASETYPE">
       <value type="UTF8" field="phase" label="phase" />
     </content_type>
 
     <content_type id="FlagValueOrigin" hr_name="Flag Value Origin"
-                  type="U1" jvm_type="FLAGVALUEORIGIN">
+                  type="U8" jvm_type="FLAGVALUEORIGIN">
       <value type="UTF8" field="origin" label="origin" />
     </content_type>
 
     <content_type id="CodeBlobType" hr_name="Code Blob Type"
-                  type="U1" jvm_type="CODEBLOBTYPE">
+                  type="U8" jvm_type="CODEBLOBTYPE">
       <value type="UTF8" field="type" label="type" />
     </content_type>
 
     <content_type id="InflateCause" hr_name="Inflation Cause"
-                  type="U1" jvm_type="INFLATECAUSE">
+                  type="U8" jvm_type="INFLATECAUSE">
       <value type="UTF8" field="cause" label="cause" />
     </content_type>
   </content_types>
@@ -245,11 +234,11 @@
                   type="bool" sizeop="1"/>
 
     <!-- 32-bit unsigned integer, SEMANTIC value BYTES -->
-    <primary_type symbol="BYTES" datatype="U4" contenttype="BYTES"
-                  type="u4" sizeop="sizeof(u4)"/>
+    <primary_type symbol="BYTES" datatype="U8" contenttype="BYTES"
+                  type="u8" sizeop="sizeof(u8)"/>
 
-    <primary_type symbol="IOBYTES" datatype="U4" contenttype="BYTES"
-                  type="u4" sizeop="sizeof(u4)"/>
+    <primary_type symbol="IOBYTES" datatype="U8" contenttype="BYTES"
+                  type="u8" sizeop="sizeof(u8)"/>
 
     <!-- 64-bit unsigned integer, SEMANTIC value BYTES -->
     <primary_type symbol="BYTES64" datatype="U8" contenttype="BYTES"
@@ -280,122 +269,109 @@
                   type="u8" sizeop="sizeof(u8)"/>
 
     <!-- 32-bit float, SEMANTIC value PERCENTAGE (0.0-1.0) -->
-    <primary_type symbol="PERCENT" datatype="FLOAT" contenttype="PERCENTAGE"
+    <primary_type symbol="PERCENTAGE" datatype="FLOAT" contenttype="PERCENTAGE"
                   type="float" sizeop="sizeof(float)"/>
 
-    <!-- UTF-encoded string, max length 64k -->
+    <!-- UTF8-encoded string, max length Integer.MAX_VALUE -->
     <primary_type symbol="UTF8" datatype="UTF8" contenttype="NONE"
-                  type="const char *" sizeop="sizeof_utf(%)"/>
-
-    <!-- UTF-16 encoded (Unicode) string, max length maxjuint -->
-    <primary_type symbol="STRING" datatype="STRING" contenttype="NONE"
-                  type="TraceUnicodeString*" sizeop="sizeof_unicode(%)"/>
+                  type="const char*" sizeop="sizeof_utf(%)"/>
 
     <!-- Symbol* constant. Note that this may currently ONLY be used by
           classes, methods fields.  This restriction might be lifted. -->
     <primary_type symbol="SYMBOL" datatype="U8" contenttype="SYMBOL"
-                  type="Symbol *" sizeop="sizeof(u8)"/>
+                  type="const Symbol*" sizeop="sizeof(u8)"/>
 
     <!-- A Klass *. The actual class is marked as "used" and will
          eventually be written into the recording constant pool -->
     <primary_type symbol="CLASS" datatype="U8" contenttype="CLASS"
-                  type="Klass *" sizeop="sizeof(u8)"/>
+                  type="const Klass*" sizeop="sizeof(u8)"/>
 
     <!-- A Method *. The method is marked as "used" and will eventually be
          written into the recording constant pool. -->
     <primary_type symbol="METHOD" datatype="U8" contenttype="METHOD"
-                  type="Method *" sizeop="sizeof(u8)"/>
+                  type="const Method*" sizeop="sizeof(u8)"/>
 
     <!--  The type for stacktraces in the recording. Shoudl not be used by
           events explicitly -->
     <primary_type symbol="STACKTRACE" datatype="U8" contenttype="STACKTRACE"
                   type="u8" sizeop="sizeof(u8)"/>
 
-    <!-- OS Thread ID -->
-    <primary_type symbol="OSTHREAD" datatype="U4" contenttype="OSTHREAD"
-                  type="u4" sizeop="sizeof(u4)"/>
-
-    <!-- VM Thread ID Note: changed from U2 to U8 for hotspot -->
-    <primary_type symbol="VMTHREAD" datatype="U8" contenttype="VMTHREAD"
-                  type="u8"  sizeop="sizeof(u8)"/>
-
-    <!-- Java Thread ID -->
-    <primary_type symbol="JAVALANGTHREAD" datatype="LONG"
-                  contenttype="JAVALANGTHREAD" type="s8"
-                  sizeop="sizeof(s8)"/>
+    <!-- Thread ID -->
+    <primary_type symbol="THREAD" datatype="U8" contenttype="THREAD"
+                  type="u8" sizeop="sizeof(u8)"/>
 
     <!-- Threadgroup THIS TYPE MAY NOT BE USED IN NORMAL EVENTS (ATM). Only
           for thread constant pool // KK TODO: u8 should be ObjectP -->
-    <primary_type symbol="THREADGROUP" datatype="U4" contenttype="THREADGROUP"
+    <primary_type symbol="THREADGROUP" datatype="U8" contenttype="THREADGROUP"
                   type="u8"
-                  sizeop="sizeof(u4)"/>
+                  sizeop="sizeof(u8)"/>
 
     <!-- FRAMETYPE enum -->
-    <primary_type symbol="FRAMETYPE" datatype="U1" contenttype="FRAMETYPE"
-                  type="u1" sizeop="sizeof(u1)"/>
+    <primary_type symbol="FRAMETYPE" datatype="U8" contenttype="FRAMETYPE"
+                  type="u8" sizeop="sizeof(u8)"/>
 
     <!-- THREADSTATE enum -->
-    <primary_type symbol="THREADSTATE" datatype="U2" contenttype="THREADSTATE"
-                  type="u2" sizeop="sizeof(u2)"/>
+    <primary_type symbol="THREADSTATE" datatype="U8" contenttype="THREADSTATE"
+                  type="u8" sizeop="sizeof(u8)"/>
 
     <!-- GCName -->
-    <primary_type symbol="GCNAME" datatype="U1" contenttype="GCNAME"
-                  type="u1" sizeop="sizeof(u1)" />
+    <primary_type symbol="GCNAME" datatype="U8" contenttype="GCNAME"
+                  type="u8" sizeop="sizeof(u8)" />
 
     <!-- GCCAUSE -->
-    <primary_type symbol="GCCAUSE" datatype="U2" contenttype="GCCAUSE"
-                  type="u2" sizeop="sizeof(u2)" />
+    <primary_type symbol="GCCAUSE" datatype="U8" contenttype="GCCAUSE"
+                  type="u8" sizeop="sizeof(u8)" />
 
     <!-- GCWHEN -->
-    <primary_type symbol="GCWHEN" datatype="U1" contenttype="GCWHEN"
-                  type="u1" sizeop="sizeof(u1)" />
+    <primary_type symbol="GCWHEN" datatype="U8" contenttype="GCWHEN"
+                  type="u8" sizeop="sizeof(u8)" />
 
     <!-- G1HEAPREGIONTYPE -->
-    <primary_type symbol="G1HEAPREGIONTYPE" datatype="U1" contenttype="G1HEAPREGIONTYPE"
-                  type="u1" sizeop="sizeof(u1)" />
+    <primary_type symbol="G1HEAPREGIONTYPE" datatype="U8" contenttype="G1HEAPREGIONTYPE"
+                  type="u8" sizeop="sizeof(u8)" />
 
     <!-- G1YCType -->
-    <primary_type symbol="G1YCTYPE" datatype="U1" contenttype="G1YCTYPE"
-                  type="u1" sizeop="sizeof(u1)" />
+    <primary_type symbol="G1YCTYPE" datatype="U8" contenttype="G1YCTYPE"
+                  type="u8" sizeop="sizeof(u8)" />
 
     <!-- GCTHRESHOLDUPDATER -->
-    <primary_type symbol="GCTHRESHOLDUPDATER" datatype="U1" contenttype="GCTHRESHOLDUPDATER"
-                  type="u1" sizeop="sizeof(u1)" />
+    <primary_type symbol="GCTHRESHOLDUPDATER" datatype="U8" contenttype="GCTHRESHOLDUPDATER"
+                  type="u8" sizeop="sizeof(u8)" />
 
     <!-- REFERENCETYPE -->
-    <primary_type symbol="REFERENCETYPE" datatype="U1"
-                  contenttype="REFERENCETYPE" type="u1" sizeop="sizeof(u1)" />
+    <primary_type symbol="REFERENCETYPE" datatype="U8"
+                  contenttype="REFERENCETYPE" type="u8" sizeop="sizeof(u8)" />
 
     <!-- METADATATYPE -->
-    <primary_type symbol="METADATATYPE" datatype="U1"
-                  contenttype="METADATATYPE" type="u1" sizeop="sizeof(u1)" />
+    <primary_type symbol="METADATATYPE" datatype="U8"
+                  contenttype="METADATATYPE" type="u8" sizeop="sizeof(u8)" />
 
     <!-- METADATAOBJTYPE -->
-    <primary_type symbol="METASPACEOBJTYPE" datatype="U1"
-                  contenttype="METASPACEOBJTYPE" type="u1" sizeop="sizeof(u1)" />
+    <primary_type symbol="METASPACEOBJTYPE" datatype="U8"
+                  contenttype="METASPACEOBJTYPE" type="u8" sizeop="sizeof(u8)" />
 
     <!-- NARROWOOPMODE -->
-    <primary_type symbol="NARROWOOPMODE" datatype="U1"
-                  contenttype="NARROWOOPMODE" type="u1" sizeop="sizeof(u1)" />
+    <primary_type symbol="NARROWOOPMODE" datatype="U8"
+                  contenttype="NARROWOOPMODE" type="u8" sizeop="sizeof(u8)" />
 
     <!-- COMPILERPHASETYPE -->
-    <primary_type symbol="COMPILERPHASETYPE" datatype="U1"
-                  contenttype="COMPILERPHASETYPE" type="u1" sizeop="sizeof(u1)" />
+    <primary_type symbol="COMPILERPHASETYPE" datatype="U8"
+                  contenttype="COMPILERPHASETYPE" type="u8" sizeop="sizeof(u8)" />
 
     <!-- VMOPERATIONTYPE -->
-    <primary_type symbol="VMOPERATIONTYPE" datatype="U2" contenttype="VMOPERATIONTYPE"
-                  type="u2" sizeop="sizeof(u2)" />
+    <primary_type symbol="VMOPERATIONTYPE" datatype="U8" contenttype="VMOPERATIONTYPE"
+                  type="u8" sizeop="sizeof(u8)" />
                   
     <!-- FLAGVALUEORIGIN -->
-    <primary_type symbol="FLAGVALUEORIGIN" datatype="U1"
-                  contenttype="FLAGVALUEORIGIN" type="u1" sizeop="sizeof(u1)" />
+    <primary_type symbol="FLAGVALUEORIGIN" datatype="U8"
+                  contenttype="FLAGVALUEORIGIN" type="u8" sizeop="sizeof(u8)" />
                   
     <!-- CODEBLOBTYPE -->
-    <primary_type symbol="CODEBLOBTYPE" datatype="U1"
-                  contenttype="CODEBLOBTYPE" type="u1" sizeop="sizeof(u1)" />
+    <primary_type symbol="CODEBLOBTYPE" datatype="U8"
+                  contenttype="CODEBLOBTYPE" type="u8" sizeop="sizeof(u8)" />
 
     <!-- INFLATECAUSE -->
-    <primary_type symbol="INFLATECAUSE" datatype="U1"
-                  contenttype="INFLATECAUSE" type="u1" sizeop="sizeof(u1)" />
+    <primary_type symbol="INFLATECAUSE" datatype="U8"
+                  contenttype="INFLATECAUSE" type="u8" sizeop="sizeof(u8)" />
   </primary_types>
 </types>
--- a/hotspot/src/share/vm/utilities/debug.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/utilities/debug.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -51,9 +51,14 @@
 #include "services/heapDumper.hpp"
 #include "utilities/defaultStream.hpp"
 #include "utilities/events.hpp"
+#include "utilities/macros.hpp"
 #include "utilities/top.hpp"
 #include "utilities/vmError.hpp"
 
+#if INCLUDE_TRACE
+#include "trace/tracing.hpp"
+#endif
+
 #ifndef ASSERT
 #  ifdef _DEBUG
    // NOTE: don't turn the lines below into a comment -- if you're getting
@@ -280,6 +285,12 @@
    exit(2);
 }
 
+static void notify_tracing() {
+#if INCLUDE_TRACE
+  Tracing::on_vm_error(true);
+#endif
+}
+
 void report_insufficient_metaspace(size_t required_size) {
   warning("\nThe MaxMetaspaceSize of " SIZE_FORMAT " bytes is not large enough.\n"
           "Either don't specify the -XX:MaxMetaspaceSize=<size>\n"
@@ -302,6 +313,8 @@
       HeapDumper::dump_heap_from_oome();
     }
 
+    notify_tracing();
+
     if (OnOutOfMemoryError && OnOutOfMemoryError[0]) {
       VMError::report_java_out_of_memory(message);
     }
--- a/hotspot/src/share/vm/utilities/hashtable.cpp	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/src/share/vm/utilities/hashtable.cpp	Mon Mar 07 09:34:29 2016 +0100
@@ -383,4 +383,9 @@
 template class BasicHashtable<mtSymbol>;
 template class BasicHashtable<mtCode>;
 template class BasicHashtable<mtInternal>;
+#if INCLUDE_TRACE
+template class Hashtable<Symbol*, mtTracing>;
+template class HashtableEntry<Symbol*, mtTracing>;
+template class BasicHashtable<mtTracing>;
+#endif
 template class BasicHashtable<mtCompiler>;
--- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2CompiledTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2CompiledTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,9 +24,10 @@
 /*
  * @test
  * @library /test/lib /testlibrary /
+ * @modules java.base/jdk.internal.org.objectweb.asm
  * @build compiler.calls.common.InvokeDynamic
  * @build compiler.calls.common.InvokeDynamicPatcher
- * @run driver compiler.calls.common.InvokeDynamicPatcher
+ * @run main compiler.calls.common.InvokeDynamicPatcher
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
--- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2InterpretedTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2InterpretedTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,9 +24,10 @@
 /*
  * @test
  * @library /test/lib /testlibrary /
+ * @modules java.base/jdk.internal.org.objectweb.asm
  * @build compiler.calls.common.InvokeDynamic
  * @build compiler.calls.common.InvokeDynamicPatcher
- * @run driver compiler.calls.common.InvokeDynamicPatcher
+ * @run main compiler.calls.common.InvokeDynamicPatcher
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
--- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2NativeTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2NativeTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,9 +24,10 @@
 /*
  * @test
  * @library /test/lib /testlibrary /
+ * @modules java.base/jdk.internal.org.objectweb.asm
  * @build compiler.calls.common.InvokeDynamic
  * @build compiler.calls.common.InvokeDynamicPatcher
- * @run driver compiler.calls.common.InvokeDynamicPatcher
+ * @run main compiler.calls.common.InvokeDynamicPatcher
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
--- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2CompiledTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2CompiledTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,9 +24,10 @@
 /*
  * @test
  * @library /test/lib /testlibrary /
+ * @modules java.base/jdk.internal.org.objectweb.asm
  * @build compiler.calls.common.InvokeDynamic
  * @build compiler.calls.common.InvokeDynamicPatcher
- * @run driver compiler.calls.common.InvokeDynamicPatcher
+ * @run main compiler.calls.common.InvokeDynamicPatcher
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
--- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2InterpretedTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2InterpretedTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,9 +24,10 @@
 /*
  * @test
  * @library /test/lib /testlibrary /
+ * @modules java.base/jdk.internal.org.objectweb.asm
  * @build compiler.calls.common.InvokeDynamic
  * @build compiler.calls.common.InvokeDynamicPatcher
- * @run driver compiler.calls.common.InvokeDynamicPatcher
+ * @run main compiler.calls.common.InvokeDynamicPatcher
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
--- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2NativeTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2NativeTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,9 +24,10 @@
 /*
  * @test
  * @library /test/lib /testlibrary /
+ * @modules java.base/jdk.internal.org.objectweb.asm
  * @build compiler.calls.common.InvokeDynamic
  * @build compiler.calls.common.InvokeDynamicPatcher
- * @run driver compiler.calls.common.InvokeDynamicPatcher
+ * @run main compiler.calls.common.InvokeDynamicPatcher
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *    sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
--- a/hotspot/test/compiler/codecache/jmx/PeakUsageTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/compiler/codecache/jmx/PeakUsageTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
 
 /*
  * @test PeakUsageTest
+ * @ignore 8151345
  * @library /testlibrary /test/lib
  * @modules java.base/sun.misc
  *          java.management
--- a/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeUnalignedMismatchedAccesses.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeUnalignedMismatchedAccesses.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
  * @test
  * @bug 8136473
  * @summary Mismatched stores on same slice possible with Unsafe.Put*Unaligned methods
+ * @modules java.base/jdk.internal.misc
  * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation TestUnsafeUnalignedMismatchedAccesses
  * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:+UnlockDiagnosticVMOptions -XX:-UseUnalignedAccesses TestUnsafeUnalignedMismatchedAccesses
  *
--- a/hotspot/test/compiler/jvmci/JVM_GetJVMCIRuntimeTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/compiler/jvmci/JVM_GetJVMCIRuntimeTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @bug 8136421
  * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
  * @library /testlibrary /
+ * @modules jdk.vm.ci/jdk.vm.ci.runtime
  * @run main/othervm -XX:+UnlockExperimentalVMOptions
  *      -Dcompiler.jvmci.JVM_GetJVMCIRuntimeTest.positive=true
  *      -XX:+EnableJVMCI
--- a/hotspot/test/compiler/jvmci/code/InterpreterFrameSizeTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/compiler/jvmci/code/InterpreterFrameSizeTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -24,6 +24,14 @@
 /**
  * @test
  * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9") & os.arch != "aarch64"
+ * @modules jdk.vm.ci/jdk.vm.ci.hotspot
+ *          jdk.vm.ci/jdk.vm.ci.code
+ *          jdk.vm.ci/jdk.vm.ci.code.site
+ *          jdk.vm.ci/jdk.vm.ci.meta
+ *          jdk.vm.ci/jdk.vm.ci.runtime
+ *          jdk.vm.ci/jdk.vm.ci.common
+ *          jdk.vm.ci/jdk.vm.ci.amd64
+ *          jdk.vm.ci/jdk.vm.ci.sparc
  * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java
  * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI compiler.jvmci.code.InterpreterFrameSizeTest
  */
--- a/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8136421
  * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
  * @library /testlibrary /
+ * @modules jdk.vm.ci/jdk.vm.ci.hotspot
+ *          jdk.vm.ci/jdk.vm.ci.runtime
  * @run main/othervm -XX:+UnlockExperimentalVMOptions
  *      -Dcompiler.jvmci.compilerToVM.JVM_RegisterJVMCINatives.positive=true
  *      -XX:+EnableJVMCI
--- a/hotspot/test/compiler/jvmci/errors/TestInvalidCompilationResult.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/compiler/jvmci/errors/TestInvalidCompilationResult.java	Mon Mar 07 09:34:29 2016 +0100
@@ -24,7 +24,14 @@
 /**
  * @test
  * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @modules jdk.vm.ci/jdk.vm.ci.hotspot
+ *          jdk.vm.ci/jdk.vm.ci.code
+ *          jdk.vm.ci/jdk.vm.ci.code.site
+ *          jdk.vm.ci/jdk.vm.ci.meta
+ *          jdk.vm.ci/jdk.vm.ci.runtime
+ *          jdk.vm.ci/jdk.vm.ci.common
  * @compile CodeInstallerTest.java
+ * @build compiler.jvmci.errors.TestInvalidCompilationResult
  * @run junit/othervm -da:jdk.vm.ci... -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI compiler.jvmci.errors.TestInvalidCompilationResult
  */
 
--- a/hotspot/test/compiler/jvmci/errors/TestInvalidDebugInfo.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/compiler/jvmci/errors/TestInvalidDebugInfo.java	Mon Mar 07 09:34:29 2016 +0100
@@ -24,6 +24,12 @@
 /**
  * @test
  * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @modules jdk.vm.ci/jdk.vm.ci.hotspot
+ *          jdk.vm.ci/jdk.vm.ci.code
+ *          jdk.vm.ci/jdk.vm.ci.code.site
+ *          jdk.vm.ci/jdk.vm.ci.meta
+ *          jdk.vm.ci/jdk.vm.ci.runtime
+ *          jdk.vm.ci/jdk.vm.ci.common
  * @compile CodeInstallerTest.java
  * @run junit/othervm -da:jdk.vm.ci... -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI compiler.jvmci.errors.TestInvalidDebugInfo
  */
--- a/hotspot/test/compiler/jvmci/errors/TestInvalidOopMap.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/compiler/jvmci/errors/TestInvalidOopMap.java	Mon Mar 07 09:34:29 2016 +0100
@@ -24,6 +24,12 @@
 /**
  * @test
  * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @modules jdk.vm.ci/jdk.vm.ci.hotspot
+ *          jdk.vm.ci/jdk.vm.ci.code
+ *          jdk.vm.ci/jdk.vm.ci.code.site
+ *          jdk.vm.ci/jdk.vm.ci.meta
+ *          jdk.vm.ci/jdk.vm.ci.runtime
+ *          jdk.vm.ci/jdk.vm.ci.common
  * @compile CodeInstallerTest.java
  * @run junit/othervm -da:jdk.vm.ci... -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI compiler.jvmci.errors.TestInvalidOopMap
  */
--- a/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,10 @@
  * @bug 8136421
  * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
  * @library /testlibrary /
+ * @modules jdk.vm.ci/jdk.vm.ci.hotspot
+ *          jdk.vm.ci/jdk.vm.ci.code
+ *          jdk.vm.ci/jdk.vm.ci.meta
+ *          jdk.vm.ci/jdk.vm.ci.runtime
  * @build compiler.jvmci.common.JVMCIHelpers
  *        compiler.jvmci.events.JvmciShutdownEventListener
  *        compiler.jvmci.events.JvmciShutdownEventTest
@@ -36,10 +40,11 @@
  *     compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
  *     compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
  *     compiler.jvmci.events.JvmciShutdownEventListener
- * @run driver
- *     compiler.jvmci.events.JvmciShutdownEventTest
+ * @run main/othervm compiler.jvmci.events.JvmciShutdownEventTest
  */
 
+ // as soon as CODETOOLS-7901589 fixed, '@run main/othervm' at L43 should be replaced w/ '@run driver'
+
 package compiler.jvmci.events;
 
 import jdk.test.lib.ExitCode;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveConcreteMethodTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveConcreteMethodTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,8 @@
 /**
  * @test
  * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @modules jdk.vm.ci/jdk.vm.ci.meta
+ *          jdk.vm.ci/jdk.vm.ci.runtime
  * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.ResolvedJavaTypeResolveConcreteMethodTest
  */
 
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveMethodTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveMethodTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,8 @@
 /**
  * @test
  * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @modules jdk.vm.ci/jdk.vm.ci.meta
+ *          jdk.vm.ci/jdk.vm.ci.runtime
  * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.ResolvedJavaTypeResolveMethodTest
  */
 
--- a/hotspot/test/gc/g1/TestGCLogMessages.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/gc/g1/TestGCLogMessages.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test TestGCLogMessages
- * @bug 8035406 8027295 8035398 8019342 8027959 8048179 8027962 8069330
+ * @bug 8035406 8027295 8035398 8019342 8027959 8048179 8027962 8069330 8076463 8150630
  * @summary Ensure the output for a minor GC with G1
  * includes the expected necessary messages.
  * @key gc
@@ -38,10 +38,24 @@
 public class TestGCLogMessages {
 
     private enum Level {
-        OFF, DEBUG, TRACE;
-        public boolean lessOrEqualTo(Level other) {
+        OFF(""),
+        INFO("info"),
+        DEBUG("debug"),
+        TRACE("trace");
+
+        private String logName;
+
+        Level(String logName) {
+            this.logName = logName;
+        }
+
+        public boolean lessThan(Level other) {
             return this.compareTo(other) < 0;
         }
+
+        public String toString() {
+            return logName;
+        }
     }
 
     private class LogMessageWithLevel {
@@ -56,44 +70,48 @@
 
     private LogMessageWithLevel allLogMessages[] = new LogMessageWithLevel[] {
         // Update RS
-        new LogMessageWithLevel("Scan HCC", Level.DEBUG),
+        new LogMessageWithLevel("Scan HCC", Level.TRACE),
         // Ext Root Scan
-        new LogMessageWithLevel("Thread Roots:", Level.DEBUG),
-        new LogMessageWithLevel("StringTable Roots:", Level.DEBUG),
-        new LogMessageWithLevel("Universe Roots:", Level.DEBUG),
-        new LogMessageWithLevel("JNI Handles Roots:", Level.DEBUG),
-        new LogMessageWithLevel("ObjectSynchronizer Roots:", Level.DEBUG),
-        new LogMessageWithLevel("FlatProfiler Roots", Level.DEBUG),
-        new LogMessageWithLevel("Management Roots", Level.DEBUG),
-        new LogMessageWithLevel("SystemDictionary Roots", Level.DEBUG),
-        new LogMessageWithLevel("CLDG Roots", Level.DEBUG),
-        new LogMessageWithLevel("JVMTI Roots", Level.DEBUG),
-        new LogMessageWithLevel("SATB Filtering", Level.DEBUG),
-        new LogMessageWithLevel("CM RefProcessor Roots", Level.DEBUG),
-        new LogMessageWithLevel("Wait For Strong CLD", Level.DEBUG),
-        new LogMessageWithLevel("Weak CLD Roots", Level.DEBUG),
+        new LogMessageWithLevel("Thread Roots", Level.TRACE),
+        new LogMessageWithLevel("StringTable Roots", Level.TRACE),
+        new LogMessageWithLevel("Universe Roots", Level.TRACE),
+        new LogMessageWithLevel("JNI Handles Roots", Level.TRACE),
+        new LogMessageWithLevel("ObjectSynchronizer Roots", Level.TRACE),
+        new LogMessageWithLevel("FlatProfiler Roots", Level.TRACE),
+        new LogMessageWithLevel("Management Roots", Level.TRACE),
+        new LogMessageWithLevel("SystemDictionary Roots", Level.TRACE),
+        new LogMessageWithLevel("CLDG Roots", Level.TRACE),
+        new LogMessageWithLevel("JVMTI Roots", Level.TRACE),
+        new LogMessageWithLevel("SATB Filtering", Level.TRACE),
+        new LogMessageWithLevel("CM RefProcessor Roots", Level.TRACE),
+        new LogMessageWithLevel("Wait For Strong CLD", Level.TRACE),
+        new LogMessageWithLevel("Weak CLD Roots", Level.TRACE),
         // Redirty Cards
         new LogMessageWithLevel("Redirty Cards", Level.DEBUG),
-        new LogMessageWithLevel("Parallel Redirty", Level.DEBUG),
-        new LogMessageWithLevel("Redirtied Cards", Level.DEBUG),
+        new LogMessageWithLevel("Parallel Redirty", Level.TRACE),
+        new LogMessageWithLevel("Redirtied Cards", Level.TRACE),
         // Misc Top-level
-        new LogMessageWithLevel("Code Root Purge", Level.DEBUG),
-        new LogMessageWithLevel("String Dedup Fixup", Level.DEBUG),
-        new LogMessageWithLevel("Expand Heap After Collection", Level.DEBUG),
+        new LogMessageWithLevel("Code Roots Purge", Level.DEBUG),
+        new LogMessageWithLevel("String Dedup Fixup", Level.INFO),
+        new LogMessageWithLevel("Expand Heap After Collection", Level.INFO),
         // Free CSet
-        new LogMessageWithLevel("Young Free CSet", Level.TRACE),
-        new LogMessageWithLevel("Non-Young Free CSet", Level.TRACE),
+        new LogMessageWithLevel("Young Free Collection Set", Level.DEBUG),
+        new LogMessageWithLevel("Non-Young Free Collection Set", Level.DEBUG),
         // Humongous Eager Reclaim
         new LogMessageWithLevel("Humongous Reclaim", Level.DEBUG),
         new LogMessageWithLevel("Humongous Register", Level.DEBUG),
+        // Preserve CM Referents
+        new LogMessageWithLevel("Preserve CM Refs", Level.DEBUG),
+        // Merge PSS
+        new LogMessageWithLevel("Merge Per-Thread State", Level.INFO),
     };
 
     void checkMessagesAtLevel(OutputAnalyzer output, LogMessageWithLevel messages[], Level level) throws Exception {
         for (LogMessageWithLevel l : messages) {
-            if (level.lessOrEqualTo(l.level)) {
+            if (level.lessThan(l.level)) {
                 output.shouldNotContain(l.message);
             } else {
-                output.shouldContain(l.message);
+                output.shouldMatch("\\[" + l.level + ".*" + l.message);
             }
         }
     }
--- a/hotspot/test/gc/g1/TestPLABOutput.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/gc/g1/TestPLABOutput.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,7 +65,7 @@
 
         System.out.println(output.getStdout());
 
-        String pattern = ".*GC\\(0\\) .*allocated = (\\d+).*";
+        String pattern = ".*GC\\(0\\) .*allocated: (\\d+).*";
         Pattern r = Pattern.compile(pattern);
         Matcher m = r.matcher(output.getStdout());
 
--- a/hotspot/test/gc/g1/plab/TestPLABPromotion.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/gc/g1/plab/TestPLABPromotion.java	Mon Mar 07 09:34:29 2016 +0100
@@ -23,7 +23,7 @@
 
  /*
  * @test TestPLABPromotion
- * @bug 8141278
+ * @bug 8141278 8141141
  * @summary Test PLAB promotion
  * @requires vm.gc=="G1" | vm.gc=="null"
  * @requires vm.opt.FlightRecorder != true
@@ -130,16 +130,15 @@
         long plabAllocatedOld;
         long directAllocatedOld;
         long memAllocated = testCase.getMemToFill();
-        long wordSize = Platform.is32bit() ? 4l : 8l;
         LogParser logParser = new LogParser(output);
 
         Map<String, Long> survivorStats = getPlabStats(logParser, LogParser.ReportType.SURVIVOR_STATS, GC_ID_SURVIVOR_STATS);
         Map<String, Long> oldStats = getPlabStats(logParser, LogParser.ReportType.OLD_STATS, GC_ID_OLD_STATS);
 
-        plabAllocatedSurvivor = wordSize * survivorStats.get("used");
-        directAllocatedSurvivor = wordSize * survivorStats.get("direct_allocated");
-        plabAllocatedOld = wordSize * oldStats.get("used");
-        directAllocatedOld = wordSize * oldStats.get("direct_allocated");
+        plabAllocatedSurvivor = survivorStats.get("used");
+        directAllocatedSurvivor = survivorStats.get("direct allocated");
+        plabAllocatedOld = oldStats.get("used");
+        directAllocatedOld = oldStats.get("direct allocated");
 
         System.out.printf("Survivor PLAB allocated:%17d Direct allocated: %17d Mem consumed:%17d%n", plabAllocatedSurvivor, directAllocatedSurvivor, memAllocated);
         System.out.printf("Old      PLAB allocated:%17d Direct allocated: %17d Mem consumed:%17d%n", plabAllocatedOld, directAllocatedOld, memAllocated);
--- a/hotspot/test/gc/g1/plab/TestPLABResize.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/gc/g1/plab/TestPLABResize.java	Mon Mar 07 09:34:29 2016 +0100
@@ -23,7 +23,7 @@
 
  /*
  * @test TestPLABResize
- * @bug 8141278
+ * @bug 8141278 8141141
  * @summary Test for PLAB resizing
  * @requires vm.gc=="G1" | vm.gc=="null"
  * @requires vm.opt.FlightRecorder != true
@@ -117,7 +117,7 @@
                 .map(item -> {
                     return item.getValue()
                             .get(LogParser.ReportType.SURVIVOR_STATS)
-                            .get("desired_plab_sz");
+                            .get("actual");
                 })
                 .collect(Collectors.toCollection(ArrayList::new));
 
--- a/hotspot/test/gc/g1/plab/lib/LogParser.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/gc/g1/plab/lib/LogParser.java	Mon Mar 07 09:34:29 2016 +0100
@@ -35,14 +35,12 @@
  *
  * Typical GC log with PLAB statistics (options - -Xlog:gc=debug,gc+plab=debug) looks like:
  *
- * [2,244s][info   ][gc     ] GC(30) Concurrent Mark abort
- * [2,245s][debug  ][gc,plab] GC(33)  (allocated = 1 wasted = 0 unused = 0 used = 1 undo_waste = 0 region_end_waste = 0 regions filled = 0 direct_allocated = 0 failure_used = 0 failure_waste = 0)  (plab_sz = 0 desired_plab_sz = 258)
- * [2,245s][debug  ][gc,plab] GC(33)  (allocated = 1 wasted = 0 unused = 0 used = 1 undo_waste = 0 region_end_waste = 0 regions filled = 0 direct_allocated = 0 failure_used = 0 failure_waste = 0)  (plab_sz = 0 desired_plab_sz = 258)
- * [2,245s][info   ][gc     ] GC(33) Pause Young (G1 Evacuation Pause) 127M->127M(128M) (2,244s, 2,245s) 0,899ms
- * [2,246s][debug  ][gc,plab] GC(34)  (allocated = 1 wasted = 0 unused = 0 used = 1 undo_waste = 0 region_end_waste = 0 regions filled = 0 direct_allocated = 0 failure_used = 0 failure_waste = 0)  (plab_sz = 0 desired_plab_sz = 258)
- * [2,246s][debug  ][gc,plab] GC(34)  (allocated = 1 wasted = 0 unused = 0 used = 1 undo_waste = 0 region_end_waste = 0 regions filled = 0 direct_allocated = 0 failure_used = 0 failure_waste = 0)  (plab_sz = 0 desired_plab_sz = 258)
- * [2,246s][info   ][gc     ] GC(34) Pause Initial Mark (G1 Evacuation Pause) 127M->127M(128M) (2,245s, 2,246s) 0,907ms
-
+ * [0.330s][debug][gc,plab  ] GC(0) Young PLAB allocation: allocated: 1825632B, wasted: 29424B, unused: 2320B, used: 1793888B, undo waste: 0B,
+ * [0.330s][debug][gc,plab  ] GC(0) Young other allocation: region end waste: 0B, regions filled: 2, direct allocated: 271520B, failure used: 0B, failure wasted: 0B
+ * [0.330s][debug][gc,plab  ] GC(0) Young sizing: calculated: 358776B, actual: 358776B
+ * [0.330s][debug][gc,plab  ] GC(0) Old PLAB allocation: allocated: 427248B, wasted: 592B, unused: 368584B, used: 58072B, undo waste: 0B,
+ * [0.330s][debug][gc,plab  ] GC(0) Old other allocation: region end waste: 0B, regions filled: 1, direct allocated: 41704B, failure used: 0B, failure wasted: 0B
+ * [0.330s][debug][gc,plab  ] GC(0) Old sizing: calculated: 11608B, actual: 11608B
  */
 final public class LogParser {
 
@@ -53,7 +51,6 @@
      * Type of parsed log element.
      */
     public static enum ReportType {
-
         SURVIVOR_STATS,
         OLD_STATS
     }
@@ -64,8 +61,8 @@
 
     // GC ID
     private static final Pattern GC_ID_PATTERN = Pattern.compile("\\[gc,plab\\s*\\] GC\\((\\d+)\\)");
-    // Pattern for extraction pair <name>=<numeric value>
-    private static final Pattern PAIRS_PATTERN = Pattern.compile("\\w+\\s+=\\s+\\d+");
+    // Pattern for extraction pair <name>: <numeric value>
+    private static final Pattern PAIRS_PATTERN = Pattern.compile("\\w* \\w+:\\s+\\d+");
 
     /**
      * Construct LogParser Object
@@ -108,24 +105,29 @@
                 if (matcher.find()) {
                     Map<ReportType,Map<String, Long>> oneReportItem;
                     ReportType reportType;
-                    // Second line in log is statistics for Old PLAB allocation
-                    if ( !allocationStatistics.containsKey(gc_id.get()) ) {
-                        oneReportItem = new EnumMap<>(ReportType.class);
+
+                    if (!allocationStatistics.containsKey(gc_id.get())) {
+                      allocationStatistics.put(gc_id.get(), new EnumMap<>(ReportType.class));
+                    }
+
+                    if ( line.contains("Young") ) {
                         reportType = ReportType.SURVIVOR_STATS;
-                        allocationStatistics.put(gc_id.get(), oneReportItem);
                     } else {
-                        oneReportItem = allocationStatistics.get(gc_id.get());
                         reportType = ReportType.OLD_STATS;
                     }
 
+                    oneReportItem = allocationStatistics.get(gc_id.get());
+                    if (!oneReportItem.containsKey(reportType)) {
+                      oneReportItem.put(reportType,new HashMap<String, Long>());
+                    }
+
                     // Extract all pairs from log.
-                    HashMap<String, Long> plabStats = new HashMap<>();
+                    Map<String, Long> plabStats = oneReportItem.get(reportType);
                     do {
                         String pair = matcher.group();
-                        String[] nameValue = pair.replaceAll(" ", "").split("=");
-                        plabStats.put(nameValue[0], Long.parseLong(nameValue[1]));
+                        String[] nameValue = pair.replaceAll(": ", ":").split(":");
+                        plabStats.put(nameValue[0].trim(), Long.parseLong(nameValue[1]));
                     } while (matcher.find());
-                    oneReportItem.put(reportType,plabStats);
                 }
             }
         }
--- a/hotspot/test/native_sanity/JniVersion.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/native_sanity/JniVersion.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,12 +27,12 @@
  */
 public class JniVersion {
 
-    public static final int JNI_VERSION_1_8 = 0x00010008;
+    public static final int JNI_VERSION_9 = 0x00090000;
 
     public static void main(String... args) throws Exception {
         System.loadLibrary("JniVersion");
         int res = getJniVersion();
-        if (res < JNI_VERSION_1_8) {
+        if (res != JNI_VERSION_9) {
             throw new Exception("Unexpected value returned from getJniVersion(): 0x" + Integer.toHexString(res));
         }
     }
--- a/hotspot/test/runtime/RedefineTests/RedefineRunningMethodsWithResolutionErrors.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/runtime/RedefineTests/RedefineRunningMethodsWithResolutionErrors.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,8 +26,9 @@
  * @bug 8076110
  * @summary Redefine running methods that have cached resolution errors
  * @library /testlibrary
- * @modules java.instrument
- *          java.base/jdk.internal.org.objectweb.asm
+ * @modules java.base/jdk.internal.org.objectweb.asm
+ *          java.instrument
+ *          jdk.jartool/sun.tools.jar
  * @build RedefineClassHelper
  * @run main RedefineClassHelper
  * @run main/othervm -javaagent:redefineagent.jar -XX:TraceRedefineClasses=0x600 RedefineRunningMethodsWithResolutionErrors
--- a/hotspot/test/runtime/ReservedStack/ReservedStackTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/runtime/ReservedStack/ReservedStackTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 /*
  * @test ReservedStackTest
  * @library /testlibrary
+ * @modules java.base/jdk.internal.vm.annotation
  * @build jdk.test.lib.*
  * @run main/othervm -XX:-Inline -XX:CompileCommand=exclude,java/util/concurrent/locks/AbstractOwnableSynchronizer.setExclusiveOwnerThread ReservedStackTest
  */
--- a/hotspot/test/runtime/SharedArchiveFile/LimitSharedSizes.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/runtime/SharedArchiveFile/LimitSharedSizes.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
  * @library /testlibrary /runtime/CommandLine/OptionsValidation/common
  * @modules java.base/sun.misc
  *          java.management
+ *          jdk.attach/sun.tools.attach
  * @run main LimitSharedSizes
  */
 
--- a/hotspot/test/runtime/contended/Basic.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/runtime/contended/Basic.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@
  * @test
  * @bug     8003985
  * @summary Support Contended Annotation - JEP 142
- * @modules java.base/sun.misc
+ * @modules java.base/jdk.internal.vm.annotation
  * @run main/othervm -XX:-RestrictContended Basic
  */
 public class Basic {
--- a/hotspot/test/runtime/contended/DefaultValue.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/runtime/contended/DefaultValue.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
  * @bug     8014509
  * @summary \@Contended: explicit default value behaves differently from the implicit value
  *
- * @modules java.base/sun.misc
+ * @modules java.base/jdk.internal.vm.annotation
  * @run main/othervm -XX:-RestrictContended DefaultValue
  */
 public class DefaultValue {
--- a/hotspot/test/runtime/contended/HasNonStatic.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/runtime/contended/HasNonStatic.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
  * @bug     8015270
  * @summary \@Contended: fix multiple issues in the layout code
  *
- * @modules java.base/sun.misc
+ * @modules java.base/jdk.internal.vm.annotation
  * @run main/othervm -XX:-RestrictContended HasNonStatic
  */
 public class HasNonStatic {
--- a/hotspot/test/runtime/contended/Inheritance1.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/runtime/contended/Inheritance1.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
  * @bug     8012939
  * @summary \@Contended doesn't work correctly with inheritance
  *
- * @modules java.base/sun.misc
+ * @modules java.base/jdk.internal.vm.annotation
  * @run main/othervm -XX:-RestrictContended Inheritance1
  */
 public class Inheritance1 {
--- a/hotspot/test/runtime/contended/OopMaps.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/runtime/contended/OopMaps.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,7 +44,7 @@
  * @bug     8015493
  * @summary \@Contended: fix multiple issues in the layout code
  *
- * @modules java.base/sun.misc
+ * @modules java.base/jdk.internal.vm.annotation
  * @run main/othervm -XX:-RestrictContended -XX:ContendedPaddingWidth=128 -Xmx128m OopMaps
  */
 public class OopMaps {
--- a/hotspot/test/runtime/contended/OopMapsSameGroup.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/runtime/contended/OopMapsSameGroup.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
  * @bug     8015272
  * @summary \@Contended within the same group to use the same oop map
  *
- * @modules java.base/sun.misc
+ * @modules java.base/jdk.internal.vm.annotation
  * @run main/othervm -XX:-RestrictContended -XX:ContendedPaddingWidth=128 -Xmx128m OopMapsSameGroup
  */
 public class OopMapsSameGroup {
--- a/hotspot/test/runtime/lambda-features/TestStaticandInstance.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/runtime/lambda-features/TestStaticandInstance.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
  * @test
  * @bug 8087342
  * @summary Test linkresolver search static, instance and overpass duplicates
+ * @modules java.base/jdk.internal.org.objectweb.asm
  * @run main/othervm -Xverify:none TestStaticandInstance
  */
 
--- a/hotspot/test/runtime/logging/ItablesTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/runtime/logging/ItablesTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -49,7 +49,6 @@
             output.shouldContain("invokespecial resolved method: caller-class:ClassB");
             output.shouldContain("invokespecial selected method: resolved-class:ClassB");
             output.shouldContain("invokeinterface selected method: receiver-class");
-            output.shouldContain("Resolving: klass: ");
             output.shouldHaveExitValue(0);
 
             pb = ProcessTools.createJavaProcessBuilder("-Xlog:itables=trace", "ItablesVtableTest");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/logging/ProtectionDomainVerificationTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,62 @@
+/*
+ * 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 ProtectionDomainVerificationTest
+ * @bug 8149064
+ * @library /testlibrary
+ * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.Platform jdk.test.lib.ProcessTools
+ * @run driver ProtectionDomainVerificationTest
+ */
+
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.Platform;
+import jdk.test.lib.ProcessTools;
+
+public class ProtectionDomainVerificationTest {
+
+    public static void main(String... args) throws Exception {
+
+        // -Xlog:protectiondomain=trace
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:protectiondomain=trace",
+                                                                  "-Xmx64m",
+                                                                  Hello.class.getName());
+        OutputAnalyzer out = new OutputAnalyzer(pb.start());
+        out.shouldContain("[protectiondomain] Checking package access");
+        out.shouldContain("[protectiondomain] pd set count = #");
+
+        // -Xlog:protectiondomain=debug
+        pb = ProcessTools.createJavaProcessBuilder("-Xlog:protectiondomain=debug",
+                                                                  "-Xmx64m",
+                                                                  Hello.class.getName());
+        out = new OutputAnalyzer(pb.start());
+        out.shouldContain("[protectiondomain] Checking package access");
+        out.shouldNotContain("pd set count = #");
+    }
+
+    public static class Hello {
+        public static void main(String[] args) {
+            System.out.print("Hello!");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/logging/ThreadLoggingTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, SAP SE 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 8149036 8150619
+ * @summary os+thread output should contain logging calls for thread start stop attaches detaches
+ * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
+ * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools
+ * @run driver ThreadLoggingTest
+ * @author Thomas Stuefe (SAP)
+ */
+
+import java.io.File;
+import java.util.Map;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.ProcessTools;
+
+public class ThreadLoggingTest {
+
+    static void analyzeOutputForInfoLevel(OutputAnalyzer output) throws Exception {
+        output.shouldContain("Thread started");
+        output.shouldContain("Thread is alive");
+        output.shouldContain("Thread finished");
+        output.shouldHaveExitValue(0);
+    }
+
+    static void analyzeOutputForDebugLevel(OutputAnalyzer output) throws Exception {
+        analyzeOutputForInfoLevel(output);
+        output.shouldContain("stack dimensions");
+        output.shouldContain("stack guard pages");
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:os+thread", "-version");
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        analyzeOutputForInfoLevel(output);
+
+        pb = ProcessTools.createJavaProcessBuilder("-Xlog:os+thread=debug", "-version");
+        output = new OutputAnalyzer(pb.start());
+        analyzeOutputForDebugLevel(output);
+
+    }
+
+}
--- a/hotspot/test/serviceability/attach/AttachSetGetFlag.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/serviceability/attach/AttachSetGetFlag.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
  *          jdk.attach/sun.tools.attach
  *          jdk.jvmstat/sun.jvmstat.monitor
  * @build jdk.test.lib.* AttachSetGetFlag
- * @run driver AttachSetGetFlag
+ * @run main AttachSetGetFlag
  */
 
 import java.io.BufferedReader;
--- a/hotspot/test/serviceability/attach/AttachWithStalePidFile.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/serviceability/attach/AttachWithStalePidFile.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
  * @bug 7162400
  * @key regression
  * @summary Regression test for attach issue where stale pid files in /tmp lead to connection issues
+ * @modules jdk.attach/sun.tools.attach
  * @library /testlibrary
  * @build jdk.test.lib.* AttachWithStalePidFileTarget
  * @run main AttachWithStalePidFile
--- a/hotspot/test/serviceability/dcmd/gc/HeapDumpAllTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/serviceability/dcmd/gc/HeapDumpAllTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -35,7 +35,7 @@
  * @build jdk.test.lib.hprof.*
  * @build jdk.test.lib.hprof.model.*
  * @build jdk.test.lib.hprof.parser.*
- * @build jdk.test.lib.hprof.utils.*
+ * @build jdk.test.lib.hprof.util.*
  * @build HeapDumpTest
  * @run testng HeapDumpAllTest
  */
--- a/hotspot/test/serviceability/dcmd/gc/HeapDumpTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/serviceability/dcmd/gc/HeapDumpTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -51,7 +51,7 @@
  * @build jdk.test.lib.hprof.*
  * @build jdk.test.lib.hprof.model.*
  * @build jdk.test.lib.hprof.parser.*
- * @build jdk.test.lib.hprof.utils.*
+ * @build jdk.test.lib.hprof.util.*
  * @run testng HeapDumpTest
  */
 public class HeapDumpTest {
--- a/hotspot/test/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -22,6 +22,10 @@
  */
 import java.io.*;
 import java.nio.file.*;
+import java.util.jar.Attributes;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
 import jdk.test.lib.*;
 import jdk.test.lib.dcmd.*;
 import org.testng.annotations.Test;
@@ -55,12 +59,7 @@
                       "'-Dtest.jdk=/path/to/jdk'.");
         }
 
-        Path libpath;
-        if (Platform.isWindows()) {
-            libpath = Paths.get(jdkPath, "bin", "instrument.dll");
-        } else {
-            libpath = Paths.get(jdkPath, "lib", Platform.getOsArch(), "libinstrument.so");
-        }
+        Path libpath = Paths.get(jdkPath, Platform.jdkLibPath(), Platform.sharedObjectName("instrument"));
 
         if (!libpath.toFile().exists()) {
             throw new FileNotFoundException(
@@ -70,31 +69,62 @@
         return libpath.toAbsolutePath().toString();
     }
 
+
+    public void createJarFileForAgent()
+      throws IOException {
+
+        final String jarName = "agent.jar";
+        final String agentClass = "SimpleJvmtiAgent";
+
+        Manifest manifest = new Manifest();
+
+        manifest.getMainAttributes().put(
+             Attributes.Name.MANIFEST_VERSION, "1.0");
+
+        manifest.getMainAttributes().put(
+             new Attributes.Name("Agent-Class"), agentClass);
+
+        JarOutputStream target = null;
+
+        try {
+            target = new
+              JarOutputStream(new FileOutputStream(jarName), manifest);
+            JarEntry entry = new JarEntry(agentClass + ".class");
+            target.putNextEntry(entry);
+            target.closeEntry();
+        } finally {
+            target.close();
+        }
+    }
+
     public void run(CommandExecutor executor)  {
         try{
-            PrintWriter pw = new PrintWriter("MANIFEST.MF");
-            pw.println("Agent-Class: SimpleJvmtiAgent");
-            pw.close();
 
-            ProcessBuilder pb = new ProcessBuilder();
-            pb.command(new String[] { JDKToolFinder.getJDKTool("jar"),
-                                      "cmf",
-                                      "MANIFEST.MF",
-                                      "agent.jar",
-                                      "SimpleJvmtiAgent.class"});
-            pb.start().waitFor();
+            createJarFileForAgent();
 
             String libpath = getLibInstrumentPath();
+            OutputAnalyzer output = null;
 
-            // Test 1: No argument
-            OutputAnalyzer output = executor.execute("JVMTI.agent_load " +
-                                                     libpath + " agent.jar");
+            // Test 1: Native agent, no arguments
+            output = executor.execute("JVMTI.agent_load " +
+                                          libpath + " agent.jar");
             output.stderrShouldBeEmpty();
 
-            // Test 2: With argument
+            // Test 2: Native agent, with arguments
+            output = executor.execute("JVMTI.agent_load " +
+                                          libpath + " \"agent.jar=foo=bar\"");
+            output.stderrShouldBeEmpty();
+
+            // Test 3: Java agent, no arguments
             output = executor.execute("JVMTI.agent_load " +
-                                      libpath + " \"agent.jar=foo=bar\"");
+                                          "agent.jar");
             output.stderrShouldBeEmpty();
+
+            // Test 4: Java agent, with arguments
+            output = executor.execute("JVMTI.agent_load " +
+                                          "\"agent.jar=foo=bar\"");
+            output.stderrShouldBeEmpty();
+
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
--- a/hotspot/test/serviceability/dcmd/jvmti/LoadJavaAgentDcmdTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +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.*;
-import jdk.test.lib.*;
-import jdk.test.lib.dcmd.*;
-import org.testng.annotations.Test;
-
-/*
- * Test to attach JVMTI java agent.
- *
- * @test
- * @bug 8147388
- * @library /testlibrary
- * @modules java.base/sun.misc
- *          java.compiler
- *          java.instrument
- *          java.management
- *          jdk.jvmstat/sun.jvmstat.monitor
- * @build ClassFileInstaller jdk.test.lib.* SimpleJvmtiAgent
- * @run main ClassFileInstaller SimpleJvmtiAgent
- * @run testng LoadJavaAgentDcmdTest
- */
-public class LoadJavaAgentDcmdTest {
-    public void run(CommandExecutor executor)  {
-        try{
-            PrintWriter pw = new PrintWriter("MANIFEST.MF");
-            pw.println("Agent-Class: SimpleJvmtiAgent");
-            pw.close();
-
-            ProcessBuilder pb = new ProcessBuilder();
-            pb.command(new String[] { JDKToolFinder.getJDKTool("jar"),
-                                      "cmf",
-                                      "MANIFEST.MF",
-                                      "agent.jar",
-                                      "SimpleJvmtiAgent.class"});
-            pb.start().waitFor();
-
-            // Test 1: No argument
-            OutputAnalyzer output = executor.execute("JVMTI.agent_load " +
-                                                     "agent.jar");
-            output.stderrShouldBeEmpty();
-
-            // Test 2: With argument
-            output = executor.execute("JVMTI.agent_load " +
-                                      "\"agent.jar=foo=bar\"");
-            output.stderrShouldBeEmpty();
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    @Test
-    public void jmx() throws Throwable {
-        run(new JMXExecutor());
-    }
-
-    @Test
-    public void cli() throws Throwable {
-        run(new PidJcmdExecutor());
-    }
-}
--- a/hotspot/test/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,7 +54,6 @@
 
 public class JMapHProfLargeHeapTest {
     private static final String HEAP_DUMP_FILE_NAME = "heap.hprof";
-    private static final String HPROF_HEADER_1_0_1 = "JAVA PROFILE 1.0.1";
     private static final String HPROF_HEADER_1_0_2 = "JAVA PROFILE 1.0.2";
     private static final long M = 1024L;
     private static final long G = 1024L * M;
@@ -79,8 +78,8 @@
             }
         }
 
-        // Small heap 22 megabytes, should create 1.0.1 file format
-        testHProfFileFormat("-Xmx1g", 22 * M, HPROF_HEADER_1_0_1);
+        // All heap dumps should create 1.0.2 file format
+        testHProfFileFormat("-Xmx1g", 22 * M, HPROF_HEADER_1_0_2);
 
         /**
          * This test was deliberately commented out since the test system lacks
--- a/hotspot/test/testlibrary/jdk/test/lib/Platform.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/testlibrary/jdk/test/lib/Platform.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -203,4 +203,31 @@
     public static boolean canAttachOSX() throws Exception {
         return userName.equals("root");
     }
+
+    /**
+     * return path to library inside jdk tree
+     */
+    public static String jdkLibPath() {
+        if (isWindows()) {
+            return "bin";
+        }
+        if (isOSX()) {
+            return "lib";
+        }
+
+        return "lib/" + getOsArch();
+    }
+
+    /**
+     * Build name of shared object according to platform rules
+     */
+    public static String sharedObjectName(String name) {
+        if (isWindows()) {
+            return name + ".dll";
+        }
+        if (isOSX()) {
+            return "lib" + name + ".dylib";
+        }
+        return "lib" + name + ".so";
+    }
 }
--- a/hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
  * @test
  * @bug 8012447
  * @library /testlibrary /test/lib /testlibrary/ctw/src
- * @modules java.base/sun.misc
+ * @modules java.base/jdk.internal.misc
  *          java.base/sun.reflect
  *          java.management
  * @build ClassFileInstaller sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar
--- a/hotspot/test/testlibrary_tests/ctw/ClassesListTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/testlibrary_tests/ctw/ClassesListTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
  * @test
  * @bug 8012447
  * @library /testlibrary /test/lib /testlibrary/ctw/src
- * @modules java.base/sun.misc
+ * @modules java.base/jdk.internal.misc
  *          java.base/sun.reflect
  *          java.management
  * @build ClassFileInstaller sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar
--- a/hotspot/test/testlibrary_tests/ctw/JarDirTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/testlibrary_tests/ctw/JarDirTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
  * @test
  * @bug 8012447
  * @library /testlibrary /test/lib /testlibrary/ctw/src
- * @modules java.base/sun.misc
+ * @modules java.base/jdk.internal.misc
  *          java.base/sun.reflect
  *          java.compiler
  *          java.management
--- a/hotspot/test/testlibrary_tests/ctw/JarsTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/hotspot/test/testlibrary_tests/ctw/JarsTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
  * @test
  * @bug 8012447
  * @library /testlibrary /test/lib /testlibrary/ctw/src
- * @modules java.base/sun.misc
+ * @modules java.base/jdk.internal.misc
  *          java.base/sun.reflect
  *          java.compiler
  *          java.management
--- a/jaxp/.hgtags	Fri Mar 04 13:16:50 2016 +0000
+++ b/jaxp/.hgtags	Mon Mar 07 09:34:29 2016 +0100
@@ -350,3 +350,4 @@
 5acf6071d4d610068a19c79e004ba8e59cf1b087 jdk-9+105
 65d615f71e81bae46dcb4d053e590582e5705879 jdk-9+106
 781b83dadcae89b8ae7545bb4044ddc62c6fa006 jdk-9+107
+3b9fa8b1491479f7ae18131a34036b58b647493e jdk-9+108
--- a/jaxws/.hgtags	Fri Mar 04 13:16:50 2016 +0000
+++ b/jaxws/.hgtags	Mon Mar 07 09:34:29 2016 +0100
@@ -353,3 +353,4 @@
 45a666c58e4c7d07638878684ad09decb3229dc9 jdk-9+105
 c072c572d14948563ef5d86e1921699b3a2396ab jdk-9+106
 fafd694e801f0f5a7c737fb08630ced3ca8f772c jdk-9+107
+513eb2e432f64f85992442da9acdfcfbb36555d9 jdk-9+108
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/Const.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/Const.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,12 +29,12 @@
  * @author Kohsuke Kawaguchi
  */
 public final class Const {
-    public static byte default_value_byte = 0;
-    public static boolean default_value_boolean = false;
-    public static char default_value_char = 0;
-    public static float default_value_float = 0;
-    public static double default_value_double = 0;
-    public static int default_value_int = 0;
-    public static long default_value_long = 0;
-    public static short default_value_short = 0;
+    public static final byte default_value_byte = 0;
+    public static final boolean default_value_boolean = false;
+    public static final char default_value_char = 0;
+    public static final float default_value_float = 0;
+    public static final double default_value_double = 0;
+    public static final int default_value_int = 0;
+    public static final long default_value_long = 0;
+    public static final short default_value_short = 0;
 }
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StructureLoader.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StructureLoader.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -231,22 +231,11 @@
     @Override
     public void childElement(UnmarshallingContext.State state, TagName arg) throws SAXException {
         ChildLoader child = childUnmarshallers.get(arg.uri,arg.local);
-        if(child==null) {
-            if ((beanInfo != null) && (beanInfo.getTypeNames() != null)) {
-                Iterator typeNamesIt = beanInfo.getTypeNames().iterator();
-                QName parentQName = null;
-                if ((typeNamesIt != null) && (typeNamesIt.hasNext()) && (catchAll == null)) {
-                    parentQName = (QName) typeNamesIt.next();
-                    String parentUri = parentQName.getNamespaceURI();
-                    child = childUnmarshallers.get(parentUri, arg.local);
-                }
-            }
-            if (child == null) {
-                child = catchAll;
-                if(child==null) {
-                    super.childElement(state,arg);
-                    return;
-                }
+        if (child == null) {
+            child = catchAll;
+            if (child==null) {
+                super.childElement(state,arg);
+                return;
             }
         }
 
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/XmlSchemaGenerator.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/XmlSchemaGenerator.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -110,6 +110,7 @@
 import com.sun.xml.internal.txw2.output.ResultFactory;
 import com.sun.xml.internal.txw2.output.XmlSerializer;
 import java.util.Collection;
+import java.util.HashSet;
 import org.xml.sax.SAXParseException;
 
 /**
@@ -436,7 +437,7 @@
 
         if(logger.isLoggable(Level.FINE)) {
             // debug logging to see what's going on.
-            logger.log(Level.FINE,"Wrigin XML Schema for "+toString(),new StackRecorder());
+            logger.log(Level.FINE,"Writing XML Schema for "+toString(),new StackRecorder());
         }
 
         // make it fool-proof
@@ -465,6 +466,8 @@
                     systemIds.put(n,output.getSystemId());
                 }
             }
+            //Clear the namespace specific set with already written classes
+            n.resetWritten();
         }
 
         // then write'em all
@@ -542,6 +545,11 @@
          */
         private boolean useMimeNs;
 
+        /**
+         * Container for already processed classes
+         */
+        private final Set<ClassInfo> written = new HashSet<ClassInfo>();
+
         public Namespace(String uri) {
             this.uri = uri;
             assert !XmlSchemaGenerator.this.namespaces.containsKey(uri);
@@ -549,6 +557,13 @@
         }
 
         /**
+         * Clear out the set of already processed classes for this namespace
+         */
+        void resetWritten() {
+            written.clear();
+        }
+
+        /**
          * Process the given PropertyInfo looking for references to namespaces that
          * are foreign to the given namespace.  Any foreign namespace references
          * found are added to the given namespaces dependency list and an {@code <import>}
@@ -853,6 +868,10 @@
          * @param parent the writer of the parent element into which the type will be defined
          */
         private void writeClass(ClassInfo<T,C> c, TypeHost parent) {
+            if (written.contains(c)) { // to avoid cycles let's check if we haven't already processed the class
+                return;
+            }
+            written.add(c);
             // special handling for value properties
             if (containsValueProp(c)) {
                 if (c.getProperties().size() == 1) {
@@ -1080,9 +1099,13 @@
                                            }
                                        }
                                     }
-                                    if (cImpl != null)
-                                        e.ref(new QName(cImpl.getElementName().getNamespaceURI(), tn.getLocalPart()));
-                                    else
+                                    if (cImpl != null) {
+                                        if (tn.getNamespaceURI() != null && tn.getNamespaceURI().trim().length() != 0) {
+                                            e.ref(new QName(tn.getNamespaceURI(), tn.getLocalPart()));
+                                        } else {
+                                            e.ref(new QName(cImpl.getElementName().getNamespaceURI(), tn.getLocalPart()));
+                                        }
+                                    } else
                                         e.ref(new QName("", tn.getLocalPart()));
                                 } else
                                     e.ref(tn);
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/client/p2p/HttpSOAPConnection.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/client/p2p/HttpSOAPConnection.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -512,13 +512,9 @@
                         : httpConnection.getInputStream());
                 // If no reply message is returned,
                 // content-Length header field value is expected to be zero.
-                // java SE 6 documentation says :
-                // available() : an estimate of the number of bytes that can be read
-                //(or skipped over) from this input stream without blocking
-                //or 0 when it reaches the end of the input stream.
+                // InputStream#available() can't be used here - it just says no data *YET*!
                 if ((httpIn == null )
-                        || (httpConnection.getContentLength() == 0)
-                        || (httpIn.available() == 0)) {
+                        || (httpConnection.getContentLength() == 0)) {
                     response = null;
                     log.warning("SAAJ0014.p2p.content.zero");
                 } else {
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/InternetHeaders.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/InternetHeaders.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -285,7 +285,7 @@
      *
      * @return  Header objects
      */
-    public FinalArrayList<hdr> getAllHeaders() {
+    public List<? extends Header> getAllHeaders() {
         return headers; // conceptually it should be read-only, but for performance reason I'm not wrapping it here
     }
 
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimeBodyPart.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimeBodyPart.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@
 package com.sun.xml.internal.messaging.saaj.packaging.mime.internet;
 
 
+import com.sun.xml.internal.messaging.saaj.packaging.mime.Header;
 import com.sun.xml.internal.messaging.saaj.packaging.mime.MessagingException;
 import com.sun.xml.internal.messaging.saaj.packaging.mime.util.OutputUtil;
 import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream;
@@ -1041,7 +1042,7 @@
      * Return all the headers from this Message as an Enumeration of
      * Header objects.
      */
-    public FinalArrayList<hdr> getAllHeaders() {
+    public List<? extends Header> getAllHeaders() {
         return headers.getAllHeaders();
     }
 
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/pipe/ThreadHelper.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/pipe/ThreadHelper.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
 
 /**
  * Simple utility class to instantiate correct Thread instance
- * depending on runtime context (jdk/non-jdk usage) and Java version.
+ * depending on Java version.
  *
  * @author miroslav.kos@oracle.com
  */
@@ -101,16 +101,16 @@
         SunMiscThreadFactory(Constructor<?> ctr) { this.ctr = ctr; }
         @Override public Thread newThread(Runnable r) {
             return AccessController.doPrivileged(
-                new PrivilegedAction<Thread>() {
-                    @Override
-                    public Thread run() {
-                        try {
-                            return (Thread) ctr.newInstance(r);
-                        } catch (Exception e) {
-                            return new Thread(r);
+                    new PrivilegedAction<Thread>() {
+                        @Override
+                        public Thread run() {
+                            try {
+                                return (Thread) ctr.newInstance(r);
+                            } catch (Exception e) {
+                                return new Thread(r);
+                            }
                         }
                     }
-                }
             );
         }
     }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/transport/Headers.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/transport/Headers.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -127,5 +127,17 @@
         l.add (value);
         put(key, l);
     }
+    /**
+     * Added to fix issue
+     * putAll() is easier to deal with as it doesn't return anything
+     */
+    public void putAll(Map<? extends String,? extends List<String>> map) {
+        for (String k : map.keySet()) {
+            List<String> list = map.get(k);
+            for (String v : list) {
+                add(k,v);
+            }
+        }
+    }
 
 }
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/ServiceFinder.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/ServiceFinder.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -338,13 +338,13 @@
             int lc = 1;
             while ((lc = parseLine(service, u, r, lc, names, returned)) >= 0) ;
         } catch (IOException x) {
-            fail(service, ": " + x);
+            fail(service, ": " + x +";URL is :"+u.toString());
         } finally {
             try {
                 if (r != null) r.close();
                 if (in != null) in.close();
             } catch (IOException y) {
-                fail(service, ": " + y);
+                fail(service, ": " + y +";URL is :"+u.toString());
             }
         }
         return names.iterator();
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/version.properties	Fri Mar 04 13:16:50 2016 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/version.properties	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -26,4 +26,4 @@
 build-id=2.3.0-SNAPSHOT
 build-version=JAX-WS RI 2.3.0-SNAPSHOT
 major-version=2.3.0
-svn-revision=ffaa49e66cc05e1bb2ddc103076a340dad5df997
+svn-revision=282759e2b822078de9ba78c743ed663541c16ead
--- a/jaxws/src/java.xml.ws/share/classes/javax/xml/soap/FactoryFinder.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/javax/xml/soap/FactoryFinder.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -184,7 +184,7 @@
     private static String fromJDKProperties(String factoryId, String deprecatedFactoryId) {
         Path path = null;
         try {
-            String JAVA_HOME = System.getProperty("java.home");
+            String JAVA_HOME = getSystemProperty("java.home");
             path = Paths.get(JAVA_HOME, "conf", "jaxm.properties");
             logger.log(Level.FINE, "Checking configuration in {0}", path);
 
--- a/jaxws/src/java.xml.ws/share/classes/javax/xml/ws/spi/FactoryFinder.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/javax/xml/ws/spi/FactoryFinder.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -137,7 +137,8 @@
         } catch (Exception ignored) {
             logger.log(Level.SEVERE, "Error reading JAX-WS configuration from ["  + path +
                     "] file. Check it is accessible and has correct format.", ignored);
-        }        return null;
+        }
+        return null;
     }
 
     private static final String OSGI_SERVICE_LOADER_CLASS_NAME = "com.sun.org.glassfish.hk2.osgiresourcelocator.ServiceLoader";
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JJavaName.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JJavaName.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -85,7 +85,7 @@
      *      ("my_children","MyChildren","myChildren", and "MY-CHILDREN", "CODE003-children" respectively)
      *      <p>
      *      Although this method only works for English words, it handles non-English
-     *      words gracefully (by just returning it as-is.) For example, &#x65E5;&#x672C;&#x8A9E;
+     *      words gracefully (by just returning it as-is.) For example, "&#x65E5;&#x672C;&#x8A9E;"
      *      will be returned as-is without modified, not "&#x65E5;&#x672C;&#x8A9E;s"
      *      <p>
      *      This method doesn't handle suffixes very well. For example, passing
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle.properties	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,49 @@
+#
+# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+UNEXPECTED_NGCC_TOKEN = \
+    Unexpected {0} appears at line {1} column {2}
+
+BASEDIR_DOESNT_EXIST = \
+    Non-existent directory: {0}
+
+VERSION = \
+        schemagen 2.3.0-SNAPSHOT
+
+FULLVERSION = \
+        schemagen full version "2.3.0-SNAPSHOT"
+
+USAGE = \
+Usage: schemagen [-options ...] <java files> \n\
+Options: \n\
+\ \ \ \ -d <path>             : specify where to place processor and javac generated class files\n\
+\ \ \ \ -cp <path>            : specify where to find user specified files\n\
+\ \ \ \ -classpath <path>     : specify where to find user specified files\n\
+\ \ \ \ -encoding <encoding>  : specify encoding to be used for annotation processing/javac invocation \n\
+\ \ \ \ -episode <file>       : generate episode file for separate compilation\n\
+\ \ \ \ -disableXmlSecurity  :  disables XML security features for usage on xml parsing apis \n\
+\ \ \ \ -version              : display version information\n\
+\ \ \ \ -fullversion          : display full version information\n\
+\ \ \ \ -help                 : display this usage message
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_de.properties	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+UNEXPECTED_NGCC_TOKEN = Nicht erkanntes {0} in Zeile {1} Spalte {2}
+
+BASEDIR_DOESNT_EXIST = Nicht vorhandenes Verzeichnis: {0}
+
+VERSION = schemagen 2.3.0-SNAPSHOT
+
+FULLVERSION = schemagen vollst\u00E4ndige Version "2.3.0-SNAPSHOT"
+
+USAGE = Verwendung: schemagen [-options ...] <java files> \nOptionen: \n\\ \\ \\ \\ -d <path>             : Gibt an, wo die von Prozessor und javac generierten Klassendateien gespeichert werden sollen\n\\ \\ \\ \\ -cp <path>            : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -classpath <path>     : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -encoding <encoding>  : Gibt die Codierung f\u00FCr die Annotationsverarbeitung/den javac-Aufruf an \n\\ \\ \\ \\ -episode <file>       : Generiert Episodendatei f\u00FCr separate Kompilierung\n\\ \\ \\ \\ -version              : Zeigt Versionsinformation an\n\\ \\ \\ \\ -fullversion          : Zeigt vollst\u00E4ndige Versionsinformationen an\n\\ \\ \\ \\ -help                 : Zeigt diese Verwendungsmeldung an
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_es.properties	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+UNEXPECTED_NGCC_TOKEN = Aparece un {0} inesperado en la l\u00EDnea {1} y la columna {2}
+
+BASEDIR_DOESNT_EXIST = Directorio no existente: {0}
+
+VERSION = schemagen 2.3.0-SNAPSHOT
+
+FULLVERSION = versi\u00F3n completa de schemagen "2.3.0-SNAPSHOT"
+
+USAGE = Sintaxis: schemagen [-options ...] <archivos java> \nOpciones: \n\\ \\ \\ \\ -d <ruta de acceso>             : especifique d\u00F3nde se colocan los archivos de clase generados por javac y el procesador\n\\ \\ \\ \\ -cp <ruta de acceso>            : especifique d\u00F3nde se encuentran los archivos especificados por el usuario\n\\ \\ \\ \\ -encoding <codificaci\u00F3n>  : especifique la codificaci\u00F3n que se va a utilizar para el procesamiento de anotaciones/llamada de javac\n\\ \\ \\ \\ -episode <archivo>       : genera un archivo de episodio para una compilaci\u00F3n diferente\n\\ \\ \\ \\ -version              : muestra la informaci\u00F3n de la versi\u00F3n\n\\ \\ \\ \\ -fullversion          : muestra la informaci\u00F3n completa de la versi\u00F3n\n\\ \\ \\ \\ -help                 : muestra este mensaje de sintaxis
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_fr.properties	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+UNEXPECTED_NGCC_TOKEN = Un \u00E9l\u00E9ment {0} inattendu appara\u00EEt \u00E0 la ligne {1}, colonne {2}
+
+BASEDIR_DOESNT_EXIST = R\u00E9pertoire {0} inexistant
+
+VERSION = schemagen 2.3.0-SNAPSHOT
+
+FULLVERSION = version compl\u00E8te de schemagen "2.3.0-SNAPSHOT"
+
+USAGE = Syntaxe : schemagen [-options ...] <java files> \nOptions : \n\ \ \ \ -d <path> : indiquez o\u00F9 placer les fichiers de classe g\u00E9n\u00E9r\u00E9s par le processeur et le compilateur javac\n\ \ \ \ -cp <path> : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -classpath <path> : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -encoding <encoding> : indiquez l'encodage \u00E0 utiliser pour l'appel de javac/traitement de l'annotation \n\ \ \ \ -episode <file> : g\u00E9n\u00E9rez un fichier d'\u00E9pisode pour la compilation s\u00E9par\u00E9e\n\ \ \ \ -version : affichez les informations de version\n\ \ \ \ -fullversion : affichez les informations compl\u00E8tes de version\n\ \ \ \ -help : affichez ce message de syntaxe
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_it.properties	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+UNEXPECTED_NGCC_TOKEN = {0} imprevisto visualizzato sulla riga {1} colonna {2}
+
+BASEDIR_DOESNT_EXIST = Directory non esistente: {0}
+
+VERSION = schemagen 2.3.0-SNAPSHOT
+
+FULLVERSION = versione completa schemagen "2.3.0-SNAPSHOT"
+
+USAGE = Uso: schemagen [-options ...] <java files> \nOpzioni: \n\ \ \ \ -d <path>             : specifica dove posizionare il processore e i file della classe generata javac\n\ \ \ \ -cp <path>            : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -classpath <path>     : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -encoding <encoding>  : specifica la codifica da usare per l'elaborazione dell'annotazione/richiamo javac \n\ \ \ \ -episode <file>       : genera il file di episodio per la compilazione separata\n\ \ \ \ -version              : visualizza le informazioni sulla versione\n\ \ \ \ -fullversion          : visualizza le informazioni sulla versione completa\n\ \ \ \ -help                 : visualizza questo messaggio sull'uso
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ja.properties	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+UNEXPECTED_NGCC_TOKEN = \u4E88\u671F\u3057\u306A\u3044{0}\u304C\u884C{1}\u3001\u5217{2}\u306B\u3042\u308A\u307E\u3059
+
+BASEDIR_DOESNT_EXIST = \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u5B58\u5728\u3057\u307E\u305B\u3093: {0}
+
+VERSION = schemagen 2.3.0-SNAPSHOT
+
+FULLVERSION = schemagen\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.3.0-SNAPSHOT"
+
+USAGE = \u4F7F\u7528\u65B9\u6CD5: schemagen [-options ...] <java files> \n\u30AA\u30D7\u30B7\u30E7\u30F3: \n\ \ \ \ -d <path>             : \u30D7\u30ED\u30BB\u30C3\u30B5\u304A\u3088\u3073javac\u304C\u751F\u6210\u3057\u305F\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u7F6E\u304F\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -cp <path>            : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -classpath <path>     : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -encoding <encoding>  : \u6CE8\u91C8\u51E6\u7406/javac\u547C\u51FA\u3057\u306B\u4F7F\u7528\u3059\u308B\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -episode <file>       : \u30B3\u30F3\u30D1\u30A4\u30EB\u3054\u3068\u306B\u30A8\u30D4\u30BD\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u3057\u307E\u3059\n\ \ \ \ -version              : \u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -fullversion          : \u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -help                 : \u3053\u306E\u4F7F\u7528\u4F8B\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3057\u307E\u3059
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ko.properties	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+UNEXPECTED_NGCC_TOKEN = \uC608\uC0C1\uCE58 \uC54A\uC740 {0}\uC774(\uAC00) {1}\uD589 {2}\uC5F4\uC5D0 \uB098\uD0C0\uB0A9\uB2C8\uB2E4.
+
+BASEDIR_DOESNT_EXIST = \uC874\uC7AC\uD558\uC9C0 \uC54A\uB294 \uB514\uB809\uD1A0\uB9AC: {0}
+
+VERSION = schemagen 2.3.0-SNAPSHOT
+
+FULLVERSION = schemagen \uC815\uC2DD \uBC84\uC804 "2.3.0-SNAPSHOT"
+
+USAGE = \uC0AC\uC6A9\uBC95: schemagen [-options ...] <java files> \n\uC635\uC158: \n\ \ \ \ -d <path>             : \uD504\uB85C\uC138\uC11C \uBC0F javac\uC5D0\uC11C \uC0DD\uC131\uD55C \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uBC30\uCE58\uD560 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -cp <path>            : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -classpath <path>     : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -encoding <encoding>  : \uC8FC\uC11D \uCC98\uB9AC/javac \uD638\uCD9C\uC5D0 \uC0AC\uC6A9\uD560 \uC778\uCF54\uB529\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4. \n\ \ \ \ -episode <file>       : \uBCC4\uB3C4 \uCEF4\uD30C\uC77C\uC744 \uC704\uD574 episode \uD30C\uC77C\uC744 \uC0DD\uC131\uD569\uB2C8\uB2E4.\n\ \ \ \ -version              : \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -fullversion          : \uC815\uC2DD \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -help                 : \uC774 \uC0AC\uC6A9\uBC95 \uBA54\uC2DC\uC9C0\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_pt_BR.properties	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+UNEXPECTED_NGCC_TOKEN = {0} inesperado aparece na linha {1} coluna {2}
+
+BASEDIR_DOESNT_EXIST = Diret\u00F3rio n\u00E3o existente: {0}
+
+VERSION = gera\u00E7\u00E3o do esquema 2.3.0-SNAPSHOT
+
+FULLVERSION = vers\u00E3o completa da gera\u00E7\u00E3o do esquema "2.3.0-SNAPSHOT"
+
+USAGE = Uso: gera\u00E7\u00E3o do esquema [-options ...] <java files> \nOp\u00E7\u00F5es: \n\\ \\ \\ \\ -d <path>             : especificar onde colocar o processador e os arquivos da classe gerados por javac\n\\ \\ \\ \\ -cp <path>            : especificar onde localizar arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -classpath <path>     : especificar onde localizar os arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -encoding <encoding>  : especificar codifica\u00E7\u00E3o a ser usada para processamento de anota\u00E7\u00E3o/chamada javac \n\\ \\ \\ \\ -episode <file>       : gerar arquivo do epis\u00F3dio para compila\u00E7\u00E3o separada\n\\ \\ \\ \\ -version              : exibir informa\u00E7\u00F5es da vers\u00E3o\n\\ \\ \\ \\ -fullversion          : exibir informa\u00E7\u00F5es da vers\u00E3o completa\n\\ \\ \\ \\ -help                 : exibir esta mensagem de uso
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_CN.properties	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+UNEXPECTED_NGCC_TOKEN = \u5728\u7B2C {1} \u884C, \u7B2C {2} \u5217\u51FA\u73B0\u610F\u5916\u7684{0}
+
+BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u5F55: {0}
+
+VERSION = schemagen 2.3.0-SNAPSHOT
+
+FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.3.0-SNAPSHOT"
+
+USAGE = \u7528\u6CD5: schemagen [-options ...] <java files> \n\u9009\u9879: \n\ \ \ \ -d <path>             : \u6307\u5B9A\u653E\u7F6E\u5904\u7406\u7A0B\u5E8F\u548C javac \u751F\u6210\u7684\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -cp <path>            : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -classpath <path>     : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -encoding <encoding>  : \u6307\u5B9A\u7528\u4E8E\u6CE8\u91CA\u5904\u7406/javac \u8C03\u7528\u7684\u7F16\u7801\n\ \ \ \ -episode <file>       : \u751F\u6210\u7247\u6BB5\u6587\u4EF6\u4EE5\u4F9B\u5355\u72EC\u7F16\u8BD1\n\ \ \ \ -version              : \u663E\u793A\u7248\u672C\u4FE1\u606F\n\ \ \ \ -fullversion          : \u663E\u793A\u5B8C\u6574\u7684\u7248\u672C\u4FE1\u606F\n\ \ \ \ -help                 : \u663E\u793A\u6B64\u7528\u6CD5\u6D88\u606F
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_TW.properties	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+UNEXPECTED_NGCC_TOKEN = \u672A\u9810\u671F\u7684 {0} \u986F\u793A\u65BC\u884C {1} \u8CC7\u6599\u6B04 {2}
+
+BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u9304: {0}
+
+VERSION = schemagen 2.3.0-SNAPSHOT
+
+FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.3.0-SNAPSHOT"
+
+USAGE = \u7528\u6CD5: schemagen [-options ...] <java files> \n\u9078\u9805: \n\\ \\ \\ \\ -d <path>             : \u6307\u5B9A\u8655\u7406\u5668\u4EE5\u53CA javac \u7522\u751F\u7684\u985E\u5225\u6A94\u6848\u653E\u7F6E\u4F4D\u7F6E\n\\ \\ \\ \\ -cp <path>            : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -classpath <path>     : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -encoding <encoding>  : \u6307\u5B9A\u8981\u7528\u65BC\u8A3B\u89E3\u8655\u7406/javac \u547C\u53EB\u7684\u7DE8\u78BC \n\\ \\ \\ \\ -episode <file>       : \u7522\u751F\u7368\u7ACB\u7DE8\u8B6F\u7684\u4E8B\u4EF6 (episode) \u6A94\u6848\n\\ \\ \\ \\ -version              : \u986F\u793A\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -fullversion          : \u986F\u793A\u5B8C\u6574\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -help                 : \u986F\u793A\u6B64\u7528\u6CD5\u8A0A\u606F
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/ap/MessageBundle.properties	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,33 @@
+#
+# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+NON_EXISTENT_FILE = \
+    Directory "{0}" doesn't exist.
+
+UNRECOGNIZED_PARAMETER = \
+    Unrecognized option {0} is not valid.
+
+OPERAND_MISSING = \
+    Option "{0}" is missing an operand.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/ap/MessageBundle_de.properties	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,30 @@
+#
+# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+NON_EXISTENT_FILE = Verzeichnis "{0}" ist nicht vorhanden.
+
+UNRECOGNIZED_PARAMETER = Unbekannte Option {0} ist nicht g\u00FCltig.
+
+OPERAND_MISSING = In Option "{0}" fehlt ein Operand.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/ap/MessageBundle_es.properties	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,30 @@
+#
+# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+NON_EXISTENT_FILE = El directorio "{0}" no existe.
+
+UNRECOGNIZED_PARAMETER = La opci\u00F3n no reconocida {0} no es v\u00E1lida.
+
+OPERAND_MISSING = A la opci\u00F3n "{0}" le falta un operando.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/ap/MessageBundle_fr.properties	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,30 @@
+#
+# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+NON_EXISTENT_FILE = Le r\u00E9pertoire "{0}" n''existe pas.
+
+UNRECOGNIZED_PARAMETER = L''option {0} non reconnue n''est pas valide.
+
+OPERAND_MISSING = Un op\u00E9rande est manquant dans l''option "{0}".
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/ap/MessageBundle_it.properties	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,30 @@
+#
+# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+NON_EXISTENT_FILE = La directory "{0}" non esiste.
+
+UNRECOGNIZED_PARAMETER = L''opzione non riconosciuta {0} non \u00E8 valida.
+
+OPERAND_MISSING = Operando mancante nell''opzione "{0}".
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/ap/MessageBundle_ja.properties	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,30 @@
+#
+# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+NON_EXISTENT_FILE = \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA"{0}"\u304C\u5B58\u5728\u3057\u307E\u305B\u3093\u3002
+
+UNRECOGNIZED_PARAMETER = \u8A8D\u8B58\u3055\u308C\u306A\u3044\u30AA\u30D7\u30B7\u30E7\u30F3{0}\u306F\u7121\u52B9\u3067\u3059\u3002
+
+OPERAND_MISSING = \u30AA\u30D7\u30B7\u30E7\u30F3"{0}"\u306B\u30AA\u30DA\u30E9\u30F3\u30C9\u304C\u3042\u308A\u307E\u305B\u3093\u3002
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/ap/MessageBundle_ko.properties	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,30 @@
+#
+# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+NON_EXISTENT_FILE = "{0}" \uB514\uB809\uD1A0\uB9AC\uAC00 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
+
+UNRECOGNIZED_PARAMETER = \uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uC635\uC158 {0}\uC740(\uB294) \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
+
+OPERAND_MISSING = "{0}" \uC635\uC158\uC5D0 \uD53C\uC5F0\uC0B0\uC790\uAC00 \uB204\uB77D\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/ap/MessageBundle_pt_BR.properties	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,30 @@
+#
+# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+NON_EXISTENT_FILE = O diret\u00F3rio "{0}" n\u00E3o existe.
+
+UNRECOGNIZED_PARAMETER = A op\u00E7\u00E3o {0} n\u00E3o reconhecida \u00E9 inv\u00E1lida.
+
+OPERAND_MISSING = A op\u00E7\u00E3o "{0}" n\u00E3o encontrou um operando.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/ap/MessageBundle_zh_CN.properties	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,30 @@
+#
+# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+NON_EXISTENT_FILE = \u76EE\u5F55 "{0}" \u4E0D\u5B58\u5728\u3002
+
+UNRECOGNIZED_PARAMETER = \u65E0\u6CD5\u8BC6\u522B\u7684\u9009\u9879{0}, \u8BE5\u9009\u9879\u65E0\u6548\u3002
+
+OPERAND_MISSING = \u9009\u9879 "{0}" \u7F3A\u5C11\u64CD\u4F5C\u6570\u3002
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/ap/MessageBundle_zh_TW.properties	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,30 @@
+#
+# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+NON_EXISTENT_FILE = \u76EE\u9304 "{0}" \u4E0D\u5B58\u5728.
+
+UNRECOGNIZED_PARAMETER = \u7121\u6CD5\u8FA8\u8B58\u7684\u9078\u9805 {0} \u7121\u6548.
+
+OPERAND_MISSING = \u9078\u9805 "{0}" \u907A\u6F0F\u904B\u7B97\u5143.
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CTypeRef.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CTypeRef.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -68,7 +68,6 @@
 
     public CTypeRef(CNonElement type, XSElementDecl decl) {
         this(type, BGMBuilder.getName(decl),getSimpleTypeName(decl), decl.isNillable(), decl.getDefaultValue() );
-
     }
 
     public QName getTypeName() {
@@ -100,10 +99,15 @@
      */
     private static QName resolveSimpleTypeName(XSType declType) {
         QName name = BGMBuilder.getName(declType);
-        if (name != null && !XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(name.getNamespaceURI()))
-            return resolveSimpleTypeName(declType.getBaseType());
-        else
-            return name;
+        QName result = null;
+        if (name != null && !XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(name.getNamespaceURI())) {
+            result = resolveSimpleTypeName(declType.getBaseType());
+        } else {
+            if ( !"anySimpleType".equals(declType.getName()) ) {
+                result = name;
+            }
+        }
+        return result;
     }
 
     public CTypeRef(CNonElement type, QName elementName, QName typeName, boolean nillable, XmlString defaultValue) {
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/version.properties	Fri Mar 04 13:16:50 2016 +0000
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/version.properties	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -26,4 +26,4 @@
 build-id=2.3.0-SNAPSHOT
 build-version=JAX-WS RI 2.3.0-SNAPSHOT
 major-version=2.3.0
-svn-revision=ffaa49e66cc05e1bb2ddc103076a340dad5df997
+svn-revision=282759e2b822078de9ba78c743ed663541c16ead
--- a/jdk/.hgtags	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/.hgtags	Mon Mar 07 09:34:29 2016 +0100
@@ -350,3 +350,4 @@
 55518739e399a1066c8613e19100d51b38d9f223 jdk-9+105
 6e9ecae50b4e0d37483fb2719202eea5dca026a4 jdk-9+106
 8701b2bb1d2e1b9abc2a9be0933993c7150a9dbe jdk-9+107
+42794e648cfe9fd67461dcbe8b7594241a84bcff jdk-9+108
--- a/jdk/make/gendata/GendataHtml32dtd.gmk	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/make/gendata/GendataHtml32dtd.gmk	Mon Mar 07 09:34:29 2016 +0100
@@ -30,6 +30,6 @@
 	$(call LogInfo, Generating HTML DTD file)
 	$(MKDIR) -p $(@D)
 	$(RM) $@
-	($(TOOL_DTDBUILDER) $(LOG_INFO) html32 > $@) || exit 1
+	($(TOOL_DTDBUILDER) html32 > $@) || exit 1
 
 TARGETS += $(HTML32DTD)
--- a/jdk/make/gensrc/GensrcCLDR.gmk	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/make/gensrc/GensrcCLDR.gmk	Mon Mar 07 09:34:29 2016 +0100
@@ -30,7 +30,7 @@
 GENSRC_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata
 
 CLDR_BASEMETAINFO_FILE := $(GENSRC_BASEDIR)/sun/util/cldr/CLDRBaseLocaleDataMetaInfo.java
-CLDR_METAINFO_FILE := $(GENSRC_DIR)/sun/util/resources/cldr/provider/CLDRLocaleDataMetaInfo_jdk_localedata.java
+CLDR_METAINFO_FILE := $(GENSRC_DIR)/sun/util/resources/cldr/provider/CLDRLocaleDataMetaInfo.java
 
 CLDR_BASE_LOCALES := "en-US"
 
--- a/jdk/make/gensrc/GensrcMisc.gmk	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/make/gensrc/GensrcMisc.gmk	Mon Mar 07 09:34:29 2016 +0100
@@ -25,11 +25,11 @@
 
 ##########################################################################################
 # Install the launcher name, release version string, full version
-# string and the runtime name into the Version.java file.
+# string and the runtime name into the VersionProps.java file.
 
 $(eval $(call SetupTextFileProcessing, BUILD_VERSION_JAVA, \
-    SOURCE_FILES := $(JDK_TOPDIR)/src/java.base/share/classes/sun/misc/Version.java.template, \
-    OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/misc/Version.java, \
+    SOURCE_FILES := $(JDK_TOPDIR)/src/java.base/share/classes/java/lang/VersionProps.java.template, \
+    OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/VersionProps.java, \
     REPLACEMENTS := \
         @@LAUNCHER_NAME@@ => $(LAUNCHER_NAME) ; \
         @@RUNTIME_NAME@@ => $(RUNTIME_NAME) ; \
--- a/jdk/make/mapfiles/libjava/mapfile-vers	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/make/mapfiles/libjava/mapfile-vers	Mon Mar 07 09:34:29 2016 +0100
@@ -268,8 +268,6 @@
 		Java_sun_reflect_Reflection_getCallerClass__;
 		Java_sun_reflect_Reflection_getCallerClass__I;
 		Java_sun_reflect_Reflection_getClassAccessFlags;
-                Java_sun_misc_Version_getJdkVersionInfo;
-                Java_sun_misc_Version_getJvmVersionInfo;
 		Java_jdk_internal_misc_VM_latestUserDefinedLoader;
                 Java_jdk_internal_misc_VM_getuid;
                 Java_jdk_internal_misc_VM_geteuid;
--- a/jdk/make/src/classes/build/tools/module/boot.modules	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/make/src/classes/build/tools/module/boot.modules	Mon Mar 07 09:34:29 2016 +0100
@@ -22,6 +22,7 @@
 jdk.deploy.osx
 jdk.httpserver
 jdk.jfr
+jdk.jsobject
 jdk.net
 jdk.vm.cds
 jdk.vm.ci
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
  * <li>By providing the size in bits of the prime modulus -
  * This will be used to create a prime modulus and base generator, which will
  * then be used to create the Diffie-Hellman key pair. The default size of the
- * prime modulus is 1024 bits.
+ * prime modulus is 2048 bits.
  * <li>By providing a prime modulus and base generator
  * </ul>
  *
@@ -68,7 +68,7 @@
 
     public DHKeyPairGenerator() {
         super();
-        initialize(1024, null);
+        initialize(2048, null);
     }
 
     /**
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/DHParameterGenerator.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/DHParameterGenerator.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,7 @@
  *
  * <p>The Diffie-Hellman parameter generation accepts the size in bits of the
  * prime modulus and the size in bits of the random exponent as input.
- * The size of the prime modulus defaults to 1024 bits.
+ * The size of the prime modulus defaults to 2048 bits.
  *
  * @author Jan Luehe
  *
@@ -50,7 +50,7 @@
 extends AlgorithmParameterGeneratorSpi {
 
     // The size in bits of the prime modulus
-    private int primeSize = 1024;
+    private int primeSize = 2048;
 
     // The size in bits of the random exponent (private value)
     private int exponentSize = 0;
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/PKCS12PBECipherCore.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/PKCS12PBECipherCore.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,6 +50,7 @@
     private CipherCore cipher;
     private int blockSize;
     private int keySize;
+    private int keyLength; // in bits
     private String algo = null;
     private String pbeAlgo = null;
     private byte[] salt = null;
@@ -166,16 +167,18 @@
         throws NoSuchAlgorithmException {
 
         algo = symmCipherAlg;
+        keyLength = defKeySize * 8;
         if (algo.equals("RC4")) {
-            pbeAlgo = "PBEWithSHA1AndRC4_" + defKeySize * 8;
+            pbeAlgo = "PBEWithSHA1AndRC4_" + keyLength;
         } else {
             SymmetricCipher symmCipher = null;
             if (algo.equals("DESede")) {
                 symmCipher = new DESedeCrypt();
                 pbeAlgo = "PBEWithSHA1AndDESede";
+                keyLength = 112; // effective key length
             } else if (algo.equals("RC2")) {
                 symmCipher = new RC2Crypt();
-                pbeAlgo = "PBEWithSHA1AndRC2_" + defKeySize * 8;
+                pbeAlgo = "PBEWithSHA1AndRC2_" + keyLength;
             } else {
                 throw new NoSuchAlgorithmException("No Cipher implementation " +
                        "for PBEWithSHA1And" + algo);
@@ -406,7 +409,7 @@
     }
 
     int implGetKeySize(Key key) throws InvalidKeyException {
-        return keySize;
+        return keyLength;
     }
 
     byte[] implWrap(Key key) throws IllegalBlockSizeException,
--- a/jdk/src/java.base/share/classes/java/lang/AbstractStringBuilder.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/AbstractStringBuilder.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -133,39 +133,62 @@
     }
 
     /**
-     * This method has the same contract as ensureCapacity, but is
-     * never synchronized.
+     * For positive values of {@code minimumCapacity}, this method
+     * behaves like {@code ensureCapacity}, however it is never
+     * synchronized.
+     * If {@code minimumCapacity} is non positive due to numeric
+     * overflow, this method throws {@code OutOfMemoryError}.
      */
     private void ensureCapacityInternal(int minimumCapacity) {
         // overflow-conscious code
-        int capacity = value.length >> coder;
-        if (minimumCapacity - capacity > 0) {
-            expandCapacity(minimumCapacity);
+        int oldCapacity = value.length >> coder;
+        if (minimumCapacity - oldCapacity > 0) {
+            value = Arrays.copyOf(value,
+                    newCapacity(minimumCapacity) << coder);
         }
     }
 
     /**
-     * This implements the expansion semantics of ensureCapacity with no
-     * size check or synchronization.
+     * The maximum size of array to allocate (unless necessary).
+     * Some VMs reserve some header words in an array.
+     * Attempts to allocate larger arrays may result in
+     * OutOfMemoryError: Requested array size exceeds VM limit
      */
-    private void expandCapacity(int minimumCapacity) {
-        int newCapacity = (value.length >> coder) * 2 + 2;
-        if (newCapacity - minimumCapacity < 0) {
-            newCapacity = minimumCapacity;
+    private static final int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8;
+
+    /**
+     * Returns a capacity at least as large as the given minimum capacity.
+     * Returns the current capacity increased by the same amount + 2 if
+     * that suffices.
+     * Will not return a capacity greater than
+     * {@code (MAX_ARRAY_SIZE >> coder)} unless the given minimum capacity
+     * is greater than that.
+     *
+     * @param  minCapacity the desired minimum capacity
+     * @throws OutOfMemoryError if minCapacity is less than zero or
+     *         greater than (Integer.MAX_VALUE >> coder)
+     */
+    private int newCapacity(int minCapacity) {
+        // overflow-conscious code
+        int oldCapacity = value.length >> coder;
+        int newCapacity = (oldCapacity << 1) + 2;
+        if (newCapacity - minCapacity < 0) {
+            newCapacity = minCapacity;
         }
-        if (newCapacity < 0) {
-            if (minimumCapacity < 0) {// overflow
-                throw new OutOfMemoryError();
-            }
-            newCapacity = Integer.MAX_VALUE;
+        int SAFE_BOUND = MAX_ARRAY_SIZE >> coder;
+        return (newCapacity <= 0 || SAFE_BOUND - newCapacity < 0)
+            ? hugeCapacity(minCapacity)
+            : newCapacity;
+    }
+
+    private int hugeCapacity(int minCapacity) {
+        int SAFE_BOUND = MAX_ARRAY_SIZE >> coder;
+        int UNSAFE_BOUND = Integer.MAX_VALUE >> coder;
+        if (UNSAFE_BOUND - minCapacity < 0) { // overflow
+            throw new OutOfMemoryError();
         }
-        if (coder != LATIN1 && newCapacity > StringUTF16.MAX_LENGTH) {
-            if (minimumCapacity >= StringUTF16.MAX_LENGTH) {
-                throw new OutOfMemoryError();
-            }
-            newCapacity = StringUTF16.MAX_LENGTH;
-        }
-        this.value = Arrays.copyOf(value, newCapacity << coder);
+        return (minCapacity > SAFE_BOUND)
+            ? minCapacity : SAFE_BOUND;
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/lang/System.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/System.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -1418,8 +1418,7 @@
          * for the given {@code caller}.
          *
          * @param name the name of the logger.
-         * @param caller the class for which the logger is being requested;
-         *               can be {@code null}.
+         * @param caller the class for which the logger is being requested.
          *
          * @return a {@link Logger logger} suitable for the given caller's
          *         use.
@@ -1831,7 +1830,7 @@
 
 
         lineSeparator = props.getProperty("line.separator");
-        sun.misc.Version.init();
+        VersionProps.init();
 
         FileInputStream fdIn = new FileInputStream(FileDescriptor.in);
         FileOutputStream fdOut = new FileOutputStream(FileDescriptor.out);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/VersionProps.java.template	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+import java.io.PrintStream;
+
+class VersionProps {
+
+
+    private static final String launcher_name =
+        "@@LAUNCHER_NAME@@";
+
+    private static final String java_version =
+        "@@VERSION_SHORT@@";
+
+    private static final String java_runtime_name =
+        "@@RUNTIME_NAME@@";
+
+    private static final String java_runtime_version =
+        "@@VERSION_STRING@@";
+
+    static {
+        init();
+    }
+
+    public static void init() {
+        System.setProperty("java.version", java_version);
+        System.setProperty("java.runtime.version", java_runtime_version);
+        System.setProperty("java.runtime.name", java_runtime_name);
+    }
+
+    /**
+     * In case you were wondering this method is called by java -version.
+     * Sad that it prints to stderr; would be nicer if default printed on
+     * stdout.
+     */
+    public static void print() {
+        print(System.err);
+    }
+
+    /**
+     * This is the same as print except that it adds an extra line-feed
+     * at the end, typically used by the -showversion in the launcher
+     */
+    public static void println() {
+        print(System.err);
+        System.err.println();
+    }
+
+    /**
+     * Give a stream, it will print version info on it.
+     */
+    public static void print(PrintStream ps) {
+        boolean isHeadless = false;
+
+        /* Report that we're running headless if the property is true */
+        String headless = System.getProperty("java.awt.headless");
+        if ( (headless != null) && (headless.equalsIgnoreCase("true")) ) {
+            isHeadless = true;
+        }
+
+        /* First line: platform version. */
+        ps.println(launcher_name + " version \"" + java_version + "\"");
+
+        /* Second line: runtime version (ie, libraries). */
+
+        String jdk_debug_level = System.getProperty("jdk.debug", "release");
+        /* Debug level is not printed for "release" builds */
+        if ("release".equals(jdk_debug_level)) {
+            jdk_debug_level = "";
+        } else {
+            jdk_debug_level = jdk_debug_level + " ";
+        }
+
+        ps.print(java_runtime_name + " (" + jdk_debug_level + "build " + java_runtime_version);
+
+        if (java_runtime_name.indexOf("Embedded") != -1 && isHeadless) {
+            // embedded builds report headless state
+            ps.print(", headless");
+        }
+        ps.println(')');
+
+        /* Third line: JVM information. */
+        String java_vm_name    = System.getProperty("java.vm.name");
+        String java_vm_version = System.getProperty("java.vm.version");
+        String java_vm_info    = System.getProperty("java.vm.info");
+        ps.println(java_vm_name + " (" + jdk_debug_level + "build " + java_vm_version + ", " +
+                   java_vm_info + ")");
+    }
+
+}
\ No newline at end of file
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Mon Mar 07 09:34:29 2016 +0100
@@ -3268,12 +3268,17 @@
      * <li>This list of types is called the "common prefix".
      * </ol>
      * <p>
-     * <em>Step 1B: Determine loop parameters.</em><ol type="a">
-     * <li>Examine init function parameter lists.
-     * <li>Omitted init functions are deemed to have {@code null} parameter lists.
-     * <li>All init function parameter lists must be effectively identical.
-     * <li>The longest parameter list (which is necessarily unique) is called the "common suffix".
+     * <em>Step 1B: Determine loop parameters.</em><ul>
+     * <li><b>If at least one init function is given,</b><ol type="a">
+     *   <li>Examine init function parameter lists.
+     *   <li>Omitted init functions are deemed to have {@code null} parameter lists.
+     *   <li>All init function parameter lists must be effectively identical.
+     *   <li>The longest parameter list (which is necessarily unique) is called the "common suffix".
      * </ol>
+     * <li><b>If no init function is given,</b><ol type="a">
+     *   <li>Examine the suffixes of the step, pred, and fini parameter lists, after removing the "common prefix".
+     *   <li>The longest of these suffixes is taken as the "common suffix".
+     * </ol></ul>
      * <p>
      * <em>Step 1C: Determine loop return type.</em><ol type="a">
      * <li>Examine fini function return types, disregarding omitted fini functions.
@@ -3286,9 +3291,6 @@
      * <li>Every non-omitted pred function must have a {@code boolean} return type.
      * </ol>
      * <p>
-     * (Implementation Note: Steps 1A, 1B, 1C, 1D are logically independent of each other, and may be performed in any
-     * order.)
-     * <p>
      * <em>Step 2: Determine parameter lists.</em><ol type="a">
      * <li>The parameter list for the resulting loop handle will be the "common suffix".
      * <li>The parameter list for init functions will be adjusted to the "common suffix". (Note that their parameter
@@ -3375,10 +3377,10 @@
      * <blockquote><pre>{@code
      * // iterative implementation of the factorial function as a loop handle
      * static int one(int k) { return 1; }
-     * int inc(int i, int acc, int k) { return i + 1; }
-     * int mult(int i, int acc, int k) { return i * acc; }
-     * boolean pred(int i, int acc, int k) { return i < k; }
-     * int fin(int i, int acc, int k) { return acc; }
+     * static int inc(int i, int acc, int k) { return i + 1; }
+     * static int mult(int i, int acc, int k) { return i * acc; }
+     * static boolean pred(int i, int acc, int k) { return i < k; }
+     * static int fin(int i, int acc, int k) { return acc; }
      * // assume MH_one, MH_inc, MH_mult, MH_pred, and MH_fin are handles to the above methods
      * // null initializer for counter, should initialize to 0
      * MethodHandle[] counterClause = new MethodHandle[]{null, MH_inc};
@@ -3436,9 +3438,7 @@
                 collect(Collectors.toList());
 
         // Step 1B: determine loop parameters.
-        final List<Class<?>> empty = new ArrayList<>();
-        final List<Class<?>> commonSuffix = init.stream().filter(Objects::nonNull).map(MethodHandle::type).
-                map(MethodType::parameterList).reduce((p, q) -> p.size() >= q.size() ? p : q).orElse(empty);
+        final List<Class<?>> commonSuffix = buildCommonSuffix(init, step, pred, fini, commonPrefix.size());
         checkLoop1b(init, commonSuffix);
 
         // Step 1C: determine loop return type.
@@ -3520,15 +3520,15 @@
      * @apiNote Example:
      * <blockquote><pre>{@code
      * // implement the zip function for lists as a loop handle
-     * List<String> initZip(Iterator<String> a, Iterator<String> b) { return new ArrayList<>(); }
-     * boolean zipPred(List<String> zip, Iterator<String> a, Iterator<String> b) { return a.hasNext() && b.hasNext(); }
-     * List<String> zipStep(List<String> zip, Iterator<String> a, Iterator<String> b) {
+     * static List<String> initZip(Iterator<String> a, Iterator<String> b) { return new ArrayList<>(); }
+     * static boolean zipPred(List<String> zip, Iterator<String> a, Iterator<String> b) { return a.hasNext() && b.hasNext(); }
+     * static List<String> zipStep(List<String> zip, Iterator<String> a, Iterator<String> b) {
      *   zip.add(a.next());
      *   zip.add(b.next());
      *   return zip;
      * }
      * // assume MH_initZip, MH_zipPred, and MH_zipStep are handles to the above methods
-     * MethodHandle loop = MethodHandles.doWhileLoop(MH_initZip, MH_zipStep, MH_zipPred);
+     * MethodHandle loop = MethodHandles.whileLoop(MH_initZip, MH_zipPred, MH_zipStep);
      * List<String> a = Arrays.asList("a", "b", "c", "d");
      * List<String> b = Arrays.asList("e", "f", "g", "h");
      * List<String> zipped = Arrays.asList("a", "e", "b", "f", "c", "g", "d", "h");
@@ -3594,9 +3594,9 @@
      * @apiNote Example:
      * <blockquote><pre>{@code
      * // int i = 0; while (i < limit) { ++i; } return i; => limit
-     * int zero(int limit) { return 0; }
-     * int step(int i, int limit) { return i + 1; }
-     * boolean pred(int i, int limit) { return i < limit; }
+     * static int zero(int limit) { return 0; }
+     * static int step(int i, int limit) { return i + 1; }
+     * static boolean pred(int i, int limit) { return i < limit; }
      * // assume MH_zero, MH_step, and MH_pred are handles to the above methods
      * MethodHandle loop = MethodHandles.doWhileLoop(MH_zero, MH_step, MH_pred);
      * assertEquals(23, loop.invoke(23));
@@ -3664,8 +3664,8 @@
      * <blockquote><pre>{@code
      * // String s = "Lambdaman!"; for (int i = 0; i < 13; ++i) { s = "na " + s; } return s;
      * // => a variation on a well known theme
-     * String start(String arg) { return arg; }
-     * String step(int counter, String v, String arg) { return "na " + v; }
+     * static String start(String arg) { return arg; }
+     * static String step(int counter, String v, String arg) { return "na " + v; }
      * // assume MH_start and MH_step are handles to the two methods above
      * MethodHandle fit13 = MethodHandles.constant(int.class, 13);
      * MethodHandle loop = MethodHandles.countedLoop(fit13, MH_start, MH_step);
@@ -3808,11 +3808,11 @@
      * @apiNote Example:
      * <blockquote><pre>{@code
      * // reverse a list
-     * List<String> reverseStep(String e, List<String> r, List<String> l) {
+     * static List<String> reverseStep(String e, List<String> r, List<String> l) {
      *   r.add(0, e);
      *   return r;
      * }
-     * List<String> newArrayList(List<String> l) { return new ArrayList<>(); }
+     * static List<String> newArrayList(List<String> l) { return new ArrayList<>(); }
      * // assume MH_reverseStep, MH_newArrayList are handles to the above methods
      * MethodHandle loop = MethodHandles.iteratedLoop(null, MH_newArrayList, MH_reverseStep);
      * List<String> list = Arrays.asList("a", "b", "c", "d", "e");
@@ -4084,6 +4084,21 @@
         }
     }
 
+    private static List<Class<?>> buildCommonSuffix(List<MethodHandle> init, List<MethodHandle> step, List<MethodHandle> pred, List<MethodHandle> fini, int cpSize) {
+        final List<Class<?>> empty = List.of();
+        final List<MethodHandle> nonNullInits = init.stream().filter(Objects::nonNull).collect(Collectors.toList());
+        if (nonNullInits.isEmpty()) {
+            final List<Class<?>> longest = Stream.of(step, pred, fini).flatMap(List::stream).filter(Objects::nonNull).
+                    // take only those that can contribute to a common suffix because they are longer than the prefix
+                    map(MethodHandle::type).filter(t -> t.parameterCount() > cpSize).map(MethodType::parameterList).
+                    reduce((p, q) -> p.size() >= q.size() ? p : q).orElse(empty);
+            return longest.size() == 0 ? empty : longest.subList(cpSize, longest.size());
+        } else {
+            return nonNullInits.stream().map(MethodHandle::type).map(MethodType::parameterList).
+                    reduce((p, q) -> p.size() >= q.size() ? p : q).get();
+        }
+    }
+
     private static void checkLoop1b(List<MethodHandle> init, List<Class<?>> commonSuffix) {
         if (init.stream().filter(Objects::nonNull).map(MethodHandle::type).map(MethodType::parameterList).
                 anyMatch(pl -> !pl.equals(commonSuffix.subList(0, pl.size())))) {
@@ -4109,8 +4124,10 @@
     }
 
     private static void checkLoop2(List<MethodHandle> step, List<MethodHandle> pred, List<MethodHandle> fini, List<Class<?>> commonParameterSequence) {
+        final int cpSize = commonParameterSequence.size();
         if (Stream.of(step, pred, fini).flatMap(List::stream).filter(Objects::nonNull).map(MethodHandle::type).
-                map(MethodType::parameterList).anyMatch(pl -> !pl.equals(commonParameterSequence.subList(0, pl.size())))) {
+                map(MethodType::parameterList).
+                anyMatch(pl -> pl.size() > cpSize || !pl.equals(commonParameterSequence.subList(0, pl.size())))) {
             throw newIllegalArgumentException("found non-effectively identical parameter type lists:\nstep: " + step +
                     "\npred: " + pred + "\nfini: " + fini + " (common parameter sequence: " + commonParameterSequence + ")");
         }
--- a/jdk/src/java.base/share/classes/java/net/DatagramSocketImpl.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/net/DatagramSocketImpl.java	Mon Mar 07 09:34:29 2016 +0100
@@ -27,9 +27,7 @@
 
 import java.io.FileDescriptor;
 import java.io.IOException;
-import java.io.InterruptedIOException;
 import java.util.Set;
-import java.util.HashSet;
 
 /**
  * Abstract datagram and multicast socket implementation base class.
@@ -352,32 +350,32 @@
         }
     }
 
-    private static final  Set<SocketOption<?>> dgSocketOptions =
-        new HashSet<>();
+    private static final Set<SocketOption<?>> dgSocketOptions;
 
-    private static final  Set<SocketOption<?>> mcSocketOptions =
-        new HashSet<>();
+    private static final Set<SocketOption<?>> mcSocketOptions;
 
     static {
-        dgSocketOptions.add(StandardSocketOptions.SO_SNDBUF);
-        dgSocketOptions.add(StandardSocketOptions.SO_RCVBUF);
-        dgSocketOptions.add(StandardSocketOptions.SO_REUSEADDR);
-        dgSocketOptions.add(StandardSocketOptions.IP_TOS);
+        dgSocketOptions = Set.of(StandardSocketOptions.SO_SNDBUF,
+                                 StandardSocketOptions.SO_RCVBUF,
+                                 StandardSocketOptions.SO_REUSEADDR,
+                                 StandardSocketOptions.IP_TOS);
 
-        mcSocketOptions.add(StandardSocketOptions.SO_SNDBUF);
-        mcSocketOptions.add(StandardSocketOptions.SO_RCVBUF);
-        mcSocketOptions.add(StandardSocketOptions.SO_REUSEADDR);
-        mcSocketOptions.add(StandardSocketOptions.IP_TOS);
-        mcSocketOptions.add(StandardSocketOptions.IP_MULTICAST_IF);
-        mcSocketOptions.add(StandardSocketOptions.IP_MULTICAST_TTL);
-        mcSocketOptions.add(StandardSocketOptions.IP_MULTICAST_LOOP);
-    };
+        mcSocketOptions = Set.of(StandardSocketOptions.SO_SNDBUF,
+                                 StandardSocketOptions.SO_RCVBUF,
+                                 StandardSocketOptions.SO_REUSEADDR,
+                                 StandardSocketOptions.IP_TOS,
+                                 StandardSocketOptions.IP_MULTICAST_IF,
+                                 StandardSocketOptions.IP_MULTICAST_TTL,
+                                 StandardSocketOptions.IP_MULTICAST_LOOP);
+    }
 
     /**
      * Returns a set of SocketOptions supported by this impl
      * and by this impl's socket (DatagramSocket or MulticastSocket)
      *
      * @return a Set of SocketOptions
+     *
+     * @since 9
      */
     protected Set<SocketOption<?>> supportedOptions() {
         if (getDatagramSocket() instanceof MulticastSocket) {
--- a/jdk/src/java.base/share/classes/java/net/SocketImpl.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/net/SocketImpl.java	Mon Mar 07 09:34:29 2016 +0100
@@ -30,8 +30,6 @@
 import java.io.OutputStream;
 import java.io.FileDescriptor;
 import java.util.Set;
-import java.util.HashSet;
-import java.util.Collections;
 
 /**
  * The abstract class {@code SocketImpl} is a common superclass
@@ -445,31 +443,31 @@
         }
     }
 
-    private static final  Set<SocketOption<?>> socketOptions =
-        new HashSet<>();
+    private static final Set<SocketOption<?>> socketOptions;
 
-    private static final  Set<SocketOption<?>> serverSocketOptions =
-        new HashSet<>();
+    private static final Set<SocketOption<?>> serverSocketOptions;
 
     static {
-        socketOptions.add(StandardSocketOptions.SO_KEEPALIVE);
-        socketOptions.add(StandardSocketOptions.SO_SNDBUF);
-        socketOptions.add(StandardSocketOptions.SO_RCVBUF);
-        socketOptions.add(StandardSocketOptions.SO_REUSEADDR);
-        socketOptions.add(StandardSocketOptions.SO_LINGER);
-        socketOptions.add(StandardSocketOptions.IP_TOS);
-        socketOptions.add(StandardSocketOptions.TCP_NODELAY);
+        socketOptions = Set.of(StandardSocketOptions.SO_KEEPALIVE,
+                               StandardSocketOptions.SO_SNDBUF,
+                               StandardSocketOptions.SO_RCVBUF,
+                               StandardSocketOptions.SO_REUSEADDR,
+                               StandardSocketOptions.SO_LINGER,
+                               StandardSocketOptions.IP_TOS,
+                               StandardSocketOptions.TCP_NODELAY);
 
-        serverSocketOptions.add(StandardSocketOptions.SO_RCVBUF);
-        serverSocketOptions.add(StandardSocketOptions.SO_REUSEADDR);
-        serverSocketOptions.add(StandardSocketOptions.IP_TOS);
-    };
+        serverSocketOptions = Set.of(StandardSocketOptions.SO_RCVBUF,
+                                     StandardSocketOptions.SO_REUSEADDR,
+                                     StandardSocketOptions.IP_TOS);
+    }
 
     /**
      * Returns a set of SocketOptions supported by this impl
      * and by this impl's socket (Socket or ServerSocket)
      *
      * @return a Set of SocketOptions
+     *
+     * @since 9
      */
     protected Set<SocketOption<?>> supportedOptions() {
         if (getSocket() != null) {
--- a/jdk/src/java.base/share/classes/java/nio/Bits.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/nio/Bits.java	Mon Mar 07 09:34:29 2016 +0100
@@ -736,202 +736,9 @@
         });
     }
 
-    // -- Bulk get/put acceleration --
-
     // These numbers represent the point at which we have empirically
     // determined that the average cost of a JNI call exceeds the expense
     // of an element by element copy.  These numbers may change over time.
     static final int JNI_COPY_TO_ARRAY_THRESHOLD   = 6;
     static final int JNI_COPY_FROM_ARRAY_THRESHOLD = 6;
-
-    // This number limits the number of bytes to copy per call to Unsafe's
-    // copyMemory method. A limit is imposed to allow for safepoint polling
-    // during a large copy
-    static final long UNSAFE_COPY_THRESHOLD = 1024L * 1024L;
-
-    // These methods do no bounds checking.  Verification that the copy will not
-    // result in memory corruption should be done prior to invocation.
-    // All positions and lengths are specified in bytes.
-
-    /**
-     * Copy from given source array to destination address.
-     *
-     * @param   src
-     *          source array
-     * @param   srcBaseOffset
-     *          offset of first element of storage in source array
-     * @param   srcPos
-     *          offset within source array of the first element to read
-     * @param   dstAddr
-     *          destination address
-     * @param   length
-     *          number of bytes to copy
-     */
-    static void copyFromArray(Object src, long srcBaseOffset, long srcPos,
-                              long dstAddr, long length)
-    {
-        long offset = srcBaseOffset + srcPos;
-        while (length > 0) {
-            long size = (length > UNSAFE_COPY_THRESHOLD) ? UNSAFE_COPY_THRESHOLD : length;
-            unsafe.copyMemory(src, offset, null, dstAddr, size);
-            length -= size;
-            offset += size;
-            dstAddr += size;
-        }
-    }
-
-    /**
-     * Copy from source address into given destination array.
-     *
-     * @param   srcAddr
-     *          source address
-     * @param   dst
-     *          destination array
-     * @param   dstBaseOffset
-     *          offset of first element of storage in destination array
-     * @param   dstPos
-     *          offset within destination array of the first element to write
-     * @param   length
-     *          number of bytes to copy
-     */
-    static void copyToArray(long srcAddr, Object dst, long dstBaseOffset, long dstPos,
-                            long length)
-    {
-        long offset = dstBaseOffset + dstPos;
-        while (length > 0) {
-            long size = (length > UNSAFE_COPY_THRESHOLD) ? UNSAFE_COPY_THRESHOLD : length;
-            unsafe.copyMemory(null, srcAddr, dst, offset, size);
-            length -= size;
-            srcAddr += size;
-            offset += size;
-        }
-    }
-
-    /**
-     * Copy and unconditionally byte swap 16 bit elements from a heap array to off-heap memory
-     *
-     * @param src
-     *        the source array, must be a 16-bit primitive array type
-     * @param srcPos
-     *        byte offset within source array of the first element to read
-     * @param dstAddr
-     *        destination address
-     * @param length
-     *        number of bytes to copy
-     */
-    static void copyFromCharArray(Object src, long srcPos, long dstAddr, long length) {
-        unsafe.copySwapMemory(src, unsafe.arrayBaseOffset(src.getClass()) + srcPos, null, dstAddr, length, 2);
-    }
-
-    /**
-     * Copy and unconditionally byte swap 16 bit elements from off-heap memory to a heap array
-     *
-     * @param srcAddr
-     *        source address
-     * @param dst
-     *        destination array, must be a 16-bit primitive array type
-     * @param dstPos
-     *        byte offset within the destination array of the first element to write
-     * @param length
-     *        number of bytes to copy
-     */
-    static void copyToCharArray(long srcAddr, Object dst, long dstPos, long length) {
-        unsafe.copySwapMemory(null, srcAddr, dst, unsafe.arrayBaseOffset(dst.getClass()) + dstPos, length, 2);
-    }
-
-    /**
-     * Copy and unconditionally byte swap 16 bit elements from a heap array to off-heap memory
-     *
-     * @param src
-     *        the source array, must be a 16-bit primitive array type
-     * @param srcPos
-     *        byte offset within source array of the first element to read
-     * @param dstAddr
-     *        destination address
-     * @param length
-     *        number of bytes to copy
-     */
-    static void copyFromShortArray(Object src, long srcPos, long dstAddr, long length) {
-        unsafe.copySwapMemory(src, unsafe.arrayBaseOffset(src.getClass()) + srcPos, null, dstAddr, length, 2);
-    }
-
-    /**
-     * Copy and unconditionally byte swap 16 bit elements from off-heap memory to a heap array
-     *
-     * @param srcAddr
-     *        source address
-     * @param dst
-     *        destination array, must be a 16-bit primitive array type
-     * @param dstPos
-     *        byte offset within the destination array of the first element to write
-     * @param length
-     *        number of bytes to copy
-     */
-    static void copyToShortArray(long srcAddr, Object dst, long dstPos, long length) {
-        unsafe.copySwapMemory(null, srcAddr, dst, unsafe.arrayBaseOffset(dst.getClass()) + dstPos, length, 2);
-    }
-
-    /**
-     * Copy and unconditionally byte swap 32 bit elements from a heap array to off-heap memory
-     *
-     * @param src
-     *        the source array, must be a 32-bit primitive array type
-     * @param srcPos
-     *        byte offset within source array of the first element to read
-     * @param dstAddr
-     *        destination address
-     * @param length
-     *        number of bytes to copy
-     */
-    static void copyFromIntArray(Object src, long srcPos, long dstAddr, long length) {
-        unsafe.copySwapMemory(src, unsafe.arrayBaseOffset(src.getClass()) + srcPos, null, dstAddr, length, 4);
-    }
-
-    /**
-     * Copy and unconditionally byte swap 32 bit elements from off-heap memory to a heap array
-     *
-     * @param srcAddr
-     *        source address
-     * @param dst
-     *        destination array, must be a 32-bit primitive array type
-     * @param dstPos
-     *        byte offset within the destination array of the first element to write
-     * @param length
-     *        number of bytes to copy
-     */
-    static void copyToIntArray(long srcAddr, Object dst, long dstPos, long length) {
-        unsafe.copySwapMemory(null, srcAddr, dst, unsafe.arrayBaseOffset(dst.getClass()) + dstPos, length, 4);
-    }
-
-    /**
-     * Copy and unconditionally byte swap 64 bit elements from a heap array to off-heap memory
-     *
-     * @param src
-     *        the source array, must be a 64-bit primitive array type
-     * @param srcPos
-     *        byte offset within source array of the first element to read
-     * @param dstAddr
-     *        destination address
-     * @param length
-     *        number of bytes to copy
-     */
-    static void copyFromLongArray(Object src, long srcPos, long dstAddr, long length) {
-        unsafe.copySwapMemory(src, unsafe.arrayBaseOffset(src.getClass()) + srcPos, null, dstAddr, length, 8);
-    }
-
-    /**
-     * Copy and unconditionally byte swap 64 bit elements from off-heap memory to a heap array
-     *
-     * @param srcAddr
-     *        source address
-     * @param dst
-     *        destination array, must be a 64-bit primitive array type
-     * @param dstPos
-     *        byte offset within the destination array of the first element to write
-     * @param length
-     *        number of bytes to copy
-     */
-    static void copyToLongArray(long srcAddr, Object dst, long dstPos, long length) {
-        unsafe.copySwapMemory(null, srcAddr, dst, unsafe.arrayBaseOffset(dst.getClass()) + dstPos, length, 8);
-    }
 }
--- a/jdk/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -270,16 +270,22 @@
             if (length > rem)
                 throw new BufferUnderflowException();
 
+            long dstOffset = arrayBaseOffset + ((long)offset << $LG_BYTES_PER_VALUE$);
 #if[!byte]
             if (order() != ByteOrder.nativeOrder())
-                Bits.copyTo$Memtype$Array(ix(pos), dst,
-                                          (long)offset << $LG_BYTES_PER_VALUE$,
-                                          (long)length << $LG_BYTES_PER_VALUE$);
+                unsafe.copySwapMemory(null,
+                                      ix(pos),
+                                      dst,
+                                      dstOffset,
+                                      (long)length << $LG_BYTES_PER_VALUE$,
+                                      (long)1 << $LG_BYTES_PER_VALUE$);
             else
 #end[!byte]
-                Bits.copyToArray(ix(pos), dst, arrayBaseOffset,
-                                 (long)offset << $LG_BYTES_PER_VALUE$,
-                                 (long)length << $LG_BYTES_PER_VALUE$);
+                unsafe.copyMemory(null,
+                                  ix(pos),
+                                  dst,
+                                  dstOffset,
+                                  (long)length << $LG_BYTES_PER_VALUE$);
             position(pos + length);
         } else {
             super.get(dst, offset, length);
@@ -362,18 +368,22 @@
             if (length > rem)
                 throw new BufferOverflowException();
 
+            long srcOffset = arrayBaseOffset + ((long)offset << $LG_BYTES_PER_VALUE$);
 #if[!byte]
             if (order() != ByteOrder.nativeOrder())
-                Bits.copyFrom$Memtype$Array(src,
-                                            (long)offset << $LG_BYTES_PER_VALUE$,
-                                            ix(pos),
-                                            (long)length << $LG_BYTES_PER_VALUE$);
+                unsafe.copySwapMemory(src,
+                                      srcOffset,
+                                      null,
+                                      ix(pos),
+                                      (long)length << $LG_BYTES_PER_VALUE$,
+                                      (long)1 << $LG_BYTES_PER_VALUE$);
             else
 #end[!byte]
-                Bits.copyFromArray(src, arrayBaseOffset,
-                                   (long)offset << $LG_BYTES_PER_VALUE$,
-                                   ix(pos),
-                                   (long)length << $LG_BYTES_PER_VALUE$);
+                unsafe.copyMemory(src,
+                                  srcOffset,
+                                  null,
+                                  ix(pos),
+                                  (long)length << $LG_BYTES_PER_VALUE$);
             position(pos + length);
         } else {
             super.put(src, offset, length);
--- a/jdk/src/java.base/share/classes/java/security/KeyPairGenerator.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/security/KeyPairGenerator.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -71,7 +71,7 @@
  * associated with each of the keys.
  *
  * <p>If the algorithm is the <i>DSA</i> algorithm, and the keysize (modulus
- * size) is 512, 768, or 1024, then the <i>Sun</i> provider uses a set of
+ * size) is 512, 768, 1024, or 2048, then the <i>Sun</i> provider uses a set of
  * precomputed values for the {@code p}, {@code q}, and
  * {@code g} parameters. If the modulus size is not one of the above
  * values, the <i>Sun</i> provider creates a new set of parameters. Other
@@ -96,7 +96,7 @@
  * (via a call to an {@code initialize} method), each provider must
  * supply (and document) a default initialization.
  * For example, the <i>Sun</i> provider uses a default modulus size (keysize)
- * of 1024 bits.
+ * of 1024 bits for DSA key pairs.
  *
  * <p>Note that this class is abstract and extends from
  * {@code KeyPairGeneratorSpi} for historical reasons.
--- a/jdk/src/java.base/share/classes/java/util/SplittableRandom.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/util/SplittableRandom.java	Mon Mar 07 09:34:29 2016 +0100
@@ -219,12 +219,20 @@
         return seed += gamma;
     }
 
+    // IllegalArgumentException messages
+    static final String BAD_BOUND = "bound must be positive";
+    static final String BAD_RANGE = "bound must be greater than origin";
+    static final String BAD_SIZE  = "size must be non-negative";
+
     /**
      * The seed generator for default constructors.
      */
-    private static final AtomicLong defaultGen = new AtomicLong(initialSeed());
+    private static final AtomicLong defaultGen
+        = new AtomicLong(mix64(System.currentTimeMillis()) ^
+                         mix64(System.nanoTime()));
 
-    private static long initialSeed() {
+    // at end of <clinit> to survive static initialization circularity
+    static {
         if (java.security.AccessController.doPrivileged(
             new java.security.PrivilegedAction<Boolean>() {
                 public Boolean run() {
@@ -234,17 +242,10 @@
             long s = (long)seedBytes[0] & 0xffL;
             for (int i = 1; i < 8; ++i)
                 s = (s << 8) | ((long)seedBytes[i] & 0xffL);
-            return s;
+            defaultGen.set(s);
         }
-        return (mix64(System.currentTimeMillis()) ^
-                mix64(System.nanoTime()));
     }
 
-    // IllegalArgumentException messages
-    static final String BAD_BOUND = "bound must be positive";
-    static final String BAD_RANGE = "bound must be greater than origin";
-    static final String BAD_SIZE  = "size must be non-negative";
-
     /*
      * Internal versions of nextX methods used by streams, as well as
      * the public nextX(origin, bound) methods.  These exist mainly to
--- a/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java	Mon Mar 07 09:34:29 2016 +0100
@@ -125,53 +125,6 @@
      * but we provide identical statistical properties.
      */
 
-    /** Generates per-thread initialization/probe field */
-    private static final AtomicInteger probeGenerator = new AtomicInteger();
-
-    /**
-     * The next seed for default constructors.
-     */
-    private static final AtomicLong seeder = new AtomicLong(initialSeed());
-
-    private static long initialSeed() {
-        if (java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction<Boolean>() {
-                public Boolean run() {
-                    return Boolean.getBoolean("java.util.secureRandomSeed");
-                }})) {
-            byte[] seedBytes = java.security.SecureRandom.getSeed(8);
-            long s = (long)seedBytes[0] & 0xffL;
-            for (int i = 1; i < 8; ++i)
-                s = (s << 8) | ((long)seedBytes[i] & 0xffL);
-            return s;
-        }
-        return (mix64(System.currentTimeMillis()) ^
-                mix64(System.nanoTime()));
-    }
-
-    /**
-     * The seed increment.
-     */
-    private static final long GAMMA = 0x9e3779b97f4a7c15L;
-
-    /**
-     * The increment for generating probe values.
-     */
-    private static final int PROBE_INCREMENT = 0x9e3779b9;
-
-    /**
-     * The increment of seeder per new instance.
-     */
-    private static final long SEEDER_INCREMENT = 0xbb67ae8584caa73bL;
-
-    // Constants from SplittableRandom
-    private static final double DOUBLE_UNIT = 0x1.0p-53;  // 1.0  / (1L << 53)
-    private static final float  FLOAT_UNIT  = 0x1.0p-24f; // 1.0f / (1 << 24)
-
-    /** Rarely-used holder for the second of a pair of Gaussians */
-    private static final ThreadLocal<Double> nextLocalGaussian =
-        new ThreadLocal<>();
-
     private static long mix64(long z) {
         z = (z ^ (z >>> 33)) * 0xff51afd7ed558ccdL;
         z = (z ^ (z >>> 33)) * 0xc4ceb9fe1a85ec53L;
@@ -194,9 +147,6 @@
         initialized = true; // false during super() call
     }
 
-    /** The common ThreadLocalRandom */
-    static final ThreadLocalRandom instance = new ThreadLocalRandom();
-
     /**
      * Initialize Thread fields for the current thread.  Called only
      * when Thread.threadLocalRandomProbe is zero, indicating that a
@@ -248,11 +198,6 @@
         return (int)(mix64(nextSeed()) >>> (64 - bits));
     }
 
-    // IllegalArgumentException messages
-    static final String BAD_BOUND = "bound must be positive";
-    static final String BAD_RANGE = "bound must be greater than origin";
-    static final String BAD_SIZE  = "size must be non-negative";
-
     /**
      * The form of nextLong used by LongStream Spliterators.  If
      * origin is greater than bound, acts as unbounded form of
@@ -1050,6 +995,32 @@
         return current();
     }
 
+    // Static initialization
+
+    /**
+     * The seed increment.
+     */
+    private static final long GAMMA = 0x9e3779b97f4a7c15L;
+
+    /**
+     * The increment for generating probe values.
+     */
+    private static final int PROBE_INCREMENT = 0x9e3779b9;
+
+    /**
+     * The increment of seeder per new instance.
+     */
+    private static final long SEEDER_INCREMENT = 0xbb67ae8584caa73bL;
+
+    // Constants from SplittableRandom
+    private static final double DOUBLE_UNIT = 0x1.0p-53;  // 1.0  / (1L << 53)
+    private static final float  FLOAT_UNIT  = 0x1.0p-24f; // 1.0f / (1 << 24)
+
+    // IllegalArgumentException messages
+    static final String BAD_BOUND = "bound must be positive";
+    static final String BAD_RANGE = "bound must be greater than origin";
+    static final String BAD_SIZE  = "size must be non-negative";
+
     // Unsafe mechanics
     private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
     private static final long SEED;
@@ -1067,4 +1038,36 @@
             throw new Error(e);
         }
     }
+
+    /** Rarely-used holder for the second of a pair of Gaussians */
+    private static final ThreadLocal<Double> nextLocalGaussian =
+        new ThreadLocal<>();
+
+    /** Generates per-thread initialization/probe field */
+    private static final AtomicInteger probeGenerator = new AtomicInteger();
+
+    /** The common ThreadLocalRandom */
+    static final ThreadLocalRandom instance = new ThreadLocalRandom();
+
+    /**
+     * The next seed for default constructors.
+     */
+    private static final AtomicLong seeder
+        = new AtomicLong(mix64(System.currentTimeMillis()) ^
+                         mix64(System.nanoTime()));
+
+    // at end of <clinit> to survive static initialization circularity
+    static {
+        if (java.security.AccessController.doPrivileged(
+            new java.security.PrivilegedAction<Boolean>() {
+                public Boolean run() {
+                    return Boolean.getBoolean("java.util.secureRandomSeed");
+                }})) {
+            byte[] seedBytes = java.security.SecureRandom.getSeed(8);
+            long s = (long)seedBytes[0] & 0xffL;
+            for (int i = 1; i < 8; ++i)
+                s = (s << 8) | ((long)seedBytes[i] & 0xffL);
+            seeder.set(s);
+        }
+    }
 }
--- a/jdk/src/java.base/share/classes/java/util/jar/JarFile.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/util/jar/JarFile.java	Mon Mar 07 09:34:29 2016 +0100
@@ -158,7 +158,7 @@
         RUNTIME_VERSION = AccessController.doPrivileged(
                 new PrivilegedAction<Integer>() {
                     public Integer run() {
-                        Integer v = sun.misc.Version.jdkMajorVersion(); // fixme when JEP 223 Version integrated
+                        Integer v = jdk.Version.current().major();
                         Integer i = Integer.getInteger("jdk.util.jar.version", v);
                         i = i < 0 ? 0 : i;
                         return i > v ? v : i;
@@ -359,7 +359,7 @@
     }
 
     private boolean runtimeVersionExists() {
-        int version = sun.misc.Version.jdkMajorVersion();  // fixme when JEP 223 integrated
+        int version = jdk.Version.current().major();
         try {
             Release.valueOf(version);
             return true;
@@ -893,11 +893,15 @@
     }
 
     private JarEntry verifiableEntry(ZipEntry ze) {
-        if (!(ze instanceof JarFileEntry)) {
-            ze = getJarEntry(ze.getName());
+        if (ze instanceof JarFileEntry) {
+            // assure the name and entry match for verification
+            return ((JarFileEntry)ze).reifiedEntry();
         }
-        // assure the name and entry match for verification
-        return ze == null ? null : ((JarFileEntry)ze).reifiedEntry();
+        ze = getJarEntry(ze.getName());
+        if (ze instanceof JarFileEntry) {
+            return ((JarFileEntry)ze).reifiedEntry();
+        }
+        return (JarEntry)ze;
     }
 
     // Statics for hand-coded Boyer-Moore search
--- a/jdk/src/java.base/share/classes/java/util/stream/AbstractPipeline.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/util/stream/AbstractPipeline.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -327,6 +327,8 @@
     @Override
     @SuppressWarnings("unchecked")
     public S onClose(Runnable closeHandler) {
+        if (linkedOrConsumed)
+            throw new IllegalStateException(MSG_STREAM_LINKED);
         Objects.requireNonNull(closeHandler);
         Runnable existingHandler = sourceStage.sourceCloseAction;
         sourceStage.sourceCloseAction =
--- a/jdk/src/java.base/share/classes/java/util/stream/DoubleStream.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/util/stream/DoubleStream.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -949,24 +949,100 @@
      */
     public static DoubleStream iterate(final double seed, final DoubleUnaryOperator f) {
         Objects.requireNonNull(f);
-        final PrimitiveIterator.OfDouble iterator = new PrimitiveIterator.OfDouble() {
-            double t = seed;
+        Spliterator.OfDouble spliterator = new Spliterators.AbstractDoubleSpliterator(Long.MAX_VALUE,
+               Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL) {
+            double prev;
+            boolean started;
 
             @Override
-            public boolean hasNext() {
+            public boolean tryAdvance(DoubleConsumer action) {
+                Objects.requireNonNull(action);
+                double t;
+                if (started)
+                    t = f.applyAsDouble(prev);
+                else {
+                    t = seed;
+                    started = true;
+                }
+                action.accept(prev = t);
+                return true;
+            }
+        };
+        return StreamSupport.doubleStream(spliterator, false);
+    }
+
+    /**
+     * Returns a sequential ordered {@code DoubleStream} produced by iterative
+     * application of a function to an initial element, conditioned on
+     * satisfying the supplied predicate.  The stream terminates as soon as
+     * the predicate returns false.
+     *
+     * <p>
+     * {@code DoubleStream.iterate} should produce the same sequence of
+     * elements as produced by the corresponding for-loop:
+     * <pre>{@code
+     *     for (double index=seed; predicate.test(index); index = f.apply(index)) {
+     *         ...
+     *     }
+     * }</pre>
+     *
+     * <p>
+     * The resulting sequence may be empty if the predicate does not hold on
+     * the seed value.  Otherwise the first element will be the supplied seed
+     * value, the next element (if present) will be the result of applying the
+     * function f to the seed value, and so on iteratively until the predicate
+     * indicates that the stream should terminate.
+     *
+     * @param seed the initial element
+     * @param predicate a predicate to apply to elements to determine when the
+     *          stream must terminate.
+     * @param f a function to be applied to the previous element to produce
+     *          a new element
+     * @return a new sequential {@code DoubleStream}
+     * @since 9
+     */
+    public static DoubleStream iterate(double seed, DoublePredicate predicate, DoubleUnaryOperator f) {
+        Objects.requireNonNull(f);
+        Objects.requireNonNull(predicate);
+        Spliterator.OfDouble spliterator = new Spliterators.AbstractDoubleSpliterator(Long.MAX_VALUE,
+               Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL) {
+            double prev;
+            boolean started, finished;
+
+            @Override
+            public boolean tryAdvance(DoubleConsumer action) {
+                Objects.requireNonNull(action);
+                if (finished)
+                    return false;
+                double t;
+                if (started)
+                    t = f.applyAsDouble(prev);
+                else {
+                    t = seed;
+                    started = true;
+                }
+                if (!predicate.test(t)) {
+                    finished = true;
+                    return false;
+                }
+                action.accept(prev = t);
                 return true;
             }
 
             @Override
-            public double nextDouble() {
-                double v = t;
-                t = f.applyAsDouble(t);
-                return v;
+            public void forEachRemaining(DoubleConsumer action) {
+                Objects.requireNonNull(action);
+                if (finished)
+                    return;
+                finished = true;
+                double t = started ? f.applyAsDouble(prev) : seed;
+                while (predicate.test(t)) {
+                    action.accept(t);
+                    t = f.applyAsDouble(t);
+                }
             }
         };
-        return StreamSupport.doubleStream(Spliterators.spliteratorUnknownSize(
-                iterator,
-                Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL), false);
+        return StreamSupport.doubleStream(spliterator, false);
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/util/stream/IntStream.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/util/stream/IntStream.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -885,28 +885,104 @@
      * @param seed the initial element
      * @param f a function to be applied to the previous element to produce
      *          a new element
-     * @return A new sequential {@code IntStream}
+     * @return a new sequential {@code IntStream}
      */
     public static IntStream iterate(final int seed, final IntUnaryOperator f) {
         Objects.requireNonNull(f);
-        final PrimitiveIterator.OfInt iterator = new PrimitiveIterator.OfInt() {
-            int t = seed;
+        Spliterator.OfInt spliterator = new Spliterators.AbstractIntSpliterator(Long.MAX_VALUE,
+               Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL) {
+            int prev;
+            boolean started;
 
             @Override
-            public boolean hasNext() {
+            public boolean tryAdvance(IntConsumer action) {
+                Objects.requireNonNull(action);
+                int t;
+                if (started)
+                    t = f.applyAsInt(prev);
+                else {
+                    t = seed;
+                    started = true;
+                }
+                action.accept(prev = t);
+                return true;
+            }
+        };
+        return StreamSupport.intStream(spliterator, false);
+    }
+
+    /**
+     * Returns a sequential ordered {@code IntStream} produced by iterative
+     * application of a function to an initial element, conditioned on
+     * satisfying the supplied predicate.  The stream terminates as soon as
+     * the predicate returns false.
+     *
+     * <p>
+     * {@code IntStream.iterate} should produce the same sequence of elements
+     * as produced by the corresponding for-loop:
+     * <pre>{@code
+     *     for (int index=seed; predicate.test(index); index = f.apply(index)) {
+     *         ...
+     *     }
+     * }</pre>
+     *
+     * <p>
+     * The resulting sequence may be empty if the predicate does not hold on
+     * the seed value.  Otherwise the first element will be the supplied seed
+     * value, the next element (if present) will be the result of applying the
+     * function f to the seed value, and so on iteratively until the predicate
+     * indicates that the stream should terminate.
+     *
+     * @param seed the initial element
+     * @param predicate a predicate to apply to elements to determine when the
+     *          stream must terminate.
+     * @param f a function to be applied to the previous element to produce
+     *          a new element
+     * @return a new sequential {@code IntStream}
+     * @since 9
+     */
+    public static IntStream iterate(int seed, IntPredicate predicate, IntUnaryOperator f) {
+        Objects.requireNonNull(f);
+        Objects.requireNonNull(predicate);
+        Spliterator.OfInt spliterator = new Spliterators.AbstractIntSpliterator(Long.MAX_VALUE,
+               Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL) {
+            int prev;
+            boolean started, finished;
+
+            @Override
+            public boolean tryAdvance(IntConsumer action) {
+                Objects.requireNonNull(action);
+                if (finished)
+                    return false;
+                int t;
+                if (started)
+                    t = f.applyAsInt(prev);
+                else {
+                    t = seed;
+                    started = true;
+                }
+                if (!predicate.test(t)) {
+                    finished = true;
+                    return false;
+                }
+                action.accept(prev = t);
                 return true;
             }
 
             @Override
-            public int nextInt() {
-                int v = t;
-                t = f.applyAsInt(t);
-                return v;
+            public void forEachRemaining(IntConsumer action) {
+                Objects.requireNonNull(action);
+                if (finished)
+                    return;
+                finished = true;
+                int t = started ? f.applyAsInt(prev) : seed;
+                while (predicate.test(t)) {
+                    action.accept(t);
+                    t = f.applyAsInt(t);
+                }
             }
         };
-        return StreamSupport.intStream(Spliterators.spliteratorUnknownSize(
-                iterator,
-                Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL), false);
+        return StreamSupport.intStream(spliterator, false);
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/util/stream/LongStream.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/util/stream/LongStream.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -879,24 +879,100 @@
      */
     public static LongStream iterate(final long seed, final LongUnaryOperator f) {
         Objects.requireNonNull(f);
-        final PrimitiveIterator.OfLong iterator = new PrimitiveIterator.OfLong() {
-            long t = seed;
+        Spliterator.OfLong spliterator = new Spliterators.AbstractLongSpliterator(Long.MAX_VALUE,
+               Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL) {
+            long prev;
+            boolean started;
 
             @Override
-            public boolean hasNext() {
+            public boolean tryAdvance(LongConsumer action) {
+                Objects.requireNonNull(action);
+                long t;
+                if (started)
+                    t = f.applyAsLong(prev);
+                else {
+                    t = seed;
+                    started = true;
+                }
+                action.accept(prev = t);
+                return true;
+            }
+        };
+        return StreamSupport.longStream(spliterator, false);
+    }
+
+    /**
+     * Returns a sequential ordered {@code LongStream} produced by iterative
+     * application of a function to an initial element, conditioned on
+     * satisfying the supplied predicate.  The stream terminates as soon as
+     * the predicate returns false.
+     *
+     * <p>
+     * {@code LongStream.iterate} should produce the same sequence of elements
+     * as produced by the corresponding for-loop:
+     * <pre>{@code
+     *     for (long index=seed; predicate.test(index); index = f.apply(index)) {
+     *         ...
+     *     }
+     * }</pre>
+     *
+     * <p>
+     * The resulting sequence may be empty if the predicate does not hold on
+     * the seed value.  Otherwise the first element will be the supplied seed
+     * value, the next element (if present) will be the result of applying the
+     * function f to the seed value, and so on iteratively until the predicate
+     * indicates that the stream should terminate.
+     *
+     * @param seed the initial element
+     * @param predicate a predicate to apply to elements to determine when the
+     *          stream must terminate.
+     * @param f a function to be applied to the previous element to produce
+     *          a new element
+     * @return a new sequential {@code LongStream}
+     * @since 9
+     */
+    public static LongStream iterate(long seed, LongPredicate predicate, LongUnaryOperator f) {
+        Objects.requireNonNull(f);
+        Objects.requireNonNull(predicate);
+        Spliterator.OfLong spliterator = new Spliterators.AbstractLongSpliterator(Long.MAX_VALUE,
+               Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL) {
+            long prev;
+            boolean started, finished;
+
+            @Override
+            public boolean tryAdvance(LongConsumer action) {
+                Objects.requireNonNull(action);
+                if (finished)
+                    return false;
+                long t;
+                if (started)
+                    t = f.applyAsLong(prev);
+                else {
+                    t = seed;
+                    started = true;
+                }
+                if (!predicate.test(t)) {
+                    finished = true;
+                    return false;
+                }
+                action.accept(prev = t);
                 return true;
             }
 
             @Override
-            public long nextLong() {
-                long v = t;
-                t = f.applyAsLong(t);
-                return v;
+            public void forEachRemaining(LongConsumer action) {
+                Objects.requireNonNull(action);
+                if (finished)
+                    return;
+                finished = true;
+                long t = started ? f.applyAsLong(prev) : seed;
+                while (predicate.test(t)) {
+                    action.accept(t);
+                    t = f.applyAsLong(t);
+                }
             }
         };
-        return StreamSupport.longStream(Spliterators.spliteratorUnknownSize(
-                iterator,
-                Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL), false);
+        return StreamSupport.longStream(spliterator, false);
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/util/stream/Stream.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/util/stream/Stream.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,6 @@
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Comparator;
-import java.util.Iterator;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.Spliterator;
@@ -1185,23 +1184,103 @@
      */
     public static<T> Stream<T> iterate(final T seed, final UnaryOperator<T> f) {
         Objects.requireNonNull(f);
-        final Iterator<T> iterator = new Iterator<T>() {
-            @SuppressWarnings("unchecked")
-            T t = (T) Streams.NONE;
+        Spliterator<T> spliterator = new Spliterators.AbstractSpliterator<>(Long.MAX_VALUE,
+               Spliterator.ORDERED | Spliterator.IMMUTABLE) {
+            T prev;
+            boolean started;
 
             @Override
-            public boolean hasNext() {
+            public boolean tryAdvance(Consumer<? super T> action) {
+                Objects.requireNonNull(action);
+                T t;
+                if (started)
+                    t = f.apply(prev);
+                else {
+                    t = seed;
+                    started = true;
+                }
+                action.accept(prev = t);
+                return true;
+            }
+        };
+        return StreamSupport.stream(spliterator, false);
+    }
+
+    /**
+     * Returns a sequential ordered {@code Stream} produced by iterative
+     * application of a function to an initial element, conditioned on
+     * satisfying the supplied predicate.  The stream terminates as soon as
+     * the predicate returns false.
+     *
+     * <p>
+     * {@code Stream.iterate} should produce the same sequence of elements as
+     * produced by the corresponding for-loop:
+     * <pre>{@code
+     *     for (T index=seed; predicate.test(index); index = f.apply(index)) {
+     *         ...
+     *     }
+     * }</pre>
+     *
+     * <p>
+     * The resulting sequence may be empty if the predicate does not hold on
+     * the seed value.  Otherwise the first element will be the supplied seed
+     * value, the next element (if present) will be the result of applying the
+     * function f to the seed value, and so on iteratively until the predicate
+     * indicates that the stream should terminate.
+     *
+     * @param <T> the type of stream elements
+     * @param seed the initial element
+     * @param predicate a predicate to apply to elements to determine when the
+     *          stream must terminate.
+     * @param f a function to be applied to the previous element to produce
+     *          a new element
+     * @return a new sequential {@code Stream}
+     * @since 9
+     */
+    public static<T> Stream<T> iterate(T seed, Predicate<? super T> predicate, UnaryOperator<T> f) {
+        Objects.requireNonNull(f);
+        Objects.requireNonNull(predicate);
+        Spliterator<T> spliterator = new Spliterators.AbstractSpliterator<>(Long.MAX_VALUE,
+               Spliterator.ORDERED | Spliterator.IMMUTABLE) {
+            T prev;
+            boolean started, finished;
+
+            @Override
+            public boolean tryAdvance(Consumer<? super T> action) {
+                Objects.requireNonNull(action);
+                if (finished)
+                    return false;
+                T t;
+                if (started)
+                    t = f.apply(prev);
+                else {
+                    t = seed;
+                    started = true;
+                }
+                if (!predicate.test(t)) {
+                    prev = null;
+                    finished = true;
+                    return false;
+                }
+                action.accept(prev = t);
                 return true;
             }
 
             @Override
-            public T next() {
-                return t = (t == Streams.NONE) ? seed : f.apply(t);
+            public void forEachRemaining(Consumer<? super T> action) {
+                Objects.requireNonNull(action);
+                if (finished)
+                    return;
+                finished = true;
+                T t = started ? f.apply(prev) : seed;
+                prev = null;
+                while (predicate.test(t)) {
+                    action.accept(t);
+                    t = f.apply(t);
+                }
             }
         };
-        return StreamSupport.stream(Spliterators.spliteratorUnknownSize(
-                iterator,
-                Spliterator.ORDERED | Spliterator.IMMUTABLE), false);
+        return StreamSupport.stream(spliterator, false);
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/util/stream/Streams.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/util/stream/Streams.java	Mon Mar 07 09:34:29 2016 +0100
@@ -49,14 +49,6 @@
     }
 
     /**
-     * An object instance representing no value, that cannot be an actual
-     * data element of a stream.  Used when processing streams that can contain
-     * {@code null} elements to distinguish between a {@code null} value and no
-     * value.
-     */
-    static final Object NONE = new Object();
-
-    /**
      * An {@code int} range spliterator.
      */
     static final class RangeIntSpliterator implements Spliterator.OfInt {
--- a/jdk/src/java.base/share/classes/jdk/Version.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/classes/jdk/Version.java	Mon Mar 07 09:34:29 2016 +0100
@@ -28,10 +28,10 @@
 import java.math.BigInteger;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.util.ArrayList;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
@@ -208,11 +208,10 @@
                                                + s + "'");
 
         // $VNUM is a dot-separated list of integers of arbitrary length
-        version
-            = Collections.unmodifiableList(
-                  Arrays.stream(m.group(VNUM_GROUP).split("\\."))
-                  .map(Integer::parseInt)
-                  .collect(Collectors.toList()));
+        List<Integer> list = new ArrayList<>();
+        for (String i : m.group(VNUM_GROUP).split("\\."))
+            list.add(Integer.parseInt(i));
+        version = Collections.unmodifiableList(list);
 
         pre = Optional.ofNullable(m.group(PRE_GROUP));
 
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java	Mon Mar 07 09:34:29 2016 +0100
@@ -118,6 +118,8 @@
     }
 
     public static JavaNetInetAddressAccess getJavaNetInetAddressAccess() {
+        if (javaNetInetAddressAccess == null)
+            unsafe.ensureClassInitialized(java.net.InetAddress.class);
         return javaNetInetAddressAccess;
     }
 
--- a/jdk/src/java.base/share/classes/sun/misc/URLClassPath.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/misc/URLClassPath.java	Mon Mar 07 09:34:29 2016 +0100
@@ -758,9 +758,13 @@
 
             final URL url;
             try {
-                // add #runtime fragment to tell JarURLConnection to use
-                // runtime versioning if the underlying jar file is multi-release
-                url = new URL(getBaseURL(), ParseUtil.encodePath(name, false) + "#runtime");
+                if (jar.isMultiRelease()) {
+                    // add #runtime fragment to tell JarURLConnection to use
+                    // runtime versioning if the underlying jar file is multi-release
+                    url = new URL(getBaseURL(), ParseUtil.encodePath(name, false) + "#runtime");
+                } else {
+                    url = new URL(getBaseURL(), ParseUtil.encodePath(name, false));
+                }
                 if (check) {
                     URLClassPath.check(url);
                 }
--- a/jdk/src/java.base/share/classes/sun/misc/Version.java.template	Fri Mar 04 13:16:50 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,268 +0,0 @@
-/*
- * 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
- * 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.misc;
-import java.io.PrintStream;
-
-public class Version {
-
-
-    private static final String launcher_name =
-        "@@LAUNCHER_NAME@@";
-
-    private static final String java_version =
-        "@@VERSION_SHORT@@";
-
-    private static final String java_runtime_name =
-        "@@RUNTIME_NAME@@";
-
-    private static final String java_runtime_version =
-        "@@VERSION_STRING@@";
-
-    static {
-        init();
-    }
-
-    public static void init() {
-        System.setProperty("java.version", java_version);
-        System.setProperty("java.runtime.version", java_runtime_version);
-        System.setProperty("java.runtime.name", java_runtime_name);
-    }
-
-    private static boolean versionsInitialized = false;
-    private static int jvm_major_version = 0;
-    private static int jvm_minor_version = 0;
-    private static int jvm_security_version = 0;
-    private static int jvm_patch_version = 0;
-    private static int jvm_build_number = 0;
-    private static int jdk_major_version = 0;
-    private static int jdk_minor_version = 0;
-    private static int jdk_security_version = 0;
-    private static int jdk_patch_version = 0;
-    private static int jdk_build_number = 0;
-
-    /**
-     * In case you were wondering this method is called by java -version.
-     * Sad that it prints to stderr; would be nicer if default printed on
-     * stdout.
-     */
-    public static void print() {
-        print(System.err);
-    }
-
-    /**
-     * This is the same as print except that it adds an extra line-feed
-     * at the end, typically used by the -showversion in the launcher
-     */
-    public static void println() {
-        print(System.err);
-        System.err.println();
-    }
-
-    /**
-     * Give a stream, it will print version info on it.
-     */
-    public static void print(PrintStream ps) {
-        boolean isHeadless = false;
-
-        /* Report that we're running headless if the property is true */
-        String headless = System.getProperty("java.awt.headless");
-        if ( (headless != null) && (headless.equalsIgnoreCase("true")) ) {
-            isHeadless = true;
-        }
-
-        /* First line: platform version. */
-        ps.println(launcher_name + " version \"" + java_version + "\"");
-
-        /* Second line: runtime version (ie, libraries). */
-
-        String jdk_debug_level = System.getProperty("jdk.debug", "release");
-        /* Debug level is not printed for "release" builds */
-        if ("release".equals(jdk_debug_level)) {
-            jdk_debug_level = "";
-        } else {
-            jdk_debug_level = jdk_debug_level + " ";
-        }
-
-        ps.print(java_runtime_name + " (" + jdk_debug_level + "build " + java_runtime_version);
-
-        if (java_runtime_name.indexOf("Embedded") != -1 && isHeadless) {
-            // embedded builds report headless state
-            ps.print(", headless");
-        }
-        ps.println(')');
-
-        /* Third line: JVM information. */
-        String java_vm_name    = System.getProperty("java.vm.name");
-        String java_vm_version = System.getProperty("java.vm.version");
-        String java_vm_info    = System.getProperty("java.vm.info");
-        ps.println(java_vm_name + " (" + jdk_debug_level + "build " + java_vm_version + ", " +
-                   java_vm_info + ")");
-    }
-
-
-    /**
-     * Returns the major version of the running JVM.
-     * @return the major version of the running JVM
-     * @since 1.6
-     */
-    public static synchronized int jvmMajorVersion() {
-        if (!versionsInitialized) {
-            initVersions();
-        }
-        return jvm_major_version;
-    }
-
-    /**
-     * Returns the minor version of the running JVM.
-     * @return the minor version of the running JVM
-     * @since 1.6
-     */
-    public static synchronized int jvmMinorVersion() {
-        if (!versionsInitialized) {
-            initVersions();
-        }
-        return jvm_minor_version;
-    }
-
-
-    /**
-     * Returns the security version of the running JVM.
-     * @return the security version of the running JVM
-     * @since 9
-     */
-    public static synchronized int jvmSecurityVersion() {
-        if (!versionsInitialized) {
-            initVersions();
-        }
-        return jvm_security_version;
-    }
-
-    /**
-     * Returns the patch release version of the running JVM.
-     * @return the patch release version of the running JVM
-     * @since 9
-     */
-    public static synchronized int jvmPatchVersion() {
-        if (!versionsInitialized) {
-            initVersions();
-        }
-        return jvm_patch_version;
-    }
-
-    /**
-     * Returns the build number of the running JVM.
-     * @return the build number of the running JVM
-     * @since 1.6
-     */
-    public static synchronized int jvmBuildNumber() {
-        if (!versionsInitialized) {
-            initVersions();
-        }
-        return jvm_build_number;
-    }
-
-    /**
-     * Returns the major version of the running JDK.
-     * @return the major version of the running JDK
-     * @since 1.6
-     */
-    public static synchronized int jdkMajorVersion() {
-        if (!versionsInitialized) {
-            initVersions();
-        }
-        return jdk_major_version;
-    }
-
-    /**
-     * Returns the minor version of the running JDK.
-     * @return the minor version of the running JDK
-     * @since 1.6
-     */
-    public static synchronized int jdkMinorVersion() {
-        if (!versionsInitialized) {
-            initVersions();
-        }
-        return jdk_minor_version;
-    }
-
-    /**
-     * Returns the security version of the running JDK.
-     * @return the security version of the running JDK
-     * @since 9
-     */
-    public static synchronized int jdkSecurityVersion() {
-        if (!versionsInitialized) {
-            initVersions();
-        }
-        return jdk_security_version;
-    }
-
-    /**
-     * Returns the patch release version of the running JDK.
-     * @return the patch release version of the running JDK
-     * @since 9
-     */
-    public static synchronized int jdkPatchVersion() {
-        if (!versionsInitialized) {
-            initVersions();
-        }
-        return jdk_patch_version;
-    }
-
-    /**
-     * Returns the build number of the running JDK.
-     * @return the build number of the running JDK
-     * @since 1.6
-     */
-    public static synchronized int jdkBuildNumber() {
-        if (!versionsInitialized) {
-            initVersions();
-        }
-        return jdk_build_number;
-    }
-
-    private static synchronized void initVersions() {
-        if (versionsInitialized) {
-            return;
-        }
-        if (!getJvmVersionInfo()) {
-            throw new InternalError("Unable to obtain JVM version info");
-        }
-        getJdkVersionInfo();
-        versionsInitialized = true;
-    }
-
-    // Gets the JVM version info if available and sets the jvm_*_version fields
-    // and its capabilities.
-    private static native boolean getJvmVersionInfo();
-    private static native void getJdkVersionInfo();
-}
-
-// Help Emacs a little because this file doesn't end in .java.
-//
-// Local Variables: ***
-// mode: java ***
-// End: ***
--- a/jdk/src/java.base/share/classes/sun/security/rsa/RSAKeyPairGenerator.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/rsa/RSAKeyPairGenerator.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,7 +55,7 @@
 
     public RSAKeyPairGenerator() {
         // initialize to default in case the app does not call initialize()
-        initialize(1024, null);
+        initialize(2048, null);
     }
 
     // initialize the generator. See JCA doc
--- a/jdk/src/java.base/share/conf/security/java.security	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/conf/security/java.security	Mon Mar 07 09:34:29 2016 +0100
@@ -578,7 +578,7 @@
 #
 # Example:
 #   jdk.tls.disabledAlgorithms=MD5, SSLv3, DSA, RSA keySize < 2048
-jdk.tls.disabledAlgorithms=SSLv3, RC4, MD5withRSA, DH keySize < 768
+jdk.tls.disabledAlgorithms=SSLv3, RC4, MD5withRSA, DH keySize < 1024
 
 # Legacy algorithms for Secure Socket Layer/Transport Layer Security (SSL/TLS)
 # processing in JSSE implementation.
--- a/jdk/src/java.base/share/native/libjava/Version.c	Fri Mar 04 13:16:50 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2005, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "jni.h"
-#include "jni_util.h"
-#include "jvm.h"
-#include "jdk_util.h"
-
-#include "sun_misc_Version.h"
-
-static void setStaticIntField(JNIEnv* env, jclass cls, const char* name, jint value)
-{
-    jfieldID fid;
-    fid = (*env)->GetStaticFieldID(env, cls, name, "I");
-    if (fid != 0) {
-        (*env)->SetStaticIntField(env, cls, fid, value);
-    }
-}
-
-typedef void (JNICALL *GetJvmVersionInfo_fp)(JNIEnv*, jvm_version_info*, size_t);
-
-JNIEXPORT jboolean JNICALL
-Java_sun_misc_Version_getJvmVersionInfo(JNIEnv *env, jclass cls)
-{
-    jvm_version_info info;
-    GetJvmVersionInfo_fp func_p;
-
-    if (!JDK_InitJvmHandle()) {
-        JNU_ThrowInternalError(env, "Handle for JVM not found for symbol lookup");
-        return JNI_FALSE;
-    }
-    func_p = (GetJvmVersionInfo_fp) JDK_FindJvmEntry("JVM_GetVersionInfo");
-    if (func_p == NULL) {
-        return JNI_FALSE;
-    }
-
-    (*func_p)(env, &info, sizeof(info));
-    setStaticIntField(env, cls, "jvm_major_version", JVM_VERSION_MAJOR(info.jvm_version));
-    JNU_CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
-    setStaticIntField(env, cls, "jvm_minor_version", JVM_VERSION_MINOR(info.jvm_version));
-    JNU_CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
-    setStaticIntField(env, cls, "jvm_security_version", JVM_VERSION_SECURITY(info.jvm_version));
-    JNU_CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
-    setStaticIntField(env, cls, "jvm_build_number", JVM_VERSION_BUILD(info.jvm_version));
-    JNU_CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
-    setStaticIntField(env, cls, "jvm_patch_version", info.patch_version);
-    JNU_CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
-
-    return JNI_TRUE;
-}
-
-JNIEXPORT void JNICALL
-Java_sun_misc_Version_getJdkVersionInfo(JNIEnv *env, jclass cls)
-{
-    jdk_version_info info;
-
-    JDK_GetVersionInfo0(&info, sizeof(info));
-    setStaticIntField(env, cls, "jdk_major_version", JDK_VERSION_MAJOR(info.jdk_version));
-    JNU_CHECK_EXCEPTION(env);
-    setStaticIntField(env, cls, "jdk_minor_version", JDK_VERSION_MINOR(info.jdk_version));
-    JNU_CHECK_EXCEPTION(env);
-    setStaticIntField(env, cls, "jdk_security_version", JDK_VERSION_SECURITY(info.jdk_version));
-    JNU_CHECK_EXCEPTION(env);
-    setStaticIntField(env, cls, "jdk_build_number", JDK_VERSION_BUILD(info.jdk_version));
-    JNU_CHECK_EXCEPTION(env);
-    setStaticIntField(env, cls, "jdk_patch_version", info.patch_version);
-    JNU_CHECK_EXCEPTION(env);
-}
--- a/jdk/src/java.base/share/native/libjli/java.c	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.base/share/native/libjli/java.c	Mon Mar 07 09:34:29 2016 +0100
@@ -1470,7 +1470,7 @@
     jclass ver;
     jmethodID print;
 
-    NULL_CHECK(ver = FindBootStrapClass(env, "sun/misc/Version"));
+    NULL_CHECK(ver = FindBootStrapClass(env, "java/lang/VersionProps"));
     NULL_CHECK(print = (*env)->GetStaticMethodID(env,
                                                  ver,
                                                  (extraLF == JNI_TRUE) ? "println" : "print",
--- a/jdk/src/java.logging/share/classes/java/util/logging/Logger.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/java.logging/share/classes/java/util/logging/Logger.java	Mon Mar 07 09:34:29 2016 +0100
@@ -839,6 +839,7 @@
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   msgSupplier   A function, which when called, produces the
      *                        desired log message
+     * @since 1.8
      */
     public void log(Level level, Supplier<String> msgSupplier) {
         if (!isLoggable(level)) {
--- a/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/RSAKeyPairGenerator.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/RSAKeyPairGenerator.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,7 +46,7 @@
     // Supported by Microsoft Base, Strong and Enhanced Cryptographic Providers
     static final int KEY_SIZE_MIN = 512; // disallow MSCAPI min. of 384
     static final int KEY_SIZE_MAX = 16384;
-    private static final int KEY_SIZE_DEFAULT = 1024;
+    private static final int KEY_SIZE_DEFAULT = 2048;
 
     // size of the key to generate, KEY_SIZE_MIN <= keySize <= KEY_SIZE_MAX
     private int keySize;
--- a/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/SunMSCAPI.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/SunMSCAPI.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -182,7 +182,7 @@
                  * Key Pair Generator engines
                  */
                 attrs.clear();
-                attrs.put("KeySize", "1024");
+                attrs.put("KeySize", "16384");
                 putService(new ProviderService(p, "KeyPairGenerator",
                            "RSA", "sun.security.mscapi.RSAKeyPairGenerator",
                            null, attrs));
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -106,8 +106,15 @@
                 maxKeyLen = 2048;
             }
         } else {
-            // RSA, DH, and DSA
-            keySize = 1024;
+            if (algorithm.equals("DSA")) {
+                // keep default keysize at 1024 since larger keysizes may be
+                // incompatible with SHA1withDSA and SHA-2 Signature algs
+                // may not be supported by native pkcs11 implementations
+                keySize = 1024;
+            } else {
+                // RSA and DH
+                keySize = 2048;
+            }
             if ((minKeyLen == -1) || (minKeyLen < 512)) {
                 minKeyLen = 512;
             }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jsobject/share/classes/jdk/internal/netscape/javascript/spi/JSObjectProvider.java	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.netscape.javascript.spi;
+
+import java.applet.Applet;
+import netscape.javascript.JSException;
+import netscape.javascript.JSObject;
+
+public interface JSObjectProvider {
+    /**
+     * Return a JSObject for the window containing the given applet.
+     * Implementations of this class should return null if not connected to a
+     * browser, for example, when running in AppletViewer.
+     *
+     * @param applet The applet.
+     * @return JSObject for the window containing the given applet or null if we
+     * are not connected to a browser.
+     * @throws JSException when an error is encountered.
+     */
+    public JSObject getWindow(Applet applet) throws JSException;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jsobject/share/classes/netscape/javascript/JSException.java	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2006, 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 netscape.javascript;
+
+/**
+ * Thrown when an exception is raised in the JavaScript engine. This is merely
+ * a marker class to indicate an exception relating to the JavaScript
+ * interface.
+ */
+public class JSException extends RuntimeException {
+    private static final long serialVersionUID = 2778103758223661489L;
+
+    /**
+     * Constructs a new JavaScript exception with null as it's detail message.
+     */
+    public JSException() {
+        super();
+    }
+
+    /**
+     * Construct a new JavaScript exception with the specified detail message.
+     *
+     * @param s The detail message
+     */
+    public JSException(String s) {
+        super(s);
+    }
+
+    /**
+     * Construct a new JavaScript exception with the specified cause.
+     *
+     * @param t Throwable cause
+     */
+    public JSException(Throwable t) {
+        super(t);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jsobject/share/classes/netscape/javascript/JSObject.java	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2006, 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 netscape.javascript;
+
+import jdk.internal.netscape.javascript.spi.JSObjectProvider;
+import java.applet.Applet;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Iterator;
+import java.util.ServiceLoader;
+
+/**
+ * <p>
+ * Allows Java code to manipulate JavaScript objects.
+ * </p>
+ *
+ * <p>
+ * When a JavaScript object is passed or returned to Java code, it
+ * is wrapped in an instance of {@code JSObject}. When a
+ * {@code JSObject} instance is passed to the JavaScript engine,
+ * it is unwrapped back to its original JavaScript object. The
+ * {@code JSObject} class provides a way to invoke JavaScript
+ * methods and examine JavaScript properties.
+ * </p>
+ *
+ * <p> Any data returned from the JavaScript engine to Java is
+ * converted to Java data types. Certain data passed to the JavaScript
+ * engine is converted to JavaScript data types.
+ * </p>
+ *
+ */
+public abstract class JSObject {
+    /**
+     * Constructs a new JSObject. Users should neither call this method nor
+     * subclass JSObject.
+     */
+    protected JSObject()  {
+    }
+
+    /**
+     * Calls a JavaScript method. Equivalent to
+     * "this.methodName(args[0], args[1], ...)" in JavaScript.
+     *
+     * @param methodName The name of the JavaScript method to be invoked.
+     * @param args the Java objects passed as arguments to the method.
+     * @return Result of the method.
+     * @throws JSException when an error is reported from the browser or
+     * JavaScript engine.
+     */
+    public abstract Object call(String methodName, Object... args) throws JSException;
+
+    /**
+     * Evaluates a JavaScript expression. The expression is a string of
+     * JavaScript source code which will be evaluated in the context given by
+     * "this".
+     *
+     * @param s The JavaScript expression.
+     * @return Result of the JavaScript evaluation.
+     * @throws JSException when an error is reported from the browser or
+     * JavaScript engine.
+     */
+    public abstract Object eval(String s) throws JSException;
+
+    /**
+     * Retrieves a named member of a JavaScript object. Equivalent to
+     * "this.name" in JavaScript.
+     *
+     * @param name The name of the JavaScript property to be accessed.
+     * @return The value of the propery.
+     * @throws JSException when an error is reported from the browser or
+     * JavaScript engine.
+     */
+    public abstract Object getMember(String name) throws JSException;
+
+    /**
+     * Sets a named member of a JavaScript object. Equivalent to
+     * "this.name = value" in JavaScript.
+     *
+     * @param name The name of the JavaScript property to be accessed.
+     * @param value The value of the propery.
+     * @throws JSException when an error is reported from the browser or
+     * JavaScript engine.
+     */
+    public abstract void setMember(String name, Object value) throws JSException;
+
+    /**
+     * Removes a named member of a JavaScript object. Equivalent
+     * to "delete this.name" in JavaScript.
+     *
+     * @param name The name of the JavaScript property to be removed.
+     * @throws JSException when an error is reported from the browser or
+     * JavaScript engine.
+     */
+    public abstract void removeMember(String name) throws JSException;
+
+    /**
+     * Retrieves an indexed member of a JavaScript object. Equivalent to
+     * "this[index]" in JavaScript.
+     *
+     * @param index The index of the array to be accessed.
+     * @return The value of the indexed member.
+     * @throws JSException when an error is reported from the browser or
+     * JavaScript engine.
+     */
+    public abstract Object getSlot(int index) throws JSException;
+
+    /**
+     * Sets an indexed member of a JavaScript object. Equivalent to
+     * "this[index] = value" in JavaScript.
+     *
+     * @param index The index of the array to be accessed.
+     * @param value The value to set
+     * @throws JSException when an error is reported from the browser or
+     * JavaScript engine.
+     */
+    public abstract void setSlot(int index, Object value) throws JSException;
+
+    /**
+     * Returns a JSObject for the window containing the given applet. This
+     * method only works when the Java code is running in a browser as an
+     * applet. The object returned may be used to access the HTML DOM directly.
+     *
+     * @param applet The applet.
+     * @return JSObject representing the window containing the given applet or
+     * {@code null} if we are not connected to a browser.
+     * @throws JSException when an error is reported from the browser or
+     * JavaScript engine or if applet is {@code null}
+     */
+    public static JSObject getWindow(Applet applet) throws JSException {
+        return ProviderLoader.callGetWindow(applet);
+    }
+
+    private static class ProviderLoader {
+        private static final JSObjectProvider provider;
+
+        static {
+            provider = AccessController.doPrivileged(
+                new PrivilegedAction<>() {
+                    @Override
+                    public JSObjectProvider run() {
+                        Iterator<JSObjectProvider> providers =
+                            ServiceLoader.loadInstalled(JSObjectProvider.class).iterator();
+                        if (providers.hasNext()) {
+                            return providers.next();
+                        }
+                        return null;
+                    }
+                }
+            );
+        }
+
+        private static JSObject callGetWindow(Applet applet) {
+            if (provider != null) {
+                return provider.getWindow(applet);
+            }
+            return null;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jsobject/share/classes/netscape/javascript/package-info.java	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2008, 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.
+ */
+
+/**
+ * <p>
+ * Provides Java code the ability to access the JavaScript engine and the
+ * HTML DOM in the web browser.
+ * </p>
+ *
+ * <p>
+ * The classes in this package were initially specified by Netscape, and are the
+ * de facto standard mechanism for calling JavaScript from the Java runtime.
+ * </p>
+ */
+
+package netscape.javascript;
--- a/jdk/test/TEST.groups	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/TEST.groups	Mon Mar 07 09:34:29 2016 +0100
@@ -28,7 +28,6 @@
 tier1 = \
     :jdk_lang \
     -java/lang/ProcessHandle/TreeTest.java \
-    -java/util/zip/TestLocalTime.java \
     :jdk_util \
     -java/util/WeakHashMap/GCDuringIteration.java \
     -java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java \
@@ -40,7 +39,6 @@
 
 tier2 = \
     java/lang/ProcessHandle/TreeTest.java \
-    java/util/zip/TestLocalTime.java \
     java/util/WeakHashMap/GCDuringIteration.java \
     java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java \
     java/util/concurrent/forkjoin/FJExceptionTableLeak.java \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/PBE/CheckPBEKeySize.java	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,73 @@
+/*
+ * 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 8151149
+ * @modules java.base/com.sun.crypto.provider
+ */
+
+import java.lang.reflect.*;
+import java.security.*;
+import javax.crypto.*;
+import javax.crypto.spec.*;
+import com.sun.crypto.provider.*;
+
+public class CheckPBEKeySize {
+
+    private static final String ALGO = "PBEWithSHA1AndDESede";
+    private static final int KEYSIZE = 112; // Triple DES effective key size
+
+    public static final void main(String[] args) throws Exception {
+
+        // Generate a PBE key
+        SecretKeyFactory skFac = SecretKeyFactory.getInstance("PBE");
+        SecretKey skey =
+            skFac.generateSecret(new PBEKeySpec("test123".toCharArray()));
+
+        // Initialize the PBE cipher
+        Cipher cipher = Cipher.getInstance(ALGO);
+        cipher.init(Cipher.ENCRYPT_MODE, skey);
+
+        // Permit access to the Cipher.spi field (a CipherSpi object)
+        Field spi = Cipher.class.getDeclaredField("spi");
+        spi.setAccessible(true);
+        Object value = spi.get(cipher);
+
+        // Permit access to the CipherSpi.engineGetKeySize method
+        Method engineGetKeySize =
+            PKCS12PBECipherCore$PBEWithSHA1AndDESede.class
+                .getDeclaredMethod("engineGetKeySize", Key.class);
+        engineGetKeySize.setAccessible(true);
+
+        // Check the key size
+        int keySize = (int) engineGetKeySize.invoke(value, skey);
+        if (keySize == KEYSIZE) {
+            System.out.println(ALGO + ".engineGetKeySize returns " + keySize +
+                " bits, as expected");
+            System.out.println("OK");
+        } else {
+            throw new Exception("ERROR: " + ALGO + " key size is incorrect");
+        }
+    }
+}
--- a/jdk/test/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -83,10 +83,10 @@
         KeyPair kp;
         KeyPairGenerator kpg = KeyPairGenerator.getInstance("DH", "SunJCE");
 
-        // Sun's default uses a default psize of 1024 and
+        // Sun's default uses a default psize of 2048 and
         // lsize of (pSize / 2) but at least 384 bits
         kp = kpg.generateKeyPair();
-        checkKeyPair(kp, Sizes.ten24, Sizes.five12);
+        checkKeyPair(kp, Sizes.twenty48, Sizes.ten24);
 
         DHPublicKey publicKey = (DHPublicKey)kp.getPublic();
         BigInteger p = publicKey.getParams().getP();
@@ -98,15 +98,15 @@
 
         kpg.initialize(new DHParameterSpec(p, g, Sizes.ten24.getIntSize()));
         kp = kpg.generateKeyPair();
-        checkKeyPair(kp, Sizes.ten24, Sizes.ten24);
+        checkKeyPair(kp, Sizes.twenty48, Sizes.ten24);
 
         kpg.initialize(new DHParameterSpec(p, g, Sizes.five12.getIntSize()));
         kp = kpg.generateKeyPair();
-        checkKeyPair(kp, Sizes.ten24, Sizes.five12);
+        checkKeyPair(kp, Sizes.twenty48, Sizes.five12);
 
         kpg.initialize(new DHParameterSpec(p, g, Sizes.two56.getIntSize()));
         kp = kpg.generateKeyPair();
-        checkKeyPair(kp, Sizes.ten24, Sizes.two56);
+        checkKeyPair(kp, Sizes.twenty48, Sizes.two56);
 
         kpg.initialize(Sizes.five12.getIntSize());
         kp = kpg.generateKeyPair();
--- a/jdk/test/java/lang/ProcessHandle/Basic.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/lang/ProcessHandle/Basic.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,8 @@
 /*
  * @test
  * @library /test/lib/share/classes
- * @run testng InfoTest
+ * @modules jdk.management
+ * @run testng Basic
  * @summary Basic tests for ProcessHandler
  * @author Roger Riggs
  */
--- a/jdk/test/java/lang/ProcessHandle/InfoTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/lang/ProcessHandle/InfoTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -49,6 +49,7 @@
  * @test
  * @bug 8077350 8081566 8081567 8098852 8136597
  * @library /test/lib/share/classes
+ * @modules jdk.management
  * @build jdk.test.lib.Platform jdk.test.lib.Utils
  * @run testng InfoTest
  * @summary Functions of ProcessHandle.Info
@@ -114,9 +115,13 @@
             long cpuLoopTime = 100;             // 100 ms
             String[] extraArgs = {"pid", "parent", "stdin"};
             JavaChild p1 = JavaChild.spawnJavaChild((Object[])extraArgs);
-            Instant afterStart = Instant.now();
+            Instant afterStart = null;
 
             try (BufferedReader lines = p1.outputReader()) {
+                // Read the args line to know the subprocess has started
+                lines.readLine();
+                afterStart = Instant.now();
+
                 Duration lastCpu = Duration.ofMillis(0L);
                 for (int j = 0; j < 10; j++) {
 
@@ -126,8 +131,7 @@
                     // Read cputime from child
                     Duration childCpuTime = null;
                     // Read lines from the child until the result from cputime is returned
-                    String s;
-                    while ((s = lines.readLine()) != null) {
+                    for (String s; (s = lines.readLine()) != null;) {
                         String[] split = s.trim().split(" ");
                         if (split.length == 3 && split[1].equals("cputime")) {
                             long nanos = Long.valueOf(split[2]);
--- a/jdk/test/java/lang/ProcessHandle/OnExitTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/lang/ProcessHandle/OnExitTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,6 +39,7 @@
 /*
  * @test
  * @library /test/lib/share/classes
+ * @modules jdk.management
  * @build jdk.test.lib.Platform jdk.test.lib.Utils
  * @run testng OnExitTest
  * @summary Functions of Process.onExit and ProcessHandle.onExit
--- a/jdk/test/java/lang/ProcessHandle/TreeTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/lang/ProcessHandle/TreeTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,6 +45,7 @@
 /*
  * @test
  * @library /test/lib/share/classes
+ * @modules jdk.management
  * @build jdk.test.lib.Utils
  * @run testng/othervm TreeTest
  * @summary Test counting and JavaChild.spawning and counting of Processes.
--- a/jdk/test/java/lang/StackWalker/StackStreamTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/lang/StackWalker/StackStreamTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
  * @test
  * @bug 8140450
  * @summary Stack Stream Test
+ * @modules java.logging
  * @run main/othervm StackStreamTest
  */
 public class StackStreamTest {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/StringBuilder/Capacity.java	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8149330
+ * @summary Basic set of tests of capacity management
+ * @run testng Capacity
+ */
+
+import java.lang.reflect.Field;
+import java.util.AbstractList;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.SplittableRandom;
+
+import org.testng.annotations.Test;
+import org.testng.annotations.DataProvider;
+import static org.testng.Assert.*;
+
+public class Capacity {
+    static final int DEFAULT_CAPACITY = 16;
+
+    private static int newCapacity(int oldCapacity,
+            int desiredCapacity)
+    {
+        return Math.max(oldCapacity * 2 + 2, desiredCapacity);
+    }
+
+    private static int nextNewCapacity(int oldCapacity) {
+        return newCapacity(oldCapacity, oldCapacity + 1);
+    }
+
+    @Test(dataProvider = "singleChar")
+    public void defaultCapacity(Character ch) {
+        StringBuilder sb = new StringBuilder();
+        assertEquals(sb.capacity(), DEFAULT_CAPACITY);
+        for (int i = 0; i < DEFAULT_CAPACITY; i++) {
+            sb.append(ch);
+            assertEquals(sb.capacity(), DEFAULT_CAPACITY);
+        }
+        sb.append(ch);
+        assertEquals(sb.capacity(), nextNewCapacity(DEFAULT_CAPACITY));
+    }
+
+    @Test(dataProvider = "charCapacity")
+    public void explicitCapacity(Character ch, int initCapacity) {
+        StringBuilder sb = new StringBuilder(initCapacity);
+        assertEquals(sb.capacity(), initCapacity);
+        for (int i = 0; i < initCapacity; i++) {
+            sb.append(ch);
+            assertEquals(sb.capacity(), initCapacity);
+        }
+        sb.append(ch);
+        assertEquals(sb.capacity(), nextNewCapacity(initCapacity));
+    }
+
+    @Test(dataProvider = "singleChar")
+    public void sbFromString(Character ch) {
+        String s = "string " + ch;
+        int expectedCapacity = s.length() + DEFAULT_CAPACITY;
+        StringBuilder sb = new StringBuilder(s);
+        assertEquals(sb.capacity(), expectedCapacity);
+        for (int i = 0; i < DEFAULT_CAPACITY; i++) {
+            sb.append(ch);
+            assertEquals(sb.capacity(), expectedCapacity);
+        }
+        sb.append(ch);
+        assertEquals(sb.capacity(), nextNewCapacity(expectedCapacity));
+    }
+
+    @Test(dataProvider = "singleChar")
+    public void sbFromCharSeq(Character ch) {
+        CharSequence cs = new MyCharSeq("char seq " + ch);
+        int expectedCapacity = cs.length() + DEFAULT_CAPACITY;
+        StringBuilder sb = new StringBuilder(cs);
+        assertEquals(sb.capacity(), expectedCapacity);
+        for (int i = 0; i < DEFAULT_CAPACITY; i++) {
+            sb.append(ch);
+            assertEquals(sb.capacity(), expectedCapacity);
+        }
+        sb.append(ch);
+        assertEquals(sb.capacity(), nextNewCapacity(expectedCapacity));
+    }
+
+    @Test(dataProvider = "charCapacity")
+    public void ensureCapacity(Character ch, int cap) {
+        StringBuilder sb = new StringBuilder(0);
+        assertEquals(sb.capacity(), 0);
+        sb.ensureCapacity(cap); // only has effect if cap > 0
+        int newCap = (cap == 0) ? 0 : newCapacity(0, cap);
+        assertEquals(sb.capacity(), newCap);
+        sb.ensureCapacity(newCap + 1);
+        assertEquals(sb.capacity(), nextNewCapacity(newCap));
+        sb.append(ch);
+        assertEquals(sb.capacity(), nextNewCapacity(newCap));
+    }
+
+    @Test(dataProvider = "negativeCapacity",
+          expectedExceptions = NegativeArraySizeException.class)
+    public void negativeInitialCapacity(int negCap) {
+        StringBuilder sb = new StringBuilder(negCap);
+    }
+
+    @Test(dataProvider = "negativeCapacity")
+    public void ensureNegativeCapacity(int negCap) {
+        StringBuilder sb = new StringBuilder();
+        sb.ensureCapacity(negCap);
+        assertEquals(sb.capacity(), DEFAULT_CAPACITY);
+    }
+
+    @Test(dataProvider = "charCapacity")
+    public void trimToSize(Character ch, int cap) {
+        StringBuilder sb = new StringBuilder(cap);
+        int halfOfCap = cap / 2;
+        for (int i = 0; i < halfOfCap; i++) {
+            sb.append(ch);
+        }
+        sb.trimToSize();
+        // according to the spec, capacity doesn't have to
+        // become exactly the size
+        assertTrue(sb.capacity() >= halfOfCap);
+    }
+
+    @DataProvider
+    public Object[][] singleChar() {
+        return new Object[][] { {'J'}, {'\u042b'} };
+    }
+
+    @DataProvider
+    public Object[][] charCapacity() {
+        return new Object[][] {
+            {'J', 0},
+            {'J', 1},
+            {'J', 15},
+            {'J', DEFAULT_CAPACITY},
+            {'J', 1024},
+            {'\u042b', 0},
+            {'\u042b', 1},
+            {'\u042b', 15},
+            {'\u042b', DEFAULT_CAPACITY},
+            {'\u042b', 1024},
+        };
+    }
+
+    @DataProvider
+    public Object[][] negativeCapacity() {
+        return new Object[][] { {-1}, {Integer.MIN_VALUE} };
+    }
+
+    private static class MyCharSeq implements CharSequence {
+        private CharSequence s;
+        public MyCharSeq(CharSequence s) { this.s = s; }
+        public char charAt(int i) { return s.charAt(i); }
+        public int length() { return s.length(); }
+        public CharSequence subSequence(int st, int e) {
+            return s.subSequence(st, e);
+        }
+        public String toString() { return s.toString(); }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/StringBuilder/HugeCapacity.java	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8149330
+ * @summary Capacity should not get close to Integer.MAX_VALUE unless
+ *          necessary
+ * @run main/othervm -Xmx5G HugeCapacity
+ * @ignore This test has huge memory requirements
+ */
+
+public class HugeCapacity {
+    private static int failures = 0;
+
+    public static void main(String[] args) {
+        testLatin1();
+        testUtf16();
+        if (failures > 0) {
+            throw new RuntimeException(failures + " tests failed");
+        }
+    }
+
+    private static void testLatin1() {
+        try {
+            StringBuilder sb = new StringBuilder();
+            sb.ensureCapacity(Integer.MAX_VALUE / 2);
+            sb.ensureCapacity(Integer.MAX_VALUE / 2 + 1);
+        } catch (OutOfMemoryError oom) {
+            oom.printStackTrace();
+            failures++;
+        }
+    }
+
+    private static void testUtf16() {
+        try {
+            StringBuilder sb = new StringBuilder();
+            sb.append('\u042b');
+            sb.ensureCapacity(Integer.MAX_VALUE / 4);
+            sb.ensureCapacity(Integer.MAX_VALUE / 4 + 1);
+        } catch (OutOfMemoryError oom) {
+            oom.printStackTrace();
+            failures++;
+        }
+    }
+}
--- a/jdk/test/java/lang/System/Logger/Level/LoggerLevelTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/lang/System/Logger/Level/LoggerLevelTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@
  * @bug 8140364
  * @summary Tests System.Logger.Level names and severity.
  * @author danielfuchs
+ * @modules java.logging
  */
 public class LoggerLevelTest {
     public static void main(String[] args) {
--- a/jdk/test/java/lang/System/Logger/default/DefaultLoggerTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/lang/System/Logger/default/DefaultLoggerTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,7 +56,7 @@
  * @summary Tests default loggers returned by System.getLogger, and in
  *          particular the implementation of the the System.Logger method
  *          performed by the default binding.
- *
+ * @modules java.logging
  * @build DefaultLoggerTest AccessSystemLogger
  * @run driver AccessSystemLogger
  * @run main/othervm -Xbootclasspath/a:boot DefaultLoggerTest NOSECURITY
--- a/jdk/test/java/lang/System/LoggerFinder/DefaultLoggerFinderTest/DefaultLoggerFinderTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/DefaultLoggerFinderTest/DefaultLoggerFinderTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -52,6 +52,7 @@
  * @bug     8140364
  * @summary Tests the default implementation of System.Logger, when
  *          JUL is the default backend.
+ * @modules java.logging
  * @build AccessSystemLogger DefaultLoggerFinderTest
  * @run  driver AccessSystemLogger
  * @run  main/othervm -Xbootclasspath/a:boot DefaultLoggerFinderTest NOSECURITY
--- a/jdk/test/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -52,6 +52,7 @@
             Tests the behavior of bootstrap loggers (and SimpleConsoleLoggers
  *          too).
  * @modules java.base/jdk.internal.logger
+ *          java.logging
  * @build BootstrapLoggerUtils LogStream
  * @run main/othervm BootstrapLoggerTest NO_SECURITY
  * @run main/othervm BootstrapLoggerTest SECURE
--- a/jdk/test/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -58,7 +58,9 @@
  * @summary JDK implementation specific unit test for JDK internal artifacts.
  *          Tests all bridge methods with the a custom backend whose
  *          loggers implement PlatformLogger.Bridge.
- * @modules java.base/sun.util.logging java.base/jdk.internal.logger
+ * @modules java.base/sun.util.logging
+ *          java.base/jdk.internal.logger
+ *          java.logging
  * @build CustomSystemClassLoader LoggerBridgeTest
  * @run  main/othervm -Djava.system.class.loader=CustomSystemClassLoader LoggerBridgeTest NOSECURITY
  * @run  main/othervm -Djava.system.class.loader=CustomSystemClassLoader LoggerBridgeTest NOPERMISSIONS
--- a/jdk/test/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,6 +57,7 @@
  *          Tests all bridge methods from PlatformLogger with the a custom
  *          backend whose loggers implement PlatformLogger.Bridge.
  * @modules java.base/sun.util.logging
+ *          java.logging
  * @build CustomSystemClassLoader PlatformLoggerBridgeTest
  * @run  main/othervm -Djava.system.class.loader=CustomSystemClassLoader PlatformLoggerBridgeTest NOSECURITY
  * @run  main/othervm -Djava.system.class.loader=CustomSystemClassLoader PlatformLoggerBridgeTest NOPERMISSIONS
--- a/jdk/test/java/lang/System/LoggerFinder/internal/api/LoggerFinderAPITest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/internal/api/LoggerFinderAPITest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
  *          Tests the consistency of the LoggerFinder and JDK extensions.
  * @modules java.base/sun.util.logging
  *          java.base/jdk.internal.logger
+ *          java.logging
  * @run  main LoggerFinderAPITest
  */
 
--- a/jdk/test/java/lang/System/MacEncoding/TestFileEncoding.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/lang/System/MacEncoding/TestFileEncoding.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
  * @bug 8011194
  * @summary Test value of file.encoding for corresponding value of LANG, etc
  * @library ../../../../tools/launcher/ ../
+ * @modules jdk.compiler
  * @build TestHelper TestFileEncoding ExpectedEncoding
  * @run main TestFileEncoding UTF-8
  * @run main/othervm -Dfile.encoding=MyEncoding -DuserEncoding=MyEncoding TestFileEncoding MyEncoding
--- a/jdk/test/java/lang/instrument/ManyMethodsBenchmarkAgent.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/lang/instrument/ManyMethodsBenchmarkAgent.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,9 +27,8 @@
  * @summary Tests and benchmarks the JVMTI RedefineClasses when a
  *          single class (and its parent) contains many methods.
  *
- * @modules java.compiler
+ * @modules jdk.compiler
  *          java.instrument
- *          jdk.compiler
  * @run build ManyMethodsBenchmarkApp ManyMethodsBenchmarkAgent
  * @run shell MakeJAR3.sh ManyMethodsBenchmarkAgent 'Can-Retransform-Classes: true'
  * @run main/othervm -javaagent:ManyMethodsBenchmarkAgent.jar ManyMethodsBenchmarkApp
--- a/jdk/test/java/lang/instrument/RetransformAgent.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/lang/instrument/RetransformAgent.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
  * @author Robert Field, Sun Microsystems
  *
  * @modules java.base/jdk.internal.org.objectweb.asm
+ *          java.instrument
  * @run shell/timeout=240 MakeJAR2.sh RetransformAgent RetransformApp 'Can-Retransform-Classes: true'
  * @run main/othervm -javaagent:RetransformAgent.jar RetransformApp
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/FindAccessTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+/* @test
+ * @bug 8139885
+ * @run testng/othervm -ea -esa test.java.lang.invoke.FindAccessTest
+ */
+
+package test.java.lang.invoke;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodHandles.Lookup;
+import java.lang.invoke.MethodType;
+
+import static org.testng.AssertJUnit.*;
+
+import org.testng.annotations.*;
+
+/**
+ * Tests for Lookup.findClass/accessClass extensions added in JEP 274.
+ */
+public class FindAccessTest {
+
+    static final Lookup LOOKUP = MethodHandles.lookup();
+
+    @Test
+    public static void testFindSpecial() throws Throwable {
+        FindSpecial.C c = new FindSpecial.C();
+        assertEquals("I1.m", c.m());
+        MethodType t = MethodType.methodType(String.class);
+        MethodHandle ci1m = LOOKUP.findSpecial(FindSpecial.I1.class, "m", t, FindSpecial.C.class);
+        assertEquals("I1.m", (String) ci1m.invoke(c));
+    }
+
+    @Test
+    public static void testFindSpecialAbstract() throws Throwable {
+        FindSpecial.C c = new FindSpecial.C();
+        assertEquals("q", c.q());
+        MethodType t = MethodType.methodType(String.class);
+        boolean caught = false;
+        try {
+            MethodHandle ci3q = LOOKUP.findSpecial(FindSpecial.I3.class, "q", t, FindSpecial.C.class);
+        } catch (Throwable thrown) {
+            if (!(thrown instanceof IllegalAccessException) || !FindSpecial.ABSTRACT_ERROR.equals(thrown.getMessage())) {
+                throw new AssertionError(thrown.getMessage(), thrown);
+            }
+            caught = true;
+        }
+        assertTrue(caught);
+    }
+
+    @Test(expectedExceptions = {ClassNotFoundException.class})
+    public static void testFindClassCNFE() throws ClassNotFoundException, IllegalAccessException {
+        LOOKUP.findClass("does.not.Exist");
+    }
+
+    static class FindSpecial {
+
+        interface I1 {
+            default String m() {
+                return "I1.m";
+            }
+        }
+
+        interface I2 {
+            default String m() {
+                return "I2.m";
+            }
+        }
+
+        interface I3 {
+            String q();
+        }
+
+        static class C implements I1, I2, I3 {
+            public String m() {
+                return I1.super.m();
+            }
+            public String q() {
+                return "q";
+            }
+        }
+
+        static final String ABSTRACT_ERROR = "no such method: test.java.lang.invoke.FindAccessTest$FindSpecial$I3.q()String/invokeSpecial";
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/FoldTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+/* @test
+ * @bug 8139885
+ * @run testng/othervm -ea -esa test.java.lang.invoke.FoldTest
+ */
+
+package test.java.lang.invoke;
+
+import java.io.StringWriter;
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodHandles.Lookup;
+import java.lang.invoke.MethodType;
+
+import static java.lang.invoke.MethodType.methodType;
+
+import static org.testng.AssertJUnit.*;
+
+import org.testng.annotations.*;
+
+/**
+ * Tests for the new fold method handle combinator added in JEP 274.
+ */
+public class FoldTest {
+
+    static final Lookup LOOKUP = MethodHandles.lookup();
+
+    @Test
+    public static void testFold0a() throws Throwable {
+        // equivalence to foldArguments(MethodHandle,MethodHandle)
+        MethodHandle fold = MethodHandles.foldArguments(Fold.MH_multer, 0, Fold.MH_adder);
+        assertEquals(Fold.MT_folded1, fold.type());
+        assertEquals(720, (int) fold.invoke(3, 4, 5));
+    }
+
+    @Test
+    public static void testFold1a() throws Throwable {
+        // test foldArguments for folding position 1
+        MethodHandle fold = MethodHandles.foldArguments(Fold.MH_multer, 1, Fold.MH_adder1);
+        assertEquals(Fold.MT_folded1, fold.type());
+        assertEquals(540, (int) fold.invoke(3, 4, 5));
+    }
+
+    @Test
+    public static void testFold0b() throws Throwable {
+        // test foldArguments equivalence with multiple types
+        MethodHandle fold = MethodHandles.foldArguments(Fold.MH_str, 0, Fold.MH_comb);
+        assertEquals(Fold.MT_folded2, fold.type());
+        assertEquals(23, (int) fold.invoke("true", true, 23));
+    }
+
+    @Test
+    public static void testFold1b() throws Throwable {
+        // test folgArguments for folding position 1, with multiple types
+        MethodHandle fold = MethodHandles.foldArguments(Fold.MH_str, 1, Fold.MH_comb2);
+        assertEquals(Fold.MT_folded3, fold.type());
+        assertEquals(1, (int) fold.invoke(true, true, 1));
+        assertEquals(-1, (int) fold.invoke(true, false, -1));
+    }
+
+    @Test
+    public static void testFoldArgumentsExample() throws Throwable {
+        // test the JavaDoc foldArguments-with-pos example
+        StringWriter swr = new StringWriter();
+        MethodHandle trace = LOOKUP.findVirtual(StringWriter.class, "write", methodType(void.class, String.class)).bindTo(swr);
+        MethodHandle cat = LOOKUP.findVirtual(String.class, "concat", methodType(String.class, String.class));
+        assertEquals("boojum", (String) cat.invokeExact("boo", "jum"));
+        MethodHandle catTrace = MethodHandles.foldArguments(cat, 1, trace);
+        assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
+        assertEquals("jum", swr.toString());
+    }
+
+    static class Fold {
+
+        static int adder(int a, int b, int c) {
+            return a + b + c;
+        }
+
+        static int adder1(int a, int b) {
+            return a + b;
+        }
+
+        static int multer(int x, int q, int r, int s) {
+            return x * q * r * s;
+        }
+
+        static int str(boolean b1, String s, boolean b2, int x) {
+            return b1 && s.equals(String.valueOf(b2)) ? x : -x;
+        }
+
+        static boolean comb(String s, boolean b2) {
+            return !s.equals(b2);
+        }
+
+        static String comb2(boolean b2, int x) {
+            int ib = b2 ? 1 : 0;
+            return ib == x ? "true" : "false";
+        }
+
+        static final Class<Fold> FOLD = Fold.class;
+
+        static final MethodType MT_adder = methodType(int.class, int.class, int.class, int.class);
+        static final MethodType MT_adder1 = methodType(int.class, int.class, int.class);
+        static final MethodType MT_multer = methodType(int.class, int.class, int.class, int.class, int.class);
+        static final MethodType MT_str = methodType(int.class, boolean.class, String.class, boolean.class, int.class);
+        static final MethodType MT_comb = methodType(boolean.class, String.class, boolean.class);
+        static final MethodType MT_comb2 = methodType(String.class, boolean.class, int.class);
+
+        static final MethodHandle MH_adder;
+        static final MethodHandle MH_adder1;
+        static final MethodHandle MH_multer;
+        static final MethodHandle MH_str;
+        static final MethodHandle MH_comb;
+        static final MethodHandle MH_comb2;
+
+        static final MethodType MT_folded1 = methodType(int.class, int.class, int.class, int.class);
+        static final MethodType MT_folded2 = methodType(int.class, String.class, boolean.class, int.class);
+        static final MethodType MT_folded3 = methodType(int.class, boolean.class, boolean.class, int.class);
+
+        static {
+            try {
+                MH_adder = LOOKUP.findStatic(FOLD, "adder", MT_adder);
+                MH_adder1 = LOOKUP.findStatic(FOLD, "adder1", MT_adder1);
+                MH_multer = LOOKUP.findStatic(FOLD, "multer", MT_multer);
+                MH_str = LOOKUP.findStatic(FOLD, "str", MT_str);
+                MH_comb = LOOKUP.findStatic(FOLD, "comb", MT_comb);
+                MH_comb2 = LOOKUP.findStatic(FOLD, "comb2", MT_comb2);
+            } catch (Exception e) {
+                throw new ExceptionInInitializerError(e);
+            }
+        }
+    }
+
+}
--- a/jdk/test/java/lang/invoke/JavaDocExamplesTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/lang/invoke/JavaDocExamplesTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -690,7 +690,7 @@
         {{
 {} /// JAVADOC
 // implement the zip function for lists as a loop handle
-MethodHandle loop = MethodHandles.doWhileLoop(MH_initZip, MH_zipStep, MH_zipPred);
+MethodHandle loop = MethodHandles.whileLoop(MH_initZip, MH_zipPred, MH_zipStep);
 List<String> a = Arrays.asList("a", "b", "c", "d");
 List<String> b = Arrays.asList("e", "f", "g", "h");
 List<String> zipped = Arrays.asList("a", "e", "b", "f", "c", "g", "d", "h");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/LoopCombinatorTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,803 @@
+/*
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+/* @test
+ * @bug 8139885
+ * @bug 8150635
+ * @run testng/othervm -ea -esa test.java.lang.invoke.LoopCombinatorTest
+ */
+
+package test.java.lang.invoke;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodHandles.Lookup;
+import java.lang.invoke.MethodType;
+import java.util.*;
+
+import static java.lang.invoke.MethodType.methodType;
+
+import static org.testng.AssertJUnit.*;
+
+import org.testng.annotations.*;
+
+/**
+ * Tests for the loop combinators introduced in JEP 274.
+ */
+public class LoopCombinatorTest {
+
+    static final Lookup LOOKUP = MethodHandles.lookup();
+
+    @Test
+    public static void testLoopFac() throws Throwable {
+        MethodHandle[] counterClause = new MethodHandle[]{Fac.MH_zero, Fac.MH_inc};
+        MethodHandle[] accumulatorClause = new MethodHandle[]{Fac.MH_one, Fac.MH_mult, Fac.MH_pred, Fac.MH_fin};
+        MethodHandle loop = MethodHandles.loop(counterClause, accumulatorClause);
+        assertEquals(Fac.MT_fac, loop.type());
+        assertEquals(120, loop.invoke(5));
+    }
+
+    @Test
+    public static void testLoopFacNullInit() throws Throwable {
+        // null initializer for counter, should initialize to 0
+        MethodHandle[] counterClause = new MethodHandle[]{null, Fac.MH_inc};
+        MethodHandle[] accumulatorClause = new MethodHandle[]{Fac.MH_one, Fac.MH_mult, Fac.MH_pred, Fac.MH_fin};
+        MethodHandle loop = MethodHandles.loop(counterClause, accumulatorClause);
+        assertEquals(Fac.MT_fac, loop.type());
+        assertEquals(120, loop.invoke(5));
+    }
+
+    @Test
+    public static void testLoopNullInit() throws Throwable {
+        // null initializer for counter, should initialize to 0, one-clause loop
+        MethodHandle[] counterClause = new MethodHandle[]{null, Loop.MH_inc, Loop.MH_pred, Loop.MH_fin};
+        MethodHandle loop = MethodHandles.loop(counterClause);
+        assertEquals(Loop.MT_loop, loop.type());
+        assertEquals(10, loop.invoke(10));
+    }
+
+    @Test
+    public static void testLoopVoid1() throws Throwable {
+        // construct a post-checked loop that only does one iteration and has a void body and void local state
+        MethodHandle loop = MethodHandles.loop(new MethodHandle[]{Empty.MH_f, Empty.MH_f, Empty.MH_pred, null});
+        assertEquals(MethodType.methodType(void.class), loop.type());
+        loop.invoke();
+    }
+
+    @Test
+    public static void testLoopVoid2() throws Throwable {
+        // construct a post-checked loop that only does one iteration and has a void body and void local state,
+        // initialized implicitly from the step type
+        MethodHandle loop = MethodHandles.loop(new MethodHandle[]{null, Empty.MH_f, Empty.MH_pred, null});
+        assertEquals(MethodType.methodType(void.class), loop.type());
+        loop.invoke();
+    }
+
+    @Test
+    public static void testLoopVoid3() throws Throwable {
+        // construct a post-checked loop that only does one iteration and has a void body and void local state,
+        // and that has a void finalizer
+        MethodHandle loop = MethodHandles.loop(new MethodHandle[]{null, Empty.MH_f, Empty.MH_pred, Empty.MH_f});
+        assertEquals(MethodType.methodType(void.class), loop.type());
+        loop.invoke();
+    }
+
+    @Test
+    public static void testLoopFacWithVoidState() throws Throwable {
+        // like testLoopFac, but with additional void state that outputs a dot
+        MethodHandle[] counterClause = new MethodHandle[]{Fac.MH_zero, Fac.MH_inc};
+        MethodHandle[] accumulatorClause = new MethodHandle[]{Fac.MH_one, Fac.MH_mult, Fac.MH_pred, Fac.MH_fin};
+        MethodHandle[] dotClause = new MethodHandle[]{null, Fac.MH_dot};
+        MethodHandle loop = MethodHandles.loop(counterClause, accumulatorClause, dotClause);
+        assertEquals(Fac.MT_fac, loop.type());
+        assertEquals(120, loop.invoke(5));
+    }
+
+    @Test
+    public static void testLoopVoidInt() throws Throwable {
+        // construct a post-checked loop that only does one iteration and has a void body and void local state,
+        // and that returns a constant
+        MethodHandle loop = MethodHandles.loop(new MethodHandle[]{null, Empty.MH_f, Empty.MH_pred, Empty.MH_c});
+        assertEquals(MethodType.methodType(int.class), loop.type());
+        assertEquals(23, loop.invoke());
+    }
+
+    @Test
+    public static void testLoopWithVirtuals() throws Throwable {
+        // construct a loop (to calculate factorial) that uses a mix of static and virtual methods
+        MethodHandle[] counterClause = new MethodHandle[]{null, LoopWithVirtuals.permute(LoopWithVirtuals.MH_inc)};
+        MethodHandle[] accumulatorClause = new MethodHandle[]{
+                // init function must indicate the loop arguments (there is no other means to determine them)
+                MethodHandles.dropArguments(LoopWithVirtuals.MH_one, 0, LoopWithVirtuals.class),
+                LoopWithVirtuals.permute(LoopWithVirtuals.MH_mult),
+                LoopWithVirtuals.permute(LoopWithVirtuals.MH_pred),
+                LoopWithVirtuals.permute(LoopWithVirtuals.MH_fin)
+        };
+        MethodHandle loop = MethodHandles.loop(counterClause, accumulatorClause);
+        assertEquals(LoopWithVirtuals.MT_loop, loop.type());
+        assertEquals(120, loop.invoke(new LoopWithVirtuals(), 5));
+    }
+
+    @DataProvider
+    static Object[][] negativeTestData() {
+        MethodHandle i0 = MethodHandles.constant(int.class, 0);
+        MethodHandle ii = MethodHandles.dropArguments(i0, 0, int.class, int.class);
+        MethodHandle id = MethodHandles.dropArguments(i0, 0, int.class, double.class);
+        MethodHandle i3 = MethodHandles.dropArguments(i0, 0, int.class, int.class, int.class);
+        List<MethodHandle> inits = Arrays.asList(ii, id, i3);
+        List<Class<?>> ints = Arrays.asList(int.class, int.class, int.class);
+        List<MethodHandle> finis = Arrays.asList(Fac.MH_fin, Fac.MH_inc, Counted.MH_step);
+        List<MethodHandle> preds1 = Arrays.asList(null, null, null);
+        List<MethodHandle> preds2 = Arrays.asList(null, Fac.MH_fin, null);
+        MethodHandle eek = MethodHandles.dropArguments(i0, 0, int.class, int.class, double.class);
+        List<MethodHandle> nesteps = Arrays.asList(Fac.MH_inc, eek, Fac.MH_dot);
+        List<MethodHandle> nepreds = Arrays.asList(null, Fac.MH_pred, null);
+        List<MethodHandle> nefinis = Arrays.asList(null, Fac.MH_fin, null);
+        List<MethodHandle> lvsteps = Arrays.asList(LoopWithVirtuals.MH_inc, LoopWithVirtuals.MH_mult);
+        List<MethodHandle> lvpreds = Arrays.asList(null, LoopWithVirtuals.MH_pred);
+        List<MethodHandle> lvfinis = Arrays.asList(null, LoopWithVirtuals.MH_fin);
+        return new Object[][] {
+                {null, "null or no clauses passed"},
+                {new MethodHandle[][]{}, "null or no clauses passed"},
+                {new MethodHandle[][]{{null, Fac.MH_inc}, {Fac.MH_one, null, Fac.MH_mult, Fac.MH_pred, Fac.MH_fin}},
+                        "All loop clauses must be represented as MethodHandle arrays with at most 4 elements."},
+                {new MethodHandle[][]{{null, Fac.MH_inc}, null}, "null clauses are not allowed"},
+                {new MethodHandle[][]{{Fac.MH_zero, Fac.MH_dot}},
+                        "clause 0: init and step return types must match: int != void"},
+                {new MethodHandle[][]{{ii}, {id}, {i3}},
+                        "found non-effectively identical init parameter type lists: " + inits +
+                                " (common suffix: " + ints + ")"},
+                {new MethodHandle[][]{{null, Fac.MH_inc, null, Fac.MH_fin}, {null, Fac.MH_inc, null, Fac.MH_inc},
+                        {null, Counted.MH_start, null, Counted.MH_step}},
+                        "found non-identical finalizer return types: " + finis + " (return type: int)"},
+                {new MethodHandle[][]{{Fac.MH_zero, Fac.MH_inc}, {Fac.MH_one, Fac.MH_mult, null, Fac.MH_fin},
+                        {null, Fac.MH_dot}}, "no predicate found: " + preds1},
+                {new MethodHandle[][]{{Fac.MH_zero, Fac.MH_inc}, {Fac.MH_one, Fac.MH_mult, Fac.MH_fin, Fac.MH_fin},
+                        {null, Fac.MH_dot}}, "predicates must have boolean return type: " + preds2},
+                {new MethodHandle[][]{{Fac.MH_zero, Fac.MH_inc}, {Fac.MH_one, eek, Fac.MH_pred, Fac.MH_fin},
+                        {null, Fac.MH_dot}},
+                        "found non-effectively identical parameter type lists:\nstep: " + nesteps +
+                                "\npred: " + nepreds + "\nfini: " + nefinis + " (common parameter sequence: " + ints + ")"},
+                {new MethodHandle[][]{{null, LoopWithVirtuals.MH_inc},
+                        {LoopWithVirtuals.MH_one, LoopWithVirtuals.MH_mult, LoopWithVirtuals.MH_pred, LoopWithVirtuals.MH_fin}},
+                        "found non-effectively identical parameter type lists:\nstep: " + lvsteps +
+                                "\npred: " + lvpreds + "\nfini: " + lvfinis + " (common parameter sequence: " + ints + ")"}
+        };
+    }
+
+    static final MethodHandle MH_loop;
+
+    static {
+        try {
+            MH_loop = LOOKUP.findStatic(MethodHandles.class, "loop", methodType(MethodHandle.class, MethodHandle[][].class));
+        } catch (NoSuchMethodException | IllegalAccessException e) {
+            throw new ExceptionInInitializerError(e);
+        }
+    }
+
+    @Test(dataProvider = "negativeTestData")
+    public static void testLoopNegative(MethodHandle[][] clauses, String expectedMessage) throws Throwable {
+        boolean caught = false;
+        try {
+            MH_loop.invokeWithArguments(clauses);
+        } catch (IllegalArgumentException iae) {
+            assertEquals(expectedMessage, iae.getMessage());
+            caught = true;
+        }
+        assertTrue(caught);
+    }
+
+    @Test
+    public static void testWhileLoop() throws Throwable {
+        // int i = 0; while (i < limit) { ++i; } return i; => limit
+        MethodHandle loop = MethodHandles.whileLoop(While.MH_zero, While.MH_pred, While.MH_step);
+        assertEquals(While.MT_while, loop.type());
+        assertEquals(23, loop.invoke(23));
+    }
+
+    @Test
+    public static void testWhileLoopNoIteration() throws Throwable {
+        // a while loop that never executes its body because the predicate evaluates to false immediately
+        MethodHandle loop = MethodHandles.whileLoop(While.MH_initString, While.MH_predString, While.MH_stepString);
+        assertEquals(While.MT_string, loop.type());
+        assertEquals("a", loop.invoke());
+    }
+
+    @Test
+    public static void testDoWhileLoop() throws Throwable {
+        // int i = 0; do { ++i; } while (i < limit); return i; => limit
+        MethodHandle loop = MethodHandles.doWhileLoop(While.MH_zero, While.MH_step, While.MH_pred);
+        assertEquals(While.MT_while, loop.type());
+        assertEquals(23, loop.invoke(23));
+    }
+
+    @Test
+    public static void testDoWhileNullInit() throws Throwable {
+        While w = new While();
+        int v = 5;
+        MethodHandle loop = MethodHandles.doWhileLoop(null, While.MH_voidBody.bindTo(w), While.MH_voidPred.bindTo(w));
+        assertEquals(While.MT_void, loop.type());
+        loop.invoke(v);
+        assertEquals(v, w.i);
+    }
+
+    @Test
+    public static void testWhileZip() throws Throwable {
+        MethodHandle loop = MethodHandles.doWhileLoop(While.MH_zipInitZip, While.MH_zipStep, While.MH_zipPred);
+        assertEquals(While.MT_zip, loop.type());
+        List<String> a = Arrays.asList("a", "b", "c", "d");
+        List<String> b = Arrays.asList("e", "f", "g", "h");
+        List<String> zipped = Arrays.asList("a", "e", "b", "f", "c", "g", "d", "h");
+        assertEquals(zipped, (List<String>) loop.invoke(a.iterator(), b.iterator()));
+    }
+
+    @Test
+    public static void testWhileNullInit() throws Throwable {
+        While w = new While();
+        int v = 5;
+        MethodHandle loop = MethodHandles.whileLoop(null, While.MH_voidPred.bindTo(w), While.MH_voidBody.bindTo(w));
+        assertEquals(While.MT_void, loop.type());
+        loop.invoke(v);
+        assertEquals(v, w.i);
+    }
+
+    @Test
+    public static void testCountedLoop() throws Throwable {
+        // String s = "Lambdaman!"; for (int i = 0; i < 13; ++i) { s = "na " + s; } return s; => a variation on a well known theme
+        MethodHandle fit13 = MethodHandles.constant(int.class, 13);
+        MethodHandle loop = MethodHandles.countedLoop(fit13, Counted.MH_start, Counted.MH_step);
+        assertEquals(Counted.MT_counted, loop.type());
+        assertEquals("na na na na na na na na na na na na na Lambdaman!", loop.invoke("Lambdaman!"));
+    }
+
+    @Test
+    public static void testCountedArrayLoop() throws Throwable {
+        // int[] a = new int[]{0}; for (int i = 0; i < 13; ++i) { ++a[0]; } => a[0] == 13
+        MethodHandle fit13 = MethodHandles.dropArguments(MethodHandles.constant(int.class, 13), 0, int[].class);
+        MethodHandle loop = MethodHandles.countedLoop(fit13, null, Counted.MH_stepUpdateArray);
+        assertEquals(Counted.MT_arrayCounted, loop.type());
+        int[] a = new int[]{0};
+        loop.invoke(a);
+        assertEquals(13, a[0]);
+    }
+
+    @Test
+    public static void testCountedPrintingLoop() throws Throwable {
+        MethodHandle fit5 = MethodHandles.constant(int.class, 5);
+        MethodHandle loop = MethodHandles.countedLoop(fit5, null, Counted.MH_printHello);
+        assertEquals(Counted.MT_countedPrinting, loop.type());
+        loop.invoke();
+    }
+
+    @Test
+    public static void testCountedRangeLoop() throws Throwable {
+        // String s = "Lambdaman!"; for (int i = -5; i < 8; ++i) { s = "na " + s; } return s; => a well known theme
+        MethodHandle fitm5 = MethodHandles.dropArguments(Counted.MH_m5, 0, String.class);
+        MethodHandle fit8 = MethodHandles.dropArguments(Counted.MH_8, 0, String.class);
+        MethodHandle loop = MethodHandles.countedLoop(fitm5, fit8, Counted.MH_start, Counted.MH_step);
+        assertEquals(Counted.MT_counted, loop.type());
+        assertEquals("na na na na na na na na na na na na na Lambdaman!", loop.invoke("Lambdaman!"));
+    }
+
+    @Test
+    public static void testIterateSum() throws Throwable {
+        // Integer[] a = new Integer[]{1,2,3,4,5,6}; int sum = 0; for (int e : a) { sum += e; } return sum; => 21
+        MethodHandle loop = MethodHandles.iteratedLoop(Iterate.MH_sumIterator, Iterate.MH_sumInit, Iterate.MH_sumStep);
+        assertEquals(Iterate.MT_sum, loop.type());
+        assertEquals(21, loop.invoke(new Integer[]{1, 2, 3, 4, 5, 6}));
+    }
+
+    @Test
+    public static void testIterateReverse() throws Throwable {
+        MethodHandle loop = MethodHandles.iteratedLoop(null, Iterate.MH_reverseInit, Iterate.MH_reverseStep);
+        assertEquals(Iterate.MT_reverse, loop.type());
+        List<String> list = Arrays.asList("a", "b", "c", "d", "e");
+        List<String> reversedList = Arrays.asList("e", "d", "c", "b", "a");
+        assertEquals(reversedList, (List<String>) loop.invoke(list));
+    }
+
+    @Test
+    public static void testIterateLength() throws Throwable {
+        MethodHandle loop = MethodHandles.iteratedLoop(null, Iterate.MH_lengthInit, Iterate.MH_lengthStep);
+        assertEquals(Iterate.MT_length, loop.type());
+        List<Double> list = Arrays.asList(23.0, 148.0, 42.0);
+        assertEquals(list.size(), (int) loop.invoke(list));
+    }
+
+    @Test
+    public static void testIterateMap() throws Throwable {
+        MethodHandle loop = MethodHandles.iteratedLoop(null, Iterate.MH_mapInit, Iterate.MH_mapStep);
+        assertEquals(Iterate.MT_map, loop.type());
+        List<String> list = Arrays.asList("Hello", "world", "!");
+        List<String> upList = Arrays.asList("HELLO", "WORLD", "!");
+        assertEquals(upList, (List<String>) loop.invoke(list));
+    }
+
+    @Test
+    public static void testIteratePrint() throws Throwable {
+        MethodHandle loop = MethodHandles.iteratedLoop(null, null, Iterate.MH_printStep);
+        assertEquals(Iterate.MT_print, loop.type());
+        loop.invoke(Arrays.asList("hello", "world"));
+    }
+
+    @Test
+    public static void testIterateNullBody() {
+        boolean caught = false;
+        try {
+            MethodHandles.iteratedLoop(MethodHandles.identity(int.class), MethodHandles.identity(int.class), null);
+        } catch (IllegalArgumentException iae) {
+            assertEquals("iterated loop body must not be null", iae.getMessage());
+            caught = true;
+        }
+        assertTrue(caught);
+    }
+
+    static class Empty {
+
+        static void f() { }
+
+        static boolean pred() {
+            return false;
+        }
+
+        static int c() {
+            return 23;
+        }
+
+        static final Class<Empty> EMPTY = Empty.class;
+
+        static final MethodType MT_f = methodType(void.class);
+        static final MethodType MT_pred = methodType(boolean.class);
+        static final MethodType MT_c = methodType(int.class);
+
+        static final MethodHandle MH_f;
+        static final MethodHandle MH_pred;
+        static final MethodHandle MH_c;
+
+        static {
+            try {
+                MH_f = LOOKUP.findStatic(EMPTY, "f", MT_f);
+                MH_pred = LOOKUP.findStatic(EMPTY, "pred", MT_pred);
+                MH_c = LOOKUP.findStatic(EMPTY, "c", MT_c);
+            } catch (Exception e) {
+                throw new ExceptionInInitializerError(e);
+            }
+        }
+    }
+
+    static class Fac {
+
+        static int zero(int k) {
+            return 0;
+        }
+
+        static int one(int k) {
+            return 1;
+        }
+
+        static boolean pred(int i, int acc, int k) {
+            return i < k;
+        }
+
+        static int inc(int i, int acc, int k) {
+            return i + 1;
+        }
+
+        static int mult(int i, int acc, int k) {
+            return i * acc;
+        }
+
+        static void dot(int i, int acc, int k) {
+            System.out.print('.');
+        }
+
+        static int fin(int i, int acc, int k) {
+            return acc;
+        }
+
+        static final Class<Fac> FAC = Fac.class;
+
+        static final MethodType MT_init = methodType(int.class, int.class);
+        static final MethodType MT_fn = methodType(int.class, int.class, int.class, int.class);
+        static final MethodType MT_dot = methodType(void.class, int.class, int.class, int.class);
+        static final MethodType MT_pred = methodType(boolean.class, int.class, int.class, int.class);
+
+        static final MethodHandle MH_zero;
+        static final MethodHandle MH_one;
+        static final MethodHandle MH_pred;
+        static final MethodHandle MH_inc;
+        static final MethodHandle MH_mult;
+        static final MethodHandle MH_dot;
+        static final MethodHandle MH_fin;
+
+        static final MethodType MT_fac = methodType(int.class, int.class);
+
+        static {
+            try {
+                MH_zero = LOOKUP.findStatic(FAC, "zero", MT_init);
+                MH_one = LOOKUP.findStatic(FAC, "one", MT_init);
+                MH_pred = LOOKUP.findStatic(FAC, "pred", MT_pred);
+                MH_inc = LOOKUP.findStatic(FAC, "inc", MT_fn);
+                MH_mult = LOOKUP.findStatic(FAC, "mult", MT_fn);
+                MH_dot = LOOKUP.findStatic(FAC, "dot", MT_dot);
+                MH_fin = LOOKUP.findStatic(FAC, "fin", MT_fn);
+            } catch (Exception e) {
+                throw new ExceptionInInitializerError(e);
+            }
+        }
+
+    }
+
+    static class Loop {
+
+        static int inc(int i, int k) {
+            return i + 1;
+        }
+
+        static boolean pred(int i, int k) {
+            return i < k;
+        }
+
+        static int fin(int i, int k) {
+            return k;
+        }
+
+        static final Class<Loop> LOOP = Loop.class;
+
+        static final MethodType MT_inc = methodType(int.class, int.class, int.class);
+        static final MethodType MT_pred = methodType(boolean.class, int.class, int.class);
+        static final MethodType MT_fin = methodType(int.class, int.class, int.class);
+
+        static final MethodHandle MH_inc;
+        static final MethodHandle MH_pred;
+        static final MethodHandle MH_fin;
+
+        static final MethodType MT_loop = methodType(int.class, int.class);
+
+        static {
+            try {
+                MH_inc = LOOKUP.findStatic(LOOP, "inc", MT_inc);
+                MH_pred = LOOKUP.findStatic(LOOP, "pred", MT_pred);
+                MH_fin = LOOKUP.findStatic(LOOP, "fin", MT_fin);
+            } catch (Exception e) {
+                throw new ExceptionInInitializerError(e);
+            }
+        }
+
+    }
+
+    static class LoopWithVirtuals {
+
+        static int one(int k) {
+            return 1;
+        }
+
+        int inc(int i, int acc, int k) {
+            return i + 1;
+        }
+
+        int mult(int i, int acc, int k) {
+            return i * acc;
+        }
+
+        boolean pred(int i, int acc, int k) {
+            return i < k;
+        }
+
+        int fin(int i, int acc, int k) {
+            return acc;
+        }
+
+        static final Class<LoopWithVirtuals> LOOP_WITH_VIRTUALS = LoopWithVirtuals.class;
+
+        static final MethodType MT_one = methodType(int.class, int.class);
+        static final MethodType MT_inc = methodType(int.class, int.class, int.class, int.class);
+        static final MethodType MT_mult = methodType(int.class, int.class, int.class, int.class);
+        static final MethodType MT_pred = methodType(boolean.class, int.class, int.class, int.class);
+        static final MethodType MT_fin = methodType(int.class, int.class, int.class, int.class);
+
+        static final MethodHandle MH_one;
+        static final MethodHandle MH_inc;
+        static final MethodHandle MH_mult;
+        static final MethodHandle MH_pred;
+        static final MethodHandle MH_fin;
+
+        static final MethodType MT_loop = methodType(int.class, LOOP_WITH_VIRTUALS, int.class);
+
+        static {
+            try {
+                MH_one = LOOKUP.findStatic(LOOP_WITH_VIRTUALS, "one", MT_one);
+                MH_inc = LOOKUP.findVirtual(LOOP_WITH_VIRTUALS, "inc", MT_inc);
+                MH_mult = LOOKUP.findVirtual(LOOP_WITH_VIRTUALS, "mult", MT_mult);
+                MH_pred = LOOKUP.findVirtual(LOOP_WITH_VIRTUALS, "pred", MT_pred);
+                MH_fin = LOOKUP.findVirtual(LOOP_WITH_VIRTUALS, "fin", MT_fin);
+            } catch (Exception e) {
+                throw new ExceptionInInitializerError(e);
+            }
+        }
+
+        static MethodHandle permute(MethodHandle h) {
+            // The handles representing virtual methods need to be rearranged to match the required order of arguments
+            // (loop-local state comes first, then loop arguments). As the receiver comes first in the signature but is
+            // a loop argument, it must be moved to the appropriate position in the signature.
+            return MethodHandles.permuteArguments(h,
+                    methodType(h.type().returnType(), int.class, int.class, LOOP_WITH_VIRTUALS, int.class), 2, 0, 1, 3);
+        }
+
+    }
+
+    static class While {
+
+        static int zero(int limit) {
+            return 0;
+        }
+
+        static boolean pred(int i, int limit) {
+            return i < limit;
+        }
+
+        static int step(int i, int limit) {
+            return i + 1;
+        }
+
+        static String initString() {
+            return "a";
+        }
+
+        static boolean predString(String s) {
+            return s.length() != 1;
+        }
+
+        static String stepString(String s) {
+            return s + "a";
+        }
+
+        static List<String> zipInitZip(Iterator<String> a, Iterator<String> b) {
+            return new ArrayList<>();
+        }
+
+        static boolean zipPred(List<String> zip, Iterator<String> a, Iterator<String> b) {
+            return a.hasNext() && b.hasNext();
+        }
+
+        static List<String> zipStep(List<String> zip, Iterator<String> a, Iterator<String> b) {
+            zip.add(a.next());
+            zip.add(b.next());
+            return zip;
+        }
+
+        private int i = 0;
+
+        void voidBody(int k) {
+            ++i;
+        }
+
+        boolean voidPred(int k) {
+            return i < k;
+        }
+
+        static final Class<While> WHILE = While.class;
+
+        static final MethodType MT_zero = methodType(int.class, int.class);
+        static final MethodType MT_pred = methodType(boolean.class, int.class, int.class);
+        static final MethodType MT_fn = methodType(int.class, int.class, int.class);
+        static final MethodType MT_initString = methodType(String.class);
+        static final MethodType MT_predString = methodType(boolean.class, String.class);
+        static final MethodType MT_stepString = methodType(String.class, String.class);
+        static final MethodType MT_zipInitZip = methodType(List.class, Iterator.class, Iterator.class);
+        static final MethodType MT_zipPred = methodType(boolean.class, List.class, Iterator.class, Iterator.class);
+        static final MethodType MT_zipStep = methodType(List.class, List.class, Iterator.class, Iterator.class);
+        static final MethodType MT_voidBody = methodType(void.class, int.class);
+        static final MethodType MT_voidPred = methodType(boolean.class, int.class);
+
+        static final MethodHandle MH_zero;
+        static final MethodHandle MH_pred;
+        static final MethodHandle MH_step;
+        static final MethodHandle MH_initString;
+        static final MethodHandle MH_predString;
+        static final MethodHandle MH_stepString;
+        static final MethodHandle MH_zipInitZip;
+        static final MethodHandle MH_zipPred;
+        static final MethodHandle MH_zipStep;
+        static final MethodHandle MH_voidBody;
+        static final MethodHandle MH_voidPred;
+
+        static final MethodType MT_while = methodType(int.class, int.class);
+        static final MethodType MT_string = methodType(String.class);
+        static final MethodType MT_zip = methodType(List.class, Iterator.class, Iterator.class);
+        static final MethodType MT_void = methodType(void.class, int.class);
+
+        static {
+            try {
+                MH_zero = LOOKUP.findStatic(WHILE, "zero", MT_zero);
+                MH_pred = LOOKUP.findStatic(WHILE, "pred", MT_pred);
+                MH_step = LOOKUP.findStatic(WHILE, "step", MT_fn);
+                MH_initString = LOOKUP.findStatic(WHILE, "initString", MT_initString);
+                MH_predString = LOOKUP.findStatic(WHILE, "predString", MT_predString);
+                MH_stepString = LOOKUP.findStatic(WHILE, "stepString", MT_stepString);
+                MH_zipInitZip = LOOKUP.findStatic(WHILE, "zipInitZip", MT_zipInitZip);
+                MH_zipPred = LOOKUP.findStatic(WHILE, "zipPred", MT_zipPred);
+                MH_zipStep = LOOKUP.findStatic(WHILE, "zipStep", MT_zipStep);
+                MH_voidBody = LOOKUP.findVirtual(WHILE, "voidBody", MT_voidBody);
+                MH_voidPred = LOOKUP.findVirtual(WHILE, "voidPred", MT_voidPred);
+            } catch (Exception e) {
+                throw new ExceptionInInitializerError(e);
+            }
+        }
+
+    }
+
+    static class Counted {
+
+        static String start(String arg) {
+            return arg;
+        }
+
+        static String step(int counter, String v, String arg) {
+            return "na " + v;
+        }
+
+        static void stepUpdateArray(int counter, int[] a) {
+            ++a[0];
+        }
+
+        static void printHello(int counter) {
+            System.out.print("hello");
+        }
+
+        static final Class<Counted> COUNTED = Counted.class;
+
+        static final MethodType MT_start = methodType(String.class, String.class);
+        static final MethodType MT_step = methodType(String.class, int.class, String.class, String.class);
+        static final MethodType MT_stepUpdateArray = methodType(void.class, int.class, int[].class);
+        static final MethodType MT_printHello = methodType(void.class, int.class);
+
+        static final MethodHandle MH_13;
+        static final MethodHandle MH_m5;
+        static final MethodHandle MH_8;
+        static final MethodHandle MH_start;
+        static final MethodHandle MH_step;
+        static final MethodHandle MH_stepUpdateArray;
+        static final MethodHandle MH_printHello;
+
+        static final MethodType MT_counted = methodType(String.class, String.class);
+        static final MethodType MT_arrayCounted = methodType(void.class, int[].class);
+        static final MethodType MT_countedPrinting = methodType(void.class);
+
+        static {
+            try {
+                MH_13 = MethodHandles.constant(int.class, 13);
+                MH_m5 = MethodHandles.constant(int.class, -5);
+                MH_8 = MethodHandles.constant(int.class, 8);
+                MH_start = LOOKUP.findStatic(COUNTED, "start", MT_start);
+                MH_step = LOOKUP.findStatic(COUNTED, "step", MT_step);
+                MH_stepUpdateArray = LOOKUP.findStatic(COUNTED, "stepUpdateArray", MT_stepUpdateArray);
+                MH_printHello = LOOKUP.findStatic(COUNTED, "printHello", MT_printHello);
+            } catch (Exception e) {
+                throw new ExceptionInInitializerError(e);
+            }
+        }
+
+    }
+
+    static class Iterate {
+
+        static Iterator<Integer> sumIterator(Integer[] a) {
+            return Arrays.asList(a).iterator();
+        }
+
+        static int sumInit(Integer[] a) {
+            return 0;
+        }
+
+        static int sumStep(int s, int e, Integer[] a) {
+            return s + e;
+        }
+
+        static List<String> reverseInit(List<String> l) {
+            return new ArrayList<>();
+        }
+
+        static List<String> reverseStep(String e, List<String> r, List<String> l) {
+            r.add(0, e);
+            return r;
+        }
+
+        static int lengthInit(List<Double> l) {
+            return 0;
+        }
+
+        static int lengthStep(Object o, int len, List<Double> l) {
+            return len + 1;
+        }
+
+        static List<String> mapInit(List<String> l) {
+            return new ArrayList<>();
+        }
+
+        static List<String> mapStep(String e, List<String> r, List<String> l) {
+            r.add(e.toUpperCase());
+            return r;
+        }
+
+        static void printStep(String s, List<String> l) {
+            System.out.print(s);
+        }
+
+        static final Class<Iterate> ITERATE = Iterate.class;
+
+        static final MethodType MT_sumIterator = methodType(Iterator.class, Integer[].class);
+
+        static final MethodType MT_sumInit = methodType(int.class, Integer[].class);
+        static final MethodType MT_reverseInit = methodType(List.class, List.class);
+        static final MethodType MT_lenghInit = methodType(int.class, List.class);
+        static final MethodType MT_mapInit = methodType(List.class, List.class);
+
+        static final MethodType MT_sumStep = methodType(int.class, int.class, int.class, Integer[].class);
+        static final MethodType MT_reverseStep = methodType(List.class, String.class, List.class, List.class);
+        static final MethodType MT_lengthStep = methodType(int.class, Object.class, int.class, List.class);
+        static final MethodType MT_mapStep = methodType(List.class, String.class, List.class, List.class);
+        static final MethodType MT_printStep = methodType(void.class, String.class, List.class);
+
+        static final MethodHandle MH_sumIterator;
+        static final MethodHandle MH_sumInit;
+        static final MethodHandle MH_sumStep;
+        static final MethodHandle MH_printStep;
+
+        static final MethodHandle MH_reverseInit;
+        static final MethodHandle MH_reverseStep;
+
+        static final MethodHandle MH_lengthInit;
+        static final MethodHandle MH_lengthStep;
+
+        static final MethodHandle MH_mapInit;
+        static final MethodHandle MH_mapStep;
+
+        static final MethodType MT_sum = methodType(int.class, Integer[].class);
+        static final MethodType MT_reverse = methodType(List.class, List.class);
+        static final MethodType MT_length = methodType(int.class, List.class);
+        static final MethodType MT_map = methodType(List.class, List.class);
+        static final MethodType MT_print = methodType(void.class, List.class);
+
+        static {
+            try {
+                MH_sumIterator = LOOKUP.findStatic(ITERATE, "sumIterator", MT_sumIterator);
+                MH_sumInit = LOOKUP.findStatic(ITERATE, "sumInit", MT_sumInit);
+                MH_sumStep = LOOKUP.findStatic(ITERATE, "sumStep", MT_sumStep);
+                MH_reverseInit = LOOKUP.findStatic(ITERATE, "reverseInit", MT_reverseInit);
+                MH_reverseStep = LOOKUP.findStatic(ITERATE, "reverseStep", MT_reverseStep);
+                MH_lengthInit = LOOKUP.findStatic(ITERATE, "lengthInit", MT_lenghInit);
+                MH_lengthStep = LOOKUP.findStatic(ITERATE, "lengthStep", MT_lengthStep);
+                MH_mapInit = LOOKUP.findStatic(ITERATE, "mapInit", MT_mapInit);
+                MH_mapStep = LOOKUP.findStatic(ITERATE, "mapStep", MT_mapStep);
+                MH_printStep = LOOKUP.findStatic(ITERATE, "printStep", MT_printStep);
+            } catch (Exception e) {
+                throw new ExceptionInInitializerError(e);
+            }
+        }
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/SpreadCollectTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,240 @@
+/*
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+/* @test
+ * @bug 8139885
+ * @bug 8143798
+ * @run testng/othervm -ea -esa test.java.lang.invoke.SpreadCollectTest
+ */
+
+package test.java.lang.invoke;
+
+import java.io.StringWriter;
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodHandles.Lookup;
+import java.lang.invoke.MethodType;
+import java.lang.invoke.WrongMethodTypeException;
+import java.util.*;
+
+import static java.lang.invoke.MethodType.methodType;
+
+import static org.testng.AssertJUnit.*;
+
+import org.testng.annotations.*;
+
+/**
+ * Tests for the new asSpreader/asCollector API added in JEP 274.
+ */
+public class SpreadCollectTest {
+
+    static final Lookup LOOKUP = MethodHandles.lookup();
+
+    @Test
+    public static void testAsSpreader() throws Throwable {
+        MethodHandle spreader = SpreadCollect.MH_forSpreading.asSpreader(1, int[].class, 3);
+        assertEquals(SpreadCollect.MT_spreader, spreader.type());
+        assertEquals("A456B", (String) spreader.invoke("A", new int[]{4, 5, 6}, "B"));
+    }
+
+    @Test
+    public static void testAsSpreaderExample() throws Throwable {
+        // test the JavaDoc asSpreader-with-pos example
+        MethodHandle compare = LOOKUP.findStatic(Objects.class, "compare", methodType(int.class, Object.class, Object.class, Comparator.class));
+        MethodHandle compare2FromArray = compare.asSpreader(0, Object[].class, 2);
+        Object[] ints = new Object[]{3, 9, 7, 7};
+        Comparator<Integer> cmp = (a, b) -> a - b;
+        assertTrue((int) compare2FromArray.invoke(Arrays.copyOfRange(ints, 0, 2), cmp) < 0);
+        assertTrue((int) compare2FromArray.invoke(Arrays.copyOfRange(ints, 1, 3), cmp) > 0);
+        assertTrue((int) compare2FromArray.invoke(Arrays.copyOfRange(ints, 2, 4), cmp) == 0);
+    }
+
+    @DataProvider
+    static Object[][] asSpreaderIllegalPositions() {
+        return new Object[][]{{-7}, {3}, {19}};
+    }
+
+    @Test(dataProvider = "asSpreaderIllegalPositions")
+    public static void testAsSpreaderIllegalPos(int p) throws Throwable {
+        boolean caught = false;
+        try {
+            SpreadCollect.MH_forSpreading.asSpreader(p, Object[].class, 3);
+        } catch (IllegalArgumentException iae) {
+            assertEquals("bad spread position", iae.getMessage());
+            caught = true;
+        }
+        assertTrue(caught);
+    }
+
+    @Test(expectedExceptions = {WrongMethodTypeException.class})
+    public static void testAsSpreaderIllegalMethodType() {
+        MethodHandle h = MethodHandles.dropArguments(MethodHandles.constant(String.class, ""), 0, int.class, int.class);
+        MethodHandle s = h.asSpreader(String[].class, 1);
+    }
+
+    @Test
+    public static void testAsCollector() throws Throwable {
+        MethodHandle collector = SpreadCollect.MH_forCollecting.asCollector(1, int[].class, 1);
+        assertEquals(SpreadCollect.MT_collector1, collector.type());
+        assertEquals("A4B", (String) collector.invoke("A", 4, "B"));
+        collector = SpreadCollect.MH_forCollecting.asCollector(1, int[].class, 2);
+        assertEquals(SpreadCollect.MT_collector2, collector.type());
+        assertEquals("A45B", (String) collector.invoke("A", 4, 5, "B"));
+        collector = SpreadCollect.MH_forCollecting.asCollector(1, int[].class, 3);
+        assertEquals(SpreadCollect.MT_collector3, collector.type());
+        assertEquals("A456B", (String) collector.invoke("A", 4, 5, 6, "B"));
+    }
+
+    @Test
+    public static void testAsCollectorInvokeWithArguments() throws Throwable {
+        MethodHandle collector = SpreadCollect.MH_forCollecting.asCollector(1, int[].class, 1);
+        assertEquals(SpreadCollect.MT_collector1, collector.type());
+        assertEquals("A4B", (String) collector.invokeWithArguments("A", 4, "B"));
+        collector = SpreadCollect.MH_forCollecting.asCollector(1, int[].class, 2);
+        assertEquals(SpreadCollect.MT_collector2, collector.type());
+        assertEquals("A45B", (String) collector.invokeWithArguments("A", 4, 5, "B"));
+        collector = SpreadCollect.MH_forCollecting.asCollector(1, int[].class, 3);
+        assertEquals(SpreadCollect.MT_collector3, collector.type());
+        assertEquals("A456B", (String) collector.invokeWithArguments("A", 4, 5, 6, "B"));
+    }
+
+    @Test
+    public static void testAsCollectorLeading() throws Throwable {
+        MethodHandle collector = SpreadCollect.MH_forCollectingLeading.asCollector(0, int[].class, 1);
+        assertEquals(SpreadCollect.MT_collectorLeading1, collector.type());
+        assertEquals("7Q", (String) collector.invoke(7, "Q"));
+        collector = SpreadCollect.MH_forCollectingLeading.asCollector(0, int[].class, 2);
+        assertEquals(SpreadCollect.MT_collectorLeading2, collector.type());
+        assertEquals("78Q", (String) collector.invoke(7, 8, "Q"));
+        collector = SpreadCollect.MH_forCollectingLeading.asCollector(0, int[].class, 3);
+        assertEquals(SpreadCollect.MT_collectorLeading3, collector.type());
+        assertEquals("789Q", (String) collector.invoke(7, 8, 9, "Q"));
+    }
+
+    @Test
+    public static void testAsCollectorLeadingInvokeWithArguments() throws Throwable {
+        MethodHandle collector = SpreadCollect.MH_forCollectingLeading.asCollector(0, int[].class, 1);
+        assertEquals(SpreadCollect.MT_collectorLeading1, collector.type());
+        assertEquals("7Q", (String) collector.invokeWithArguments(7, "Q"));
+        collector = SpreadCollect.MH_forCollectingLeading.asCollector(0, int[].class, 2);
+        assertEquals(SpreadCollect.MT_collectorLeading2, collector.type());
+        assertEquals("78Q", (String) collector.invokeWithArguments(7, 8, "Q"));
+        collector = SpreadCollect.MH_forCollectingLeading.asCollector(0, int[].class, 3);
+        assertEquals(SpreadCollect.MT_collectorLeading3, collector.type());
+        assertEquals("789Q", (String) collector.invokeWithArguments(7, 8, 9, "Q"));
+    }
+
+    @Test
+    public static void testAsCollectorNone() throws Throwable {
+        MethodHandle collector = SpreadCollect.MH_forCollecting.asCollector(1, int[].class, 0);
+        assertEquals(SpreadCollect.MT_collector0, collector.type());
+        assertEquals("AB", (String) collector.invoke("A", "B"));
+    }
+
+    @DataProvider
+    static Object[][] asCollectorIllegalPositions() {
+        return new Object[][]{{-1}, {17}};
+    }
+
+    @Test(dataProvider = "asCollectorIllegalPositions")
+    public static void testAsCollectorIllegalPos(int p) {
+        boolean caught = false;
+        try {
+            SpreadCollect.MH_forCollecting.asCollector(p, int[].class, 0);
+        } catch (IllegalArgumentException iae) {
+            assertEquals("bad collect position", iae.getMessage());
+            caught = true;
+        }
+        assertTrue(caught);
+    }
+
+    @Test
+    public static void testAsCollectorExample() throws Throwable {
+        // test the JavaDoc asCollector-with-pos example
+        StringWriter swr = new StringWriter();
+        MethodHandle swWrite = LOOKUP.
+                findVirtual(StringWriter.class, "write", methodType(void.class, char[].class, int.class, int.class)).
+                bindTo(swr);
+        MethodHandle swWrite4 = swWrite.asCollector(0, char[].class, 4);
+        swWrite4.invoke('A', 'B', 'C', 'D', 1, 2);
+        assertEquals("BC", swr.toString());
+        swWrite4.invoke('P', 'Q', 'R', 'S', 0, 4);
+        assertEquals("BCPQRS", swr.toString());
+        swWrite4.invoke('W', 'X', 'Y', 'Z', 3, 1);
+        assertEquals("BCPQRSZ", swr.toString());
+    }
+
+    static class SpreadCollect {
+
+        static String forSpreading(String s1, int i1, int i2, int i3, String s2) {
+            return s1 + i1 + i2 + i3 + s2;
+        }
+
+        static String forCollecting(String s1, int[] is, String s2) {
+            StringBuilder sb = new StringBuilder(s1);
+            for (int i : is) {
+                sb.append(i);
+            }
+            return sb.append(s2).toString();
+        }
+
+        static String forCollectingLeading(int[] is, String s) {
+            return forCollecting("", is, s);
+        }
+
+        static final Class<SpreadCollect> SPREAD_COLLECT = SpreadCollect.class;
+
+        static final MethodType MT_forSpreading = methodType(String.class, String.class, int.class, int.class, int.class, String.class);
+        static final MethodType MT_forCollecting = methodType(String.class, String.class, int[].class, String.class);
+        static final MethodType MT_forCollectingLeading = methodType(String.class, int[].class, String.class);
+
+        static final MethodHandle MH_forSpreading;
+        static final MethodHandle MH_forCollecting;
+        static final MethodHandle MH_forCollectingLeading;
+
+        static final MethodType MT_spreader = methodType(String.class, String.class, int[].class, String.class);
+        static final MethodType MT_collector0 = methodType(String.class, String.class, String.class);
+        static final MethodType MT_collector1 = methodType(String.class, String.class, int.class, String.class);
+        static final MethodType MT_collector2 = methodType(String.class, String.class, int.class, int.class, String.class);
+        static final MethodType MT_collector3 = methodType(String.class, String.class, int.class, int.class, int.class, String.class);
+        static final MethodType MT_collectorLeading1 = methodType(String.class, int.class, String.class);
+        static final MethodType MT_collectorLeading2 = methodType(String.class, int.class, int.class, String.class);
+        static final MethodType MT_collectorLeading3 = methodType(String.class, int.class, int.class, int.class, String.class);
+
+        static final String NONE_ERROR = "zero array length in MethodHandle.asCollector";
+
+        static {
+            try {
+                MH_forSpreading = LOOKUP.findStatic(SPREAD_COLLECT, "forSpreading", MT_forSpreading);
+                MH_forCollecting = LOOKUP.findStatic(SPREAD_COLLECT, "forCollecting", MT_forCollecting);
+                MH_forCollectingLeading = LOOKUP.findStatic(SPREAD_COLLECT, "forCollectingLeading", MT_forCollectingLeading);
+            } catch (Exception e) {
+                throw new ExceptionInInitializerError(e);
+            }
+        }
+
+    }
+
+}
--- a/jdk/test/java/lang/invoke/T8139885.java	Fri Mar 04 13:16:50 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1111 +0,0 @@
-/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  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.
- */
-
-/* @test
- * @bug 8139885
- * @bug 8143798
- * @bug 8150825
- * @run testng/othervm -ea -esa test.java.lang.invoke.T8139885
- */
-
-package test.java.lang.invoke;
-
-import java.io.StringWriter;
-import java.lang.invoke.MethodHandle;
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.MethodHandles.Lookup;
-import java.lang.invoke.MethodType;
-import java.lang.invoke.WrongMethodTypeException;
-import java.util.*;
-
-import static java.lang.invoke.MethodType.methodType;
-
-import static org.testng.AssertJUnit.*;
-
-import org.testng.annotations.*;
-
-/**
- * Example-scale and negative tests for JEP 274 extensions.
- */
-public class T8139885 {
-
-    static final Lookup LOOKUP = MethodHandles.lookup();
-
-    //
-    // Tests.
-    //
-
-    @Test
-    public static void testLoopFac() throws Throwable {
-        MethodHandle[] counterClause = new MethodHandle[]{Fac.MH_zero, Fac.MH_inc};
-        MethodHandle[] accumulatorClause = new MethodHandle[]{Fac.MH_one, Fac.MH_mult, Fac.MH_pred, Fac.MH_fin};
-        MethodHandle loop = MethodHandles.loop(counterClause, accumulatorClause);
-        assertEquals(Fac.MT_fac, loop.type());
-        assertEquals(120, loop.invoke(5));
-    }
-
-    @Test
-    public static void testLoopFacNullInit() throws Throwable {
-        // null initializer for counter, should initialize to 0
-        MethodHandle[] counterClause = new MethodHandle[]{null, Fac.MH_inc};
-        MethodHandle[] accumulatorClause = new MethodHandle[]{Fac.MH_one, Fac.MH_mult, Fac.MH_pred, Fac.MH_fin};
-        MethodHandle loop = MethodHandles.loop(counterClause, accumulatorClause);
-        assertEquals(Fac.MT_fac, loop.type());
-        assertEquals(120, loop.invoke(5));
-    }
-
-    @Test
-    public static void testLoopVoid1() throws Throwable {
-        // construct a post-checked loop that only does one iteration and has a void body and void local state
-        MethodHandle loop = MethodHandles.loop(new MethodHandle[]{Empty.MH_f, Empty.MH_f, Empty.MH_pred, null});
-        assertEquals(MethodType.methodType(void.class), loop.type());
-        loop.invoke();
-    }
-
-    @Test
-    public static void testLoopVoid2() throws Throwable {
-        // construct a post-checked loop that only does one iteration and has a void body and void local state,
-        // initialized implicitly from the step type
-        MethodHandle loop = MethodHandles.loop(new MethodHandle[]{null, Empty.MH_f, Empty.MH_pred, null});
-        assertEquals(MethodType.methodType(void.class), loop.type());
-        loop.invoke();
-    }
-
-    @Test
-    public static void testLoopFacWithVoidState() throws Throwable {
-        // like testLoopFac, but with additional void state that outputs a dot
-        MethodHandle[] counterClause = new MethodHandle[]{Fac.MH_zero, Fac.MH_inc};
-        MethodHandle[] accumulatorClause = new MethodHandle[]{Fac.MH_one, Fac.MH_mult, Fac.MH_pred, Fac.MH_fin};
-        MethodHandle[] dotClause = new MethodHandle[]{null, Fac.MH_dot};
-        MethodHandle loop = MethodHandles.loop(counterClause, accumulatorClause, dotClause);
-        assertEquals(Fac.MT_fac, loop.type());
-        assertEquals(120, loop.invoke(5));
-    }
-
-    @Test
-    public static void testLoopNegative() throws Throwable {
-        MethodHandle mh_loop =
-                LOOKUP.findStatic(MethodHandles.class, "loop", methodType(MethodHandle.class, MethodHandle[][].class));
-        MethodHandle i0 = MethodHandles.constant(int.class, 0);
-        MethodHandle ii = MethodHandles.dropArguments(i0, 0, int.class, int.class);
-        MethodHandle id = MethodHandles.dropArguments(i0, 0, int.class, double.class);
-        MethodHandle i3 = MethodHandles.dropArguments(i0, 0, int.class, int.class, int.class);
-        List<MethodHandle> inits = Arrays.asList(ii, id, i3);
-        List<Class<?>> ints = Arrays.asList(int.class, int.class, int.class);
-        List<MethodHandle> finis = Arrays.asList(Fac.MH_fin, Fac.MH_inc, Counted.MH_step);
-        List<MethodHandle> preds1 = Arrays.asList(null, null, null);
-        List<MethodHandle> preds2 = Arrays.asList(null, Fac.MH_fin, null);
-        MethodHandle eek = MethodHandles.dropArguments(i0, 0, int.class, int.class, double.class);
-        List<MethodHandle> nesteps = Arrays.asList(Fac.MH_inc, eek, Fac.MH_dot);
-        List<MethodHandle> nepreds = Arrays.asList(null, Fac.MH_pred, null);
-        List<MethodHandle> nefinis = Arrays.asList(null, Fac.MH_fin, null);
-        MethodHandle[][][] cases = {
-                null,
-                {},
-                {{null, Fac.MH_inc}, {Fac.MH_one, null, Fac.MH_mult, Fac.MH_pred, Fac.MH_fin}},
-                {{null, Fac.MH_inc}, null},
-                {{Fac.MH_zero, Fac.MH_dot}},
-                {{ii}, {id}, {i3}},
-                {{null, Fac.MH_inc, null, Fac.MH_fin}, {null, Fac.MH_inc, null, Fac.MH_inc},
-                        {null, Counted.MH_start, null, Counted.MH_step}},
-                {{Fac.MH_zero, Fac.MH_inc}, {Fac.MH_one, Fac.MH_mult, null, Fac.MH_fin}, {null, Fac.MH_dot}},
-                {{Fac.MH_zero, Fac.MH_inc}, {Fac.MH_one, Fac.MH_mult, Fac.MH_fin, Fac.MH_fin}, {null, Fac.MH_dot}},
-                {{Fac.MH_zero, Fac.MH_inc}, {Fac.MH_one, eek, Fac.MH_pred, Fac.MH_fin}, {null, Fac.MH_dot}}
-        };
-        String[] messages = {
-                "null or no clauses passed",
-                "null or no clauses passed",
-                "All loop clauses must be represented as MethodHandle arrays with at most 4 elements.",
-                "null clauses are not allowed",
-                "clause 0: init and step return types must match: int != void",
-                "found non-effectively identical init parameter type lists: " + inits + " (common suffix: " + ints + ")",
-                "found non-identical finalizer return types: " + finis + " (return type: int)",
-                "no predicate found: " + preds1,
-                "predicates must have boolean return type: " + preds2,
-                "found non-effectively identical parameter type lists:\nstep: " + nesteps + "\npred: " + nepreds +
-                        "\nfini: " + nefinis + " (common parameter sequence: " + ints + ")"
-        };
-        for (int i = 0; i < cases.length; ++i) {
-            boolean caught = false;
-            try {
-                mh_loop.invokeWithArguments(cases[i]);
-            } catch (IllegalArgumentException iae) {
-                assertEquals(messages[i], iae.getMessage());
-                caught = true;
-            }
-            assertTrue(caught);
-        }
-    }
-
-    @Test
-    public static void testWhileLoop() throws Throwable {
-        // int i = 0; while (i < limit) { ++i; } return i; => limit
-        MethodHandle loop = MethodHandles.whileLoop(While.MH_zero, While.MH_pred, While.MH_step);
-        assertEquals(While.MT_while, loop.type());
-        assertEquals(23, loop.invoke(23));
-    }
-
-    @Test
-    public static void testWhileLoopNoIteration() throws Throwable {
-        // a while loop that never executes its body because the predicate evaluates to false immediately
-        MethodHandle loop = MethodHandles.whileLoop(While.MH_initString, While.MH_predString, While.MH_stepString);
-        assertEquals(While.MT_string, loop.type());
-        assertEquals("a", loop.invoke());
-    }
-
-    @Test
-    public static void testDoWhileLoop() throws Throwable {
-        // int i = 0; do { ++i; } while (i < limit); return i; => limit
-        MethodHandle loop = MethodHandles.doWhileLoop(While.MH_zero, While.MH_step, While.MH_pred);
-        assertEquals(While.MT_while, loop.type());
-        assertEquals(23, loop.invoke(23));
-    }
-
-    @Test
-    public static void testWhileZip() throws Throwable {
-        MethodHandle loop = MethodHandles.doWhileLoop(While.MH_zipInitZip, While.MH_zipStep, While.MH_zipPred);
-        assertEquals(While.MT_zip, loop.type());
-        List<String> a = Arrays.asList("a", "b", "c", "d");
-        List<String> b = Arrays.asList("e", "f", "g", "h");
-        List<String> zipped = Arrays.asList("a", "e", "b", "f", "c", "g", "d", "h");
-        assertEquals(zipped, (List<String>) loop.invoke(a.iterator(), b.iterator()));
-    }
-
-    @Test
-    public static void testCountedLoop() throws Throwable {
-        // String s = "Lambdaman!"; for (int i = 0; i < 13; ++i) { s = "na " + s; } return s; => a variation on a well known theme
-        MethodHandle fit13 = MethodHandles.constant(int.class, 13);
-        MethodHandle loop = MethodHandles.countedLoop(fit13, Counted.MH_start, Counted.MH_step);
-        assertEquals(Counted.MT_counted, loop.type());
-        assertEquals("na na na na na na na na na na na na na Lambdaman!", loop.invoke("Lambdaman!"));
-    }
-
-    @Test
-    public static void testCountedArrayLoop() throws Throwable {
-        // int[] a = new int[]{0}; for (int i = 0; i < 13; ++i) { ++a[0]; } => a[0] == 13
-        MethodHandle fit13 = MethodHandles.dropArguments(MethodHandles.constant(int.class, 13), 0, int[].class);
-        MethodHandle loop = MethodHandles.countedLoop(fit13, null, Counted.MH_stepUpdateArray);
-        assertEquals(Counted.MT_arrayCounted, loop.type());
-        int[] a = new int[]{0};
-        loop.invoke(a);
-        assertEquals(13, a[0]);
-    }
-
-    @Test
-    public static void testCountedPrintingLoop() throws Throwable {
-        MethodHandle fit5 = MethodHandles.constant(int.class, 5);
-        MethodHandle loop = MethodHandles.countedLoop(fit5, null, Counted.MH_printHello);
-        assertEquals(Counted.MT_countedPrinting, loop.type());
-        loop.invoke();
-    }
-
-    @Test
-    public static void testCountedRangeLoop() throws Throwable {
-        // String s = "Lambdaman!"; for (int i = -5; i < 8; ++i) { s = "na " + s; } return s; => a well known theme
-        MethodHandle fitm5 = MethodHandles.dropArguments(Counted.MH_m5, 0, String.class);
-        MethodHandle fit8 = MethodHandles.dropArguments(Counted.MH_8, 0, String.class);
-        MethodHandle loop = MethodHandles.countedLoop(fitm5, fit8, Counted.MH_start, Counted.MH_step);
-        assertEquals(Counted.MT_counted, loop.type());
-        assertEquals("na na na na na na na na na na na na na Lambdaman!", loop.invoke("Lambdaman!"));
-    }
-
-    @Test
-    public static void testIterateSum() throws Throwable {
-        // Integer[] a = new Integer[]{1,2,3,4,5,6}; int sum = 0; for (int e : a) { sum += e; } return sum; => 21
-        MethodHandle loop = MethodHandles.iteratedLoop(Iterate.MH_sumIterator, Iterate.MH_sumInit, Iterate.MH_sumStep);
-        assertEquals(Iterate.MT_sum, loop.type());
-        assertEquals(21, loop.invoke(new Integer[]{1, 2, 3, 4, 5, 6}));
-    }
-
-    @Test
-    public static void testIterateReverse() throws Throwable {
-        MethodHandle loop = MethodHandles.iteratedLoop(null, Iterate.MH_reverseInit, Iterate.MH_reverseStep);
-        assertEquals(Iterate.MT_reverse, loop.type());
-        List<String> list = Arrays.asList("a", "b", "c", "d", "e");
-        List<String> reversedList = Arrays.asList("e", "d", "c", "b", "a");
-        assertEquals(reversedList, (List<String>) loop.invoke(list));
-    }
-
-    @Test
-    public static void testIterateLength() throws Throwable {
-        MethodHandle loop = MethodHandles.iteratedLoop(null, Iterate.MH_lengthInit, Iterate.MH_lengthStep);
-        assertEquals(Iterate.MT_length, loop.type());
-        List<Double> list = Arrays.asList(23.0, 148.0, 42.0);
-        assertEquals(list.size(), (int) loop.invoke(list));
-    }
-
-    @Test
-    public static void testIterateMap() throws Throwable {
-        MethodHandle loop = MethodHandles.iteratedLoop(null, Iterate.MH_mapInit, Iterate.MH_mapStep);
-        assertEquals(Iterate.MT_map, loop.type());
-        List<String> list = Arrays.asList("Hello", "world", "!");
-        List<String> upList = Arrays.asList("HELLO", "WORLD", "!");
-        assertEquals(upList, (List<String>) loop.invoke(list));
-    }
-
-    @Test
-    public static void testIteratePrint() throws Throwable {
-        MethodHandle loop = MethodHandles.iteratedLoop(null, null, Iterate.MH_printStep);
-        assertEquals(Iterate.MT_print, loop.type());
-        loop.invoke(Arrays.asList("hello", "world"));
-    }
-
-    @Test
-    public static void testIterateNullBody() {
-        boolean caught = false;
-        try {
-            MethodHandles.iteratedLoop(MethodHandles.identity(int.class), MethodHandles.identity(int.class), null);
-        } catch (IllegalArgumentException iae) {
-            assertEquals("iterated loop body must not be null", iae.getMessage());
-            caught = true;
-        }
-        assertTrue(caught);
-    }
-
-    @Test
-    public static void testTryFinally() throws Throwable {
-        MethodHandle hello = MethodHandles.tryFinally(TryFinally.MH_greet, TryFinally.MH_exclaim);
-        assertEquals(TryFinally.MT_hello, hello.type());
-        assertEquals("Hello, world!", hello.invoke("world"));
-    }
-
-    @Test
-    public static void testTryFinallyVoid() throws Throwable {
-        MethodHandle tfVoid = MethodHandles.tryFinally(TryFinally.MH_print, TryFinally.MH_printMore);
-        assertEquals(TryFinally.MT_printHello, tfVoid.type());
-        tfVoid.invoke("world");
-    }
-
-    @Test
-    public static void testTryFinallySublist() throws Throwable {
-        MethodHandle helloMore = MethodHandles.tryFinally(TryFinally.MH_greetMore, TryFinally.MH_exclaimMore);
-        assertEquals(TryFinally.MT_moreHello, helloMore.type());
-        assertEquals("Hello, world and universe (but world first)!", helloMore.invoke("world", "universe"));
-    }
-
-    @Test
-    public static void testTryFinallyNegative() {
-        MethodHandle intid = MethodHandles.identity(int.class);
-        MethodHandle intco = MethodHandles.constant(int.class, 0);
-        MethodHandle errTarget = MethodHandles.dropArguments(intco, 0, int.class, double.class, String.class, int.class);
-        MethodHandle errCleanup = MethodHandles.dropArguments(MethodHandles.constant(int.class, 0), 0, Throwable.class,
-                int.class, double.class, Object.class);
-        MethodHandle[][] cases = {
-                {intid, MethodHandles.identity(double.class)},
-                {intid, MethodHandles.dropArguments(intid, 0, String.class)},
-                {intid, MethodHandles.dropArguments(intid, 0, Throwable.class, double.class)},
-                {errTarget, errCleanup},
-                {TryFinally.MH_voidTarget, TryFinally.MH_voidCleanup}
-        };
-        String[] messages = {
-                "target and return types must match: double != int",
-                "cleanup first argument and Throwable must match: (String,int)int != class java.lang.Throwable",
-                "cleanup second argument and target return type must match: (Throwable,double,int)int != int",
-                "cleanup parameters after (Throwable,result) and target parameter list prefix must match: " +
-                        errCleanup.type() + " != " + errTarget.type(),
-                "cleanup parameters after (Throwable,result) and target parameter list prefix must match: " +
-                        TryFinally.MH_voidCleanup.type() + " != " + TryFinally.MH_voidTarget.type()
-        };
-        for (int i = 0; i < cases.length; ++i) {
-            boolean caught = false;
-            try {
-                MethodHandles.tryFinally(cases[i][0], cases[i][1]);
-            } catch (IllegalArgumentException iae) {
-                assertEquals(messages[i], iae.getMessage());
-                caught = true;
-            }
-            assertTrue(caught);
-        }
-    }
-
-    @Test
-    public static void testFold0a() throws Throwable {
-        // equivalence to foldArguments(MethodHandle,MethodHandle)
-        MethodHandle fold = MethodHandles.foldArguments(Fold.MH_multer, 0, Fold.MH_adder);
-        assertEquals(Fold.MT_folded1, fold.type());
-        assertEquals(720, (int) fold.invoke(3, 4, 5));
-    }
-
-    @Test
-    public static void testFold1a() throws Throwable {
-        // test foldArguments for folding position 1
-        MethodHandle fold = MethodHandles.foldArguments(Fold.MH_multer, 1, Fold.MH_adder1);
-        assertEquals(Fold.MT_folded1, fold.type());
-        assertEquals(540, (int) fold.invoke(3, 4, 5));
-    }
-
-    @Test
-    public static void testFold0b() throws Throwable {
-        // test foldArguments equivalence with multiple types
-        MethodHandle fold = MethodHandles.foldArguments(Fold.MH_str, 0, Fold.MH_comb);
-        assertEquals(Fold.MT_folded2, fold.type());
-        assertEquals(23, (int) fold.invoke("true", true, 23));
-    }
-
-    @Test
-    public static void testFold1b() throws Throwable {
-        // test folgArguments for folding position 1, with multiple types
-        MethodHandle fold = MethodHandles.foldArguments(Fold.MH_str, 1, Fold.MH_comb2);
-        assertEquals(Fold.MT_folded3, fold.type());
-        assertEquals(1, (int) fold.invoke(true, true, 1));
-        assertEquals(-1, (int) fold.invoke(true, false, -1));
-    }
-
-    @Test
-    public static void testFoldArgumentsExample() throws Throwable {
-        // test the JavaDoc foldArguments-with-pos example
-        StringWriter swr = new StringWriter();
-        MethodHandle trace = LOOKUP.findVirtual(StringWriter.class, "write", methodType(void.class, String.class)).bindTo(swr);
-        MethodHandle cat = LOOKUP.findVirtual(String.class, "concat", methodType(String.class, String.class));
-        assertEquals("boojum", (String) cat.invokeExact("boo", "jum"));
-        MethodHandle catTrace = MethodHandles.foldArguments(cat, 1, trace);
-        assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
-        assertEquals("jum", swr.toString());
-    }
-
-    @Test
-    public static void testAsSpreader() throws Throwable {
-        MethodHandle spreader = SpreadCollect.MH_forSpreading.asSpreader(1, int[].class, 3);
-        assertEquals(SpreadCollect.MT_spreader, spreader.type());
-        assertEquals("A456B", (String) spreader.invoke("A", new int[]{4, 5, 6}, "B"));
-    }
-
-    @Test
-    public static void testAsSpreaderExample() throws Throwable {
-        // test the JavaDoc asSpreader-with-pos example
-        MethodHandle compare = LOOKUP.findStatic(Objects.class, "compare", methodType(int.class, Object.class, Object.class, Comparator.class));
-        MethodHandle compare2FromArray = compare.asSpreader(0, Object[].class, 2);
-        Object[] ints = new Object[]{3, 9, 7, 7};
-        Comparator<Integer> cmp = (a, b) -> a - b;
-        assertTrue((int) compare2FromArray.invoke(Arrays.copyOfRange(ints, 0, 2), cmp) < 0);
-        assertTrue((int) compare2FromArray.invoke(Arrays.copyOfRange(ints, 1, 3), cmp) > 0);
-        assertTrue((int) compare2FromArray.invoke(Arrays.copyOfRange(ints, 2, 4), cmp) == 0);
-    }
-
-    @Test
-    public static void testAsSpreaderIllegalPos() throws Throwable {
-        int[] illegalPos = {-7, 3, 19};
-        int caught = 0;
-        for (int p : illegalPos) {
-            try {
-                SpreadCollect.MH_forSpreading.asSpreader(p, Object[].class, 3);
-            } catch (IllegalArgumentException iae) {
-                assertEquals("bad spread position", iae.getMessage());
-                ++caught;
-            }
-        }
-        assertEquals(illegalPos.length, caught);
-    }
-
-    @Test
-    public static void testAsSpreaderIllegalMethodType() throws Throwable {
-        MethodHandle h = MethodHandles.dropArguments(MethodHandles.constant(String.class, ""), 0, int.class, int.class);
-        boolean caught = false;
-        try {
-            MethodHandle s = h.asSpreader(String[].class, 1);
-        } catch (WrongMethodTypeException wmte) {
-            caught = true;
-        }
-        assertTrue(caught);
-    }
-
-    @Test
-    public static void testAsCollector() throws Throwable {
-        MethodHandle collector = SpreadCollect.MH_forCollecting.asCollector(1, int[].class, 1);
-        assertEquals(SpreadCollect.MT_collector1, collector.type());
-        assertEquals("A4B", (String) collector.invoke("A", 4, "B"));
-        collector = SpreadCollect.MH_forCollecting.asCollector(1, int[].class, 2);
-        assertEquals(SpreadCollect.MT_collector2, collector.type());
-        assertEquals("A45B", (String) collector.invoke("A", 4, 5, "B"));
-        collector = SpreadCollect.MH_forCollecting.asCollector(1, int[].class, 3);
-        assertEquals(SpreadCollect.MT_collector3, collector.type());
-        assertEquals("A456B", (String) collector.invoke("A", 4, 5, 6, "B"));
-    }
-
-    @Test
-    public static void testAsCollectorInvokeWithArguments() throws Throwable {
-        MethodHandle collector = SpreadCollect.MH_forCollecting.asCollector(1, int[].class, 1);
-        assertEquals(SpreadCollect.MT_collector1, collector.type());
-        assertEquals("A4B", (String) collector.invokeWithArguments("A", 4, "B"));
-        collector = SpreadCollect.MH_forCollecting.asCollector(1, int[].class, 2);
-        assertEquals(SpreadCollect.MT_collector2, collector.type());
-        assertEquals("A45B", (String) collector.invokeWithArguments("A", 4, 5, "B"));
-        collector = SpreadCollect.MH_forCollecting.asCollector(1, int[].class, 3);
-        assertEquals(SpreadCollect.MT_collector3, collector.type());
-        assertEquals("A456B", (String) collector.invokeWithArguments("A", 4, 5, 6, "B"));
-    }
-
-    @Test
-    public static void testAsCollectorLeading() throws Throwable {
-        MethodHandle collector = SpreadCollect.MH_forCollectingLeading.asCollector(0, int[].class, 1);
-        assertEquals(SpreadCollect.MT_collectorLeading1, collector.type());
-        assertEquals("7Q", (String) collector.invoke(7, "Q"));
-        collector = SpreadCollect.MH_forCollectingLeading.asCollector(0, int[].class, 2);
-        assertEquals(SpreadCollect.MT_collectorLeading2, collector.type());
-        assertEquals("78Q", (String) collector.invoke(7, 8, "Q"));
-        collector = SpreadCollect.MH_forCollectingLeading.asCollector(0, int[].class, 3);
-        assertEquals(SpreadCollect.MT_collectorLeading3, collector.type());
-        assertEquals("789Q", (String) collector.invoke(7, 8, 9, "Q"));
-    }
-
-    @Test
-    public static void testAsCollectorLeadingInvokeWithArguments() throws Throwable {
-        MethodHandle collector = SpreadCollect.MH_forCollectingLeading.asCollector(0, int[].class, 1);
-        assertEquals(SpreadCollect.MT_collectorLeading1, collector.type());
-        assertEquals("7Q", (String) collector.invokeWithArguments(7, "Q"));
-        collector = SpreadCollect.MH_forCollectingLeading.asCollector(0, int[].class, 2);
-        assertEquals(SpreadCollect.MT_collectorLeading2, collector.type());
-        assertEquals("78Q", (String) collector.invokeWithArguments(7, 8, "Q"));
-        collector = SpreadCollect.MH_forCollectingLeading.asCollector(0, int[].class, 3);
-        assertEquals(SpreadCollect.MT_collectorLeading3, collector.type());
-        assertEquals("789Q", (String) collector.invokeWithArguments(7, 8, 9, "Q"));
-    }
-
-    @Test
-    public static void testAsCollectorNone() throws Throwable {
-        MethodHandle collector = SpreadCollect.MH_forCollecting.asCollector(1, int[].class, 0);
-        assertEquals(SpreadCollect.MT_collector0, collector.type());
-        assertEquals("AB", (String) collector.invoke("A", "B"));
-    }
-
-    @Test
-    public static void testAsCollectorIllegalPos() throws Throwable {
-        int[] illegalPos = {-1, 17};
-        int caught = 0;
-        for (int p : illegalPos) {
-            try {
-                SpreadCollect.MH_forCollecting.asCollector(p, int[].class, 0);
-            } catch (IllegalArgumentException iae) {
-                assertEquals("bad collect position", iae.getMessage());
-                ++caught;
-            }
-        }
-        assertEquals(illegalPos.length, caught);
-    }
-
-    @Test
-    public static void testAsCollectorExample() throws Throwable {
-        // test the JavaDoc asCollector-with-pos example
-        StringWriter swr = new StringWriter();
-        MethodHandle swWrite = LOOKUP.
-                findVirtual(StringWriter.class, "write", methodType(void.class, char[].class, int.class, int.class)).
-                bindTo(swr);
-        MethodHandle swWrite4 = swWrite.asCollector(0, char[].class, 4);
-        swWrite4.invoke('A', 'B', 'C', 'D', 1, 2);
-        assertEquals("BC", swr.toString());
-        swWrite4.invoke('P', 'Q', 'R', 'S', 0, 4);
-        assertEquals("BCPQRS", swr.toString());
-        swWrite4.invoke('W', 'X', 'Y', 'Z', 3, 1);
-        assertEquals("BCPQRSZ", swr.toString());
-    }
-
-    @Test
-    public static void testFindSpecial() throws Throwable {
-        FindSpecial.C c = new FindSpecial.C();
-        assertEquals("I1.m", c.m());
-        MethodType t = MethodType.methodType(String.class);
-        MethodHandle ci1m = LOOKUP.findSpecial(FindSpecial.I1.class, "m", t, FindSpecial.C.class);
-        assertEquals("I1.m", (String) ci1m.invoke(c));
-    }
-
-    @Test
-    public static void testFindSpecialAbstract() throws Throwable {
-        FindSpecial.C c = new FindSpecial.C();
-        assertEquals("q", c.q());
-        MethodType t = MethodType.methodType(String.class);
-        boolean caught = false;
-        try {
-            MethodHandle ci3q = LOOKUP.findSpecial(FindSpecial.I3.class, "q", t, FindSpecial.C.class);
-        } catch (Throwable thrown) {
-            if (!(thrown instanceof IllegalAccessException) || !FindSpecial.ABSTRACT_ERROR.equals(thrown.getMessage())) {
-                throw new AssertionError(thrown.getMessage(), thrown);
-            }
-            caught = true;
-        }
-        assertTrue(caught);
-    }
-
-    @Test
-    public static void testFindClassCNFE() throws Throwable {
-        boolean caught = false;
-        try {
-            LOOKUP.findClass("does.not.Exist");
-        } catch (ClassNotFoundException cnfe) {
-            caught = true;
-        }
-        assertTrue(caught);
-    }
-
-    //
-    // Methods used to assemble tests.
-    //
-
-    static class Empty {
-
-        static void f() { }
-
-        static boolean pred() {
-            return false;
-        }
-
-        static final Class<Empty> EMPTY = Empty.class;
-
-        static final MethodType MT_f = methodType(void.class);
-        static final MethodType MT_pred = methodType(boolean.class);
-
-        static final MethodHandle MH_f;
-        static final MethodHandle MH_pred;
-
-        static {
-            try {
-                MH_f = LOOKUP.findStatic(EMPTY, "f", MT_f);
-                MH_pred = LOOKUP.findStatic(EMPTY, "pred", MT_pred);
-            } catch (Exception e) {
-                throw new ExceptionInInitializerError(e);
-            }
-        }
-    }
-
-    static class Fac {
-
-        static int zero(int k) {
-            return 0;
-        }
-
-        static int one(int k) {
-            return 1;
-        }
-
-        static boolean pred(int i, int acc, int k) {
-            return i < k;
-        }
-
-        static int inc(int i, int acc, int k) {
-            return i + 1;
-        }
-
-        static int mult(int i, int acc, int k) {
-            return i * acc;
-        }
-
-        static void dot(int i, int acc, int k) {
-            System.out.print('.');
-        }
-
-        static int fin(int i, int acc, int k) {
-            return acc;
-        }
-
-        static final Class<Fac> FAC = Fac.class;
-
-        static final MethodType MT_init = methodType(int.class, int.class);
-        static final MethodType MT_fn = methodType(int.class, int.class, int.class, int.class);
-        static final MethodType MT_dot = methodType(void.class, int.class, int.class, int.class);
-        static final MethodType MT_pred = methodType(boolean.class, int.class, int.class, int.class);
-
-        static final MethodHandle MH_zero;
-        static final MethodHandle MH_one;
-        static final MethodHandle MH_pred;
-        static final MethodHandle MH_inc;
-        static final MethodHandle MH_mult;
-        static final MethodHandle MH_dot;
-        static final MethodHandle MH_fin;
-
-        static final MethodType MT_fac = methodType(int.class, int.class);
-
-        static {
-            try {
-                MH_zero = LOOKUP.findStatic(FAC, "zero", MT_init);
-                MH_one = LOOKUP.findStatic(FAC, "one", MT_init);
-                MH_pred = LOOKUP.findStatic(FAC, "pred", MT_pred);
-                MH_inc = LOOKUP.findStatic(FAC, "inc", MT_fn);
-                MH_mult = LOOKUP.findStatic(FAC, "mult", MT_fn);
-                MH_dot = LOOKUP.findStatic(FAC, "dot", MT_dot);
-                MH_fin = LOOKUP.findStatic(FAC, "fin", MT_fn);
-            } catch (Exception e) {
-                throw new ExceptionInInitializerError(e);
-            }
-        }
-
-    }
-
-    static class While {
-
-        static int zero(int limit) {
-            return 0;
-        }
-
-        static boolean pred(int i, int limit) {
-            return i < limit;
-        }
-
-        static int step(int i, int limit) {
-            return i + 1;
-        }
-
-        static String initString() {
-            return "a";
-        }
-
-        static boolean predString(String s) {
-            return s.length() != 1;
-        }
-
-        static String stepString(String s) {
-            return s + "a";
-        }
-
-        static List<String> zipInitZip(Iterator<String> a, Iterator<String> b) {
-            return new ArrayList<>();
-        }
-
-        static boolean zipPred(List<String> zip, Iterator<String> a, Iterator<String> b) {
-            return a.hasNext() && b.hasNext();
-        }
-
-        static List<String> zipStep(List<String> zip, Iterator<String> a, Iterator<String> b) {
-            zip.add(a.next());
-            zip.add(b.next());
-            return zip;
-        }
-
-        static final Class<While> WHILE = While.class;
-
-        static final MethodType MT_zero = methodType(int.class, int.class);
-        static final MethodType MT_pred = methodType(boolean.class, int.class, int.class);
-        static final MethodType MT_fn = methodType(int.class, int.class, int.class);
-        static final MethodType MT_initString = methodType(String.class);
-        static final MethodType MT_predString = methodType(boolean.class, String.class);
-        static final MethodType MT_stepString = methodType(String.class, String.class);
-        static final MethodType MT_zipInitZip = methodType(List.class, Iterator.class, Iterator.class);
-        static final MethodType MT_zipPred = methodType(boolean.class, List.class, Iterator.class, Iterator.class);
-        static final MethodType MT_zipStep = methodType(List.class, List.class, Iterator.class, Iterator.class);
-
-        static final MethodHandle MH_zero;
-        static final MethodHandle MH_pred;
-        static final MethodHandle MH_step;
-        static final MethodHandle MH_initString;
-        static final MethodHandle MH_predString;
-        static final MethodHandle MH_stepString;
-        static final MethodHandle MH_zipInitZip;
-        static final MethodHandle MH_zipPred;
-        static final MethodHandle MH_zipStep;
-
-        static final MethodType MT_while = methodType(int.class, int.class);
-        static final MethodType MT_string = methodType(String.class);
-        static final MethodType MT_zip = methodType(List.class, Iterator.class, Iterator.class);
-
-        static {
-            try {
-                MH_zero = LOOKUP.findStatic(WHILE, "zero", MT_zero);
-                MH_pred = LOOKUP.findStatic(WHILE, "pred", MT_pred);
-                MH_step = LOOKUP.findStatic(WHILE, "step", MT_fn);
-                MH_initString = LOOKUP.findStatic(WHILE, "initString", MT_initString);
-                MH_predString = LOOKUP.findStatic(WHILE, "predString", MT_predString);
-                MH_stepString = LOOKUP.findStatic(WHILE, "stepString", MT_stepString);
-                MH_zipInitZip = LOOKUP.findStatic(WHILE, "zipInitZip", MT_zipInitZip);
-                MH_zipPred = LOOKUP.findStatic(WHILE, "zipPred", MT_zipPred);
-                MH_zipStep = LOOKUP.findStatic(WHILE, "zipStep", MT_zipStep);
-            } catch (Exception e) {
-                throw new ExceptionInInitializerError(e);
-            }
-        }
-
-    }
-
-    static class Counted {
-
-        static String start(String arg) {
-            return arg;
-        }
-
-        static String step(int counter, String v, String arg) {
-            return "na " + v;
-        }
-
-        static void stepUpdateArray(int counter, int[] a) {
-            ++a[0];
-        }
-
-        static void printHello(int counter) {
-            System.out.print("hello");
-        }
-
-        static final Class<Counted> COUNTED = Counted.class;
-
-        static final MethodType MT_start = methodType(String.class, String.class);
-        static final MethodType MT_step = methodType(String.class, int.class, String.class, String.class);
-        static final MethodType MT_stepUpdateArray = methodType(void.class, int.class, int[].class);
-        static final MethodType MT_printHello = methodType(void.class, int.class);
-
-        static final MethodHandle MH_13;
-        static final MethodHandle MH_m5;
-        static final MethodHandle MH_8;
-        static final MethodHandle MH_start;
-        static final MethodHandle MH_step;
-        static final MethodHandle MH_stepUpdateArray;
-        static final MethodHandle MH_printHello;
-
-        static final MethodType MT_counted = methodType(String.class, String.class);
-        static final MethodType MT_arrayCounted = methodType(void.class, int[].class);
-        static final MethodType MT_countedPrinting = methodType(void.class);
-
-        static {
-            try {
-                MH_13 = MethodHandles.constant(int.class, 13);
-                MH_m5 = MethodHandles.constant(int.class, -5);
-                MH_8 = MethodHandles.constant(int.class, 8);
-                MH_start = LOOKUP.findStatic(COUNTED, "start", MT_start);
-                MH_step = LOOKUP.findStatic(COUNTED, "step", MT_step);
-                MH_stepUpdateArray = LOOKUP.findStatic(COUNTED, "stepUpdateArray", MT_stepUpdateArray);
-                MH_printHello = LOOKUP.findStatic(COUNTED, "printHello", MT_printHello);
-            } catch (Exception e) {
-                throw new ExceptionInInitializerError(e);
-            }
-        }
-
-    }
-
-    static class Iterate {
-
-        static Iterator<Integer> sumIterator(Integer[] a) {
-            return Arrays.asList(a).iterator();
-        }
-
-        static int sumInit(Integer[] a) {
-            return 0;
-        }
-
-        static int sumStep(int s, int e, Integer[] a) {
-            return s + e;
-        }
-
-        static List<String> reverseInit(List<String> l) {
-            return new ArrayList<>();
-        }
-
-        static List<String> reverseStep(String e, List<String> r, List<String> l) {
-            r.add(0, e);
-            return r;
-        }
-
-        static int lengthInit(List<Double> l) {
-            return 0;
-        }
-
-        static int lengthStep(Object o, int len, List<Double> l) {
-            return len + 1;
-        }
-
-        static List<String> mapInit(List<String> l) {
-            return new ArrayList<>();
-        }
-
-        static List<String> mapStep(String e, List<String> r, List<String> l) {
-            r.add(e.toUpperCase());
-            return r;
-        }
-
-        static void printStep(String s, List<String> l) {
-            System.out.print(s);
-        }
-
-        static final Class<Iterate> ITERATE = Iterate.class;
-
-        static final MethodType MT_sumIterator = methodType(Iterator.class, Integer[].class);
-
-        static final MethodType MT_sumInit = methodType(int.class, Integer[].class);
-        static final MethodType MT_reverseInit = methodType(List.class, List.class);
-        static final MethodType MT_lenghInit = methodType(int.class, List.class);
-        static final MethodType MT_mapInit = methodType(List.class, List.class);
-
-        static final MethodType MT_sumStep = methodType(int.class, int.class, int.class, Integer[].class);
-        static final MethodType MT_reverseStep = methodType(List.class, String.class, List.class, List.class);
-        static final MethodType MT_lengthStep = methodType(int.class, Object.class, int.class, List.class);
-        static final MethodType MT_mapStep = methodType(List.class, String.class, List.class, List.class);
-        static final MethodType MT_printStep = methodType(void.class, String.class, List.class);
-
-        static final MethodHandle MH_sumIterator;
-        static final MethodHandle MH_sumInit;
-        static final MethodHandle MH_sumStep;
-        static final MethodHandle MH_printStep;
-
-        static final MethodHandle MH_reverseInit;
-        static final MethodHandle MH_reverseStep;
-
-        static final MethodHandle MH_lengthInit;
-        static final MethodHandle MH_lengthStep;
-
-        static final MethodHandle MH_mapInit;
-        static final MethodHandle MH_mapStep;
-
-        static final MethodType MT_sum = methodType(int.class, Integer[].class);
-        static final MethodType MT_reverse = methodType(List.class, List.class);
-        static final MethodType MT_length = methodType(int.class, List.class);
-        static final MethodType MT_map = methodType(List.class, List.class);
-        static final MethodType MT_print = methodType(void.class, List.class);
-
-        static {
-            try {
-                MH_sumIterator = LOOKUP.findStatic(ITERATE, "sumIterator", MT_sumIterator);
-                MH_sumInit = LOOKUP.findStatic(ITERATE, "sumInit", MT_sumInit);
-                MH_sumStep = LOOKUP.findStatic(ITERATE, "sumStep", MT_sumStep);
-                MH_reverseInit = LOOKUP.findStatic(ITERATE, "reverseInit", MT_reverseInit);
-                MH_reverseStep = LOOKUP.findStatic(ITERATE, "reverseStep", MT_reverseStep);
-                MH_lengthInit = LOOKUP.findStatic(ITERATE, "lengthInit", MT_lenghInit);
-                MH_lengthStep = LOOKUP.findStatic(ITERATE, "lengthStep", MT_lengthStep);
-                MH_mapInit = LOOKUP.findStatic(ITERATE, "mapInit", MT_mapInit);
-                MH_mapStep = LOOKUP.findStatic(ITERATE, "mapStep", MT_mapStep);
-                MH_printStep = LOOKUP.findStatic(ITERATE, "printStep", MT_printStep);
-            } catch (Exception e) {
-                throw new ExceptionInInitializerError(e);
-            }
-        }
-
-    }
-
-    static class TryFinally {
-
-        static String greet(String whom) {
-            return "Hello, " + whom;
-        }
-
-        static String exclaim(Throwable t, String r, String whom) {
-            return r + "!";
-        }
-
-        static void print(String what) {
-            System.out.print("Hello, " + what);
-        }
-
-        static void printMore(Throwable t, String what) {
-            System.out.println("!");
-        }
-
-        static String greetMore(String first, String second) {
-            return "Hello, " + first + " and " + second;
-        }
-
-        static String exclaimMore(Throwable t, String r, String first) {
-            return r + " (but " + first + " first)!";
-        }
-
-        static void voidTarget() {}
-
-        static void voidCleanup(Throwable t, int a) {}
-
-        static final Class<TryFinally> TRY_FINALLY = TryFinally.class;
-
-        static final MethodType MT_greet = methodType(String.class, String.class);
-        static final MethodType MT_exclaim = methodType(String.class, Throwable.class, String.class, String.class);
-        static final MethodType MT_print = methodType(void.class, String.class);
-        static final MethodType MT_printMore = methodType(void.class, Throwable.class, String.class);
-        static final MethodType MT_greetMore = methodType(String.class, String.class, String.class);
-        static final MethodType MT_exclaimMore = methodType(String.class, Throwable.class, String.class, String.class);
-        static final MethodType MT_voidTarget = methodType(void.class);
-        static final MethodType MT_voidCleanup = methodType(void.class, Throwable.class, int.class);
-
-        static final MethodHandle MH_greet;
-        static final MethodHandle MH_exclaim;
-        static final MethodHandle MH_print;
-        static final MethodHandle MH_printMore;
-        static final MethodHandle MH_greetMore;
-        static final MethodHandle MH_exclaimMore;
-        static final MethodHandle MH_voidTarget;
-        static final MethodHandle MH_voidCleanup;
-
-        static final MethodType MT_hello = methodType(String.class, String.class);
-        static final MethodType MT_printHello = methodType(void.class, String.class);
-        static final MethodType MT_moreHello = methodType(String.class, String.class, String.class);
-
-        static {
-            try {
-                MH_greet = LOOKUP.findStatic(TRY_FINALLY, "greet", MT_greet);
-                MH_exclaim = LOOKUP.findStatic(TRY_FINALLY, "exclaim", MT_exclaim);
-                MH_print = LOOKUP.findStatic(TRY_FINALLY, "print", MT_print);
-                MH_printMore = LOOKUP.findStatic(TRY_FINALLY, "printMore", MT_printMore);
-                MH_greetMore = LOOKUP.findStatic(TRY_FINALLY, "greetMore", MT_greetMore);
-                MH_exclaimMore = LOOKUP.findStatic(TRY_FINALLY, "exclaimMore", MT_exclaimMore);
-                MH_voidTarget = LOOKUP.findStatic(TRY_FINALLY, "voidTarget", MT_voidTarget);
-                MH_voidCleanup = LOOKUP.findStatic(TRY_FINALLY, "voidCleanup", MT_voidCleanup);
-            } catch (Exception e) {
-                throw new ExceptionInInitializerError(e);
-            }
-        }
-
-    }
-
-    static class Fold {
-
-        static int adder(int a, int b, int c) {
-            return a + b + c;
-        }
-
-        static int adder1(int a, int b) {
-            return a + b;
-        }
-
-        static int multer(int x, int q, int r, int s) {
-            return x * q * r * s;
-        }
-
-        static int str(boolean b1, String s, boolean b2, int x) {
-            return b1 && s.equals(String.valueOf(b2)) ? x : -x;
-        }
-
-        static boolean comb(String s, boolean b2) {
-            return !s.equals(b2);
-        }
-
-        static String comb2(boolean b2, int x) {
-            int ib = b2 ? 1 : 0;
-            return ib == x ? "true" : "false";
-        }
-
-        static final Class<Fold> FOLD = Fold.class;
-
-        static final MethodType MT_adder = methodType(int.class, int.class, int.class, int.class);
-        static final MethodType MT_adder1 = methodType(int.class, int.class, int.class);
-        static final MethodType MT_multer = methodType(int.class, int.class, int.class, int.class, int.class);
-        static final MethodType MT_str = methodType(int.class, boolean.class, String.class, boolean.class, int.class);
-        static final MethodType MT_comb = methodType(boolean.class, String.class, boolean.class);
-        static final MethodType MT_comb2 = methodType(String.class, boolean.class, int.class);
-
-        static final MethodHandle MH_adder;
-        static final MethodHandle MH_adder1;
-        static final MethodHandle MH_multer;
-        static final MethodHandle MH_str;
-        static final MethodHandle MH_comb;
-        static final MethodHandle MH_comb2;
-
-        static final MethodType MT_folded1 = methodType(int.class, int.class, int.class, int.class);
-        static final MethodType MT_folded2 = methodType(int.class, String.class, boolean.class, int.class);
-        static final MethodType MT_folded3 = methodType(int.class, boolean.class, boolean.class, int.class);
-
-        static {
-            try {
-                MH_adder = LOOKUP.findStatic(FOLD, "adder", MT_adder);
-                MH_adder1 = LOOKUP.findStatic(FOLD, "adder1", MT_adder1);
-                MH_multer = LOOKUP.findStatic(FOLD, "multer", MT_multer);
-                MH_str = LOOKUP.findStatic(FOLD, "str", MT_str);
-                MH_comb = LOOKUP.findStatic(FOLD, "comb", MT_comb);
-                MH_comb2 = LOOKUP.findStatic(FOLD, "comb2", MT_comb2);
-            } catch (Exception e) {
-                throw new ExceptionInInitializerError(e);
-            }
-        }
-    }
-
-    static class SpreadCollect {
-
-        static String forSpreading(String s1, int i1, int i2, int i3, String s2) {
-            return s1 + i1 + i2 + i3 + s2;
-        }
-
-        static String forCollecting(String s1, int[] is, String s2) {
-            StringBuilder sb = new StringBuilder(s1);
-            for (int i : is) {
-                sb.append(i);
-            }
-            return sb.append(s2).toString();
-        }
-
-        static String forCollectingLeading(int[] is, String s) {
-            return forCollecting("", is, s);
-        }
-
-        static final Class<SpreadCollect> SPREAD_COLLECT = SpreadCollect.class;
-
-        static final MethodType MT_forSpreading = methodType(String.class, String.class, int.class, int.class, int.class, String.class);
-        static final MethodType MT_forCollecting = methodType(String.class, String.class, int[].class, String.class);
-        static final MethodType MT_forCollectingLeading = methodType(String.class, int[].class, String.class);
-
-        static final MethodHandle MH_forSpreading;
-        static final MethodHandle MH_forCollecting;
-        static final MethodHandle MH_forCollectingLeading;
-
-        static final MethodType MT_spreader = methodType(String.class, String.class, int[].class, String.class);
-        static final MethodType MT_collector0 = methodType(String.class, String.class, String.class);
-        static final MethodType MT_collector1 = methodType(String.class, String.class, int.class, String.class);
-        static final MethodType MT_collector2 = methodType(String.class, String.class, int.class, int.class, String.class);
-        static final MethodType MT_collector3 = methodType(String.class, String.class, int.class, int.class, int.class, String.class);
-        static final MethodType MT_collectorLeading1 = methodType(String.class, int.class, String.class);
-        static final MethodType MT_collectorLeading2 = methodType(String.class, int.class, int.class, String.class);
-        static final MethodType MT_collectorLeading3 = methodType(String.class, int.class, int.class, int.class, String.class);
-
-        static final String NONE_ERROR = "zero array length in MethodHandle.asCollector";
-
-        static {
-            try {
-                MH_forSpreading = LOOKUP.findStatic(SPREAD_COLLECT, "forSpreading", MT_forSpreading);
-                MH_forCollecting = LOOKUP.findStatic(SPREAD_COLLECT, "forCollecting", MT_forCollecting);
-                MH_forCollectingLeading = LOOKUP.findStatic(SPREAD_COLLECT, "forCollectingLeading", MT_forCollectingLeading);
-            } catch (Exception e) {
-                throw new ExceptionInInitializerError(e);
-            }
-        }
-
-    }
-
-    static class FindSpecial {
-
-        interface I1 {
-            default String m() {
-                return "I1.m";
-            }
-        }
-
-        interface I2 {
-            default String m() {
-                return "I2.m";
-            }
-        }
-
-        interface I3 {
-            String q();
-        }
-
-        static class C implements I1, I2, I3 {
-            public String m() {
-                return I1.super.m();
-            }
-            public String q() {
-                return "q";
-            }
-        }
-
-        static final String ABSTRACT_ERROR = "no such method: test.java.lang.invoke.T8139885$FindSpecial$I3.q()String/invokeSpecial";
-
-    }
-
-    //
-    // Auxiliary methods.
-    //
-
-    static MethodHandle[] mha(MethodHandle... mhs) {
-        return mhs;
-    }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/TryFinallyTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,179 @@
+/*
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+/* @test
+ * @bug 8139885
+ * @bug 8150825
+ * @run testng/othervm -ea -esa test.java.lang.invoke.TryFinallyTest
+ */
+
+package test.java.lang.invoke;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodHandles.Lookup;
+import java.lang.invoke.MethodType;
+
+import static java.lang.invoke.MethodType.methodType;
+
+import static org.testng.AssertJUnit.*;
+
+import org.testng.annotations.*;
+
+/**
+ * Tests for the tryFinally method handle combinator introduced in JEP 274.
+ */
+public class TryFinallyTest {
+
+    static final Lookup LOOKUP = MethodHandles.lookup();
+
+    @Test
+    public static void testTryFinally() throws Throwable {
+        MethodHandle hello = MethodHandles.tryFinally(TryFinally.MH_greet, TryFinally.MH_exclaim);
+        assertEquals(TryFinally.MT_hello, hello.type());
+        assertEquals("Hello, world!", hello.invoke("world"));
+    }
+
+    @Test
+    public static void testTryFinallyVoid() throws Throwable {
+        MethodHandle tfVoid = MethodHandles.tryFinally(TryFinally.MH_print, TryFinally.MH_printMore);
+        assertEquals(TryFinally.MT_printHello, tfVoid.type());
+        tfVoid.invoke("world");
+    }
+
+    @Test
+    public static void testTryFinallySublist() throws Throwable {
+        MethodHandle helloMore = MethodHandles.tryFinally(TryFinally.MH_greetMore, TryFinally.MH_exclaimMore);
+        assertEquals(TryFinally.MT_moreHello, helloMore.type());
+        assertEquals("Hello, world and universe (but world first)!", helloMore.invoke("world", "universe"));
+    }
+
+    @DataProvider
+    static Object[][] negativeTestData() {
+        MethodHandle intid = MethodHandles.identity(int.class);
+        MethodHandle intco = MethodHandles.constant(int.class, 0);
+        MethodHandle errTarget = MethodHandles.dropArguments(intco, 0, int.class, double.class, String.class, int.class);
+        MethodHandle errCleanup = MethodHandles.dropArguments(MethodHandles.constant(int.class, 0), 0, Throwable.class,
+                int.class, double.class, Object.class);
+        return new Object[][]{
+                {intid, MethodHandles.identity(double.class),
+                        "target and return types must match: double != int"},
+                {intid, MethodHandles.dropArguments(intid, 0, String.class),
+                        "cleanup first argument and Throwable must match: (String,int)int != class java.lang.Throwable"},
+                {intid, MethodHandles.dropArguments(intid, 0, Throwable.class, double.class),
+                        "cleanup second argument and target return type must match: (Throwable,double,int)int != int"},
+                {errTarget, errCleanup,
+                        "cleanup parameters after (Throwable,result) and target parameter list prefix must match: " +
+                                errCleanup.type() + " != " + errTarget.type()},
+                {TryFinally.MH_voidTarget, TryFinally.MH_voidCleanup,
+                        "cleanup parameters after (Throwable,result) and target parameter list prefix must match: " +
+                                TryFinally.MH_voidCleanup.type() + " != " + TryFinally.MH_voidTarget.type()}
+        };
+    }
+
+    @Test(dataProvider = "negativeTestData")
+    public static void testTryFinallyNegative(MethodHandle target, MethodHandle cleanup, String expectedMessage) {
+        boolean caught = false;
+        try {
+            MethodHandles.tryFinally(target, cleanup);
+        } catch (IllegalArgumentException iae) {
+            assertEquals(expectedMessage, iae.getMessage());
+            caught = true;
+        }
+        assertTrue(caught);
+    }
+
+    static class TryFinally {
+
+        static String greet(String whom) {
+            return "Hello, " + whom;
+        }
+
+        static String exclaim(Throwable t, String r, String whom) {
+            return r + "!";
+        }
+
+        static void print(String what) {
+            System.out.print("Hello, " + what);
+        }
+
+        static void printMore(Throwable t, String what) {
+            System.out.println("!");
+        }
+
+        static String greetMore(String first, String second) {
+            return "Hello, " + first + " and " + second;
+        }
+
+        static String exclaimMore(Throwable t, String r, String first) {
+            return r + " (but " + first + " first)!";
+        }
+
+        static void voidTarget() {}
+
+        static void voidCleanup(Throwable t, int a) {}
+
+        static final Class<TryFinally> TRY_FINALLY = TryFinally.class;
+
+        static final MethodType MT_greet = methodType(String.class, String.class);
+        static final MethodType MT_exclaim = methodType(String.class, Throwable.class, String.class, String.class);
+        static final MethodType MT_print = methodType(void.class, String.class);
+        static final MethodType MT_printMore = methodType(void.class, Throwable.class, String.class);
+        static final MethodType MT_greetMore = methodType(String.class, String.class, String.class);
+        static final MethodType MT_exclaimMore = methodType(String.class, Throwable.class, String.class, String.class);
+        static final MethodType MT_voidTarget = methodType(void.class);
+        static final MethodType MT_voidCleanup = methodType(void.class, Throwable.class, int.class);
+
+        static final MethodHandle MH_greet;
+        static final MethodHandle MH_exclaim;
+        static final MethodHandle MH_print;
+        static final MethodHandle MH_printMore;
+        static final MethodHandle MH_greetMore;
+        static final MethodHandle MH_exclaimMore;
+        static final MethodHandle MH_voidTarget;
+        static final MethodHandle MH_voidCleanup;
+
+        static final MethodType MT_hello = methodType(String.class, String.class);
+        static final MethodType MT_printHello = methodType(void.class, String.class);
+        static final MethodType MT_moreHello = methodType(String.class, String.class, String.class);
+
+        static {
+            try {
+                MH_greet = LOOKUP.findStatic(TRY_FINALLY, "greet", MT_greet);
+                MH_exclaim = LOOKUP.findStatic(TRY_FINALLY, "exclaim", MT_exclaim);
+                MH_print = LOOKUP.findStatic(TRY_FINALLY, "print", MT_print);
+                MH_printMore = LOOKUP.findStatic(TRY_FINALLY, "printMore", MT_printMore);
+                MH_greetMore = LOOKUP.findStatic(TRY_FINALLY, "greetMore", MT_greetMore);
+                MH_exclaimMore = LOOKUP.findStatic(TRY_FINALLY, "exclaimMore", MT_exclaimMore);
+                MH_voidTarget = LOOKUP.findStatic(TRY_FINALLY, "voidTarget", MT_voidTarget);
+                MH_voidCleanup = LOOKUP.findStatic(TRY_FINALLY, "voidCleanup", MT_voidCleanup);
+            } catch (Exception e) {
+                throw new ExceptionInInitializerError(e);
+            }
+        }
+
+    }
+
+}
--- a/jdk/test/java/lang/invoke/lambda/LambdaAccessControlDoPrivilegedTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/lang/invoke/lambda/LambdaAccessControlDoPrivilegedTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @summary tests DoPrivileged action (implemented as lambda expressions) by
  * inserting them into the BootClassPath.
  * @modules jdk.compiler
+ *          jdk.zipfs
  * @compile -XDignore.symbol.file LambdaAccessControlDoPrivilegedTest.java LUtils.java
  * @run main/othervm LambdaAccessControlDoPrivilegedTest
  */
--- a/jdk/test/java/lang/invoke/lambda/LambdaAsm.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/lang/invoke/lambda/LambdaAsm.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
  * generate  bytecodes with correct constant pool references
  * @modules java.base/jdk.internal.org.objectweb.asm
  *          jdk.jdeps/com.sun.tools.classfile
+ *          jdk.zipfs
  * @compile -XDignore.symbol.file LambdaAsm.java LUtils.java
  * @run main/othervm LambdaAsm
  */
--- a/jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -26,6 +26,8 @@
  * @bug 8023524
  * @summary tests logging generated classes for lambda
  * @library /java/nio/file
+ * @modules jdk.compiler
+ *          jdk.zipfs
  * @run testng LogGeneratedClassesTest
  */
 import java.io.File;
--- a/jdk/test/java/lang/ref/CleanerTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/lang/ref/CleanerTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -52,7 +52,10 @@
  * @library /test/lib/share/classes /lib/testlibrary /test/lib
  * @build sun.hotspot.WhiteBox
  * @build jdk.test.lib.Utils
- * @modules java.base/jdk.internal.misc java.base/jdk.internal.ref
+ * @modules java.base/jdk.internal
+ *          java.base/jdk.internal.misc
+ *          java.base/jdk.internal.ref
+ *          java.management
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  * @run testng/othervm
  *      -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/SocketOption/ImmutableOptions.java	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,184 @@
+/*
+ * 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 8148609
+ * @run testng/othervm ImmutableOptions
+ * @summary Assert that the set of socket options are immutable
+ */
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.*;
+import java.util.Set;
+
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+public class ImmutableOptions {
+
+    @BeforeTest
+    void setupServerSocketFactory() throws IOException {
+        ServerSocket.setSocketFactory(new ServerSocketImplFactory());
+    }
+
+    @Test(expectedExceptions = UnsupportedOperationException.class)
+    public void socketThrows() throws IOException {
+        CustomSocketImpl impl = new CustomSocketImpl();
+        Socket socket = new CustomSocket(impl);
+        socket.supportedOptions().clear();
+    }
+
+    @Test(expectedExceptions = UnsupportedOperationException.class)
+    public void socketImplThrows() throws IOException {
+        CustomSocketImpl impl = new CustomSocketImpl();
+        impl.supportedOptions().clear();
+    }
+
+    @Test(expectedExceptions = UnsupportedOperationException.class)
+    public void serverSocketThrows() throws IOException {
+        ServerSocket ss = new ServerSocket();
+        ss.supportedOptions().clear();
+    }
+
+    @Test(expectedExceptions = UnsupportedOperationException.class)
+    public void serverSocketImplThrows() throws IOException {
+        ServerSocket ss = new ServerSocket();
+        ServerSocketImplFactory.mostRecentlyCreated.supportedOptions().clear();
+    }
+
+    @Test(expectedExceptions = UnsupportedOperationException.class)
+    public void datagramSocketThrows() throws IOException {
+        CustomDatagramSocketImpl impl = new CustomDatagramSocketImpl();
+        DatagramSocket socket = new CustomDatagramSocket(impl);
+        socket.supportedOptions().clear();
+    }
+
+    @Test(expectedExceptions = UnsupportedOperationException.class)
+    public void datagramSocketImplThrows() throws IOException {
+        CustomDatagramSocketImpl impl = new CustomDatagramSocketImpl();
+        impl.supportedOptions().clear();
+    }
+
+
+    // Socket descendants
+    static class CustomSocket extends Socket {
+        public CustomSocket(SocketImpl impl) throws IOException {
+            super(impl);
+        }
+    }
+
+    static class CustomDatagramSocket extends DatagramSocket {
+        public CustomDatagramSocket(DatagramSocketImpl impl) {
+            super(impl);
+        }
+    }
+
+    static class ServerSocketImplFactory implements SocketImplFactory {
+        static volatile CustomSocketImpl mostRecentlyCreated;
+
+        @Override public SocketImpl createSocketImpl() {
+            return mostRecentlyCreated = new CustomSocketImpl();
+        }
+    }
+
+    // Custom impl's
+    static class CustomSocketImpl extends SocketImpl {
+        // The only method interesting to this test.
+        @Override public Set<SocketOption<?>> supportedOptions() {
+            return super.supportedOptions();
+        }
+
+        public void create(boolean stream) throws IOException { }
+
+        public void connect(String host, int port) throws IOException { }
+
+        public void connect(InetAddress addr, int port) throws IOException { }
+
+        public void connect(SocketAddress addr, int timeout) throws IOException { }
+
+        public void bind(InetAddress host, int port) throws IOException { }
+
+        public void listen(int backlog) throws IOException { }
+
+        public void accept(SocketImpl s) throws IOException { }
+
+        public InputStream getInputStream() throws IOException { return null; }
+
+        public OutputStream getOutputStream() throws IOException { return null; }
+
+        public int available() throws IOException { return 0; }
+
+        public void close() throws IOException { }
+
+        public void sendUrgentData(int data) throws IOException { }
+
+        public Object getOption(int i) throws SocketException { return null; }
+
+        public void setOption(int i, Object o) throws SocketException { }
+    }
+
+    static class CustomDatagramSocketImpl extends DatagramSocketImpl {
+        // The only method interesting to this test.
+        @Override public Set<SocketOption<?>> supportedOptions() {
+            return super.supportedOptions();
+        }
+
+        protected void create() throws SocketException { }
+
+        protected void bind(int lport, InetAddress laddr) throws SocketException { }
+
+        protected void send(DatagramPacket p) throws IOException { }
+
+        protected int peek(InetAddress i) throws IOException { return 0; }
+
+        protected int peekData(DatagramPacket p) throws IOException { return 0; }
+
+        protected void receive(DatagramPacket p) throws IOException { }
+
+        protected void setTTL(byte ttl) throws IOException { }
+
+        protected byte getTTL() throws IOException { return 0; }
+
+        protected void setTimeToLive(int ttl) throws IOException { }
+
+        protected int getTimeToLive() throws IOException { return 0; }
+
+        protected void join(InetAddress inetaddr) throws IOException { }
+
+        protected void leave(InetAddress inetaddr) throws IOException { }
+
+        protected void joinGroup(SocketAddress x, NetworkInterface y)
+            throws IOException { }
+
+        protected void leaveGroup(SocketAddress x, NetworkInterface y)
+            throws IOException { }
+
+        protected void close() { }
+
+        public void setOption(int optID, Object value) throws SocketException { }
+
+        public Object getOption(int optID) throws SocketException { return null; }
+    }
+}
--- a/jdk/test/java/net/ipv6tests/UdpTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/net/ipv6tests/UdpTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 4868820
+ * @key intermittent
  * @summary IPv6 support for Windows XP and 2003 server
  */
 
--- a/jdk/test/java/rmi/server/Unreferenced/leaseCheckInterval/LeaseCheckInterval.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/rmi/server/Unreferenced/leaseCheckInterval/LeaseCheckInterval.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,7 @@
  *          java.rmi/sun.rmi.transport.tcp
  * @build TestLibrary JavaVM LeaseCheckInterval_Stub SelfTerminator
  * @run main/othervm LeaseCheckInterval
+ * @key intermittent
  */
 
 import java.rmi.Remote;
--- a/jdk/test/java/util/WeakHashMap/GCDuringIteration.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/WeakHashMap/GCDuringIteration.java	Mon Mar 07 09:34:29 2016 +0100
@@ -29,26 +29,50 @@
  * @run main GCDuringIteration
  * @summary Check that iterators work properly in the presence of
  *          concurrent finalization and removal of elements.
- * @key randomness intermittent
+ * @key randomness
  */
 
-import java.util.*;
+import static java.util.concurrent.TimeUnit.SECONDS;
+
+import java.lang.ref.WeakReference;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Random;
+import java.util.WeakHashMap;
 import java.util.concurrent.CountDownLatch;
+import java.util.function.BooleanSupplier;
 import jdk.testlibrary.RandomFactory;
 
 public class GCDuringIteration {
-    private static void waitForFinalizersToRun() {
-        for (int i = 0; i < 2; i++)
-            tryWaitForFinalizersToRun();
+
+    /** No guarantees, but effective in practice. */
+    static void forceFullGc() {
+        CountDownLatch finalizeDone = new CountDownLatch(1);
+        WeakReference<?> ref = new WeakReference<Object>(new Object() {
+            protected void finalize() { finalizeDone.countDown(); }});
+        try {
+            for (int i = 0; i < 10; i++) {
+                System.gc();
+                if (finalizeDone.await(1L, SECONDS) && ref.get() == null) {
+                    System.runFinalization(); // try to pick up stragglers
+                    return;
+                }
+            }
+        } catch (InterruptedException unexpected) {
+            throw new AssertionError("unexpected InterruptedException");
+        }
+        throw new AssertionError("failed to do a \"full\" gc");
     }
 
-    private static void tryWaitForFinalizersToRun() {
-        System.gc();
-        final CountDownLatch fin = new CountDownLatch(1);
-        new Object() { protected void finalize() { fin.countDown(); }};
-        System.gc();
-        try { fin.await(); }
-        catch (InterruptedException ie) { throw new Error(ie); }
+    static void gcAwait(BooleanSupplier s) {
+        for (int i = 0; i < 10; i++) {
+            if (s.getAsBoolean())
+                return;
+            forceFullGc();
+        }
+        throw new AssertionError("failed to satisfy condition");
     }
 
     // A class with the traditional pessimal hashCode implementation,
@@ -76,9 +100,13 @@
             if (rnd.nextBoolean()) check(it.hasNext());
             equal(it.next().getValue(), i);
         }
-        if (rnd.nextBoolean())
-            THROWS(NoSuchElementException.class,
-                   new F(){void f(){it.next();}});
+        if (rnd.nextBoolean()) {
+            try {
+                it.next();
+                throw new AssertionError("should throw");
+            } catch (NoSuchElementException success) {}
+        }
+
         if (rnd.nextBoolean())
             check(! it.hasNext());
     }
@@ -106,9 +134,7 @@
             int first = firstValue(map);
             final Iterator<Map.Entry<Foo,Integer>> it = map.entrySet().iterator();
             foos[first] = null;
-            for (int i = 0; i < 10 && map.size() != first; i++)
-                tryWaitForFinalizersToRun();
-            equal(map.size(), first);
+            gcAwait(() -> map.size() == first);
             checkIterator(it, first-1);
             equal(map.size(), first);
             equal(firstValue(map), first-1);
@@ -119,15 +145,14 @@
             final Iterator<Map.Entry<Foo,Integer>> it = map.entrySet().iterator();
             it.next();          // protects first entry
             System.out.println(map.values());
+            int oldSize = map.size();
             foos[first] = null;
-            tryWaitForFinalizersToRun();
-            equal(map.size(), first+1);
+            forceFullGc();
+            equal(map.size(), oldSize);
             System.out.println(map.values());
             checkIterator(it, first-1);
             // first entry no longer protected
-            for (int i = 0; i < 10 && map.size() != first; i++)
-                tryWaitForFinalizersToRun();
-            equal(map.size(), first);
+            gcAwait(() -> map.size() == first);
             equal(firstValue(map), first-1);
         }
 
@@ -137,15 +162,12 @@
             it.next();          // protects first entry
             System.out.println(map.values());
             foos[first] = foos[first-1] = null;
-            tryWaitForFinalizersToRun();
-            equal(map.size(), first);
+            gcAwait(() -> map.size() == first);
             equal(firstValue(map), first);
             System.out.println(map.values());
             checkIterator(it, first-2);
             // first entry no longer protected
-            for (int i = 0; i < 10 && map.size() != first-1; i++)
-                tryWaitForFinalizersToRun();
-            equal(map.size(), first-1);
+            gcAwait(() -> map.size() == first-1);
             equal(firstValue(map), first-2);
         }
 
@@ -155,16 +177,15 @@
             it.next();          // protects first entry
             it.hasNext();       // protects second entry
             System.out.println(map.values());
+            int oldSize = map.size();
             foos[first] = foos[first-1] = null;
-            tryWaitForFinalizersToRun();
+            forceFullGc();
+            equal(map.size(), oldSize);
             equal(firstValue(map), first);
-            equal(map.size(), first+1);
             System.out.println(map.values());
             checkIterator(it, first-1);
             // first entry no longer protected
-            for (int i = 0; i < 10 && map.size() != first-1; i++)
-                tryWaitForFinalizersToRun();
-            equal(map.size(), first-1);
+            gcAwait(() -> map.size() == first-1);
             equal(firstValue(map), first-2);
         }
 
@@ -173,17 +194,16 @@
             final Iterator<Map.Entry<Foo,Integer>> it = map.entrySet().iterator();
             it.next();          // protects first entry
             System.out.println(map.values());
+            equal(map.size(), first+1);
             foos[first] = foos[first-1] = null;
-            tryWaitForFinalizersToRun();
+            gcAwait(() -> map.size() == first);
             it.remove();
             equal(firstValue(map), first-2);
             equal(map.size(), first-1);
             System.out.println(map.values());
             checkIterator(it, first-2);
             // first entry no longer protected
-            for (int i = 0; i < 10 && map.size() != first-1; i++)
-                tryWaitForFinalizersToRun();
-            equal(map.size(), first-1);
+            gcAwait(() -> map.size() == first-1);
             equal(firstValue(map), first-2);
         }
 
@@ -194,15 +214,14 @@
             it.remove();
             it.hasNext();       // protects second entry
             System.out.println(map.values());
+            equal(map.size(), first);
             foos[first] = foos[first-1] = null;
-            tryWaitForFinalizersToRun();
+            forceFullGc();
             equal(firstValue(map), first-1);
             equal(map.size(), first);
             System.out.println(map.values());
             checkIterator(it, first-1);
-            for (int i = 0; i < 10 && map.size() != first-1; i++)
-                tryWaitForFinalizersToRun();
-            equal(map.size(), first-1);
+            gcAwait(() -> map.size() == first-1);
             equal(firstValue(map), first-2);
         }
 
@@ -211,14 +230,11 @@
             final Iterator<Map.Entry<Foo,Integer>> it = map.entrySet().iterator();
             it.hasNext();       // protects first entry
             Arrays.fill(foos, null);
-            tryWaitForFinalizersToRun();
-            equal(map.size(), 1);
+            gcAwait(() -> map.size() == 1);
             System.out.println(map.values());
             equal(it.next().getValue(), first);
             check(! it.hasNext());
-            for (int i = 0; i < 10 && map.size() != 0; i++)
-                tryWaitForFinalizersToRun();
-            equal(map.size(), 0);
+            gcAwait(() -> map.size() == 0);
             check(map.isEmpty());
         }
     }
@@ -239,11 +255,4 @@
         try {test(args);} catch (Throwable t) {unexpected(t);}
         System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
         if (failed > 0) throw new AssertionError("Some tests failed");}
-    abstract class F {abstract void f() throws Throwable;}
-    void THROWS(Class<? extends Throwable> k, F... fs) {
-        for (F f : fs)
-            try {f.f(); fail("Expected " + k.getName() + " not thrown");}
-            catch (Throwable t) {
-                if (k.isAssignableFrom(t.getClass())) pass();
-                else unexpected(t);}}
 }
--- a/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java	Mon Mar 07 09:34:29 2016 +0100
@@ -35,8 +35,11 @@
  * @test
  * @bug 4486658
  * @summary Checks for responsiveness of blocking queues to cancellation.
+ * @library /lib/testlibrary/
  */
 
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.SplittableRandom;
@@ -53,8 +56,10 @@
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.TimeUnit;
+import jdk.testlibrary.Utils;
 
 public class CancelledProducerConsumerLoops {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
     static ExecutorService pool;
 
     public static void main(String[] args) throws Exception {
@@ -73,7 +78,7 @@
                 new CancelledProducerConsumerLoops(i, queue).run();
         }
         pool.shutdown();
-        if (! pool.awaitTermination(10L, TimeUnit.SECONDS))
+        if (! pool.awaitTermination(LONG_DELAY_MS, MILLISECONDS))
             throw new AssertionError("timed out");
         pool = null;
     }
@@ -117,18 +122,18 @@
             assertCancelled(cons[i]);
         }
 
-        if (!producersInterrupted.await(10L, TimeUnit.SECONDS))
+        if (!producersInterrupted.await(LONG_DELAY_MS, MILLISECONDS))
             throw new AssertionError("timed out");
-        if (!consumersInterrupted.await(10L, TimeUnit.SECONDS))
+        if (!consumersInterrupted.await(LONG_DELAY_MS, MILLISECONDS))
             throw new AssertionError("timed out");
         if (prods[0].isDone() || prods[0].isCancelled())
             throw new AssertionError("completed too early");
 
         done = true;
 
-        if (! (prods[0].get(10L, TimeUnit.SECONDS) instanceof Integer))
+        if (! (prods[0].get(LONG_DELAY_MS, MILLISECONDS) instanceof Integer))
             throw new AssertionError("expected Integer");
-        if (! (cons[0].get(10L, TimeUnit.SECONDS) instanceof Integer))
+        if (! (cons[0].get(LONG_DELAY_MS, MILLISECONDS) instanceof Integer))
             throw new AssertionError("expected Integer");
     }
 
@@ -138,7 +143,7 @@
         if (!future.isCancelled())
             throw new AssertionError("not cancelled");
         try {
-            future.get(10L, TimeUnit.SECONDS);
+            future.get(LONG_DELAY_MS, MILLISECONDS);
             throw new AssertionError("should throw CancellationException");
         } catch (CancellationException success) {}
     }
--- a/jdk/test/java/util/concurrent/BlockingQueue/Interrupt.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/BlockingQueue/Interrupt.java	Mon Mar 07 09:34:29 2016 +0100
@@ -26,10 +26,10 @@
  * @bug 6384064
  * @summary Check proper handling of interrupts
  * @author Martin Buchholz
+ * @library /lib/testlibrary/
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static java.util.concurrent.TimeUnit.SECONDS;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -41,8 +41,10 @@
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.Executor;
 import java.util.concurrent.ScheduledThreadPoolExecutor;
+import jdk.testlibrary.Utils;
 
 public class Interrupt {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
 
     static void checkInterrupted0(Iterable<Fun> fs, Executor ex) {
         for (Fun f : fs) {
@@ -71,7 +73,7 @@
         checkInterrupted0(fs, immediateExecutor);
         checkInterrupted0(fs, delayedExecutor);
         stpe.shutdown();
-        check(stpe.awaitTermination(10L, SECONDS));
+        check(stpe.awaitTermination(LONG_DELAY_MS, MILLISECONDS));
     }
 
     static void testQueue(final BlockingQueue<Object> q) {
@@ -82,12 +84,12 @@
             q.clear();
             List<Fun> fs = new ArrayList<Fun>();
             fs.add(() -> q.take());
-            fs.add(() -> q.poll(60, SECONDS));
+            fs.add(() -> q.poll(LONG_DELAY_MS, MILLISECONDS));
             if (deq != null) {
                 fs.add(() -> deq.takeFirst());
                 fs.add(() -> deq.takeLast());
-                fs.add(() -> deq.pollFirst(7, SECONDS));
-                fs.add(() -> deq.pollLast(7, SECONDS));
+                fs.add(() -> deq.pollFirst(LONG_DELAY_MS, MILLISECONDS));
+                fs.add(() -> deq.pollLast(LONG_DELAY_MS, MILLISECONDS));
             }
 
             checkInterrupted(fs);
@@ -99,12 +101,12 @@
 
             fs.clear();
             fs.add(() -> q.put(1));
-            fs.add(() -> q.offer(1, 7, SECONDS));
+            fs.add(() -> q.offer(1, LONG_DELAY_MS, MILLISECONDS));
             if (deq != null) {
                 fs.add(() -> deq.putFirst(1));
                 fs.add(() -> deq.putLast(1));
-                fs.add(() -> deq.offerFirst(1, 7, SECONDS));
-                fs.add(() -> deq.offerLast(1, 7, SECONDS));
+                fs.add(() -> deq.offerFirst(1, LONG_DELAY_MS, MILLISECONDS));
+                fs.add(() -> deq.offerLast(1, LONG_DELAY_MS, MILLISECONDS));
             }
             checkInterrupted(fs);
         } catch (Throwable t) {
--- a/jdk/test/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java	Mon Mar 07 09:34:29 2016 +0100
@@ -35,10 +35,11 @@
  * @test
  * @bug 4486658
  * @summary  multiple producers and single consumer using blocking queues
+ * @library /lib/testlibrary/
  */
 
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
 import static java.util.concurrent.TimeUnit.NANOSECONDS;
-import static java.util.concurrent.TimeUnit.SECONDS;
 
 import java.util.concurrent.ArrayBlockingQueue;
 import java.util.concurrent.BlockingQueue;
@@ -51,8 +52,10 @@
 import java.util.concurrent.PriorityBlockingQueue;
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.atomic.AtomicInteger;
+import jdk.testlibrary.Utils;
 
 public class MultipleProducersSingleConsumerLoops {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
     static ExecutorService pool;
 
     public static void main(String[] args) throws Exception {
@@ -77,7 +80,7 @@
         }
 
         pool.shutdown();
-        if (! pool.awaitTermination(10L, SECONDS))
+        if (! pool.awaitTermination(LONG_DELAY_MS, MILLISECONDS))
             throw new Error();
         pool = null;
     }
--- a/jdk/test/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java	Mon Mar 07 09:34:29 2016 +0100
@@ -35,10 +35,11 @@
  * @test
  * @bug 4486658
  * @summary  multiple producers and consumers using blocking queues
+ * @library /lib/testlibrary/
  */
 
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
 import static java.util.concurrent.TimeUnit.NANOSECONDS;
-import static java.util.concurrent.TimeUnit.SECONDS;
 
 import java.util.concurrent.ArrayBlockingQueue;
 import java.util.concurrent.BlockingQueue;
@@ -51,8 +52,10 @@
 import java.util.concurrent.PriorityBlockingQueue;
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.atomic.AtomicInteger;
+import jdk.testlibrary.Utils;
 
 public class ProducerConsumerLoops {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
     static ExecutorService pool;
 
     public static void main(String[] args) throws Exception {
@@ -77,7 +80,7 @@
             run(new ArrayBlockingQueue<Integer>(100, true), i, 100);
         }
         pool.shutdown();
-        if (! pool.awaitTermination(60L, SECONDS))
+        if (! pool.awaitTermination(LONG_DELAY_MS, MILLISECONDS))
             throw new Error();
         pool = null;
    }
--- a/jdk/test/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java	Mon Mar 07 09:34:29 2016 +0100
@@ -35,10 +35,11 @@
  * @test
  * @bug 4486658
  * @summary  check ordering for blocking queues with 1 producer and multiple consumers
+ * @library /lib/testlibrary/
  */
 
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
 import static java.util.concurrent.TimeUnit.NANOSECONDS;
-import static java.util.concurrent.TimeUnit.SECONDS;
 
 import java.util.concurrent.ArrayBlockingQueue;
 import java.util.concurrent.BlockingQueue;
@@ -50,8 +51,10 @@
 import java.util.concurrent.LinkedTransferQueue;
 import java.util.concurrent.PriorityBlockingQueue;
 import java.util.concurrent.SynchronousQueue;
+import jdk.testlibrary.Utils;
 
 public class SingleProducerMultipleConsumerLoops {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
     static ExecutorService pool;
 
     public static void main(String[] args) throws Exception {
@@ -75,7 +78,7 @@
             run(new ArrayBlockingQueue<Integer>(100, true), i, 100);
         }
         pool.shutdown();
-        if (! pool.awaitTermination(60L, SECONDS))
+        if (! pool.awaitTermination(LONG_DELAY_MS, MILLISECONDS))
             throw new Error();
         pool = null;
    }
--- a/jdk/test/java/util/concurrent/CompletableFuture/Basic.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/CompletableFuture/Basic.java	Mon Mar 07 09:34:29 2016 +0100
@@ -34,15 +34,17 @@
 /*
  * @test
  * @bug 8005696
+ * @summary Basic tests for CompletableFuture
+ * @library /lib/testlibrary/
  * @run main Basic
  * @run main/othervm -Djava.util.concurrent.ForkJoinPool.common.parallelism=0 Basic
- * @summary Basic tests for CompletableFuture
  * @author Chris Hegarty
  */
 
 import static java.util.concurrent.CompletableFuture.runAsync;
 import static java.util.concurrent.CompletableFuture.supplyAsync;
 import static java.util.concurrent.ForkJoinPool.commonPool;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
 import static java.util.concurrent.TimeUnit.SECONDS;
 
 import java.lang.reflect.Array;
@@ -54,8 +56,10 @@
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.atomic.AtomicInteger;
+import jdk.testlibrary.Utils;
 
 public class Basic {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
 
     static void checkCompletedNormally(CompletableFuture<?> cf, Object value) {
         checkCompletedNormally(cf, value == null ? null : new Object[] { value });
@@ -109,12 +113,13 @@
     }
 
     private static void realMain(String[] args) throws Throwable {
-        ExecutorService executor = Executors.newFixedThreadPool(2);
+        ExecutorService pool = Executors.newFixedThreadPool(2);
         try {
-            test(executor);
+            test(pool);
         } finally {
-            executor.shutdown();
-            executor.awaitTermination(30L, SECONDS);
+            pool.shutdown();
+            if (! pool.awaitTermination(LONG_DELAY_MS, MILLISECONDS))
+                throw new Error();
         }
     }
 
--- a/jdk/test/java/util/concurrent/ConcurrentHashMap/MapLoops.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/MapLoops.java	Mon Mar 07 09:34:29 2016 +0100
@@ -34,7 +34,6 @@
 /*
  * @test
  * @bug 4486658
- * @run main/timeout=1600 MapLoops
  * @summary Exercise multithreaded maps, by default ConcurrentHashMap.
  * Multithreaded hash table test.  Each thread does a random walk
  * though elements of "key" array. On each iteration, it checks if
@@ -42,9 +41,11 @@
  * inserts it, and if present, with probability premove it removes
  * it.  (pinsert and premove are expressed as percentages to simplify
  * parsing from command line.)
+ * @library /lib/testlibrary/
+ * @run main/timeout=1600 MapLoops
  */
 
-import static java.util.concurrent.TimeUnit.SECONDS;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
 
 import java.util.List;
 import java.util.Map;
@@ -53,8 +54,10 @@
 import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
+import jdk.testlibrary.Utils;
 
 public class MapLoops {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
     static int nkeys       = 1000; // 10_000
     static int pinsert     = 60;
     static int premove     = 2;
@@ -126,7 +129,7 @@
                 i = k;
         }
         pool.shutdown();
-        if (! pool.awaitTermination(60L, SECONDS))
+        if (! pool.awaitTermination(LONG_DELAY_MS, MILLISECONDS))
             throw new Error();
 
         if (! throwables.isEmpty())
--- a/jdk/test/java/util/concurrent/ConcurrentQueues/ConcurrentQueueLoops.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/ConcurrentQueues/ConcurrentQueueLoops.java	Mon Mar 07 09:34:29 2016 +0100
@@ -34,11 +34,12 @@
 /*
  * @test
  * @bug 4486658 6785442
+ * @summary Checks that a set of threads can repeatedly get and modify items
+ * @library /lib/testlibrary/
  * @run main ConcurrentQueueLoops 8 123456
- * @summary Checks that a set of threads can repeatedly get and modify items
  */
 
-import static java.util.concurrent.TimeUnit.SECONDS;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -57,8 +58,10 @@
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.LinkedTransferQueue;
 import java.util.concurrent.atomic.AtomicInteger;
+import jdk.testlibrary.Utils;
 
 public class ConcurrentQueueLoops {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
     ExecutorService pool;
     AtomicInteger totalItems;
     boolean print;
@@ -106,16 +109,14 @@
         print = false;
         System.out.println("Warmup...");
         oneRun(1, items, q);
-        //Thread.sleep(100);
         oneRun(3, items, q);
-        Thread.sleep(100);
         print = true;
 
         for (int i = 1; i <= maxStages; i += (i+1) >>> 1) {
             oneRun(i, items, q);
         }
         pool.shutdown();
-        check(pool.awaitTermination(60L, SECONDS));
+        check(pool.awaitTermination(LONG_DELAY_MS, MILLISECONDS));
    }
 
     class Stage implements Callable<Integer> {
--- a/jdk/test/java/util/concurrent/ConcurrentQueues/GCRetention.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/ConcurrentQueues/GCRetention.java	Mon Mar 07 09:34:29 2016 +0100
@@ -38,10 +38,14 @@
  * @run main GCRetention 12345
  */
 
+import static java.util.concurrent.TimeUnit.SECONDS;
+
+import java.lang.ref.WeakReference;
 import java.util.concurrent.ArrayBlockingQueue;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentLinkedDeque;
 import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.LinkedBlockingDeque;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.LinkedTransferQueue;
@@ -59,6 +63,25 @@
     // Suitable for benchmarking.  Overridden by args[0] for testing.
     int count = 1024 * 1024;
 
+    /** No guarantees, but effective in practice. */
+    static void forceFullGc() {
+        CountDownLatch finalizeDone = new CountDownLatch(1);
+        WeakReference<?> ref = new WeakReference<Object>(new Object() {
+            protected void finalize() { finalizeDone.countDown(); }});
+        try {
+            for (int i = 0; i < 10; i++) {
+                System.gc();
+                if (finalizeDone.await(1L, SECONDS) && ref.get() == null) {
+                    System.runFinalization(); // try to pick up stragglers
+                    return;
+                }
+            }
+        } catch (InterruptedException unexpected) {
+            throw new AssertionError("unexpected InterruptedException");
+        }
+        throw new AssertionError("failed to do a \"full\" gc");
+    }
+
     final Map<String,String> results = new ConcurrentHashMap<String,String>();
 
     Collection<Queue<Boolean>> queues() {
@@ -117,8 +140,8 @@
         long t0 = System.nanoTime();
         for (int i = 0; i < count; i++)
             check(q.add(Boolean.TRUE));
-        System.gc();
-        System.gc();
+        forceFullGc();
+        // forceFullGc();
         Boolean x;
         while ((x = q.poll()) != null)
             equal(x, Boolean.TRUE);
--- a/jdk/test/java/util/concurrent/CyclicBarrier/Basic.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/CyclicBarrier/Basic.java	Mon Mar 07 09:34:29 2016 +0100
@@ -25,11 +25,11 @@
  * @test
  * @bug 6253848 6366811
  * @summary Basic tests for CyclicBarrier
+ * @library /lib/testlibrary/
  * @author Martin Buchholz, David Holmes
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static java.util.concurrent.TimeUnit.SECONDS;
 
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -39,8 +39,10 @@
 import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicInteger;
+import jdk.testlibrary.Utils;
 
 public class Basic {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
 
     private static void checkBroken(final CyclicBarrier barrier) {
         check(barrier.isBroken());
@@ -77,7 +79,7 @@
     private static final CyclicBarrier atTheStartingGate = new CyclicBarrier(3);
 
     private static void toTheStartingGate() {
-        try { atTheStartingGate.await(10, SECONDS); pass(); }
+        try { atTheStartingGate.await(LONG_DELAY_MS, MILLISECONDS); pass(); }
         catch (Throwable t) {
             unexpected(t);
             reset(atTheStartingGate);
@@ -314,13 +316,13 @@
             Throwable throwable() { return this.throwable; }
             boolean interruptBit() { return this.interrupted; }
             void realRun() throws Throwable {
-                startingGate.await(10, SECONDS);
+                startingGate.await(LONG_DELAY_MS, MILLISECONDS);
                 try {
-                    if (timed) barrier.await(10, SECONDS);
+                    if (timed) barrier.await(LONG_DELAY_MS, MILLISECONDS);
                     else barrier.await(); }
                 catch (Throwable throwable) { this.throwable = throwable; }
 
-                try { doneSignal.await(10, SECONDS); }
+                try { doneSignal.await(LONG_DELAY_MS, MILLISECONDS); }
                 catch (InterruptedException e) { interrupted = true; }
             }
         }
@@ -354,7 +356,7 @@
                 waiter.start();
                 waiters.add(waiter);
             }
-            startingGate.await(10, SECONDS);
+            startingGate.await(LONG_DELAY_MS, MILLISECONDS);
             while (barrier.getNumberWaiting() < N) Thread.yield();
             barrier.await();
             doneSignal.countDown();
@@ -383,7 +385,7 @@
                 waiter.start();
                 waiters.add(waiter);
             }
-            startingGate.await(10, SECONDS);
+            startingGate.await(LONG_DELAY_MS, MILLISECONDS);
             while (barrier.getNumberWaiting() < N) Thread.yield();
             for (int i = 0; i < N/2; i++)
                 waiters.get(i).interrupt();
--- a/jdk/test/java/util/concurrent/DelayQueue/Stress.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/DelayQueue/Stress.java	Mon Mar 07 09:34:29 2016 +0100
@@ -26,6 +26,7 @@
 
 import java.util.concurrent.DelayQueue;
 import java.util.concurrent.Delayed;
+import java.util.concurrent.TimeUnit;
 
 /**
  * This is not a regression test, but a stress benchmark test for
--- a/jdk/test/java/util/concurrent/Exchanger/ExchangeLoops.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/Exchanger/ExchangeLoops.java	Mon Mar 07 09:34:29 2016 +0100
@@ -34,18 +34,20 @@
 /*
  * @test
  * @bug 4486658
- * @run main/timeout=720 ExchangeLoops
  * @summary checks to make sure a pipeline of exchangers passes data.
+ * @library /lib/testlibrary/
  */
 
-import static java.util.concurrent.TimeUnit.SECONDS;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
 
 import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.Exchanger;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
+import jdk.testlibrary.Utils;
 
 public class ExchangeLoops {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
     static final ExecutorService pool = Executors.newCachedThreadPool();
     static boolean print = false;
 
@@ -56,14 +58,14 @@
 
     public static void main(String[] args) throws Exception {
         int maxStages = 5;
-        int iters = 10000;
+        int iters = 2000;
 
         if (args.length > 0)
             maxStages = Integer.parseInt(args[0]);
 
         print = false;
         System.out.println("Warmup...");
-        oneRun(2, 100000);
+        oneRun(2, iters);
         print = true;
 
         for (int i = 2; i <= maxStages; i += (i+1) >>> 1) {
@@ -71,7 +73,7 @@
             oneRun(i, iters);
         }
         pool.shutdown();
-        if (! pool.awaitTermination(60L, SECONDS))
+        if (! pool.awaitTermination(LONG_DELAY_MS, MILLISECONDS))
             throw new Error();
    }
 
--- a/jdk/test/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java	Mon Mar 07 09:34:29 2016 +0100
@@ -34,19 +34,21 @@
 /*
  * @test
  * @bug 4965960
- * @run main/timeout=3600 ExecutorCompletionServiceLoops
- * @summary  Exercise ExecutorCompletionServiceLoops
+ * @summary  Exercise ExecutorCompletionService
+ * @library /lib/testlibrary/
  */
 
-import static java.util.concurrent.TimeUnit.SECONDS;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
 
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorCompletionService;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
+import jdk.testlibrary.Utils;
 
 public class ExecutorCompletionServiceLoops {
-    static final int POOLSIZE = 100;
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
+    static final int POOLSIZE = 10;
     static final ExecutorService pool =
         Executors.newFixedThreadPool(POOLSIZE);
     static final ExecutorCompletionService<Integer> ecs =
@@ -55,23 +57,21 @@
 
     public static void main(String[] args) throws Exception {
         int max = 8;
-        int base = 10000;
+        int base = 2000;
 
         if (args.length > 0)
             max = Integer.parseInt(args[0]);
 
         System.out.println("Warmup...");
         oneTest(base);
-        Thread.sleep(100);
         print = true;
 
         for (int i = 1; i <= max; i += (i+1) >>> 1) {
             System.out.print("n: " + i * base);
             oneTest(i * base);
-            Thread.sleep(100);
         }
         pool.shutdown();
-        if (! pool.awaitTermination(60L, SECONDS))
+        if (! pool.awaitTermination(LONG_DELAY_MS, MILLISECONDS))
             throw new Error();
    }
 
--- a/jdk/test/java/util/concurrent/Executors/AutoShutdown.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/Executors/AutoShutdown.java	Mon Mar 07 09:34:29 2016 +0100
@@ -24,26 +24,32 @@
 /*
  * @test
  * @bug 6399443
+ * @summary Check for auto-shutdown and gc of singleThreadExecutors
+ * @library /lib/testlibrary/
  * @run main/othervm/timeout=1000 AutoShutdown
- * @summary Check for auto-shutdown and gc of singleThreadExecutors
  * @author Martin Buchholz
  */
 
+import static java.util.concurrent.Executors.defaultThreadFactory;
+import static java.util.concurrent.Executors.newFixedThreadPool;
+import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
+import static java.util.concurrent.Executors.newSingleThreadExecutor;
+
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+
 import java.lang.ref.WeakReference;
 import java.util.Arrays;
 import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Executor;
 import java.util.concurrent.TimeUnit;
-import static java.util.concurrent.Executors.defaultThreadFactory;
-import static java.util.concurrent.Executors.newFixedThreadPool;
-import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
-import static java.util.concurrent.Executors.newSingleThreadExecutor;
+import jdk.testlibrary.Utils;
 
 public class AutoShutdown {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
 
     static void await(CountDownLatch latch) throws InterruptedException {
-        if (!latch.await(100L, TimeUnit.SECONDS))
+        if (!latch.await(LONG_DELAY_MS, MILLISECONDS))
             throw new AssertionError("timed out waiting for latch");
     }
 
--- a/jdk/test/java/util/concurrent/FutureTask/CancelledFutureLoops.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/FutureTask/CancelledFutureLoops.java	Mon Mar 07 09:34:29 2016 +0100
@@ -34,13 +34,14 @@
 /*
  * @test
  * @bug 4486658
- * @run main/timeout=2000 CancelledFutureLoops
  * @summary Checks for responsiveness of futures to cancellation.
  * Runs under the assumption that ITERS computations require more than
  * TIMEOUT msecs to complete.
+ * @library /lib/testlibrary/
+ * @run main/timeout=2000 CancelledFutureLoops
  */
 
-import static java.util.concurrent.TimeUnit.SECONDS;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
 
 import java.util.SplittableRandom;
 import java.util.concurrent.BrokenBarrierException;
@@ -51,8 +52,10 @@
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 import java.util.concurrent.locks.ReentrantLock;
+import jdk.testlibrary.Utils;
 
 public final class CancelledFutureLoops {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
     static final ExecutorService pool = Executors.newCachedThreadPool();
     static final SplittableRandom rnd = new SplittableRandom();
     static boolean print = false;
@@ -80,7 +83,7 @@
             Thread.sleep(TIMEOUT);
         }
         pool.shutdown();
-        if (! pool.awaitTermination(60L, SECONDS))
+        if (! pool.awaitTermination(6 * LONG_DELAY_MS, MILLISECONDS))
             throw new Error();
     }
 
--- a/jdk/test/java/util/concurrent/FutureTask/DoneMeansDone.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/FutureTask/DoneMeansDone.java	Mon Mar 07 09:34:29 2016 +0100
@@ -36,8 +36,11 @@
  * @bug 8073704
  * @summary Checks that once isDone() returns true,
  * get() never throws InterruptedException or TimeoutException
+ * @library /lib/testlibrary/
  */
 
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+
 import java.util.ArrayList;
 import java.util.concurrent.Callable;
 import java.util.concurrent.CountDownLatch;
@@ -49,8 +52,11 @@
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicReference;
+import jdk.testlibrary.Utils;
 
 public class DoneMeansDone {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
+
     public static void main(String[] args) throws Throwable {
         final int iters = 1000;
         final int nThreads = 2;
@@ -92,7 +98,7 @@
         }
         done.set(true);
         pool.shutdown();
-        if (!pool.awaitTermination(10L, TimeUnit.SECONDS))
+        if (!pool.awaitTermination(LONG_DELAY_MS, MILLISECONDS))
             throw new AssertionError();
         for (Future<?> future : futures)
             future.get();
--- a/jdk/test/java/util/concurrent/ScheduledThreadPoolExecutor/DelayOverflow.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/ScheduledThreadPoolExecutor/DelayOverflow.java	Mon Mar 07 09:34:29 2016 +0100
@@ -35,14 +35,21 @@
  * @test
  * @bug 6725789
  * @summary Check for long overflow in task time comparison.
+ * @library /lib/testlibrary/
  */
 
+import static java.util.concurrent.TimeUnit.DAYS;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static java.util.concurrent.TimeUnit.NANOSECONDS;
+
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
+import jdk.testlibrary.Utils;
 
 public class DelayOverflow {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
+
     static void waitForNanoTimeTick() {
         for (long t0 = System.nanoTime(); t0 == System.nanoTime(); )
             ;
@@ -52,16 +59,16 @@
                      Runnable r, int how) {
         switch (how) {
         case 0:
-            pool.schedule(r, 0, TimeUnit.MILLISECONDS);
+            pool.schedule(r, 0, MILLISECONDS);
             break;
         case 1:
-            pool.schedule(Executors.callable(r), 0, TimeUnit.DAYS);
+            pool.schedule(Executors.callable(r), 0, DAYS);
             break;
         case 2:
-            pool.scheduleWithFixedDelay(r, 0, 1000, TimeUnit.NANOSECONDS);
+            pool.scheduleWithFixedDelay(r, 0, 1000, NANOSECONDS);
             break;
         case 3:
-            pool.scheduleAtFixedRate(r, 0, 1000, TimeUnit.MILLISECONDS);
+            pool.scheduleAtFixedRate(r, 0, 1000, MILLISECONDS);
             break;
         default:
             fail(String.valueOf(how));
@@ -72,16 +79,16 @@
                                 Runnable r, int how) {
         switch (how) {
         case 0:
-            pool.schedule(r, Long.MAX_VALUE, TimeUnit.MILLISECONDS);
+            pool.schedule(r, Long.MAX_VALUE, MILLISECONDS);
             break;
         case 1:
-            pool.schedule(Executors.callable(r), Long.MAX_VALUE, TimeUnit.DAYS);
+            pool.schedule(Executors.callable(r), Long.MAX_VALUE, DAYS);
             break;
         case 2:
-            pool.scheduleWithFixedDelay(r, Long.MAX_VALUE, 1000, TimeUnit.NANOSECONDS);
+            pool.scheduleWithFixedDelay(r, Long.MAX_VALUE, 1000, NANOSECONDS);
             break;
         case 3:
-            pool.scheduleAtFixedRate(r, Long.MAX_VALUE, 1000, TimeUnit.MILLISECONDS);
+            pool.scheduleAtFixedRate(r, Long.MAX_VALUE, 1000, MILLISECONDS);
             break;
         default:
             fail(String.valueOf(how));
@@ -114,14 +121,14 @@
                                 proceedLatch.await();
                             } catch (Throwable t) { unexpected(t); }
                         }};
-                pool.schedule(keepPoolBusy, 0, TimeUnit.SECONDS);
+                pool.schedule(keepPoolBusy, 0, DAYS);
                 busyLatch.await();
                 scheduleNow(pool, notifier, nowHow);
                 waitForNanoTimeTick();
                 scheduleAtTheEndOfTime(pool, neverRuns, thenHow);
                 proceedLatch.countDown();
 
-                check(runLatch.await(10L, TimeUnit.SECONDS));
+                check(runLatch.await(LONG_DELAY_MS, MILLISECONDS));
                 equal(runLatch.getCount(), 0L);
 
                 pool.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
@@ -142,10 +149,9 @@
                         } catch (Throwable t) { unexpected(t); }
                     }};
             pool.scheduleWithFixedDelay(scheduleNowScheduler,
-                                        0, Long.MAX_VALUE,
-                                        TimeUnit.NANOSECONDS);
+                                        0, Long.MAX_VALUE, NANOSECONDS);
 
-            check(runLatch.await(10L, TimeUnit.SECONDS));
+            check(runLatch.await(LONG_DELAY_MS, MILLISECONDS));
             equal(runLatch.getCount(), 0L);
 
             pool.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
--- a/jdk/test/java/util/concurrent/ScheduledThreadPoolExecutor/GCRetention.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/ScheduledThreadPoolExecutor/GCRetention.java	Mon Mar 07 09:34:29 2016 +0100
@@ -34,8 +34,11 @@
 /*
  * @test
  * @summary Ensure that waiting pool threads don't retain refs to tasks.
+ * @library /lib/testlibrary/
  */
 
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+
 import java.lang.ref.WeakReference;
 import java.util.concurrent.Delayed;
 import java.util.concurrent.ExecutionException;
@@ -44,8 +47,11 @@
 import java.util.concurrent.ScheduledThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
+import jdk.testlibrary.Utils;
 
 public class GCRetention {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
+
     /**
      * A custom thread pool with a custom RunnableScheduledFuture, for the
      * sole purpose of ensuring that the task retains a strong reference to
@@ -116,7 +122,7 @@
             Thread.sleep(10);
         }
         pool.shutdown();
-        pool.awaitTermination(10L, TimeUnit.SECONDS);
+        pool.awaitTermination(LONG_DELAY_MS, MILLISECONDS);
         if (cleared < size)
             throw new Error(String.format
                             ("references to %d/%d tasks retained (\"leaked\")",
--- a/jdk/test/java/util/concurrent/ScheduledThreadPoolExecutor/ZeroCorePoolSize.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/ScheduledThreadPoolExecutor/ZeroCorePoolSize.java	Mon Mar 07 09:34:29 2016 +0100
@@ -26,16 +26,21 @@
  * @bug 7091003
  * @summary ScheduledExecutorService never executes Runnable
  *          with corePoolSize of zero
+ * @library /lib/testlibrary/
  * @author Chris Hegarty
  */
 
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+
 import java.util.concurrent.ScheduledThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
+import jdk.testlibrary.Utils;
 
 /**
  * Verify that tasks can be run even with a core pool size of 0.
  */
 public class ZeroCorePoolSize {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
 
     volatile boolean taskRun;
 
@@ -49,10 +54,10 @@
         };
         check(pool.getCorePoolSize() == 0);
 
-        pool.schedule(task, 1, TimeUnit.SECONDS);
+        pool.schedule(task, 12L, MILLISECONDS);
 
         pool.shutdown();
-        check(pool.awaitTermination(20L, TimeUnit.SECONDS));
+        check(pool.awaitTermination(LONG_DELAY_MS, MILLISECONDS));
         check(pool.getCorePoolSize() == 0);
         check(taskRun);
     }
--- a/jdk/test/java/util/concurrent/ScheduledThreadPoolExecutor/ZeroCoreThreads.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/ScheduledThreadPoolExecutor/ZeroCoreThreads.java	Mon Mar 07 09:34:29 2016 +0100
@@ -35,9 +35,11 @@
  * @test
  * @bug 8022642 8065320 8129861
  * @summary Ensure relative sanity when zero core threads
+ * @library /lib/testlibrary/
  */
 
 import static java.util.concurrent.TimeUnit.HOURS;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
 import static java.util.concurrent.TimeUnit.SECONDS;
 
 import java.lang.reflect.Field;
@@ -45,8 +47,28 @@
 import java.util.concurrent.ScheduledThreadPoolExecutor;
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.ReentrantLock;
+import java.util.function.BooleanSupplier;
+import jdk.testlibrary.Utils;
 
 public class ZeroCoreThreads {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
+
+    static long millisElapsedSince(long startTime) {
+        return (System.nanoTime() - startTime) / (1000L * 1000L);
+    }
+
+    static void spinWaitUntil(BooleanSupplier predicate, long timeoutMillis) {
+        long startTime = -1L;
+        while (!predicate.getAsBoolean()) {
+            if (startTime == -1L)
+                startTime = System.nanoTime();
+            else if (millisElapsedSince(startTime) > timeoutMillis)
+                throw new AssertionError(
+                    String.format("timed out after %s ms", timeoutMillis));
+            Thread.yield();
+        }
+    }
+
     static boolean hasWaiters(ReentrantLock lock, Condition condition) {
         lock.lock();
         try {
@@ -56,6 +78,11 @@
         }
     }
 
+    static void awaitHasWaiters(ReentrantLock lock, Condition condition,
+                                long timeoutMillis) {
+        spinWaitUntil(() -> hasWaiters(lock, condition), timeoutMillis);
+    }
+
     static <T> T getField(Object x, String fieldName) {
         try {
             Field field = x.getClass().getDeclaredField(fieldName);
@@ -72,7 +99,7 @@
             test(p);
         } finally {
             p.shutdownNow();
-            check(p.awaitTermination(10L, SECONDS));
+            check(p.awaitTermination(LONG_DELAY_MS, MILLISECONDS));
         }
     }
 
@@ -89,13 +116,7 @@
         equal(0L, p.getCompletedTaskCount());
         p.schedule(dummy, 1L, HOURS);
         // Ensure one pool thread actually waits in timed queue poll
-        long t0 = System.nanoTime();
-        while (!hasWaiters(lock, available)) {
-            if (System.nanoTime() - t0 > SECONDS.toNanos(10L))
-                throw new AssertionError
-                    ("timed out waiting for a waiter to show up");
-            Thread.yield();
-        }
+        awaitHasWaiters(lock, available, LONG_DELAY_MS);
         equal(1, p.getPoolSize());
         equal(1, p.getLargestPoolSize());
         equal(1L, p.getTaskCount());
--- a/jdk/test/java/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java	Mon Mar 07 09:34:29 2016 +0100
@@ -25,17 +25,22 @@
  * @test
  * @bug 6233235 6268386
  * @summary Test allowsCoreThreadTimeOut
+ * @library /lib/testlibrary/
  * @author Martin Buchholz
  */
 
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+
 import java.util.concurrent.ArrayBlockingQueue;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
+import jdk.testlibrary.Utils;
 
 public class CoreThreadTimeOut {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
 
     static class IdentifiableThreadFactory implements ThreadFactory {
         static ThreadFactory defaultThreadFactory
@@ -60,8 +65,8 @@
         return count;
     }
 
-    static long millisElapsedSince(long t0) {
-        return (System.nanoTime() - t0) / (1000L * 1000L);
+    static long millisElapsedSince(long startTime) {
+        return (System.nanoTime() - startTime) / (1000L * 1000L);
     }
 
     void test(String[] args) throws Throwable {
@@ -89,7 +94,7 @@
         equal(countExecutorThreads(), 0);
         tpe.shutdown();
         check(tpe.allowsCoreThreadTimeOut());
-        check(tpe.awaitTermination(10L, TimeUnit.SECONDS));
+        check(tpe.awaitTermination(LONG_DELAY_MS, MILLISECONDS));
 
         System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
         if (failed > 0) throw new Exception("Some tests failed");
--- a/jdk/test/java/util/concurrent/ThreadPoolExecutor/Custom.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/ThreadPoolExecutor/Custom.java	Mon Mar 07 09:34:29 2016 +0100
@@ -25,9 +25,12 @@
  * @test
  * @bug 6277663
  * @summary Test TPE extensibility framework
+ * @library /lib/testlibrary/
  * @author Martin Buchholz
  */
 
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+
 import java.util.concurrent.ArrayBlockingQueue;
 import java.util.concurrent.Callable;
 import java.util.concurrent.FutureTask;
@@ -37,8 +40,11 @@
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.BooleanSupplier;
+import jdk.testlibrary.Utils;
 
 public class Custom {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
     static volatile int passed = 0, failed = 0;
     static void pass() { passed++; }
     static void fail() { failed++; Thread.dumpStack(); }
@@ -97,6 +103,22 @@
 
     private static final int threadCount = 10;
 
+    static long millisElapsedSince(long startTime) {
+        return (System.nanoTime() - startTime) / (1000L * 1000L);
+    }
+
+    static void spinWaitUntil(BooleanSupplier predicate, long timeoutMillis) {
+        long startTime = -1L;
+        while (!predicate.getAsBoolean()) {
+            if (startTime == -1L)
+                startTime = System.nanoTime();
+            else if (millisElapsedSince(startTime) > timeoutMillis)
+                throw new AssertionError(
+                    String.format("timed out after %s ms", timeoutMillis));
+            Thread.yield();
+        }
+    }
+
     public static void main(String[] args) throws Throwable {
         CustomTPE tpe = new CustomTPE();
         equal(tpe.getCorePoolSize(), threadCount);
@@ -106,9 +128,8 @@
         equal(countExecutorThreads(), threadCount);
         equal(CustomTask.births.get(), threadCount);
         tpe.shutdown();
-        tpe.awaitTermination(120L, TimeUnit.SECONDS);
-        Thread.sleep(1000);
-        equal(countExecutorThreads(), 0);
+        tpe.awaitTermination(LONG_DELAY_MS, MILLISECONDS);
+        spinWaitUntil(() -> countExecutorThreads() == 0, LONG_DELAY_MS);
 
         CustomSTPE stpe = new CustomSTPE();
         for (int i = 0; i < threadCount; i++)
@@ -116,9 +137,8 @@
         equal(CustomSTPE.decorations.get(), threadCount);
         equal(countExecutorThreads(), threadCount);
         stpe.shutdown();
-        stpe.awaitTermination(120L, TimeUnit.SECONDS);
-        Thread.sleep(1000);
-        equal(countExecutorThreads(), 0);
+        stpe.awaitTermination(LONG_DELAY_MS, MILLISECONDS);
+        spinWaitUntil(() -> countExecutorThreads() == 0, LONG_DELAY_MS);
 
         System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
         if (failed > 0) throw new Exception("Some tests failed");
--- a/jdk/test/java/util/concurrent/ThreadPoolExecutor/FlakyThreadFactory.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/ThreadPoolExecutor/FlakyThreadFactory.java	Mon Mar 07 09:34:29 2016 +0100
@@ -35,14 +35,20 @@
 /*
  * @test
  * @summary Should be able to shutdown a pool when worker creation failed.
+ * @library /lib/testlibrary/
  */
 
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
+import jdk.testlibrary.Utils;
 
 public class FlakyThreadFactory {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
+
     void test(String[] args) throws Throwable {
         test(NullPointerException.class,
              new ThreadFactory() {
@@ -89,7 +95,7 @@
             check(exceptionClass.isInstance(t));
         }
         pool.shutdown();
-        check(pool.awaitTermination(10L, TimeUnit.SECONDS));
+        check(pool.awaitTermination(LONG_DELAY_MS, MILLISECONDS));
     }
 
     //--------------------- Infrastructure ---------------------------
--- a/jdk/test/java/util/concurrent/ThreadPoolExecutor/SelfInterrupt.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/ThreadPoolExecutor/SelfInterrupt.java	Mon Mar 07 09:34:29 2016 +0100
@@ -25,14 +25,20 @@
  * @test
  * @bug 6576792
  * @summary non-idle worker threads should not be interrupted
+ * @library /lib/testlibrary/
  */
 
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
+import jdk.testlibrary.Utils;
 
 public class SelfInterrupt {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
+
     void test(String[] args) throws Throwable {
         final int n = 100;
         final ThreadPoolExecutor pool =
@@ -58,7 +64,7 @@
                 } catch (Throwable t) { unexpected(t); }}});
         finishLine.await();
         pool.shutdown();
-        check(pool.awaitTermination(1000L, TimeUnit.SECONDS));
+        check(pool.awaitTermination(LONG_DELAY_MS, MILLISECONDS));
     }
 
     //--------------------- Infrastructure ---------------------------
--- a/jdk/test/java/util/concurrent/ThreadPoolExecutor/ThreadRestarts.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/ThreadPoolExecutor/ThreadRestarts.java	Mon Mar 07 09:34:29 2016 +0100
@@ -36,6 +36,7 @@
  * @test
  * @summary Only one thread should be created when a thread needs to
  * be kept alive to service a delayed task waiting in the queue.
+ * @library /lib/testlibrary/
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -44,8 +45,12 @@
 import java.util.concurrent.ScheduledThreadPoolExecutor;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.atomic.AtomicLong;
+import jdk.testlibrary.Utils;
 
 public class ThreadRestarts {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
+    static final long FAR_FUTURE_MS = 10 * LONG_DELAY_MS;
+
     public static void main(String[] args) throws Exception {
         test(false);
         test(true);
@@ -56,14 +61,15 @@
         ScheduledThreadPoolExecutor stpe
             = new ScheduledThreadPoolExecutor(10, ctf);
         try {
+            // schedule a dummy task in the "far future"
             Runnable nop = new Runnable() { public void run() {}};
-            stpe.schedule(nop, 10*1000L, MILLISECONDS);
+            stpe.schedule(nop, FAR_FUTURE_MS, MILLISECONDS);
             stpe.setKeepAliveTime(1L, MILLISECONDS);
             stpe.allowCoreThreadTimeOut(allowTimeout);
-            MILLISECONDS.sleep(100L);
+            MILLISECONDS.sleep(12L);
         } finally {
             stpe.shutdownNow();
-            if (!stpe.awaitTermination(60L, SECONDS))
+            if (!stpe.awaitTermination(LONG_DELAY_MS, MILLISECONDS))
                 throw new AssertionError("timed out");
         }
         if (ctf.count.get() > 1)
@@ -76,8 +82,9 @@
         final AtomicLong count = new AtomicLong(0L);
 
         public Thread newThread(Runnable r) {
+            count.getAndIncrement();
             Thread t = new Thread(r);
-            count.getAndIncrement();
+            t.setDaemon(true);
             return t;
         }
     }
--- a/jdk/test/java/util/concurrent/ThreadPoolExecutor/TimeOutShrink.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/ThreadPoolExecutor/TimeOutShrink.java	Mon Mar 07 09:34:29 2016 +0100
@@ -25,15 +25,22 @@
  * @test
  * @bug 6458662
  * @summary poolSize might shrink below corePoolSize after timeout
+ * @library /lib/testlibrary/
  * @author Martin Buchholz
  */
 
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+
 import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
+import jdk.testlibrary.Utils;
 
 public class TimeOutShrink {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
+    static final long KEEPALIVE_MS = 12L;
+
     static void checkPoolSizes(ThreadPoolExecutor pool,
                                int size, int core, int max) {
         equal(pool.getPoolSize(), size);
@@ -45,7 +52,8 @@
         final int n = 4;
         final CyclicBarrier barrier = new CyclicBarrier(2*n+1);
         final ThreadPoolExecutor pool
-            = new ThreadPoolExecutor(n, 2*n, 1L, TimeUnit.SECONDS,
+            = new ThreadPoolExecutor(n, 2*n,
+                                     KEEPALIVE_MS, MILLISECONDS,
                                      new SynchronousQueue<Runnable>());
         final Runnable r = new Runnable() { public void run() {
             try {
@@ -58,12 +66,16 @@
         barrier.await();
         checkPoolSizes(pool, 2*n, n, 2*n);
         barrier.await();
-        while (pool.getPoolSize() > n)
-            Thread.sleep(100);
-        Thread.sleep(100);
+        long nap = KEEPALIVE_MS + (KEEPALIVE_MS >> 2);
+        for (long sleepyTime = 0L; pool.getPoolSize() > n; ) {
+            check((sleepyTime += nap) <= LONG_DELAY_MS);
+            Thread.sleep(nap);
+        }
+        checkPoolSizes(pool, n, n, 2*n);
+        Thread.sleep(nap);
         checkPoolSizes(pool, n, n, 2*n);
         pool.shutdown();
-        check(pool.awaitTermination(60L, TimeUnit.SECONDS));
+        check(pool.awaitTermination(LONG_DELAY_MS, MILLISECONDS));
     }
 
     //--------------------- Infrastructure ---------------------------
--- a/jdk/test/java/util/concurrent/locks/Lock/CheckedLockLoops.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/locks/Lock/CheckedLockLoops.java	Mon Mar 07 09:34:29 2016 +0100
@@ -35,9 +35,10 @@
  * @test
  * @bug 4486658
  * @summary basic safety and liveness of ReentrantLocks, and other locks based on them
+ * @library /lib/testlibrary/
  */
 
-import static java.util.concurrent.TimeUnit.SECONDS;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
 
 import java.util.SplittableRandom;
 import java.util.concurrent.CyclicBarrier;
@@ -47,8 +48,10 @@
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
+import jdk.testlibrary.Utils;
 
 public final class CheckedLockLoops {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
     static ExecutorService pool;
     static final SplittableRandom rnd = new SplittableRandom();
 
@@ -63,7 +66,7 @@
             oneTest(i, iters / i);
         }
         pool.shutdown();
-        if (! pool.awaitTermination(10L, SECONDS))
+        if (! pool.awaitTermination(LONG_DELAY_MS, MILLISECONDS))
             throw new Error();
         pool = null;
     }
--- a/jdk/test/java/util/concurrent/locks/Lock/FlakyMutex.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/locks/Lock/FlakyMutex.java	Mon Mar 07 09:34:29 2016 +0100
@@ -25,9 +25,12 @@
  * @test
  * @bug 6503247 6574123
  * @summary Test resilience to tryAcquire methods that throw
+ * @library /lib/testlibrary/
  * @author Martin Buchholz
  */
 
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+
 import java.util.Random;
 import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.ExecutorService;
@@ -36,6 +39,7 @@
 import java.util.concurrent.locks.AbstractQueuedLongSynchronizer;
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.Lock;
+import jdk.testlibrary.Utils;
 
 /**
  * This uses a variant of the standard Mutex demo, except with a
@@ -44,6 +48,7 @@
  */
 @SuppressWarnings("serial")
 public class FlakyMutex implements Lock {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
     static class MyError extends Error {}
     static class MyException extends Exception {}
     static class MyRuntimeException extends RuntimeException {}
@@ -91,7 +96,7 @@
                 } catch (Throwable t) { unexpected(t); }}});}
         barrier.await();
         es.shutdown();
-        check(es.awaitTermination(30L, TimeUnit.SECONDS));
+        check(es.awaitTermination(LONG_DELAY_MS, MILLISECONDS));
     }
 
     private static class FlakySync extends AbstractQueuedLongSynchronizer {
--- a/jdk/test/java/util/concurrent/locks/Lock/TimedAcquireLeak.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/locks/Lock/TimedAcquireLeak.java	Mon Mar 07 09:34:29 2016 +0100
@@ -25,9 +25,11 @@
  * @test
  * @bug 6460501 6236036 6500694 6490770
  * @summary Repeated failed timed waits shouldn't leak memory
+ * @library /lib/testlibrary/
  * @author Martin Buchholz
  */
 
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
 import static java.util.concurrent.TimeUnit.NANOSECONDS;
 import static java.util.concurrent.TimeUnit.SECONDS;
 
@@ -54,8 +56,11 @@
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import jdk.testlibrary.Utils;
 
 public class TimedAcquireLeak {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
+
     static String javahome() {
         String jh = System.getProperty("java.home");
         return (jh.endsWith("jre")) ? jh.substring(0, jh.length() - 4) : jh;
@@ -191,7 +196,7 @@
 
         final String[] jobCmd = {
             java, "-Xmx8m", "-XX:+UsePerfData",
-            "-classpath", System.getProperty("test.classes", "."),
+            "-classpath", System.getProperty("test.class.path"),
             childClassName, uniqueID
         };
         final Process p = new ProcessBuilder(jobCmd).start();
@@ -219,7 +224,7 @@
         check(Math.abs(n1 - n0) < 10);
         check(n1 < 25);
         drainers.shutdown();
-        if (!drainers.awaitTermination(10L, SECONDS)) {
+        if (!drainers.awaitTermination(LONG_DELAY_MS, MILLISECONDS)) {
             drainers.shutdownNow(); // last resort
             throw new AssertionError("thread pool did not terminate");
         }
--- a/jdk/test/java/util/concurrent/locks/LockSupport/ParkLoops.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/locks/LockSupport/ParkLoops.java	Mon Mar 07 09:34:29 2016 +0100
@@ -35,11 +35,12 @@
  * @test
  * @bug 8074773
  * @summary Stress test looks for lost unparks
+ * @library /lib/testlibrary/
  * @modules java.management
- * @run main/timeout=1200 ParkLoops
  */
 
-import static java.util.concurrent.TimeUnit.SECONDS;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+
 import java.lang.management.ManagementFactory;
 import java.lang.management.ThreadInfo;
 import java.util.SplittableRandom;
@@ -49,13 +50,12 @@
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.atomic.AtomicReferenceArray;
 import java.util.concurrent.locks.LockSupport;
+import jdk.testlibrary.Utils;
 
 public final class ParkLoops {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
     static final int THREADS = 4;
-    // static final int ITERS = 2_000_000;
-    // static final int TIMEOUT = 3500;  // in seconds
-    static final int ITERS = 100_000;
-    static final int TIMEOUT = 1000;  // in seconds
+    static final int ITERS = 30_000;
 
     static class Parker implements Runnable {
         static {
@@ -130,13 +130,13 @@
             pool.submit(unparker);
         }
         try {
-          if (!done.await(TIMEOUT, SECONDS)) {
+          if (!done.await(LONG_DELAY_MS, MILLISECONDS)) {
             dumpAllStacks();
             throw new AssertionError("lost unpark");
           }
         } finally {
           pool.shutdown();
-          pool.awaitTermination(10L, SECONDS);
+          pool.awaitTermination(LONG_DELAY_MS, MILLISECONDS);
         }
     }
 
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java	Mon Mar 07 09:34:29 2016 +0100
@@ -34,25 +34,27 @@
 /*
  * @test
  * @bug 4486658
- * @run main/timeout=15000 LockOncePerThreadLoops
  * @summary Checks for missed signals by locking and unlocking each of an array of locks once per thread
+ * @library /lib/testlibrary/
  */
 
-import static java.util.concurrent.TimeUnit.SECONDS;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
 
 import java.util.SplittableRandom;
 import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.locks.ReentrantLock;
+import jdk.testlibrary.Utils;
 
 public final class LockOncePerThreadLoops {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
     static final ExecutorService pool = Executors.newCachedThreadPool();
     static final SplittableRandom rnd = new SplittableRandom();
     static boolean print = false;
-    static int nlocks = 50000;
-    static int nthreads = 100;
-    static int replications = 5;
+    static int nlocks = 20_000;
+    static int nthreads = 20;
+    static int replications = 3;
 
     public static void main(String[] args) throws Exception {
         if (args.length > 0)
@@ -66,10 +68,9 @@
         for (int i = 0; i < replications; ++i) {
             System.out.print("Iteration: " + i);
             new ReentrantLockLoop().test();
-            Thread.sleep(100);
         }
         pool.shutdown();
-        if (! pool.awaitTermination(60L, SECONDS))
+        if (! pool.awaitTermination(LONG_DELAY_MS, MILLISECONDS))
             throw new Error();
     }
 
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java	Mon Mar 07 09:34:29 2016 +0100
@@ -34,23 +34,25 @@
 /*
  * @test
  * @bug 4486658
- * @run main/timeout=4500 SimpleReentrantLockLoops
  * @summary multiple threads using a single lock
+ * @library /lib/testlibrary/
  */
 
-import static java.util.concurrent.TimeUnit.SECONDS;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
 
 import java.util.SplittableRandom;
 import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.locks.ReentrantLock;
+import jdk.testlibrary.Utils;
 
 public final class SimpleReentrantLockLoops {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
     static final ExecutorService pool = Executors.newCachedThreadPool();
     static final SplittableRandom rnd = new SplittableRandom();
     static boolean print = false;
-    static int iters = 1000000;
+    static int iters = 100_000;
 
     public static void main(String[] args) throws Exception {
         int maxThreads = 5;
@@ -66,11 +68,10 @@
             while (n-- > 0) {
                 System.out.print("Threads: " + i);
                 new ReentrantLockLoop(i).test();
-                Thread.sleep(100);
             }
         }
         pool.shutdown();
-        if (! pool.awaitTermination(60L, SECONDS))
+        if (! pool.awaitTermination(LONG_DELAY_MS, MILLISECONDS))
             throw new Error();
     }
 
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java	Mon Mar 07 09:34:29 2016 +0100
@@ -34,18 +34,22 @@
 /*
  * @test
  * @bug 4486658 5031862 8140471
- * @run main TimeoutLockLoops
  * @summary Checks for responsiveness of locks to timeouts.
+ * @library /lib/testlibrary/
  */
 
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+
 import java.util.SplittableRandom;
 import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.ReentrantLock;
+import jdk.testlibrary.Utils;
 
 public final class TimeoutLockLoops {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
     static final ExecutorService pool = Executors.newCachedThreadPool();
     static final SplittableRandom rnd = new SplittableRandom();
     static boolean print = false;
@@ -63,7 +67,7 @@
             new ReentrantLockLoop(i).test();
         }
         pool.shutdown();
-        if (! pool.awaitTermination(60L, TimeUnit.SECONDS))
+        if (! pool.awaitTermination(LONG_DELAY_MS, MILLISECONDS))
             throw new Error();
     }
 
--- a/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/Count.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/Count.java	Mon Mar 07 09:34:29 2016 +0100
@@ -25,9 +25,12 @@
  * @test
  * @bug 6207928 6328220 6378321 6625723
  * @summary Recursive lock invariant sanity checks
+ * @library /lib/testlibrary/
  * @author Martin Buchholz
  */
 
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -42,9 +45,11 @@
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
+import jdk.testlibrary.Utils;
 
 // I am the Cownt, and I lahve to cownt.
 public class Count {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
     final Random rnd = new Random();
 
     void lock(Lock lock) {
@@ -102,7 +107,7 @@
                     barrier.await();
                 } catch (Throwable t) { unexpected(t); }}});}
         es.shutdown();
-        check(es.awaitTermination(10L, TimeUnit.SECONDS));
+        check(es.awaitTermination(LONG_DELAY_MS, MILLISECONDS));
     }
 
     void testReentrantLocks(final boolean fair,
--- a/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java	Mon Mar 07 09:34:29 2016 +0100
@@ -41,17 +41,20 @@
  * inserts it, and if present, with probability premove it removes
  * it.  (pinsert and premove are expressed as percentages to simplify
  * parsing from command line.)
+ * @library /lib/testlibrary/
  */
 
-import static java.util.concurrent.TimeUnit.SECONDS;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
 
 import java.util.Map;
 import java.util.SplittableRandom;
 import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
+import jdk.testlibrary.Utils;
 
 public class MapLoops {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
     static final int NKEYS = 100000;
     static int pinsert     = 60;
     static int premove     = 2;
@@ -125,7 +128,7 @@
             map.clear();
         }
         pool.shutdown();
-        if (! pool.awaitTermination(10L, SECONDS))
+        if (! pool.awaitTermination(LONG_DELAY_MS, MILLISECONDS))
             throw new Error();
     }
 
--- a/jdk/test/java/util/concurrent/locks/StampedLock/Basic.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/locks/StampedLock/Basic.java	Mon Mar 07 09:34:29 2016 +0100
@@ -35,6 +35,7 @@
  * @test
  * @bug 8005697
  * @summary Basic tests for StampedLock
+ * @library /lib/testlibrary/
  * @author Chris Hegarty
  */
 
@@ -49,8 +50,10 @@
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.StampedLock;
+import jdk.testlibrary.Utils;
 
 public class Basic {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
 
     static void checkResult(Locker l, Class<? extends Throwable> c) {
         Throwable t = l.thrown();
@@ -268,7 +271,7 @@
                     case 2: case 5:
                         return interruptibleReader(sl, -1, SECONDS, gate, view ^= true);
                     default:
-                        return interruptibleReader(sl, 30, SECONDS, gate, view ^= true); }}
+                        return interruptibleReader(sl, LONG_DELAY_MS, MILLISECONDS, gate, view ^= true); }}
             public void remove() {throw new UnsupportedOperationException();}};
     }
 
@@ -286,7 +289,7 @@
                     case 2: case 5:
                         return interruptibleWriter(sl, -1, SECONDS, gate, view ^= true);
                     default:
-                        return interruptibleWriter(sl, 30, SECONDS, gate, view ^= true); }}
+                        return interruptibleWriter(sl, LONG_DELAY_MS, MILLISECONDS, gate, view ^= true); }}
             public void remove() {throw new UnsupportedOperationException();}};
     }
 
@@ -454,13 +457,13 @@
             // We test interrupting both before and after trying to acquire
             boolean view = false;
             StampedLock sl = new StampedLock();
-            for (long timeout : new long[] { -1L, 30L, -1L, 30L }) {
+            for (long timeout : new long[] { -1L, LONG_DELAY_MS, -1L, LONG_DELAY_MS }) {
                 long stamp;
                 Thread.State state;
 
                 stamp = sl.writeLock();
                 try {
-                    Reader r = interruptibleReader(sl, timeout, SECONDS, null, view);
+                    Reader r = interruptibleReader(sl, timeout, MILLISECONDS, null, view);
                     r.start();
                     r.interrupt();
                     r.join();
@@ -471,7 +474,7 @@
 
                 stamp = sl.writeLock();
                 try {
-                    Reader r = interruptibleReader(sl, timeout, SECONDS, null, view);
+                    Reader r = interruptibleReader(sl, timeout, MILLISECONDS, null, view);
                     r.start();
                     waitForThreadToBlock(r);
                     r.interrupt();
@@ -483,7 +486,7 @@
 
                 stamp = sl.readLock();
                 try {
-                    Writer w = interruptibleWriter(sl, timeout, SECONDS, null, view);
+                    Writer w = interruptibleWriter(sl, timeout, MILLISECONDS, null, view);
                     w.start();
                     w.interrupt();
                     w.join();
@@ -494,7 +497,7 @@
 
                 stamp = sl.readLock();
                 try {
-                    Writer w = interruptibleWriter(sl, timeout, SECONDS, null, view);
+                    Writer w = interruptibleWriter(sl, timeout, MILLISECONDS, null, view);
                     w.start();
                     waitForThreadToBlock(w);
                     w.interrupt();
@@ -509,7 +512,7 @@
                 check(!sl.tryUnlockRead());
                 check(!sl.tryUnlockWrite());
                 check(sl.tryOptimisticRead() != 0L);
-                if (timeout == 30L)
+                if (timeout == LONG_DELAY_MS)
                     view = true;
             }
         } catch (Throwable t) { unexpected(t); }
--- a/jdk/test/java/util/concurrent/tck/Collection8Test.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/tck/Collection8Test.java	Mon Mar 07 09:34:29 2016 +0100
@@ -37,6 +37,7 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
@@ -98,26 +99,29 @@
     public void testForEachConcurrentStressTest() throws Throwable {
         if (!impl.isConcurrent()) return;
         final Collection c = impl.emptyCollection();
-        final long testDurationMillis = SHORT_DELAY_MS;
+        final long testDurationMillis = timeoutMillis();
         final AtomicBoolean done = new AtomicBoolean(false);
         final Object elt = impl.makeElement(1);
-        ExecutorService pool = Executors.newCachedThreadPool();
-        Runnable checkElt = () -> {
-            while (!done.get())
-                c.stream().forEach((x) -> { assertSame(x, elt); }); };
-        Runnable addRemove = () -> {
-            while (!done.get()) {
-                assertTrue(c.add(elt));
-                assertTrue(c.remove(elt));
-            }};
-        Future<?> f1 = pool.submit(checkElt);
-        Future<?> f2 = pool.submit(addRemove);
-        Thread.sleep(testDurationMillis);
-        done.set(true);
-        pool.shutdown();
-        assertTrue(pool.awaitTermination(LONG_DELAY_MS, MILLISECONDS));
-        assertNull(f1.get(LONG_DELAY_MS, MILLISECONDS));
-        assertNull(f2.get(LONG_DELAY_MS, MILLISECONDS));
+        final Future<?> f1, f2;
+        final ExecutorService pool = Executors.newCachedThreadPool();
+        try (PoolCleaner cleaner = cleaner(pool, done)) {
+            final CountDownLatch threadsStarted = new CountDownLatch(2);
+            Runnable checkElt = () -> {
+                threadsStarted.countDown();
+                while (!done.get())
+                    c.stream().forEach((x) -> { assertSame(x, elt); }); };
+            Runnable addRemove = () -> {
+                threadsStarted.countDown();
+                while (!done.get()) {
+                    assertTrue(c.add(elt));
+                    assertTrue(c.remove(elt));
+                }};
+            f1 = pool.submit(checkElt);
+            f2 = pool.submit(addRemove);
+            Thread.sleep(testDurationMillis);
+        }
+        assertNull(f1.get(0L, MILLISECONDS));
+        assertNull(f2.get(0L, MILLISECONDS));
     }
 
     // public void testCollection8DebugFail() { fail(); }
--- a/jdk/test/java/util/concurrent/tck/JSR166TestCase.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/tck/JSR166TestCase.java	Mon Mar 07 09:34:29 2016 +0100
@@ -88,6 +88,7 @@
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeoutException;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -210,11 +211,31 @@
     private static final int suiteRuns =
         Integer.getInteger("jsr166.suiteRuns", 1);
 
+    private static float systemPropertyValue(String name, float defaultValue) {
+        String floatString = System.getProperty(name);
+        if (floatString == null)
+            return defaultValue;
+        try {
+            return Float.parseFloat(floatString);
+        } catch (NumberFormatException ex) {
+            throw new IllegalArgumentException(
+                String.format("Bad float value in system property %s=%s",
+                              name, floatString));
+        }
+    }
+
     /**
      * The scaling factor to apply to standard delays used in tests.
      */
-    private static final int delayFactor =
-        Integer.getInteger("jsr166.delay.factor", 1);
+    private static final float delayFactor =
+        systemPropertyValue("jsr166.delay.factor", 1.0f);
+
+    /**
+     * The timeout factor as used in the jtreg test harness.
+     * See: http://openjdk.java.net/jtreg/tag-spec.html
+     */
+    private static final float jtregTestTimeoutFactor
+        = systemPropertyValue("test.timeout.factor", 1.0f);
 
     public JSR166TestCase() { super(); }
     public JSR166TestCase(String name) { super(name); }
@@ -590,10 +611,12 @@
 
     /**
      * Returns the shortest timed delay. This can be scaled up for
-     * slow machines using the jsr166.delay.factor system property.
+     * slow machines using the jsr166.delay.factor system property,
+     * or via jtreg's -timeoutFactor: flag.
+     * http://openjdk.java.net/jtreg/command-help.html
      */
     protected long getShortDelay() {
-        return 50 * delayFactor;
+        return (long) (50 * delayFactor * jtregTestTimeoutFactor);
     }
 
     /**
@@ -906,6 +929,14 @@
         }};
     }
 
+    PoolCleaner cleaner(ExecutorService pool, AtomicBoolean flag) {
+        return new PoolCleanerWithReleaser(pool, releaser(flag));
+    }
+
+    Runnable releaser(final AtomicBoolean flag) {
+        return new Runnable() { public void run() { flag.set(true); }};
+    }
+
     /**
      * Waits out termination of a thread pool or fails doing so.
      */
@@ -1462,16 +1493,20 @@
         return new LatchAwaiter(latch);
     }
 
-    public void await(CountDownLatch latch) {
+    public void await(CountDownLatch latch, long timeoutMillis) {
         try {
-            if (!latch.await(LONG_DELAY_MS, MILLISECONDS))
+            if (!latch.await(timeoutMillis, MILLISECONDS))
                 fail("timed out waiting for CountDownLatch for "
-                     + (LONG_DELAY_MS/1000) + " sec");
+                     + (timeoutMillis/1000) + " sec");
         } catch (Throwable fail) {
             threadUnexpectedException(fail);
         }
     }
 
+    public void await(CountDownLatch latch) {
+        await(latch, LONG_DELAY_MS);
+    }
+
     public void await(Semaphore semaphore) {
         try {
             if (!semaphore.tryAcquire(LONG_DELAY_MS, MILLISECONDS))
--- a/jdk/test/java/util/concurrent/tck/ScheduledExecutorSubclassTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/tck/ScheduledExecutorSubclassTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -32,6 +32,7 @@
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static java.util.concurrent.TimeUnit.NANOSECONDS;
 import static java.util.concurrent.TimeUnit.SECONDS;
 
 import java.util.ArrayList;
@@ -55,7 +56,9 @@
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -226,52 +229,75 @@
     }
 
     /**
-     * scheduleAtFixedRate executes series of tasks at given rate
+     * scheduleAtFixedRate executes series of tasks at given rate.
+     * Eventually, it must hold that:
+     *   cycles - 1 <= elapsedMillis/delay < cycles
      */
     public void testFixedRateSequence() throws InterruptedException {
         final CustomExecutor p = new CustomExecutor(1);
         try (PoolCleaner cleaner = cleaner(p)) {
             for (int delay = 1; delay <= LONG_DELAY_MS; delay *= 3) {
-                long startTime = System.nanoTime();
-                int cycles = 10;
+                final long startTime = System.nanoTime();
+                final int cycles = 8;
                 final CountDownLatch done = new CountDownLatch(cycles);
-                Runnable task = new CheckedRunnable() {
+                final Runnable task = new CheckedRunnable() {
                     public void realRun() { done.countDown(); }};
-                ScheduledFuture h =
+                final ScheduledFuture periodicTask =
                     p.scheduleAtFixedRate(task, 0, delay, MILLISECONDS);
-                await(done);
-                h.cancel(true);
-                double normalizedTime =
-                    (double) millisElapsedSince(startTime) / delay;
-                if (normalizedTime >= cycles - 1 &&
-                    normalizedTime <= cycles)
+                final int totalDelayMillis = (cycles - 1) * delay;
+                await(done, totalDelayMillis + LONG_DELAY_MS);
+                periodicTask.cancel(true);
+                final long elapsedMillis = millisElapsedSince(startTime);
+                assertTrue(elapsedMillis >= totalDelayMillis);
+                if (elapsedMillis <= cycles * delay)
                     return;
+                // else retry with longer delay
             }
             fail("unexpected execution rate");
         }
     }
 
     /**
-     * scheduleWithFixedDelay executes series of tasks with given period
+     * scheduleWithFixedDelay executes series of tasks with given period.
+     * Eventually, it must hold that each task starts at least delay and at
+     * most 2 * delay after the termination of the previous task.
      */
     public void testFixedDelaySequence() throws InterruptedException {
         final CustomExecutor p = new CustomExecutor(1);
         try (PoolCleaner cleaner = cleaner(p)) {
             for (int delay = 1; delay <= LONG_DELAY_MS; delay *= 3) {
-                long startTime = System.nanoTime();
-                int cycles = 10;
+                final long startTime = System.nanoTime();
+                final AtomicLong previous = new AtomicLong(startTime);
+                final AtomicBoolean tryLongerDelay = new AtomicBoolean(false);
+                final int cycles = 8;
                 final CountDownLatch done = new CountDownLatch(cycles);
-                Runnable task = new CheckedRunnable() {
-                    public void realRun() { done.countDown(); }};
-                ScheduledFuture h =
+                final int d = delay;
+                final Runnable task = new CheckedRunnable() {
+                    public void realRun() {
+                        long now = System.nanoTime();
+                        long elapsedMillis
+                            = NANOSECONDS.toMillis(now - previous.get());
+                        if (done.getCount() == cycles) { // first execution
+                            if (elapsedMillis >= d)
+                                tryLongerDelay.set(true);
+                        } else {
+                            assertTrue(elapsedMillis >= d);
+                            if (elapsedMillis >= 2 * d)
+                                tryLongerDelay.set(true);
+                        }
+                        previous.set(now);
+                        done.countDown();
+                    }};
+                final ScheduledFuture periodicTask =
                     p.scheduleWithFixedDelay(task, 0, delay, MILLISECONDS);
-                await(done);
-                h.cancel(true);
-                double normalizedTime =
-                    (double) millisElapsedSince(startTime) / delay;
-                if (normalizedTime >= cycles - 1 &&
-                    normalizedTime <= cycles)
+                final int totalDelayMillis = (cycles - 1) * delay;
+                await(done, totalDelayMillis + cycles * LONG_DELAY_MS);
+                periodicTask.cancel(true);
+                final long elapsedMillis = millisElapsedSince(startTime);
+                assertTrue(elapsedMillis >= totalDelayMillis);
+                if (!tryLongerDelay.get())
                     return;
+                // else retry with longer delay
             }
             fail("unexpected execution rate");
         }
--- a/jdk/test/java/util/concurrent/tck/ScheduledExecutorTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/tck/ScheduledExecutorTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -34,6 +34,7 @@
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static java.util.concurrent.TimeUnit.NANOSECONDS;
 import static java.util.concurrent.TimeUnit.SECONDS;
 
 import java.util.ArrayList;
@@ -52,7 +53,9 @@
 import java.util.concurrent.ScheduledThreadPoolExecutor;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -170,52 +173,75 @@
     }
 
     /**
-     * scheduleAtFixedRate executes series of tasks at given rate
+     * scheduleAtFixedRate executes series of tasks at given rate.
+     * Eventually, it must hold that:
+     *   cycles - 1 <= elapsedMillis/delay < cycles
      */
     public void testFixedRateSequence() throws InterruptedException {
         final ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1);
         try (PoolCleaner cleaner = cleaner(p)) {
             for (int delay = 1; delay <= LONG_DELAY_MS; delay *= 3) {
-                long startTime = System.nanoTime();
-                int cycles = 10;
+                final long startTime = System.nanoTime();
+                final int cycles = 8;
                 final CountDownLatch done = new CountDownLatch(cycles);
-                Runnable task = new CheckedRunnable() {
+                final Runnable task = new CheckedRunnable() {
                     public void realRun() { done.countDown(); }};
-                ScheduledFuture h =
+                final ScheduledFuture periodicTask =
                     p.scheduleAtFixedRate(task, 0, delay, MILLISECONDS);
-                await(done);
-                h.cancel(true);
-                double normalizedTime =
-                    (double) millisElapsedSince(startTime) / delay;
-                if (normalizedTime >= cycles - 1 &&
-                    normalizedTime <= cycles)
+                final int totalDelayMillis = (cycles - 1) * delay;
+                await(done, totalDelayMillis + LONG_DELAY_MS);
+                periodicTask.cancel(true);
+                final long elapsedMillis = millisElapsedSince(startTime);
+                assertTrue(elapsedMillis >= totalDelayMillis);
+                if (elapsedMillis <= cycles * delay)
                     return;
+                // else retry with longer delay
             }
             fail("unexpected execution rate");
         }
     }
 
     /**
-     * scheduleWithFixedDelay executes series of tasks with given period
+     * scheduleWithFixedDelay executes series of tasks with given period.
+     * Eventually, it must hold that each task starts at least delay and at
+     * most 2 * delay after the termination of the previous task.
      */
     public void testFixedDelaySequence() throws InterruptedException {
         final ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1);
         try (PoolCleaner cleaner = cleaner(p)) {
             for (int delay = 1; delay <= LONG_DELAY_MS; delay *= 3) {
-                long startTime = System.nanoTime();
-                int cycles = 10;
+                final long startTime = System.nanoTime();
+                final AtomicLong previous = new AtomicLong(startTime);
+                final AtomicBoolean tryLongerDelay = new AtomicBoolean(false);
+                final int cycles = 8;
                 final CountDownLatch done = new CountDownLatch(cycles);
-                Runnable task = new CheckedRunnable() {
-                    public void realRun() { done.countDown(); }};
-                ScheduledFuture h =
+                final int d = delay;
+                final Runnable task = new CheckedRunnable() {
+                    public void realRun() {
+                        long now = System.nanoTime();
+                        long elapsedMillis
+                            = NANOSECONDS.toMillis(now - previous.get());
+                        if (done.getCount() == cycles) { // first execution
+                            if (elapsedMillis >= d)
+                                tryLongerDelay.set(true);
+                        } else {
+                            assertTrue(elapsedMillis >= d);
+                            if (elapsedMillis >= 2 * d)
+                                tryLongerDelay.set(true);
+                        }
+                        previous.set(now);
+                        done.countDown();
+                    }};
+                final ScheduledFuture periodicTask =
                     p.scheduleWithFixedDelay(task, 0, delay, MILLISECONDS);
-                await(done);
-                h.cancel(true);
-                double normalizedTime =
-                    (double) millisElapsedSince(startTime) / delay;
-                if (normalizedTime >= cycles - 1 &&
-                    normalizedTime <= cycles)
+                final int totalDelayMillis = (cycles - 1) * delay;
+                await(done, totalDelayMillis + cycles * LONG_DELAY_MS);
+                periodicTask.cancel(true);
+                final long elapsedMillis = millisElapsedSince(startTime);
+                assertTrue(elapsedMillis >= totalDelayMillis);
+                if (!tryLongerDelay.get())
                     return;
+                // else retry with longer delay
             }
             fail("unexpected execution rate");
         }
--- a/jdk/test/java/util/concurrent/tck/ThreadTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/concurrent/tck/ThreadTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -77,7 +77,7 @@
      */
     public void testGetAndSetDefaultUncaughtExceptionHandler() {
         assertEquals(null, Thread.getDefaultUncaughtExceptionHandler());
-        // failure due to securityException is OK.
+        // failure due to SecurityException is OK.
         // Would be nice to explicitly test both ways, but cannot yet.
         Thread.UncaughtExceptionHandler defaultHandler
             = Thread.getDefaultUncaughtExceptionHandler();
--- a/jdk/test/java/util/jar/JarFile/MultiReleaseJarAPI.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/jar/JarFile/MultiReleaseJarAPI.java	Mon Mar 07 09:34:29 2016 +0100
@@ -39,9 +39,9 @@
 import java.util.jar.JarFile;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
+import jdk.Version;
 
 import static java.util.jar.JarFile.Release;
-import static sun.misc.Version.jdkMajorVersion;  // fixme JEP 223 Version
 
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
@@ -50,6 +50,9 @@
 
 
 public class MultiReleaseJarAPI {
+
+    static final int MAJOR_VERSION = Version.current().major();
+
     String userdir = System.getProperty("user.dir",".");
     File unversioned = new File(userdir, "unversioned.jar");
     File multirelease = new File(userdir, "multi-release.jar");
@@ -106,7 +109,7 @@
         }
 
         // assure that we have a Release object corresponding to the actual runtime version
-        String version = "VERSION_" + jdkMajorVersion();
+        String version = "VERSION_" + MAJOR_VERSION;
         boolean runtimeVersionExists = false;
         for (Release value : values) {
             if (version.equals(value.name())) runtimeVersionExists = true;
@@ -123,7 +126,7 @@
             if (name.equals("BASE")) {
                 prefix = "";
             } else if (name.equals("RUNTIME")) {
-                prefix = "META-INF/versions/" + jdkMajorVersion() + "/";
+                prefix = "META-INF/versions/" + MAJOR_VERSION + "/";
             } else {
                 prefix = "META-INF/versions/" + name.substring(8) + "/";
             }
--- a/jdk/test/java/util/jar/JarFile/MultiReleaseJarIterators.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/jar/JarFile/MultiReleaseJarIterators.java	Mon Mar 07 09:34:29 2016 +0100
@@ -42,9 +42,9 @@
 import java.util.jar.JarFile;
 import java.util.stream.Collectors;
 import java.util.zip.ZipFile;
+import jdk.Version;
 
 import static java.util.jar.JarFile.Release;
-import static sun.misc.Version.jdkMajorVersion;  // fixme JEP 223 Version
 
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
@@ -53,6 +53,9 @@
 
 
 public class MultiReleaseJarIterators {
+
+    static final int MAJOR_VERSION = Version.current().major();
+
     String userdir = System.getProperty("user.dir", ".");
     File unversioned = new File(userdir, "unversioned.jar");
     File multirelease = new File(userdir, "multi-release.jar");
@@ -121,7 +124,7 @@
 
         try (JarFile jf = new JarFile(multirelease, true, ZipFile.OPEN_READ, Release.RUNTIME)) {
             Map<String,JarEntry> expectedEntries;
-            switch (jdkMajorVersion()) {
+            switch (MAJOR_VERSION) {
                 case 9:
                     expectedEntries = v9Entries;
                     break;
--- a/jdk/test/java/util/jar/JarFile/MultiReleaseJarProperties.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/jar/JarFile/MultiReleaseJarProperties.java	Mon Mar 07 09:34:29 2016 +0100
@@ -54,8 +54,7 @@
 import java.nio.file.Files;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
-
-import static sun.misc.Version.jdkMajorVersion;  // fixme JEP 223 Version
+import jdk.Version;
 
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
@@ -63,6 +62,9 @@
 import org.testng.annotations.Test;
 
 public class MultiReleaseJarProperties {
+
+    static final int MAJOR_VERSION = Version.current().major();
+
     final static int ROOTVERSION = 8; // magic number from knowledge of internals
     final static String userdir = System.getProperty("user.dir", ".");
     final static File multirelease = new File(userdir, "multi-release.jar");
@@ -77,14 +79,14 @@
         creator.compileEntries();
         creator.buildMultiReleaseJar();
 
-        rtVersion = Integer.getInteger("jdk.util.jar.version", jdkMajorVersion());
+        rtVersion = Integer.getInteger("jdk.util.jar.version", MAJOR_VERSION);
         String mrprop = System.getProperty("jdk.util.jar.enableMultiRelease", "");
         if (mrprop.equals("false")) {
             rtVersion = ROOTVERSION;
         } else if (rtVersion < ROOTVERSION) {
             rtVersion = ROOTVERSION;
-        } else if (rtVersion > jdkMajorVersion()) {
-            rtVersion = jdkMajorVersion();
+        } else if (rtVersion > MAJOR_VERSION) {
+            rtVersion = MAJOR_VERSION;
         }
         force = mrprop.equals("force");
 
--- a/jdk/test/java/util/jar/JarFile/MultiReleaseJarSecurity.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/jar/JarFile/MultiReleaseJarSecurity.java	Mon Mar 07 09:34:29 2016 +0100
@@ -40,6 +40,7 @@
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 import java.util.zip.ZipFile;
+import jdk.Version;
 
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
@@ -47,6 +48,9 @@
 import org.testng.annotations.Test;
 
 public class MultiReleaseJarSecurity {
+
+    static final int MAJOR_VERSION = Version.current().major();
+
     String userdir = System.getProperty("user.dir",".");
     File multirelease = new File(userdir, "multi-release.jar");
     File signedmultirelease = new File(userdir, "signed-multi-release.jar");
@@ -68,9 +72,8 @@
     @Test
     public void testCertsAndSigners() throws IOException {
         try (JarFile jf = new JarFile(signedmultirelease, true, ZipFile.OPEN_READ, JarFile.Release.RUNTIME)) {
-            int version = sun.misc.Version.jdkMajorVersion();  // fixme JEP 223 Version
             CertsAndSigners vcas = new CertsAndSigners(jf, jf.getJarEntry("version/Version.class"));
-            CertsAndSigners rcas = new CertsAndSigners(jf, jf.getJarEntry("META-INF/versions/" + version + "/version/Version.class"));
+            CertsAndSigners rcas = new CertsAndSigners(jf, jf.getJarEntry("META-INF/versions/" + MAJOR_VERSION + "/version/Version.class"));
             Assert.assertTrue(Arrays.equals(rcas.getCertificates(), vcas.getCertificates()));
             Assert.assertTrue(Arrays.equals(rcas.getCodeSigners(), vcas.getCodeSigners()));
         }
--- a/jdk/test/java/util/stream/bootlib/java.base/java/util/stream/DoubleStreamTestDataProvider.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/stream/bootlib/java.base/java/util/stream/DoubleStreamTestDataProvider.java	Mon Mar 07 09:34:29 2016 +0100
@@ -126,6 +126,9 @@
                                             () -> Spliterators.spliterator(isl.iterator(), doubles.length, 0)));
                 spliterators.add(splitDescr("Primitives.s(SpinedBuffer.iterator()):" + name,
                                             () -> Spliterators.spliteratorUnknownSize(isl.iterator(), 0)));
+                spliterators.add(splitDescr("DoubleStream.iterate(0,x->x<l;x->x+1):" + name,
+                                            () -> DoubleStream.iterate(0.0, x -> x < doubles.length, x -> x + 1.0)
+                                                              .spliterator()));
                 // Need more!
             }
             spliteratorTestData = spliterators.toArray(new Object[0][]);
--- a/jdk/test/java/util/stream/bootlib/java.base/java/util/stream/IntStreamTestDataProvider.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/stream/bootlib/java.base/java/util/stream/IntStreamTestDataProvider.java	Mon Mar 07 09:34:29 2016 +0100
@@ -136,6 +136,8 @@
                                             () -> IntStream.range(0, ints.length).spliterator()));
                 spliterators.add(splitDescr("IntStream.intRangeClosed(0,l):" + name,
                                             () -> IntStream.rangeClosed(0, ints.length).spliterator()));
+                spliterators.add(splitDescr("IntStream.iterate(0,x->x<l,x->x+1): " + name,
+                                            () -> IntStream.iterate(0, x -> x < ints.length, x -> x + 1).spliterator()));
                 // Need more!
             }
             spliteratorTestData = spliterators.toArray(new Object[0][]);
--- a/jdk/test/java/util/stream/bootlib/java.base/java/util/stream/LongStreamTestDataProvider.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/stream/bootlib/java.base/java/util/stream/LongStreamTestDataProvider.java	Mon Mar 07 09:34:29 2016 +0100
@@ -136,6 +136,9 @@
                                             () -> LongStream.range(0, longs.length).spliterator()));
                 spliterators.add(splitDescr("LongStream.longRangeClosed(0,l):" + name,
                                             () -> LongStream.rangeClosed(0, longs.length).spliterator()));
+                spliterators.add(splitDescr("LongStream.iterate(0,x->x<l;x->x+1):" + name,
+                                            () -> LongStream.iterate(0L, x -> x < longs.length, x -> x + 1L)
+                                                            .spliterator()));
                 // Need more!
             }
             spliteratorTestData = spliterators.toArray(new Object[0][]);
--- a/jdk/test/java/util/stream/bootlib/java.base/java/util/stream/StreamTestDataProvider.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/stream/bootlib/java.base/java/util/stream/StreamTestDataProvider.java	Mon Mar 07 09:34:29 2016 +0100
@@ -171,6 +171,8 @@
                                             () -> Spliterators.spliterator(Arrays.asList(ints).iterator(), ints.length, 0)));
                 spliterators.add(splitDescr("Iterators.s(Arrays.s(array).iterator()):" + name,
                                             () -> Spliterators.spliteratorUnknownSize(Arrays.asList(ints).iterator(), 0)));
+                spliterators.add(splitDescr("Stream.iterate(0,x->x<l,x->x+1): " + name,
+                                            () -> Stream.iterate(0, x -> x < ints.length, x -> x + 1).spliterator()));
                 // @@@ Add map and collection spliterators when spliterator() is exposed on Collection or Iterable
             }
             spliteratorTestData = spliterators.toArray(new Object[0][]);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/IterateTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,100 @@
+/*
+ * 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 8072727
+ */
+
+package org.openjdk.tests.java.util.stream;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.DoubleStream;
+import java.util.stream.IntStream;
+import java.util.stream.LongStream;
+import java.util.stream.OpTestCase;
+import java.util.stream.Stream;
+import java.util.stream.TestData;
+import java.util.stream.TestData.Factory;
+
+import static java.util.stream.ThowableHelper.checkNPE;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+@Test
+public class IterateTest extends OpTestCase {
+
+    @DataProvider(name = "IterateStreamsData")
+    public static Object[][] makeIterateStreamsTestData() {
+        Object[][] data = {
+            {List.of(),
+                Factory.ofSupplier("ref.empty", () -> Stream.iterate(1, x -> x < 0, x -> x * 2))},
+            {List.of(1),
+                Factory.ofSupplier("ref.one", () -> Stream.iterate(1, x -> x < 2, x -> x * 2))},
+            {List.of(1, 2, 4, 8, 16, 32, 64, 128, 256, 512),
+                Factory.ofSupplier("ref.ten", () -> Stream.iterate(1, x -> x < 1000, x -> x * 2))},
+            {List.of(10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0),
+                Factory.ofSupplier("ref.nullCheck", () -> Stream.iterate(10, Objects::nonNull, x -> x > 0 ? x - 1 : null))},
+            {List.of(),
+                Factory.ofIntSupplier("int.empty", () -> IntStream.iterate(1, x -> x < 0, x -> x + 1))},
+            {List.of(1),
+                Factory.ofIntSupplier("int.one", () -> IntStream.iterate(1, x -> x < 2, x -> x + 1))},
+            {List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
+                Factory.ofIntSupplier("int.ten", () -> IntStream.iterate(1, x -> x <= 10, x -> x + 1))},
+            {List.of(5, 4, 3, 2, 1),
+                Factory.ofIntSupplier("int.divZero", () -> IntStream.iterate(5, x -> x != 0, x -> x - 1/x/2 - 1))},
+            {List.of(),
+                Factory.ofLongSupplier("long.empty", () -> LongStream.iterate(1L, x -> x < 0, x -> x + 1))},
+            {List.of(1L),
+                Factory.ofLongSupplier("long.one", () -> LongStream.iterate(1L, x -> x < 2, x -> x + 1))},
+            {List.of(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L),
+                Factory.ofLongSupplier("long.ten", () -> LongStream.iterate(1L, x -> x <= 10, x -> x + 1))},
+            {List.of(),
+                Factory.ofDoubleSupplier("double.empty", () -> DoubleStream.iterate(1.0, x -> x < 0, x -> x + 1))},
+            {List.of(1.0),
+                Factory.ofDoubleSupplier("double.one", () -> DoubleStream.iterate(1.0, x -> x < 2, x -> x + 1))},
+            {List.of(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0),
+                Factory.ofDoubleSupplier("double.ten", () -> DoubleStream.iterate(1.0, x -> x <= 10, x -> x + 1))}
+        };
+        return data;
+    }
+
+    @Test(dataProvider = "IterateStreamsData")
+    public <T> void testIterate(List<T> expected, TestData<T, ?> data) {
+        withData(data).stream(s -> s).expectedResult(expected).exercise();
+    }
+
+    @Test
+    public void testNPE() {
+        checkNPE(() -> Stream.iterate("", null, x -> x + "a"));
+        checkNPE(() -> Stream.iterate("", String::isEmpty, null));
+        checkNPE(() -> IntStream.iterate(0, null, x -> x + 1));
+        checkNPE(() -> IntStream.iterate(0, x -> x < 10, null));
+        checkNPE(() -> LongStream.iterate(0, null, x -> x + 1));
+        checkNPE(() -> LongStream.iterate(0, x -> x < 10, null));
+        checkNPE(() -> DoubleStream.iterate(0, null, x -> x + 1));
+        checkNPE(() -> DoubleStream.iterate(0, x -> x < 10, null));
+    }
+}
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/StreamCloseTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/StreamCloseTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 /*
  * @test
  * @summary close handlers and closing streams
- * @bug 8044047
+ * @bug 8044047 8147505
  */
 
 package org.openjdk.tests.java.util.stream;
@@ -37,6 +37,7 @@
 
 import static java.util.stream.LambdaTestHelpers.countTo;
 import static java.util.stream.ThowableHelper.checkNPE;
+import static java.util.stream.ThowableHelper.checkISE;
 
 @Test(groups = { "serialization-hostile" })
 public class StreamCloseTest extends OpTestCase {
@@ -170,4 +171,21 @@
         for (int i=0; i<n-1; i++)
         assertTrue(e.getSuppressed()[i].getMessage().equals(String.valueOf(i + 2)));
     }
+
+    public void testConsumed() {
+        try(Stream<Integer> s = countTo(100).stream()) {
+            s.forEach(i -> {});
+            // Adding onClose handler when stream is consumed is illegal
+            // handler must not be registered
+            checkISE(() -> s.onClose(() -> fail("1")));
+        }
+
+        // close() must be idempotent:
+        // second close() invoked at the end of try-with-resources must have no effect
+        try(Stream<Integer> s = countTo(100).stream()) {
+            s.close();
+            // Adding onClose handler when stream is closed is also illegal
+            checkISE(() -> s.onClose(() -> fail("3")));
+        }
+    }
 }
--- a/jdk/test/java/util/zip/TestLocalTime.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/java/util/zip/TestLocalTime.java	Mon Mar 07 09:34:29 2016 +0100
@@ -24,7 +24,6 @@
 /*
  * @test
  * @bug 8075526 8135108
- * @key intermittent
  * @summary Test timestamp via ZipEntry.get/setTimeLocal()
  */
 
--- a/jdk/test/javax/management/mxbean/MXBeanLoadingTest1.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/javax/management/mxbean/MXBeanLoadingTest1.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,6 @@
 
 import java.lang.ref.WeakReference;
 import java.net.URL;
-import java.net.URLClassLoader;
 import java.util.Arrays;
 import java.util.Map;
 import javax.management.Attribute;
@@ -70,16 +69,16 @@
                     + " some little extra check of Descriptors, MBean*Info.");
 
             ClassLoader myClassLoader = MXBeanLoadingTest1.class.getClassLoader();
+            if(myClassLoader == null)
+                throw new RuntimeException("Test Failed : Null Classloader for test");
+            URL url = myClassLoader.getResource(
+                    MXBeanLoadingTest1.class.getCanonicalName()
+                            .replace(".", "/") + ".class");
+            String clsLoadPath = url.toURI().toString().
+                    replaceAll(MXBeanLoadingTest1.class.getSimpleName()
+                            + ".class", "");
 
-            if (!(myClassLoader instanceof URLClassLoader)) {
-                String message = "(ERROR) Test's class loader is not " +
-                        "a URLClassLoader";
-                System.out.println(message);
-                throw new RuntimeException(message);
-            }
-
-            URLClassLoader myURLClassLoader = (URLClassLoader) myClassLoader;
-            URL[] urls = myURLClassLoader.getURLs();
+            URL[] urls = new URL[]{new URL(clsLoadPath)};
             PrivateMLet mlet = new PrivateMLet(urls, null, false);
             Class<?> shadowClass = mlet.loadClass(TestMXBean.class.getName());
 
--- a/jdk/test/jdk/nio/zipfs/MultiReleaseJarTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/jdk/nio/zipfs/MultiReleaseJarTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -44,7 +44,7 @@
 import org.testng.annotations.*;
 
 public class MultiReleaseJarTest {
-    final private int MAJOR_VERSION= Version.current().major();
+    final private int MAJOR_VERSION = Version.current().major();
 
     final private String userdir = System.getProperty("user.dir",".");
     final private Map<String,String> stringEnv = new HashMap<>();
--- a/jdk/test/sun/misc/Version/Version.java	Fri Mar 04 13:16:50 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +0,0 @@
-/*
- * Copyright (c) 2010, 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
- * 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 6994413 8134365
- * @summary Check the JDK and JVM version returned by sun.misc.Version
- *          matches the versions defined in the system properties.
- *          Should use the API described in JDK-8136651 when available
- * @modules java.base/sun.misc
- * @compile -XDignore.symbol.file Version.java
- * @run main Version
- */
-
-import static sun.misc.Version.*;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class Version {
-
-    public static void main(String[] args) throws Exception {
-        VersionInfo jdk = newVersionInfo(System.getProperty("java.runtime.version"));
-        VersionInfo v1 = new VersionInfo(jdkMajorVersion(),
-                                         jdkMinorVersion(),
-                                         jdkSecurityVersion(),
-                                         jdkPatchVersion(),
-                                         jdkBuildNumber());
-        System.out.println("JDK version = " + jdk + "  " + v1);
-        if (!jdk.equals(v1)) {
-            throw new RuntimeException("Unmatched version: " + jdk + " vs " + v1);
-        }
-        VersionInfo jvm = newVersionInfo(System.getProperty("java.vm.version"));
-        VersionInfo v2 = new VersionInfo(jvmMajorVersion(),
-                                         jvmMinorVersion(),
-                                         jvmSecurityVersion(),
-                                         jvmPatchVersion(),
-                                         jvmBuildNumber());
-        System.out.println("JVM version = " + jvm + " " + v2);
-        if (!jvm.equals(v2)) {
-            throw new RuntimeException("Unmatched version: " + jvm + " vs " + v2);
-        }
-    }
-
-    static class VersionInfo {
-        final int major;
-        final int minor;
-        final int security;
-        final int patch;
-        final int build;
-        VersionInfo(int major, int minor, int security,
-                    int patch, int build) {
-            this.major = major;
-            this.minor = minor;
-            this.security = security;
-            this.patch = patch;
-            this.build = build;
-        }
-
-        VersionInfo(int[] fields) {
-            this.major = fields[0];
-            this.minor = fields[1];
-            this.security = fields[2];
-            this.patch = fields[3];
-            this.build = fields[4];
-        }
-
-        public boolean equals(VersionInfo v) {
-            return (this.major == v.major && this.minor == v.minor &&
-                    this.security == v.security && this.patch == v.patch &&
-                    this.build == v.build);
-        }
-
-        public String toString() {
-            StringBuilder sb = new StringBuilder();
-            // Do not include trailing zeros
-            if (patch > 0) {
-                sb.insert(0, "." + patch);
-            }
-            if (security > 0 || sb.length() > 0) {
-                sb.insert(0, "." + security);
-            }
-            if (minor > 0 || sb.length() > 0) {
-                sb.insert(0, "." + minor);
-            }
-            sb.insert(0, major);
-
-            if (build >= 0)
-                sb.append("+" + build);
-
-            return sb.toString();
-        }
-    }
-
-    private static VersionInfo newVersionInfo(String version) throws Exception {
-        // Version string fromat as defined by JEP-223
-        String jep223Pattern =
-                "^([0-9]+)(\\.([0-9]+))?(\\.([0-9]+))?(\\.([0-9]+))?" + // $VNUM
-                "(-([a-zA-Z]+))?(\\.([a-zA-Z]+))?" + // $PRE
-                "(\\+([0-9]+))?" +                   // Build Number
-                "(([-a-zA-Z0-9.]+))?$";              // $OPT
-
-        // Pattern group index for: Major, Minor, Security, Patch, Build
-        int[] groups = {1, 3, 5, 7, 13};
-        // Default values for Major, Minor, Security, Patch, Build
-        int[] versionFields = {0, 0, 0, 0, 0};
-
-        Pattern pattern = Pattern.compile(jep223Pattern);
-        Matcher matcher = pattern.matcher(version);
-        if (matcher.matches()) {
-            for (int i = 0; i < versionFields.length; i++) {
-                String field = matcher.group(groups[i]);
-                versionFields[i] = (field != null) ? Integer.parseInt(field) : 0;
-            }
-        }
-
-        VersionInfo vi = new VersionInfo(versionFields);
-        System.out.printf("newVersionInfo: input=%s output=%s\n", version, vi);
-        return vi;
-    }
-}
--- a/jdk/test/sun/net/www/protocol/jar/MultiReleaseJarURLConnection.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/sun/net/www/protocol/jar/MultiReleaseJarURLConnection.java	Mon Mar 07 09:34:29 2016 +0100
@@ -42,27 +42,40 @@
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
 public class MultiReleaseJarURLConnection {
     String userdir = System.getProperty("user.dir",".");
-    String urlFile = "jar:file:" + userdir + "/multi-release.jar!/";
-    String urlEntry = urlFile + "version/Version.java";
+    String file = userdir + "/signed-multi-release.jar";
 
     @BeforeClass
     public void initialize() throws Exception {
         CreateMultiReleaseTestJars creator = new CreateMultiReleaseTestJars();
         creator.compileEntries();
         creator.buildMultiReleaseJar();
+        creator.buildSignedMultiReleaseJar();
     }
 
     @AfterClass
     public void close() throws IOException {
         Files.delete(Paths.get(userdir, "multi-release.jar"));
+        Files.delete(Paths.get(userdir, "signed-multi-release.jar"));
     }
 
-    @Test
-    public void testRuntimeVersioning() throws Exception {
+    @DataProvider(name = "data")
+    public Object[][] createData() {
+        return new Object[][]{
+                {"unsigned file", userdir + "/multi-release.jar"},
+                {"signed file", userdir + "/signed-multi-release.jar"},
+        };
+    }
+
+    @Test(dataProvider = "data")
+    public void testRuntimeVersioning(String ignore, String file) throws Exception {
+        String urlFile = "jar:file:" + file + "!/";
+        String urlEntry = urlFile + "version/Version.java";
+
         Assert.assertTrue(readAndCompare(new URL(urlEntry), "return 8"));
         // #runtime is "magic"
         Assert.assertTrue(readAndCompare(new URL(urlEntry + "#runtime"), "return 9"));
@@ -72,8 +85,10 @@
         Assert.assertTrue(readAndCompare(new URL(urlEntry), "return 8"));
     }
 
-    @Test
-    public void testCachedJars() throws Exception {
+    @Test(dataProvider = "data")
+    public void testCachedJars(String ignore, String file) throws Exception {
+        String urlFile = "jar:file:" + file + "!/";
+
         URL rootUrl = new URL(urlFile);
         JarURLConnection juc = (JarURLConnection)rootUrl.openConnection();
         JarFile rootJar = juc.getJarFile();
--- a/jdk/test/sun/security/pkcs11/PKCS11Test.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/sun/security/pkcs11/PKCS11Test.java	Mon Mar 07 09:34:29 2016 +0100
@@ -380,7 +380,9 @@
     }
 
     static double getNSSInfo(String library) {
-        String nssHeader = "$Header: NSS";
+        // look for two types of headers in NSS libraries
+        String nssHeader1 = "$Header: NSS";
+        String nssHeader2 = "Version: NSS";
         boolean found = false;
         String s = null;
         int i = 0;
@@ -408,7 +410,8 @@
                     }
 
                     s = new String(data, 0, read);
-                    if ((i = s.indexOf(nssHeader)) > 0) {
+                    i = s.indexOf(nssHeader1);
+                    if (i > 0 || (i = s.indexOf(nssHeader2)) > 0) {
                         found = true;
                         // If the nssHeader is before 920 we can break, otherwise
                         // we may not have the whole header so do another read.  If
--- a/jdk/test/sun/security/provider/NSASuiteB/TestDSAGenParameterSpec.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/sun/security/provider/NSASuiteB/TestDSAGenParameterSpec.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,6 +37,7 @@
 /*
  * @test
  * @bug 8075286
+ * @key intermittent
  * @summary Verify that DSAGenParameterSpec can and can only be used to generate
  *          DSA within some certain range of key sizes as described in the class
  *          specification (L, N) as (1024, 160), (2048, 224), (2048, 256) and
--- a/jdk/test/sun/security/rsa/SpecTest.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/sun/security/rsa/SpecTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@
 /**
  * @test
  * @bug 8044199
+ * @key intermittent
  * @summary Check same KeyPair's private key and public key have same modulus.
  *  also check public key's public exponent equals to given spec's public
  *  exponent.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/DHKeyExchange/LegacyDHEKeyExchange.java	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,325 @@
+/*
+ * 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.
+ */
+
+// SunJSSE does not support dynamic system properties, no way to re-use
+// system properties in samevm/agentvm mode.
+
+/*
+ * @test
+ * @bug 8148108
+ * @summary Disable Diffie-Hellman keys less than 1024 bits
+ * @run main/othervm -Djdk.tls.ephemeralDHKeySize=legacy LegacyDHEKeyExchange
+ */
+
+import java.io.*;
+import javax.net.ssl.*;
+
+public class LegacyDHEKeyExchange {
+
+    /*
+     * =============================================================
+     * Set the various variables needed for the tests, then
+     * specify what tests to run on each side.
+     */
+
+    /*
+     * Should we run the client or server in a separate thread?
+     * Both sides can throw exceptions, but do you have a preference
+     * as to which side should be the main thread.
+     */
+    static boolean separateServerThread = false;
+
+    /*
+     * Where do we find the keystores?
+     */
+    static String pathToStores = "../../../../javax/net/ssl/etc";
+    static String keyStoreFile = "keystore";
+    static String trustStoreFile = "truststore";
+    static String passwd = "passphrase";
+
+    /*
+     * Is the server ready to serve?
+     */
+    volatile static boolean serverReady = false;
+
+    /*
+     * Turn on SSL debugging?
+     */
+    static boolean debug = false;
+
+    /*
+     * If the client or server is doing some kind of object creation
+     * that the other side depends on, and that thread prematurely
+     * exits, you may experience a hang.  The test harness will
+     * terminate all hung threads after its timeout has expired,
+     * currently 3 minutes by default, but you might try to be
+     * smart about it....
+     */
+
+    /*
+     * Define the server side of the test.
+     *
+     * If the server prematurely exits, serverReady will be set to true
+     * to avoid infinite hangs.
+     */
+    void doServerSide() throws Exception {
+        SSLServerSocketFactory sslssf =
+            (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
+        SSLServerSocket sslServerSocket =
+            (SSLServerSocket) sslssf.createServerSocket(serverPort);
+
+        serverPort = sslServerSocket.getLocalPort();
+
+        /*
+         * Signal Client, we're ready for his connect.
+         */
+        serverReady = true;
+
+        try (SSLSocket sslSocket = (SSLSocket)sslServerSocket.accept()) {
+            InputStream sslIS = sslSocket.getInputStream();
+            OutputStream sslOS = sslSocket.getOutputStream();
+
+            sslIS.read();
+            sslOS.write(85);
+            sslOS.flush();
+
+            throw new Exception(
+                "Leagcy DH keys (< 1024) should be restricted");
+        } catch (SSLHandshakeException she) {
+            // ignore, client should terminate the connection
+        } finally {
+            sslServerSocket.close();
+        }
+    }
+
+    /*
+     * Define the client side of the test.
+     *
+     * If the server prematurely exits, serverReady will be set to true
+     * to avoid infinite hangs.
+     */
+    void doClientSide() throws Exception {
+
+        /*
+         * Wait for server to get started.
+         */
+        while (!serverReady) {
+            Thread.sleep(50);
+        }
+
+        SSLSocketFactory sslsf =
+            (SSLSocketFactory) SSLSocketFactory.getDefault();
+        SSLSocket sslSocket = (SSLSocket)
+            sslsf.createSocket("localhost", serverPort);
+
+        String[] suites = new String [] {"TLS_DHE_RSA_WITH_AES_128_CBC_SHA"};
+        sslSocket.setEnabledCipherSuites(suites);
+
+        try {
+            InputStream sslIS = sslSocket.getInputStream();
+            OutputStream sslOS = sslSocket.getOutputStream();
+
+            sslOS.write(280);
+            sslOS.flush();
+            sslIS.read();
+
+            throw new Exception("Leagcy DH keys (< 1024) should be restricted");
+        } catch (SSLHandshakeException she) {
+            // ignore, should be caused by algorithm constraints
+        } finally {
+            sslSocket.close();
+        }
+    }
+
+    /*
+     * =============================================================
+     * The remainder is just support stuff
+     */
+
+    // use any free port by default
+    volatile int serverPort = 0;
+
+    volatile Exception serverException = null;
+    volatile Exception clientException = null;
+
+    public static void main(String[] args) throws Exception {
+        String keyFilename =
+            System.getProperty("test.src", ".") + "/" + pathToStores +
+                "/" + keyStoreFile;
+        String trustFilename =
+            System.getProperty("test.src", ".") + "/" + pathToStores +
+                "/" + trustStoreFile;
+
+        System.setProperty("javax.net.ssl.keyStore", keyFilename);
+        System.setProperty("javax.net.ssl.keyStorePassword", passwd);
+        System.setProperty("javax.net.ssl.trustStore", trustFilename);
+        System.setProperty("javax.net.ssl.trustStorePassword", passwd);
+
+        if (debug) {
+            System.setProperty("javax.net.debug", "all");
+        }
+
+        /*
+         * Start the tests.
+         */
+        new LegacyDHEKeyExchange();
+    }
+
+    Thread clientThread = null;
+    Thread serverThread = null;
+
+    /*
+     * Primary constructor, used to drive remainder of the test.
+     *
+     * Fork off the other side, then do your work.
+     */
+    LegacyDHEKeyExchange() throws Exception {
+        Exception startException = null;
+        try {
+            if (separateServerThread) {
+                startServer(true);
+                startClient(false);
+            } else {
+                startClient(true);
+                startServer(false);
+            }
+        } catch (Exception e) {
+            startException = e;
+        }
+
+        /*
+         * Wait for other side to close down.
+         */
+        if (separateServerThread) {
+            if (serverThread != null) {
+                serverThread.join();
+            }
+        } else {
+            if (clientThread != null) {
+                clientThread.join();
+            }
+        }
+
+        /*
+         * When we get here, the test is pretty much over.
+         * Which side threw the error?
+         */
+        Exception local;
+        Exception remote;
+
+        if (separateServerThread) {
+            remote = serverException;
+            local = clientException;
+        } else {
+            remote = clientException;
+            local = serverException;
+        }
+
+        Exception exception = null;
+
+        /*
+         * Check various exception conditions.
+         */
+        if ((local != null) && (remote != null)) {
+            // If both failed, return the curthread's exception.
+            local.initCause(remote);
+            exception = local;
+        } else if (local != null) {
+            exception = local;
+        } else if (remote != null) {
+            exception = remote;
+        } else if (startException != null) {
+            exception = startException;
+        }
+
+        /*
+         * If there was an exception *AND* a startException,
+         * output it.
+         */
+        if (exception != null) {
+            if (exception != startException && startException != null) {
+                exception.addSuppressed(startException);
+            }
+            throw exception;
+        }
+
+        // Fall-through: no exception to throw!
+    }
+
+    void startServer(boolean newThread) throws Exception {
+        if (newThread) {
+            serverThread = new Thread() {
+                @Override
+                public void run() {
+                    try {
+                        doServerSide();
+                    } catch (Exception e) {
+                        /*
+                         * Our server thread just died.
+                         *
+                         * Release the client, if not active already...
+                         */
+                        System.err.println("Server died...");
+                        serverReady = true;
+                        serverException = e;
+                    }
+                }
+            };
+            serverThread.start();
+        } else {
+            try {
+                doServerSide();
+            } catch (Exception e) {
+                serverException = e;
+            } finally {
+                serverReady = true;
+            }
+        }
+    }
+
+    void startClient(boolean newThread) throws Exception {
+        if (newThread) {
+            clientThread = new Thread() {
+                @Override
+                public void run() {
+                    try {
+                        doClientSide();
+                    } catch (Exception e) {
+                        /*
+                         * Our client thread just died.
+                         */
+                        System.err.println("Client died...");
+                        clientException = e;
+                    }
+                }
+            };
+            clientThread.start();
+        } else {
+            try {
+                doClientSide();
+            } catch (Exception e) {
+                clientException = e;
+            }
+        }
+    }
+}
--- a/jdk/test/tools/jar/JarEntryTime.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/jdk/test/tools/jar/JarEntryTime.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -31,6 +31,8 @@
 import java.io.File;
 import java.io.PrintWriter;
 import java.nio.file.attribute.FileTime;
+import java.util.Date;
+import java.util.TimeZone;
 import sun.tools.jar.Main;
 
 public class JarEntryTime {
@@ -39,6 +41,9 @@
     // allow for e.g. rounding/truncation and networked/samba drives.
     static final long PRECISION = 10000L;
 
+    static final TimeZone TZ = TimeZone.getDefault();
+    static final boolean DST = TZ.inDaylightTime(new Date());
+
     static boolean cleanup(File dir) throws Throwable {
         boolean rc = true;
         File[] x = dir.listFiles();
@@ -75,11 +80,13 @@
         File dirOuter = new File("outer");
         File dirInner = new File(dirOuter, "inner");
         File jarFile = new File("JarEntryTime.jar");
+        File testFile = new File("JarEntryTimeTest.txt");
 
         // Remove any leftovers from prior run
         cleanup(dirInner);
         cleanup(dirOuter);
         jarFile.delete();
+        testFile.delete();
 
         /* Create a directory structure
          * outer/
@@ -129,23 +136,39 @@
         check(cleanup(dirInner));
         check(cleanup(dirOuter));
 
+        try (PrintWriter pw = new PrintWriter(testFile)) {
+            pw.println("hello, world");
+        }
+        final long start = testFile.lastModified();
+
         // Extract and check the last modified values are the current times.
         // See sun.tools.jar.Main
         extractJar(jarFile, true);
+
+        try (PrintWriter pw = new PrintWriter(testFile)) {
+            pw.println("hello, world");
+        }
+        final long end = testFile.lastModified();
+
         check(dirOuter.exists());
         check(dirInner.exists());
         check(fileInner.exists());
-        checkFileTime(dirOuter.lastModified(), now);
-        checkFileTime(dirInner.lastModified(), now);
-        checkFileTime(fileInner.lastModified(), now);
+        checkFileTime(start, dirOuter.lastModified(), end);
+        checkFileTime(start, dirInner.lastModified(), end);
+        checkFileTime(start, fileInner.lastModified(), end);
 
         check(cleanup(dirInner));
         check(cleanup(dirOuter));
 
         check(jarFile.delete());
+        check(testFile.delete());
     }
 
     static void checkFileTime(long now, long original) {
+        if (isTimeSettingChanged()) {
+            return;
+        }
+
         if (Math.abs(now - original) > PRECISION) {
             System.out.format("Extracted to %s, expected to be close to %s%n",
                 FileTime.fromMillis(now), FileTime.fromMillis(original));
@@ -153,6 +176,27 @@
         }
     }
 
+    static void checkFileTime(long start, long now, long end) {
+        if (isTimeSettingChanged()) {
+            return;
+        }
+
+        if (now < start || now > end) {
+            System.out.format("Extracted to %s, "
+                              + "expected to be after %s and before %s%n",
+                              FileTime.fromMillis(now),
+                              FileTime.fromMillis(start),
+                              FileTime.fromMillis(end));
+            fail();
+        }
+    }
+
+    private static boolean isTimeSettingChanged() {
+        TimeZone currentTZ = TimeZone.getDefault();
+        boolean currentDST = currentTZ.inDaylightTime(new Date());
+        return (!currentTZ.equals(TZ) || currentDST != DST);
+    }
+
     //--------------------- Infrastructure ---------------------------
     static volatile int passed = 0, failed = 0;
     static void pass() {passed++;}
--- a/langtools/.hgtags	Fri Mar 04 13:16:50 2016 +0000
+++ b/langtools/.hgtags	Mon Mar 07 09:34:29 2016 +0100
@@ -350,3 +350,4 @@
 81bd82222f8a1f2b291a44a49e063973caa4e73b jdk-9+105
 dd05d3761a341143ef4a6b1a245e0960cc125b76 jdk-9+106
 7a0c343551497bd0e38ad69a77cc57d9f396615a jdk-9+107
+fd18a155ad22f62e06a9b74850ab8609d415c752 jdk-9+108
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Mon Mar 07 09:34:29 2016 +0100
@@ -2001,10 +2001,11 @@
             }
         }
 
+        final boolean explicitOverride = m.attribute(syms.overrideType.tsym) != null;
         // Check if this method must override a super method due to being annotated with @Override
         // or by virtue of being a member of a diamond inferred anonymous class. Latter case is to
         // be treated "as if as they were annotated" with @Override.
-        boolean mustOverride = m.attribute(syms.overrideType.tsym) != null ||
+        boolean mustOverride = explicitOverride ||
                 (env.info.isAnonymousDiamond && !m.isConstructor() && !m.isPrivate());
         if (mustOverride && !isOverrider(m)) {
             DiagnosticPosition pos = tree.pos();
@@ -2014,7 +2015,9 @@
                     break;
                 }
             }
-            log.error(pos, "method.does.not.override.superclass");
+            log.error(pos,
+                      explicitOverride ? Errors.MethodDoesNotOverrideSuperclass :
+                                Errors.AnonymousDiamondMethodDoesNotOverrideSuperclass(Fragments.DiamondAnonymousMethodsImplicitlyOverride));
         }
     }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Mon Mar 07 09:34:29 2016 +0100
@@ -4043,7 +4043,12 @@
                         found = false;
                         break;
                     }
-                    allThrown = chk.intersect(allThrown, mt2.getThrownTypes());
+                    List<Type> thrownTypes2 = mt2.getThrownTypes();
+                    if (mt.hasTag(FORALL) && mt2.hasTag(FORALL)) {
+                        // if both are generic methods, adjust thrown types ahead of intersection computation
+                        thrownTypes2 = types.subst(thrownTypes2, mt2.getTypeArguments(), mt.getTypeArguments());
+                    }
+                    allThrown = chk.intersect(allThrown, thrownTypes2);
                 }
                 if (found) {
                     //all ambiguous methods were abstract and one method had
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java	Mon Mar 07 09:34:29 2016 +0100
@@ -80,6 +80,11 @@
      */
     private final Type methodType;
 
+    /**
+     * Are we presently traversing a let expression ? Yes if depth != 0
+     */
+    private int letExprDepth;
+
     public static Gen instance(Context context) {
         Gen instance = context.get(genKey);
         if (instance == null)
@@ -1006,8 +1011,10 @@
         if (tree.init != null) {
             checkStringConstant(tree.init.pos(), v.getConstValue());
             if (v.getConstValue() == null || varDebugInfo) {
+                Assert.check(letExprDepth != 0 || code.state.stacksize == 0);
                 genExpr(tree.init, v.erasure(types)).load();
                 items.makeLocalItem(v).store();
+                Assert.check(letExprDepth != 0 || code.state.stacksize == 0);
             }
         }
         checkDimension(tree.pos(), v.type);
@@ -1062,12 +1069,14 @@
                 CondItem c;
                 if (cond != null) {
                     code.statBegin(cond.pos);
+                    Assert.check(code.state.stacksize == 0);
                     c = genCond(TreeInfo.skipParens(cond), CRT_FLOW_CONTROLLER);
                 } else {
                     c = items.makeCondItem(goto_);
                 }
                 Chain loopDone = c.jumpFalse();
                 code.resolve(c.trueJumps);
+                Assert.check(code.state.stacksize == 0);
                 genStat(body, loopEnv, CRT_STATEMENT | CRT_FLOW_TARGET);
                 code.resolve(loopEnv.info.cont);
                 genStats(step, loopEnv);
@@ -1080,11 +1089,13 @@
                 CondItem c;
                 if (cond != null) {
                     code.statBegin(cond.pos);
+                    Assert.check(code.state.stacksize == 0);
                     c = genCond(TreeInfo.skipParens(cond), CRT_FLOW_CONTROLLER);
                 } else {
                     c = items.makeCondItem(goto_);
                 }
                 code.resolve(c.jumpTrue(), startpc);
+                Assert.check(code.state.stacksize == 0);
                 code.resolve(c.falseJumps);
             }
             Chain exit = loopEnv.info.exit;
@@ -1112,6 +1123,7 @@
         int limit = code.nextreg;
         Assert.check(!tree.selector.type.hasTag(CLASS));
         int startpcCrt = genCrt ? code.curCP() : 0;
+        Assert.check(code.state.stacksize == 0);
         Item sel = genExpr(tree.selector, syms.intType);
         List<JCCase> cases = tree.cases;
         if (cases.isEmpty()) {
@@ -1280,6 +1292,7 @@
         int limit = code.nextreg;
         // Generate code to evaluate lock and save in temporary variable.
         final LocalItem lockVar = makeTemp(syms.objectType);
+        Assert.check(code.state.stacksize == 0);
         genExpr(tree.lock, tree.lock.type).load().duplicate();
         lockVar.store();
 
@@ -1526,9 +1539,11 @@
     public void visitIf(JCIf tree) {
         int limit = code.nextreg;
         Chain thenExit = null;
+        Assert.check(code.state.stacksize == 0);
         CondItem c = genCond(TreeInfo.skipParens(tree.cond),
                              CRT_FLOW_CONTROLLER);
         Chain elseChain = c.jumpFalse();
+        Assert.check(code.state.stacksize == 0);
         if (!c.isFalse()) {
             code.resolve(c.trueJumps);
             genStat(tree.thenpart, env, CRT_STATEMENT | CRT_FLOW_TARGET);
@@ -1542,6 +1557,7 @@
         }
         code.resolve(thenExit);
         code.endScopes(limit);
+        Assert.check(code.state.stacksize == 0);
     }
 
     public void visitExec(JCExpressionStatement tree) {
@@ -1555,7 +1571,9 @@
                 ((JCUnary) e).setTag(PREDEC);
                 break;
         }
+        Assert.check(code.state.stacksize == 0);
         genExpr(tree.expr, tree.expr.type).drop();
+        Assert.check(code.state.stacksize == 0);
     }
 
     public void visitBreak(JCBreak tree) {
@@ -1581,6 +1599,7 @@
          */
         int tmpPos = code.pendingStatPos;
         if (tree.expr != null) {
+            Assert.check(code.state.stacksize == 0);
             Item r = genExpr(tree.expr, pt).load();
             if (hasFinally(env.enclMethod, env)) {
                 r = makeTemp(pt);
@@ -1600,8 +1619,10 @@
     }
 
     public void visitThrow(JCThrow tree) {
+        Assert.check(code.state.stacksize == 0);
         genExpr(tree.expr, tree.expr.type).load();
         code.emitop0(athrow);
+        Assert.check(code.state.stacksize == 0);
     }
 
 /* ************************************************************************
@@ -2101,10 +2122,12 @@
     }
 
     public void visitLetExpr(LetExpr tree) {
+        letExprDepth++;
         int limit = code.nextreg;
         genStats(tree.defs, env);
         result = genExpr(tree.expr, tree.expr.type).load();
         code.endScopes(limit);
+        letExprDepth--;
     }
 
     private void generateReferencesToPrunedTree(ClassSymbol classSymbol, Pool pool) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Fri Mar 04 13:16:50 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Mar 07 09:34:29 2016 +0100
@@ -214,6 +214,11 @@
     Unexpected @FunctionalInterface annotation\n\
     {0}
 
+# 0: message segment
+compiler.err.anonymous.diamond.method.does.not.override.superclass=\
+    method does not override or implement a method from a supertype\n\
+    {0}
+
 # 0: symbol
 compiler.misc.not.a.functional.intf=\
     {0} is not a functional interface
@@ -1196,6 +1201,9 @@
 ## miscellaneous strings
 ##
 
+compiler.misc.diamond.anonymous.methods.implicitly.override=\
+    (due to <>, every non-private method declared in this anonymous class must override or implement a method from a supertype)
+
 compiler.misc.source.unavailable=\
     (source unavailable)
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java	Mon Mar 07 09:34:29 2016 +0100
@@ -50,6 +50,7 @@
 import com.sun.tools.javac.parser.ParserFactory;
 import com.sun.tools.javac.parser.ReferenceParser;
 import com.sun.tools.javac.parser.Tokens.Comment;
+import com.sun.tools.javac.parser.Tokens.Comment.CommentStyle;
 import com.sun.tools.javac.tree.DCTree.DCAttribute;
 import com.sun.tools.javac.tree.DCTree.DCAuthor;
 import com.sun.tools.javac.tree.DCTree.DCComment;
@@ -206,7 +207,31 @@
         lb.addAll(cast(firstSentence));
         lb.addAll(cast(body));
         List<DCTree> fullBody = lb.toList();
-        DCDocComment tree = new DCDocComment(null, fullBody, cast(firstSentence), cast(body), cast(tags));
+
+        // A dummy comment to keep the diagnostics logic happy.
+        Comment c = new Comment() {
+            @Override
+            public String getText() {
+                return null;
+            }
+
+            @Override
+            public int getSourcePos(int index) {
+                return Position.NOPOS;
+            }
+
+            @Override
+            public CommentStyle getStyle() {
+                return CommentStyle.JAVADOC;
+            }
+
+            @Override
+            public boolean isDeprecated() {
+                return false;
+            }
+        };
+
+        DCDocComment tree = new DCDocComment(c, fullBody, cast(firstSentence), cast(body), cast(tags));
         return tree;
     }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SjavacImpl.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SjavacImpl.java	Mon Mar 07 09:34:29 2016 +0100
@@ -28,7 +28,6 @@
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.StringWriter;
-import java.io.Writer;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.ArrayList;
@@ -81,6 +80,10 @@
         if (!validateOptions(options))
             return RC_FATAL;
 
+        if (srcDstOverlap(options.getSources(), options.getDestDir())) {
+            return RC_FATAL;
+        }
+
         if (!createIfMissing(options.getDestDir()))
             return RC_FATAL;
 
@@ -330,6 +333,22 @@
 
     }
 
+    private static boolean srcDstOverlap(List<SourceLocation> locs, Path dest) {
+        for (SourceLocation loc : locs) {
+            if (isOverlapping(loc.getPath(), dest)) {
+                Log.error("Source location " + loc.getPath() + " overlaps with destination " + dest);
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private static boolean isOverlapping(Path p1, Path p2) {
+        p1 = p1.toAbsolutePath().normalize();
+        p2 = p2.toAbsolutePath().normalize();
+        return p1.startsWith(p2) || p2.startsWith(p1);
+    }
+
     private static boolean createIfMissing(Path dir) {
 
         if (Files.isDirectory(dir))
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -96,6 +96,7 @@
     protected void generateFrameFile() throws IOException {
         Content frame = getFrameDetails();
         HtmlTree body = new HtmlTree(HtmlTag.BODY);
+        body.addAttr(HtmlAttr.ONLOAD, "loadFrames()");
         if (configuration.allowTag(HtmlTag.MAIN)) {
             HtmlTree main = HtmlTree.MAIN(frame);
             body.addContent(main);
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -423,6 +423,10 @@
                 "            }" + DocletConstants.NL +
                 "        }" + DocletConstants.NL +
                 "        return true;" + DocletConstants.NL +
+                "    }" + DocletConstants.NL +
+                "    function loadFrames() {" + DocletConstants.NL +
+                "        if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +
+                "             top.classFrame.location = top.targetPage;" + DocletConstants.NL +
                 "    }" + DocletConstants.NL;
         RawHtml scriptContent = new RawHtml(scriptCode);
         script.addContent(scriptContent);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java	Mon Mar 07 09:34:29 2016 +0100
@@ -196,8 +196,12 @@
         div.addStyle(HtmlStyle.header);
         PackageElement pkg = utils.containingPackage(typeElement);
         if (!pkg.isUnnamed()) {
-            Content pkgNameContent = new StringContent(utils.getPackageName(pkg));
-            Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent);
+            Content classPackageLabel = HtmlTree.SPAN(HtmlStyle.packageLabelInClass, packageLabel);
+            Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classPackageLabel);
+            pkgNameDiv.addContent(getSpace());
+            Content pkgNameContent = getPackageLink(pkg,
+                    new StringContent(pkg.getQualifiedName().toString()));
+            pkgNameDiv.addContent(pkgNameContent);
             div.addContent(pkgNameDiv);
         }
         LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java	Mon Mar 07 09:34:29 2016 +0100
@@ -27,6 +27,7 @@
 
 import java.io.*;
 
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
@@ -102,6 +103,7 @@
     protected void generateFrameFile() throws IOException {
         Content frame = getFrameDetails();
         HtmlTree body = new HtmlTree(HtmlTag.BODY);
+        body.addAttr(HtmlAttr.ONLOAD, "loadFrames()");
         if (configuration.allowTag(HtmlTag.MAIN)) {
             HtmlTree main = HtmlTree.MAIN(frame);
             body.addContent(main);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -84,6 +84,7 @@
     overrideSpecifyLabel,
     overviewSummary,
     packageHierarchyLabel,
+    packageLabelInClass,
     paramLabel,
     returnLabel,
     rightContainer,
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java	Mon Mar 07 09:34:29 2016 +0100
@@ -401,6 +401,10 @@
                 "            }" + DocletConstants.NL +
                 "        }" + DocletConstants.NL +
                 "        return true;" + DocletConstants.NL +
+                "    }" + DocletConstants.NL +
+                "    function loadFrames() {" + DocletConstants.NL +
+                "        if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +
+                "             top.classFrame.location = top.targetPage;" + DocletConstants.NL +
                 "    }" + DocletConstants.NL;
         RawHtml scriptContent = new RawHtml(scriptCode);
         script.addContent(scriptContent);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Fri Mar 04 13:16:50 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Mon Mar 07 09:34:29 2016 +0100
@@ -610,8 +610,9 @@
     color:#474747;
 }
 .deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink,
-.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel,
-.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink, .searchTagLink {
+.overrideSpecifyLabel, .packageLabelInClass, .packageHierarchyLabel,
+.paramLabel, .returnLabel, .seeLabel, .simpleTagLabel, .throwsLabel,
+.typeNameLabel, .typeNameLink, .searchTagLink {
     font-weight:bold;
 }
 .deprecationComment, .emphasizedPhrase, .interfaceName {
--- a/langtools/test/com/sun/javadoc/testHtmlVersion/TestHtmlVersion.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/langtools/test/com/sun/javadoc/testHtmlVersion/TestHtmlVersion.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8072945 8081854 8141492
+ * @bug 8072945 8081854 8141492 8148985
  * @summary Test the version of HTML generated by the javadoc tool.
  * @author bpatel
  * @library ../lib
@@ -688,7 +688,7 @@
         checkOutput("index.html", true,
                 "<!DOCTYPE HTML>",
                 "<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" title=\"Style\">",
-                "<body>\n"
+                "<body onload=\"loadFrames()\">\n"
                 + "<main role=\"main\">\n"
                 + "<div class=\"mainContainer\">\n"
                 + "<div class=\"leftContainer\">\n"
@@ -1599,7 +1599,7 @@
         checkOutput("index.html", true,
                 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
                 "<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" title=\"Style\">",
-                "<body>\n"
+                "<body onload=\"loadFrames()\">\n"
                 + "<div class=\"mainContainer\">\n"
                 + "<div class=\"leftContainer\">\n"
                 + "<div class=\"leftTop\">\n"
--- a/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -100,8 +100,15 @@
                 + "        }\n"
                 + "        return true;\n"
                 + "    }\n"
+                + "    function loadFrames() {\n"
+                + "        if (targetPage != \"\" && targetPage != \"undefined\")\n"
+                + "             top.classFrame.location = top.targetPage;\n"
+                + "    }\n"
                 + "</script>");
 
+        checkOutput("index.html", true,
+                "<body onload=\"loadFrames()\"");
+
         //Make sure title javascript only runs if is-external is not true
         checkOutput("pkg/C.html", true,
                 "    try {\n"
--- a/langtools/test/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8072945 8081854 8141492
+ * @bug 8072945 8081854 8141492 8148985
  * @summary Test the version of HTML generated by the javadoc tool.
  * @author bpatel
  * @library ../lib
@@ -599,7 +599,7 @@
         checkOutput("index.html", true,
                 "<!DOCTYPE HTML>",
                 "<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" title=\"Style\">",
-                "<body>\n"
+                "<body onload=\"loadFrames()\">\n"
                 + "<main role=\"main\">\n"
                 + "<div class=\"mainContainer\">\n"
                 + "<div class=\"leftContainer\">\n"
@@ -1391,7 +1391,7 @@
         checkOutput("index.html", true,
                 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
                 "<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" title=\"Style\">",
-                "<body>\n"
+                "<body onload=\"loadFrames()\">\n"
                 + "<div class=\"mainContainer\">\n"
                 + "<div class=\"leftContainer\">\n"
                 + "<div class=\"leftTop\">\n"
--- a/langtools/test/jdk/javadoc/doclet/testIncluded/TestIncluded.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testIncluded/TestIncluded.java	Mon Mar 07 09:34:29 2016 +0100
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      8149468
+ * @bug      8149842
  * @summary  Verify that non included classes are not inspected.
  * @library  ../lib
  * @modules  jdk.javadoc/jdk.javadoc.internal.tool
--- a/langtools/test/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7112427 8012295 8025633 8026567 8061305 8081854
+ * @bug 7112427 8012295 8025633 8026567 8061305 8081854 8150130
  * @summary Test of the JavaFX doclet features.
  * @author jvalenta
  * @library ../lib
@@ -137,6 +137,7 @@
                 + "</ul>\n"
                 + "</li>");
     }
+
     /*
      * Test without -javafx option, to ensure property getters and setters
      * are treated just like any other java method.
@@ -181,4 +182,22 @@
                 + "</span>()</code>&nbsp;</td>"
         );
     }
+
+    /*
+     * Force the doclet to emit a warning when processing a synthesized,
+     * DocComment, and ensure that the run succeeds.
+     */
+    @Test
+    void test4() {
+        javadoc("-d", "out4",
+                "-javafx",
+                "-Xdoclint:none",
+                "-sourcepath", testSrc,
+                "-package",
+                "pkg4");
+        checkExit(Exit.OK);
+
+        // make sure the doclet indeed emits the warning
+        checkOutput(Output.OUT, true, "C.java:0: warning - invalid usage of tag >");
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testJavaFX/pkg4/C.java	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg4;
+
+public class C {
+
+    /**
+     * Defines the number of cycles in this animation. The {@code cycleCount}
+     * may be {@code INDEFINITE} for animations that repeat indefinitely.
+     * Now we add a > to deliberately cause an Html error.
+     * @defaultValue 11
+     * @since JavaFX 8.0
+     */
+    public DoubleProperty rate;
+
+    public final void setRate(double value) {}
+
+    public final double getRate() {return 2.0d;}
+
+    public final DoubleProperty rateProperty() {return new DoubleProperty();}
+
+    class DoubleProperty {}
+
+}
--- a/langtools/test/jdk/javadoc/doclet/testJavascript/TestJavascript.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testJavascript/TestJavascript.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4665566 4855876 7025314 8012375 8015997 8016328 8024756
+ * @bug      4665566 4855876 7025314 8012375 8015997 8016328 8024756 8148985
  * @summary  Verify that the output has the right javascript.
  * @author   jamieh
  * @library  ../lib
@@ -100,8 +100,15 @@
                 + "        }\n"
                 + "        return true;\n"
                 + "    }\n"
+                + "    function loadFrames() {\n"
+                + "        if (targetPage != \"\" && targetPage != \"undefined\")\n"
+                + "             top.classFrame.location = top.targetPage;\n"
+                + "    }\n"
                 + "</script>");
 
+        checkOutput("index.html", true,
+                "<body onload=\"loadFrames()\"");
+
         //Make sure title javascript only runs if is-external is not true
         checkOutput("pkg/C.html", true,
                 "    try {\n"
--- a/langtools/test/jdk/javadoc/doclet/testSubTitle/TestSubTitle.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testSubTitle/TestSubTitle.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7010342
+ * @bug 7010342 8150000
  * @summary Test for correct sub title generation.
  * @author Bhavesh Patel
  * @library ../lib
@@ -50,7 +50,8 @@
             "<div class=\"block\">This is the description of package pkg.</div>");
 
         checkOutput("pkg/C.html", true,
-            "<div class=\"subTitle\">pkg</div>");
+                "<div class=\"subTitle\"><span class=\"packageLabelInClass\">" +
+                "Package</span>&nbsp;<a href=\"../pkg/package-summary.html\">pkg</a></div>");
 
         checkOutput("pkg/package-summary.html", false,
             "<p class=\"subTitle\">\n" +
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DiamondMethodDoesNotOverride.java	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+// key: compiler.err.anonymous.diamond.method.does.not.override.superclass
+// key: compiler.misc.diamond.anonymous.methods.implicitly.override
+
+class X {
+    interface  Foo<T> {
+        void g(T t);
+    }
+    void m() {
+      Foo<String> fs = new Foo<>() {
+          public void g(String s) { }
+          void someMethod() { }
+      };
+   }
+}
--- a/langtools/test/tools/javac/generics/diamond/neg/Neg15.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/langtools/test/tools/javac/generics/diamond/neg/Neg15.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,6 +1,6 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 8062373
+ * @bug 8062373 8151018
  *
  * @summary  Test that javac complains when a <> inferred class contains a public method that does override a supertype method.
  * @author sadayapalam
--- a/langtools/test/tools/javac/generics/diamond/neg/Neg15.out	Fri Mar 04 13:16:50 2016 +0000
+++ b/langtools/test/tools/javac/generics/diamond/neg/Neg15.out	Mon Mar 07 09:34:29 2016 +0100
@@ -1,4 +1,4 @@
-Neg15.java:48:28: compiler.err.method.does.not.override.superclass
-Neg15.java:52:21: compiler.err.method.does.not.override.superclass
-Neg15.java:56:31: compiler.err.method.does.not.override.superclass
+Neg15.java:48:28: compiler.err.anonymous.diamond.method.does.not.override.superclass: (compiler.misc.diamond.anonymous.methods.implicitly.override)
+Neg15.java:52:21: compiler.err.anonymous.diamond.method.does.not.override.superclass: (compiler.misc.diamond.anonymous.methods.implicitly.override)
+Neg15.java:56:31: compiler.err.anonymous.diamond.method.does.not.override.superclass: (compiler.misc.diamond.anonymous.methods.implicitly.override)
 3 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/CheckNoTimeoutException.java	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,60 @@
+/*
+ * 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 8148930
+ * @summary Verify that there is no spurious unreported exception error.
+ * @modules java.sql
+ * @compile CheckNoTimeoutException.java
+ */
+
+import java.util.Collection;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.concurrent.TimeoutException;
+import java.io.*;
+import java.sql.SQLException;
+import java.sql.SQLTransientException;
+
+class CheckNoTimeoutException {
+
+    interface V {List<?> foo(List<String> arg) throws EOFException, SQLException, TimeoutException;}
+    interface U {Collection foo(List<String> arg) throws IOException, SQLTransientException;}
+
+    //SAM type ([List<String>], List<String>/List, {EOFException, SQLTransientException})
+    interface UV extends U, V {}
+
+
+    private static List<String> strs = new ArrayList<String>();
+    void methodUV(UV uv) {
+        System.out.println("methodUV(): SAM type interface UV object instantiated: " + uv);
+        try{
+            System.out.println("result returned: " + uv.foo(strs));
+        }catch(EOFException e){
+            System.out.println(e.getMessage());
+        }catch(SQLTransientException ex){
+            System.out.println(ex.getMessage());
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/IntersectThrownTypesTest.java	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,28 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8148930
+ * @summary Incorrect erasure of exceptions in override-equivalent dual interface impl
+ * @compile/fail/ref=IntersectThrownTypesTest.out -XDrawDiagnostics IntersectThrownTypesTest.java
+ */
+
+public class IntersectThrownTypesTest {
+
+    interface S1 {
+        <K extends Exception> void run(Class<K> clazz) throws K;
+    }
+
+    interface S2 {
+        <K extends Exception> void run(Class<K> clazz) throws K;
+    }
+
+    interface S extends S1, S2 {}
+
+    public void foo(S1 s) {
+        s.run(java.io.IOException.class);
+    }
+
+    public void foo(S s) {
+        s.run(java.io.IOException.class);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/IntersectThrownTypesTest.out	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,3 @@
+IntersectThrownTypesTest.java:21:14: compiler.err.unreported.exception.need.to.catch.or.throw: java.io.IOException
+IntersectThrownTypesTest.java:25:14: compiler.err.unreported.exception.need.to.catch.or.throw: java.io.IOException
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/OverlappingSrcDst.java	Mon Mar 07 09:34:29 2016 +0100
@@ -0,0 +1,102 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @summary Make sure sjavac doesn't allow overlapping source and destination
+ *          directories.
+ * @bug 8061320
+ * @library /tools/lib
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.file
+ *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.compiler/com.sun.tools.sjavac
+ * @build Wrapper ToolBox
+ * @run main Wrapper OverlappingSrcDst
+ */
+
+import java.io.File;
+import java.nio.file.Paths;
+
+public class OverlappingSrcDst extends SJavacTester {
+    public static void main(String... args) {
+        new OverlappingSrcDst().run();
+    }
+
+    public void run() {
+        String abs = ToolBox.currDir.toAbsolutePath().toString();
+
+        // Relative vs relative
+        test("dir", "dir", false);
+        test("dir", "dir/dst", false);
+        test("dir/src", "dir", false);
+        test("src", "dst", true);
+
+        // Absolute vs absolute
+        test(abs + "/dir", abs + "/dir", false);
+        test(abs + "/dir", abs + "/dir/dst", false);
+        test(abs + "/dir/src", abs + "/dir", false);
+        test(abs + "/src", abs + "/dst", true);
+
+        // Absolute vs relative
+        test(abs + "/dir", "dir", false);
+        test(abs + "/dir", "dir/dst", false);
+        test(abs + "/dir/src", "dir", false);
+        test(abs + "/src", "dst", true);
+
+        // Relative vs absolute
+        test("dir", abs + "/dir", false);
+        test("dir", abs + "/dir/dst", false);
+        test("dir/src", abs + "/dir", false);
+        test("src", abs + "/dst", true);
+    }
+
+    private void test(String srcDir, String dstDir, boolean shouldSucceed) {
+        boolean succeeded = testCompilation(srcDir, dstDir);
+        if (shouldSucceed != succeeded) {
+            throw new AssertionError(
+                    String.format("Test failed for "
+                                          + "srcDir=\"%s\", "
+                                          + "dstDir=\"%s\". "
+                                          + "Compilation was expected to %s but %s.",
+                                  srcDir,
+                                  dstDir,
+                                  shouldSucceed ? "succeed" : "fail",
+                                  succeeded ? "succeeded" : "failed"));
+        }
+    }
+
+    private boolean testCompilation(String srcDir, String dstDir) {
+        try {
+            srcDir = srcDir.replace('/', File.separatorChar);
+            dstDir = dstDir.replace('/', File.separatorChar);
+            tb.writeFile(Paths.get(srcDir, "pkg", "A.java"), "package pkg; class A {}");
+            compile("--state-dir=state", "-src", srcDir, "-d", dstDir);
+            return true;
+        } catch (Exception e) {
+            return false;
+        }
+    }
+}
--- a/make/Images.gmk	Fri Mar 04 13:16:50 2016 +0000
+++ b/make/Images.gmk	Mon Mar 07 09:34:29 2016 +0100
@@ -42,7 +42,7 @@
                jdk.security.auth jdk.security.jgss jdk.pack200 jdk.xml.dom \
                jdk.accessibility jdk.internal.le jdk.dynalink \
                jdk.scripting.nashorn jdk.scripting.nashorn.shell \
-               jdk.vm.ci jdk.management
+               jdk.vm.ci jdk.management jdk.jsobject
 
 # providers
 PROVIDER_MODULES += jdk.charsets jdk.crypto.ec jdk.crypto.pkcs11 jdk.jvmstat jdk.jvmstat.rmi \
--- a/make/common/MakeBase.gmk	Fri Mar 04 13:16:50 2016 +0000
+++ b/make/common/MakeBase.gmk	Mon Mar 07 09:34:29 2016 +0100
@@ -282,7 +282,7 @@
     # Default shell seems to always be /bin/sh. Must override with bash to get this to work on Solaris.
     # Only use time if it's GNU time which supports format and output file.
     WRAPPER_SHELL := $$(BASH) $$(SRC_ROOT)/common/bin/shell-tracer.sh $$(if $$(findstring yes,$$(IS_GNU_TIME)),$$(TIME),-) $$(OUTPUT_ROOT)/build-trace-time.log $$(SHELL)
-    SHELL := $$(warning $$(if $$@,Building $$@,Running shell command) $$(if $$<, (from $$<))$$(if $$?, ($$(wordlist 1, 20, $$?) $$(if $$(wordlist 21, 22, $$?), ... [in total $$(words $$?) files]) newer)))$$(WRAPPER_SHELL)
+    SHELL = $$(warning $$(if $$@,Building $$@,Running shell command) $$(if $$<, (from $$<))$$(if $$?, ($$(wordlist 1, 20, $$?) $$(if $$(wordlist 21, 22, $$?), ... [in total $$(words $$?) files]) newer)))$$(WRAPPER_SHELL)
   endif
   # The warn level can never be turned off
   LogWarn = $$(info $$(strip $$1))
--- a/modules.xml	Fri Mar 04 13:16:50 2016 +0000
+++ b/modules.xml	Mon Mar 07 09:34:29 2016 +0100
@@ -844,6 +844,18 @@
     </export>
   </module>
   <module>
+    <name>jdk.jsobject</name>
+    <depend>java.base</depend>
+    <depend re-exports="true">java.desktop</depend>
+    <export>
+      <name>netscape.javascript</name>
+    </export>
+    <export>
+      <name>jdk.internal.netscape.javascript.spi</name>
+      <to>jdk.plugin</to>
+    </export>
+  </module>
+  <module>
     <name>java.httpclient</name>
     <depend>java.base</depend>
     <export>
@@ -1802,10 +1814,10 @@
       <name>com.sun.tools.javadoc</name>
     </export>
     <export>
-      <name>jdk.javadoc.doclet</name>  
+      <name>jdk.javadoc.doclet</name>
     </export>
     <export>
-      <name>jdk.javadoc.doclet.taglet</name>  
+      <name>jdk.javadoc.doclet.taglet</name>
     </export>
   </module>
   <module>
--- a/nashorn/.hgtags	Fri Mar 04 13:16:50 2016 +0000
+++ b/nashorn/.hgtags	Mon Mar 07 09:34:29 2016 +0100
@@ -341,3 +341,4 @@
 4e9749cc32f15251d9b2d0eab4373529952902a3 jdk-9+105
 cfb3167456932b14c16a6d4cffd5fe295fbe01ff jdk-9+106
 8042e81b530e480dfdad41fd53a7a26f69ebba26 jdk-9+107
+58409eff7e3e0c07f12f543341769964619c0acf jdk-9+108
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeStore.java	Fri Mar 04 13:16:50 2016 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeStore.java	Mon Mar 07 09:34:29 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -34,13 +34,10 @@
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.Serializable;
-import java.security.AccessControlException;
 import java.security.AccessController;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
-import java.util.Iterator;
 import java.util.Map;
-import java.util.ServiceLoader;
 import jdk.nashorn.internal.codegen.OptimisticTypesPersistence;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.runtime.logging.DebugLogger;
@@ -54,11 +51,6 @@
 @Logger(name="codestore")
 public abstract class CodeStore implements Loggable {
 
-    /**
-     * Permission needed to provide a CodeStore instance via ServiceLoader.
-     */
-    public final static String NASHORN_PROVIDE_CODE_STORE = "nashorn.provideCodeStore";
-
     private DebugLogger log;
 
     /**
@@ -85,23 +77,6 @@
      * @return The instance, or null if code store could not be created
      */
     public static CodeStore newCodeStore(final Context context) {
-        final Class<CodeStore> baseClass = CodeStore.class;
-        try {
-            // security check first
-            final SecurityManager sm = System.getSecurityManager();
-            if (sm != null) {
-                sm.checkPermission(new RuntimePermission(NASHORN_PROVIDE_CODE_STORE));
-            }
-            final ServiceLoader<CodeStore> services = ServiceLoader.load(baseClass);
-            final Iterator<CodeStore> iterator = services.iterator();
-            if (iterator.hasNext()) {
-                final CodeStore store = iterator.next();
-                store.initLogger(context).info("using code store provider ", store.getClass().getCanonicalName());
-                return store;
-            }
-        } catch (final AccessControlException e) {
-            context.getLogger(CodeStore.class).warning("failed to load code store provider ", e);
-        }
         try {
             final CodeStore store = new DirectoryCodeStore(context);
             store.initLogger(context);